#include "../include/commons.cuh"

__host__  void usage()
{
    cout << "./main [cpu/gpu] [number_of_spheres]\n";
    exit(EXIT_FAILURE);
}

__host__  void controls()
{
    cout << "[] Controls:\n";
    cout << "|- View  Position:         A, D, Mouse-Scroll\n";
    cout << "|- Light Position:         W, S, Q, E\n";
    cout << "|- Start/Stop Animation:   SPACEBAR\n";
    cout << "|- Exit:                   ESC\n";
}

__host__  void parseArgs(int argc, char* argv[],int* gCalcType, int* gSpheresCount)
{
    if(argc != 3) usage();
    else
    {
        if(!strcmp(argv[1],"cpu")) *gCalcType = CPU;
        else if(!strcmp(argv[1],"gpu")) *gCalcType = GPU;
        else usage();
        *gSpheresCount = atoi(argv[2]);
    }
}

__host__  void saveTime(double time, int* gCalcType, int* gSpheresCount)
{
    ofstream            gLogStream;
    string calcType = (*gCalcType == GPU) ? "gpu" : "cpu";
    gLogStream.open(LOG_FILE, std::ios_base::app);
    gLogStream << "calc_type: " << calcType << " spheres: "<< *gSpheresCount << " Time: " << time << endl;
}

__host__  float randFloat(float rBoundary)
{
    return static_cast <float> (rand()) / (static_cast <float> (RAND_MAX/rBoundary));
}

__host__  float randFloat(float lBoundary, float rBoundary)
{
    return lBoundary + static_cast <float> (rand()) /( static_cast <float> (RAND_MAX/(rBoundary-lBoundary)));
}

__host__ __device__ float dot(Vector3f lhs, Vector3f rhs)
{
    return (lhs.x * rhs.x) + (lhs.y * rhs.y) + (lhs.z * rhs.z);
}

__host__ __device__ float clip(float val, float down, float up)
{
    val = (val > up) ? up : val;
    val = (val < down) ? down : val;
    return val;
}

__host__ __device__ RGB clip(RGB color)
{
    color.r = clip(color.r, 0 ,255);
    color.g = clip(color.g, 0 ,255);
    color.b = clip(color.b, 0 ,255);
    return color;
}

	.file	"tmpxft_0020296f_00000000-6_commons.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3798:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3798:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"./main [cpu/gpu] [number_of_spheres]\n"
	.text
	.globl	_Z5usagev
	.type	_Z5usagev, @function
_Z5usagev:
.LFB3787:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	leaq	_ZSt4cout(%rip), %rdi
	leaq	.LC0(%rip), %rsi
	pushq	%rax
	.cfi_def_cfa_offset 16
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	$1, %edi
	call	exit@PLT
	.cfi_endproc
.LFE3787:
	.size	_Z5usagev, .-_Z5usagev
	.section	.rodata.str1.1
.LC1:
	.string	"[] Controls:\n"
.LC2:
	.string	"|- View  Position:         A, D, Mouse-Scroll\n"
.LC3:
	.string	"|- Light Position:         W, S, Q, E\n"
.LC4:
	.string	"|- Start/Stop Animation:   SPACEBAR\n"
.LC5:
	.string	"|- Exit:                   ESC\n"
	.text
	.globl	_Z8controlsv
	.type	_Z8controlsv, @function
_Z8controlsv:
.LFB3788:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	_ZSt4cout(%rip), %rbx
	leaq	.LC1(%rip), %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rbx, %rdi
	leaq	.LC2(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rbx, %rdi
	leaq	.LC3(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rbx, %rdi
	leaq	.LC4(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rbx, %rdi
	leaq	.LC5(%rip), %rsi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	.cfi_endproc
.LFE3788:
	.size	_Z8controlsv, .-_Z8controlsv
	.section	.rodata.str1.1
.LC6:
	.string	"cpu"
.LC7:
	.string	"gpu"
	.text
	.globl	_Z9parseArgsiPPcPiS1_
	.type	_Z9parseArgsiPPcPiS1_, @function
_Z9parseArgsiPPcPiS1_:
.LFB3789:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	pushq	%r8
	.cfi_def_cfa_offset 48
	cmpl	$3, %edi
	je	.L7
.L9:
	call	_Z5usagev
.L7:
	movq	8(%rsi), %r13
	movq	%rsi, %rbx
	movq	%rdx, %r12
	movq	%rcx, %rbp
	leaq	.LC6(%rip), %rsi
	movq	%r13, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	je	.L10
	leaq	.LC7(%rip), %rsi
	movq	%r13, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L9
	movl	$1, %eax
	jmp	.L8
.L10:
	movl	$2, %eax
.L8:
	movl	%eax, (%r12)
	movq	16(%rbx), %rdi
	call	atoi@PLT
	movl	%eax, 0(%rbp)
	popq	%rax
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3789:
	.size	_Z9parseArgsiPPcPiS1_, .-_Z9parseArgsiPPcPiS1_
	.globl	_Z9randFloatf
	.type	_Z9randFloatf, @function
_Z9randFloatf:
.LFB3791:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movss	%xmm0, 12(%rsp)
	call	rand@PLT
	movss	.LC8(%rip), %xmm1
	divss	12(%rsp), %xmm1
	addq	$24, %rsp
	.cfi_def_cfa_offset 8
	cvtsi2ssl	%eax, %xmm0
	divss	%xmm1, %xmm0
	ret
	.cfi_endproc
.LFE3791:
	.size	_Z9randFloatf, .-_Z9randFloatf
	.globl	_Z9randFloatff
	.type	_Z9randFloatff, @function
_Z9randFloatff:
.LFB3792:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movss	%xmm0, 12(%rsp)
	movss	%xmm1, 8(%rsp)
	call	rand@PLT
	movss	12(%rsp), %xmm2
	movss	8(%rsp), %xmm1
	movss	.LC8(%rip), %xmm3
	cvtsi2ssl	%eax, %xmm0
	addq	$24, %rsp
	.cfi_def_cfa_offset 8
	subss	%xmm2, %xmm1
	divss	%xmm1, %xmm3
	divss	%xmm3, %xmm0
	addss	%xmm2, %xmm0
	ret
	.cfi_endproc
.LFE3792:
	.size	_Z9randFloatff, .-_Z9randFloatff
	.globl	_Z3dot8Vector3fS_
	.type	_Z3dot8Vector3fS_, @function
_Z3dot8Vector3fS_:
.LFB3793:
	.cfi_startproc
	endbr64
	movq	%xmm2, -32(%rsp)
	mulss	%xmm3, %xmm1
	movq	%xmm0, -16(%rsp)
	movss	-16(%rsp), %xmm0
	movss	-12(%rsp), %xmm2
	mulss	-32(%rsp), %xmm0
	mulss	-28(%rsp), %xmm2
	addss	%xmm2, %xmm0
	addss	%xmm1, %xmm0
	ret
	.cfi_endproc
.LFE3793:
	.size	_Z3dot8Vector3fS_, .-_Z3dot8Vector3fS_
	.globl	_Z4clipfff
	.type	_Z4clipfff, @function
_Z4clipfff:
.LFB3794:
	.cfi_startproc
	endbr64
	minss	%xmm0, %xmm2
	maxss	%xmm2, %xmm1
	movaps	%xmm1, %xmm0
	ret
	.cfi_endproc
.LFE3794:
	.size	_Z4clipfff, .-_Z4clipfff
	.globl	_Z4clip3RGB
	.type	_Z4clip3RGB, @function
_Z4clip3RGB:
.LFB3795:
	.cfi_startproc
	endbr64
	movq	%xmm0, -40(%rsp)
	movss	-40(%rsp), %xmm2
	movaps	%xmm1, %xmm3
	comiss	.LC10(%rip), %xmm2
	movss	-36(%rsp), %xmm0
	ja	.L32
	xorps	%xmm1, %xmm1
	comiss	%xmm2, %xmm1
	jbe	.L26
	movaps	%xmm1, %xmm2
	jmp	.L26
.L32:
	movss	.LC10(%rip), %xmm2
.L26:
	comiss	.LC10(%rip), %xmm0
	ja	.L33
	xorps	%xmm1, %xmm1
	comiss	%xmm0, %xmm1
	jbe	.L28
	movaps	%xmm1, %xmm0
	jmp	.L28
.L33:
	movss	.LC10(%rip), %xmm0
.L28:
	movss	.LC10(%rip), %xmm1
	comiss	%xmm1, %xmm3
	ja	.L30
	xorps	%xmm4, %xmm4
	movaps	%xmm3, %xmm1
	cmpnltss	%xmm4, %xmm1
	andps	%xmm3, %xmm1
.L30:
	movss	%xmm2, -20(%rsp)
	movss	%xmm0, -16(%rsp)
	movq	-20(%rsp), %xmm0
	ret
	.cfi_endproc
.LFE3795:
	.size	_Z4clip3RGB, .-_Z4clip3RGB
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3821:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	movq	%rax, %rdi
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE3821:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.rodata.str1.1
.LC11:
	.string	"log.txt"
.LC12:
	.string	"calc_type: "
.LC13:
	.string	" spheres: "
.LC14:
	.string	" Time: "
	.text
	.globl	_Z8saveTimedPiS_
	.type	_Z8saveTimedPiS_, @function
_Z8saveTimedPiS_:
.LFB3790:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3790
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movq	%rsi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%xmm0, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$568, %rsp
	.cfi_def_cfa_offset 608
	movq	%fs:40, %rax
	movq	%rax, 552(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rbx
	movq	%rbx, %rdi
.LEHB0:
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE0:
	cmpl	$1, (%r12)
	leaq	24(%rsp), %rdi
	leaq	.LC7(%rip), %rsi
	movq	%rdi, 8(%rsp)
	je	.L42
	leaq	.LC6(%rip), %rsi
.L42:
	leaq	3(%rsi), %rdx
	leaq	8(%rsp), %r12
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE13_S_copy_charsEPcPKcS7_@PLT
	movq	8(%rsp), %rax
	movl	$1, %edx
	movq	%rbx, %rdi
	movq	$3, 16(%rsp)
	leaq	.LC11(%rip), %rsi
	movb	$0, 3(%rax)
.LEHB1:
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	leaq	.LC12(%rip), %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movq	%r12, %rsi
	call	_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	%rax, %rdi
	leaq	.LC13(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	0(%r13), %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	leaq	.LC14(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movq	%rbp, %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
.LEHE1:
	movq	%r12, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	%rbx, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	552(%rsp), %rax
	subq	%fs:40, %rax
	je	.L45
	jmp	.L47
.L46:
	endbr64
	movq	%rax, %rbp
.L43:
	movq	%r12, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	%rbx, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	552(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L47
	movq	%rbp, %rdi
.LEHB2:
	call	_Unwind_Resume@PLT
.LEHE2:
.L47:
	call	__stack_chk_fail@PLT
.L45:
	addq	$568, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3790:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA3790:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3790-.LLSDACSB3790
.LLSDACSB3790:
	.uleb128 .LEHB0-.LFB3790
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB3790
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L46-.LFB3790
	.uleb128 0
	.uleb128 .LEHB2-.LFB3790
	.uleb128 .LEHE2-.LEHB2
	.uleb128 0
	.uleb128 0
.LLSDACSE3790:
	.text
	.size	_Z8saveTimedPiS_, .-_Z8saveTimedPiS_
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC8:
	.long	1325400064
	.align 4
.LC10:
	.long	1132396544
	.hidden	DW.ref.__gxx_personality_v0
	.weak	DW.ref.__gxx_personality_v0
	.section	.data.rel.local.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
	.align 8
	.type	DW.ref.__gxx_personality_v0, @object
	.size	DW.ref.__gxx_personality_v0, 8
DW.ref.__gxx_personality_v0:
	.quad	__gxx_personality_v0
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <hip/hip_runtime.h>
#include "../include/commons.cuh"

__host__  void usage()
{
    cout << "./main [cpu/gpu] [number_of_spheres]\n";
    exit(EXIT_FAILURE);
}

__host__  void controls()
{
    cout << "[] Controls:\n";
    cout << "|- View  Position:         A, D, Mouse-Scroll\n";
    cout << "|- Light Position:         W, S, Q, E\n";
    cout << "|- Start/Stop Animation:   SPACEBAR\n";
    cout << "|- Exit:                   ESC\n";
}

__host__  void parseArgs(int argc, char* argv[],int* gCalcType, int* gSpheresCount)
{
    if(argc != 3) usage();
    else
    {
        if(!strcmp(argv[1],"cpu")) *gCalcType = CPU;
        else if(!strcmp(argv[1],"gpu")) *gCalcType = GPU;
        else usage();
        *gSpheresCount = atoi(argv[2]);
    }
}

__host__  void saveTime(double time, int* gCalcType, int* gSpheresCount)
{
    ofstream            gLogStream;
    string calcType = (*gCalcType == GPU) ? "gpu" : "cpu";
    gLogStream.open(LOG_FILE, std::ios_base::app);
    gLogStream << "calc_type: " << calcType << " spheres: "<< *gSpheresCount << " Time: " << time << endl;
}

__host__  float randFloat(float rBoundary)
{
    return static_cast <float> (rand()) / (static_cast <float> (RAND_MAX/rBoundary));
}

__host__  float randFloat(float lBoundary, float rBoundary)
{
    return lBoundary + static_cast <float> (rand()) /( static_cast <float> (RAND_MAX/(rBoundary-lBoundary)));
}

__host__ __device__ float dot(Vector3f lhs, Vector3f rhs)
{
    return (lhs.x * rhs.x) + (lhs.y * rhs.y) + (lhs.z * rhs.z);
}

__host__ __device__ float clip(float val, float down, float up)
{
    val = (val > up) ? up : val;
    val = (val < down) ? down : val;
    return val;
}

__host__ __device__ RGB clip(RGB color)
{
    color.r = clip(color.r, 0 ,255);
    color.g = clip(color.g, 0 ,255);
    color.b = clip(color.b, 0 ,255);
    return color;
}

	.text
	.file	"commons.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.globl	_Z5usagev                       # -- Begin function _Z5usagev
	.type	_Z5usagev,@function
_Z5usagev:                              # @_Z5usagev
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movl	$_ZSt4cout, %edi
	movl	$.L.str, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$1, %edi
	callq	exit
.Lfunc_end0:
	.size	_Z5usagev, .Lfunc_end0-_Z5usagev
	.cfi_endproc
                                        # -- End function
	.globl	_Z8controlsv                    # -- Begin function _Z8controlsv
	.type	_Z8controlsv,@function
_Z8controlsv:                           # @_Z8controlsv
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movl	$_ZSt4cout, %edi
	movl	$.L.str.1, %esi
	movl	$13, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	$.L.str.2, %esi
	movl	$46, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	$.L.str.3, %esi
	movl	$38, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	$.L.str.4, %esi
	movl	$36, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	$.L.str.5, %esi
	movl	$31, %edx
	popq	%rax
	.cfi_def_cfa_offset 8
	jmp	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l # TAILCALL
.Lfunc_end1:
	.size	_Z8controlsv, .Lfunc_end1-_Z8controlsv
	.cfi_endproc
                                        # -- End function
	.globl	_Z9parseArgsiPPcPiS1_           # -- Begin function _Z9parseArgsiPPcPiS1_
	.type	_Z9parseArgsiPPcPiS1_,@function
_Z9parseArgsiPPcPiS1_:                  # @_Z9parseArgsiPPcPiS1_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	cmpl	$3, %edi
	jne	.LBB2_5
# %bb.1:
	movq	%rcx, %rbx
	movq	%rdx, %r15
	movq	%rsi, %r14
	movq	8(%rsi), %r12
	movl	$.L.str.6, %esi
	movq	%r12, %rdi
	callq	strcmp
	testl	%eax, %eax
	je	.LBB2_2
# %bb.3:
	movl	$.L.str.7, %esi
	movq	%r12, %rdi
	callq	strcmp
	movl	$1, %ecx
	testl	%eax, %eax
	je	.LBB2_4
.LBB2_5:
	movl	$_ZSt4cout, %edi
	movl	$.L.str, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$1, %edi
	callq	exit
.LBB2_2:
	movl	$2, %ecx
.LBB2_4:
	movl	%ecx, (%r15)
	movq	16(%r14), %rdi
	callq	atoi
	movl	%eax, (%rbx)
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z9parseArgsiPPcPiS1_, .Lfunc_end2-_Z9parseArgsiPPcPiS1_
	.cfi_endproc
                                        # -- End function
	.globl	_Z8saveTimedPiS_                # -- Begin function _Z8saveTimedPiS_
	.type	_Z8saveTimedPiS_,@function
_Z8saveTimedPiS_:                       # @_Z8saveTimedPiS_
.Lfunc_begin0:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception0
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	subq	$560, %rsp                      # imm = 0x230
	.cfi_def_cfa_offset 592
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	leaq	48(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev
	cmpl	$1, (%r14)
	movl	$.L.str.7, %eax
	movl	$.L.str.6, %esi
	cmoveq	%rax, %rsi
	leaq	32(%rsp), %r15
	movq	%r15, -16(%r15)
	movl	$.L.str.7+3, %eax
	movl	$.L.str.6+3, %edx
	cmoveq	%rax, %rdx
.Ltmp0:
	leaq	16(%rsp), %rdi
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
.Ltmp1:
# %bb.1:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_.exit
.Ltmp3:
	leaq	48(%rsp), %rdi
	movl	$.L.str.8, %esi
	movl	$1, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode
.Ltmp4:
# %bb.2:
.Ltmp5:
	leaq	48(%rsp), %rdi
	movl	$.L.str.9, %esi
	movl	$11, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp6:
# %bb.3:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
	movq	16(%rsp), %rsi
	movq	24(%rsp), %rdx
.Ltmp7:
	leaq	48(%rsp), %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp8:
# %bb.4:                                # %_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE.exit
.Ltmp9:
	movq	%rax, %r14
	movl	$.L.str.10, %esi
	movl	$10, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp10:
# %bb.5:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit6
	movl	(%rbx), %esi
.Ltmp11:
	movq	%r14, %rdi
	callq	_ZNSolsEi
.Ltmp12:
# %bb.6:
.Ltmp13:
	movq	%rax, %rbx
	movl	$.L.str.11, %esi
	movl	$7, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp14:
# %bb.7:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit7
.Ltmp15:
	movq	%rbx, %rdi
	movsd	8(%rsp), %xmm0                  # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp16:
# %bb.8:                                # %_ZNSolsEd.exit
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
.Ltmp17:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp18:
# %bb.9:                                # %.noexc
.Ltmp19:
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
.Ltmp20:
# %bb.10:                               # %.noexc11
.Ltmp21:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp22:
# %bb.11:                               # %_ZNSolsEPFRSoS_E.exit
	movq	16(%rsp), %rdi
	cmpq	%r15, %rdi
	je	.LBB3_13
# %bb.12:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
	callq	_ZdlPv
.LBB3_13:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE(%rip), %rax
	leaq	56(%rsp), %rdi
	movq	%rax, -8(%rdi)
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE+24(%rip), %rcx
	movq	-24(%rax), %rax
	movq	%rcx, 48(%rsp,%rax)
	callq	_ZNSt13basic_filebufIcSt11char_traitsIcEED2Ev
	leaq	296(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	addq	$560, %rsp                      # imm = 0x230
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.LBB3_14:
	.cfi_def_cfa_offset 592
.Ltmp2:
	movq	%rax, %rbx
	jmp	.LBB3_17
.LBB3_15:
.Ltmp23:
	movq	%rax, %rbx
	movq	16(%rsp), %rdi
	cmpq	%r15, %rdi
	je	.LBB3_17
# %bb.16:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i8
	callq	_ZdlPv
.LBB3_17:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit10
	leaq	48(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end3:
	.size	_Z8saveTimedPiS_, .Lfunc_end3-_Z8saveTimedPiS_
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table3:
.Lexception0:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
	.uleb128 .Lfunc_begin0-.Lfunc_begin0    # >> Call Site 1 <<
	.uleb128 .Ltmp0-.Lfunc_begin0           #   Call between .Lfunc_begin0 and .Ltmp0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp1-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp1
	.uleb128 .Ltmp2-.Lfunc_begin0           #     jumps to .Ltmp2
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp3-.Lfunc_begin0           # >> Call Site 3 <<
	.uleb128 .Ltmp22-.Ltmp3                 #   Call between .Ltmp3 and .Ltmp22
	.uleb128 .Ltmp23-.Lfunc_begin0          #     jumps to .Ltmp23
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp22-.Lfunc_begin0          # >> Call Site 4 <<
	.uleb128 .Lfunc_end3-.Ltmp22            #   Call between .Ltmp22 and .Lfunc_end3
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z9randFloatf
.LCPI4_0:
	.long	0x4f000000                      # float 2.14748365E+9
	.text
	.globl	_Z9randFloatf
	.type	_Z9randFloatf,@function
_Z9randFloatf:                          # @_Z9randFloatf
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movss	%xmm0, 4(%rsp)                  # 4-byte Spill
	callq	rand
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	movss	.LCPI4_0(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	divss	4(%rsp), %xmm1                  # 4-byte Folded Reload
	divss	%xmm1, %xmm0
	popq	%rax
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	_Z9randFloatf, .Lfunc_end4-_Z9randFloatf
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z9randFloatff
.LCPI5_0:
	.long	0x4f000000                      # float 2.14748365E+9
	.text
	.globl	_Z9randFloatff
	.type	_Z9randFloatff,@function
_Z9randFloatff:                         # @_Z9randFloatff
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movss	%xmm1, 4(%rsp)                  # 4-byte Spill
	movss	%xmm0, (%rsp)                   # 4-byte Spill
	callq	rand
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	movss	(%rsp), %xmm2                   # 4-byte Reload
                                        # xmm2 = mem[0],zero,zero,zero
	movss	4(%rsp), %xmm3                  # 4-byte Reload
                                        # xmm3 = mem[0],zero,zero,zero
	subss	%xmm2, %xmm3
	movss	.LCPI5_0(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	divss	%xmm3, %xmm1
	divss	%xmm1, %xmm0
	addss	%xmm2, %xmm0
	popq	%rax
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end5:
	.size	_Z9randFloatff, .Lfunc_end5-_Z9randFloatff
	.cfi_endproc
                                        # -- End function
	.globl	_Z3dot8Vector3fS_               # -- Begin function _Z3dot8Vector3fS_
	.type	_Z3dot8Vector3fS_,@function
_Z3dot8Vector3fS_:                      # @_Z3dot8Vector3fS_
	.cfi_startproc
# %bb.0:
	mulps	%xmm2, %xmm0
	movaps	%xmm0, %xmm2
	shufps	$85, %xmm0, %xmm2               # xmm2 = xmm2[1,1],xmm0[1,1]
	addss	%xmm2, %xmm0
	mulss	%xmm3, %xmm1
	addss	%xmm1, %xmm0
	retq
.Lfunc_end6:
	.size	_Z3dot8Vector3fS_, .Lfunc_end6-_Z3dot8Vector3fS_
	.cfi_endproc
                                        # -- End function
	.globl	_Z4clipfff                      # -- Begin function _Z4clipfff
	.type	_Z4clipfff,@function
_Z4clipfff:                             # @_Z4clipfff
	.cfi_startproc
# %bb.0:
	minss	%xmm0, %xmm2
	maxss	%xmm2, %xmm1
	movaps	%xmm1, %xmm0
	retq
.Lfunc_end7:
	.size	_Z4clipfff, .Lfunc_end7-_Z4clipfff
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z4clip3RGB
.LCPI8_0:
	.long	0x437f0000                      # float 255
	.text
	.globl	_Z4clip3RGB
	.type	_Z4clip3RGB,@function
_Z4clip3RGB:                            # @_Z4clip3RGB
	.cfi_startproc
# %bb.0:
	movss	.LCPI8_0(%rip), %xmm4           # xmm4 = mem[0],zero,zero,zero
	movaps	%xmm4, %xmm5
	minss	%xmm0, %xmm5
	xorps	%xmm2, %xmm2
	xorps	%xmm3, %xmm3
	maxss	%xmm5, %xmm3
	shufps	$85, %xmm0, %xmm0               # xmm0 = xmm0[1,1,1,1]
	movaps	%xmm4, %xmm5
	minss	%xmm0, %xmm5
	xorps	%xmm0, %xmm0
	maxss	%xmm5, %xmm0
	unpcklps	%xmm0, %xmm3                    # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1]
	minss	%xmm1, %xmm4
	maxss	%xmm4, %xmm2
	movaps	%xmm3, %xmm0
	movaps	%xmm2, %xmm1
	retq
.Lfunc_end8:
	.size	_Z4clip3RGB, .Lfunc_end8-_Z4clip3RGB
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,comdat
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag # -- Begin function _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.p2align	1, 0x90
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,@function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag: # @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %rbx
	subq	%rsi, %r14
	movq	%r14, (%rsp)
	cmpq	$15, %r14
	jbe	.LBB9_1
# %bb.2:
	movq	%rsp, %r12
	movq	%rbx, %rdi
	movq	%r12, %rsi
	xorl	%edx, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm
	movq	%rax, (%rbx)
	movq	(%r12), %rcx
	movq	%rcx, 16(%rbx)
	jmp	.LBB9_3
.LBB9_1:                                # %._crit_edge
	movq	(%rbx), %rax
.LBB9_3:
	testq	%r14, %r14
	je	.LBB9_7
# %bb.4:
	cmpq	$1, %r14
	jne	.LBB9_6
# %bb.5:
	movb	(%r15), %cl
	movb	%cl, (%rax)
	jmp	.LBB9_7
.LBB9_6:
	movq	%rax, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	memcpy@PLT
.LBB9_7:                                # %_ZZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tagEN6_GuardD2Ev.exit
	movq	(%rsp), %rax
	movq	%rax, 8(%rbx)
	movq	(%rbx), %rcx
	movb	$0, (%rcx,%rax)
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end9:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag, .Lfunc_end9-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"./main [cpu/gpu] [number_of_spheres]\n"
	.size	.L.str, 38

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"[] Controls:\n"
	.size	.L.str.1, 14

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"|- View  Position:         A, D, Mouse-Scroll\n"
	.size	.L.str.2, 47

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"|- Light Position:         W, S, Q, E\n"
	.size	.L.str.3, 39

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"|- Start/Stop Animation:   SPACEBAR\n"
	.size	.L.str.4, 37

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"|- Exit:                   ESC\n"
	.size	.L.str.5, 32

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"cpu"
	.size	.L.str.6, 4

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"gpu"
	.size	.L.str.7, 4

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"log.txt"
	.size	.L.str.8, 8

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"calc_type: "
	.size	.L.str.9, 12

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	" spheres: "
	.size	.L.str.10, 11

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	" Time: "
	.size	.L.str.11, 8

	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _ZSt4cout
	.addrsig_sym __hip_cuid_

	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.amdgpu_metadata
---
amdhsa.kernels:  []
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
