#include <iostream>
#include <ctime>
#include <string>

struct Obstacle
{
public:
    double c_x, c_y, r, v_x, v_y;

    Obstacle()
    {
	c_x = 0;
	c_y = 0;
	r = 1.0;
	v_x = 0;
	v_y = 0; 
    }

    Obstacle(double cx, double cy, double r0, double vx, double vy)
    {
        c_x = cx;
        c_y = cy;
        r = r0;
        v_x = vx;
        v_y = vy;
    }
};

__device__ double infty_g(void)
{
    const unsigned long long ieee754inf = 0x7ff0000000000000;
    return __longlong_as_double(ieee754inf);
}

double infty_c(void)
{
    const unsigned long long ieee754inf = 0x7ff0000000000000;
    return (double)(ieee754inf);
}
__global__ void intersectTime_g(int n, Obstacle points[], double list[])
{
    int index = blockIdx.x * blockDim.x + threadIdx.x;
    int stride = blockDim.x * gridDim.x;
    // process each obstacle
    for(int j = index; j < n; j += stride)
    {
        Obstacle a = points[j];

        //distance @d b/w obstacle and scooter
        double d =  sqrt(a.c_x * a.c_x + a.c_y * a.c_y);
      	double t_s = 0;
      	double t_e = 0;
      	//Case 1: object alrd collide w scooter
      	if(d <= 1)
      	{
       	    t_s = 0;
      	    t_e = infty_g();
              }
      	//Case 2: object move in opposite dir w.r.t scooter
      	else if(a.c_x * a.v_x >= 0 || a.c_y * a.v_y >= 0)
      	{
            t_s = infty_g();
      	    t_e = infty_g();
      	} else
      	{
      	    double v = sqrt(a.v_x * a.v_x + a.v_y * a.v_y);
      	    double delta_t = 2 * sqrt((1.0 + a.r) * (1.0 + a.r) - 1) / v;
      	    t_s = (sqrt(d * d - 1.0) / v) - 0.5 * delta_t;
      	    t_e = t_s + delta_t;
      	}
              //store in list[j]
              list[2 * j] = t_s;
              list[2 * j + 1] = t_e;

        //for test output
        //printf("GPU: (%.2lf, %.2lf), v = %.3lf, t_s = %.2lf, t_e = %.2lf\n", a._x, a._y, v, t_s, t_e);
    }
}

void intersectTime_c(int n, Obstacle points[], double list[])
{
    for(int j = 0; j < n; j++)
    {
        Obstacle a = points[j];

        //distance @d b/w obstacle and scooter
        double d =  sqrt(a.c_x * a.c_x + a.c_y * a.c_y);
        double t_s = 0;
        double t_e = 0;
        //Case 1: object alrd collide w scooter
        if(d <= 1)
        {
            t_s = 0;
            t_e = infty_c();
        }
        //Case 2: object move in opposite dir w.r.t scooter
        else if(a.c_x * a.v_x >= 0 || a.c_y * a.v_y >= 0)
        {
            t_s = infty_c();
            t_e = infty_c();
        } else
        {
            double v = sqrt(a.v_x * a.v_x + a.v_y * a.v_y);
            double delta_t = 2 * sqrt((1.0 + a.r) * (1.0 + a.r) - 1) / v;
            t_s = (sqrt(d * d - 1.0) / v) - 0.5 * delta_t;
            t_e = t_s + delta_t;
        }
            //store in list[j]
            list[2 * j] = t_s;
            list[2 * j + 1] = t_e;

        //for test output
        //printf("GPU: (%.2lf, %.2lf), v = %.3lf, t_s = %.2lf, t_e = %.2lf\n", a._x, a._y, v, t_s, t_e);
    }
}

double* gpu_discrete(int n, Obstacle points[], double list[])
{
    Obstacle* points_g;
    cudaMalloc(&points_g, n * sizeof(Obstacle));
    double* list_g;
    cudaMalloc(&list_g, n * 2 * sizeof(double));
    cudaMemcpy(points_g, points, n * sizeof(Obstacle), cudaMemcpyHostToDevice);
    int blockSize = 256;
    int numBlocks = (n + blockSize - 1) / blockSize;
    intersectTime_g<<<numBlocks, blockSize>>>(n, points_g, list_g);
    cudaDeviceSynchronize();
    cudaMemcpy(list, list_g, n * 2 * sizeof(double), cudaMemcpyDeviceToHost);
    return list;
}

double* gpu_unified(int n, Obstacle points[], double list[])
{
    Obstacle* points_g;
    cudaMallocManaged(&points_g, n * sizeof(Obstacle));
    double* list_g;
    cudaMallocManaged(&list_g, n * 2 * sizeof(double));
    cudaMemcpy(points_g, points, n * sizeof(Obstacle), cudaMemcpyHostToDevice);
    int blockSize = 256;
    int numBlocks = (n + blockSize - 1) / blockSize;
    intersectTime_g<<<numBlocks, blockSize>>>(n, points_g, list_g);
    cudaDeviceSynchronize();
    return list_g;
}

double* cpu(int n, Obstacle points[], double list[])
{
    intersectTime_c(n, points, list);
    return list;
}

int main(int argc, char *argv[])
{
    std::string response;
    bool valid = false;
    int n = 0;
    std::cin >> n;
    Obstacle* obstacles = new Obstacle[n];
    double* result = new double[2 * n];
    double c_x, c_y, r, v_x, v_y;
    for(int i = 0; i < n; i++)
    {
        std::cin >> c_x >> c_y >> r >> v_x >> v_y;
        obstacles[i] = Obstacle(c_x, c_y, r, v_x, v_y);
    }
    valid = true;
    // while (valid)
    {
        std::cout << "Use GPU for computation ? (Y/N)" << std::endl;
        std::cin >> response;
        if(response == "Y" || response == "y" || response == "yes")
        {
            std::cout << "Use unified memory? (Y/N)" << std::endl;
            std::cin >> response;
            if(response == "Y" || response == "y" || response == "yes")
            {
                //unified gpu memory
                std::cout << "unified gpu memory incurred.\n";
                valid = false;
                result = gpu_unified(n, obstacles, result);
            } else if (response == "N" || response == "n" || response == "no")
            {
                //discrete gpu memory
                std::cout << "discrete gpu memory incurred.\n";
                valid = false;
                result = gpu_discrete(n, obstacles, result);
            } else {
                std::cout << "invalid input. try again\n";
            }
        } else if (response == "N" || response == "n" || response == "no")
        {
            // cpu
            std::cout << "cpu memory incurred.\n";
            valid = false;
            result = cpu(n, obstacles, result);
        } else {
            std::cout << "invalid input. try again\n";
        }
    }
    //print output
    for(int i = 0; i < n; i++)
    {
        std::cout << i << " " << result[2 * i] << " " << result[2 * i + 1] << std::endl;
    }
}

	.file	"tmpxft_003b538f_00000000-6_interface_v2.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3651:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3651:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z7infty_gv
	.type	_Z7infty_gv, @function
_Z7infty_gv:
.LFB3641:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE3641:
	.size	_Z7infty_gv, .-_Z7infty_gv
	.globl	_Z7infty_cv
	.type	_Z7infty_cv, @function
_Z7infty_cv:
.LFB3642:
	.cfi_startproc
	endbr64
	movsd	.LC0(%rip), %xmm0
	ret
	.cfi_endproc
.LFE3642:
	.size	_Z7infty_cv, .-_Z7infty_cv
	.globl	_Z15intersectTime_ciP8ObstaclePd
	.type	_Z15intersectTime_ciP8ObstaclePd, @function
_Z15intersectTime_ciP8ObstaclePd:
.LFB3643:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%rdx, %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movl	%edi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movq	%rsi, %rbx
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
.L6:
	cmpl	%ebp, %r12d
	jge	.L14
	movsd	(%rbx), %xmm5
	movsd	8(%rbx), %xmm4
	movsd	16(%rbx), %xmm6
	movsd	24(%rbx), %xmm1
	movaps	%xmm5, %xmm0
	movaps	%xmm4, %xmm2
	movsd	32(%rbx), %xmm3
	movsd	%xmm4, (%rsp)
	mulsd	%xmm4, %xmm2
	movq	%xmm6, %r14
	movsd	%xmm1, 24(%rsp)
	mulsd	%xmm5, %xmm0
	movsd	%xmm3, 16(%rsp)
	movsd	%xmm5, 8(%rsp)
	addsd	%xmm2, %xmm0
	call	sqrt@PLT
	movsd	.LC2(%rip), %xmm7
	movaps	%xmm0, %xmm2
	comisd	%xmm0, %xmm7
	jnb	.L9
	movsd	8(%rsp), %xmm5
	movsd	24(%rsp), %xmm1
	xorps	%xmm0, %xmm0
	mulsd	%xmm1, %xmm5
	comisd	%xmm0, %xmm5
	jnb	.L11
	movsd	(%rsp), %xmm4
	movsd	16(%rsp), %xmm3
	mulsd	%xmm3, %xmm4
	comisd	%xmm0, %xmm4
	jnb	.L11
	mulsd	%xmm3, %xmm3
	movsd	%xmm2, 16(%rsp)
	mulsd	%xmm1, %xmm1
	addsd	%xmm3, %xmm1
	movaps	%xmm1, %xmm0
	call	sqrt@PLT
	movq	%r14, %xmm6
	movsd	%xmm0, (%rsp)
	movsd	.LC2(%rip), %xmm0
	addsd	%xmm6, %xmm0
	mulsd	%xmm0, %xmm0
	subsd	.LC2(%rip), %xmm0
	call	sqrt@PLT
	movsd	16(%rsp), %xmm2
	addsd	%xmm0, %xmm0
	mulsd	%xmm2, %xmm2
	subsd	.LC2(%rip), %xmm2
	movaps	%xmm0, %xmm1
	divsd	(%rsp), %xmm1
	movsd	%xmm1, 8(%rsp)
	movaps	%xmm2, %xmm0
	call	sqrt@PLT
	movsd	8(%rsp), %xmm1
	divsd	(%rsp), %xmm0
	movsd	.LC3(%rip), %xmm2
	mulsd	%xmm1, %xmm2
	subsd	%xmm2, %xmm0
	addsd	%xmm0, %xmm1
	jmp	.L7
.L9:
	movsd	.LC0(%rip), %xmm1
	xorps	%xmm0, %xmm0
	jmp	.L7
.L11:
	movsd	.LC0(%rip), %xmm1
	movaps	%xmm1, %xmm0
.L7:
	movsd	%xmm0, 0(%r13)
	incl	%r12d
	addq	$16, %r13
	addq	$40, %rbx
	movsd	%xmm1, -8(%r13)
	jmp	.L6
.L14:
	addq	$32, %rsp
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3643:
	.size	_Z15intersectTime_ciP8ObstaclePd, .-_Z15intersectTime_ciP8ObstaclePd
	.globl	_Z3cpuiP8ObstaclePd
	.type	_Z3cpuiP8ObstaclePd, @function
_Z3cpuiP8ObstaclePd:
.LFB3646:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdx, %rbx
	call	_Z15intersectTime_ciP8ObstaclePd
	movq	%rbx, %rax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3646:
	.size	_Z3cpuiP8ObstaclePd, .-_Z3cpuiP8ObstaclePd
	.globl	_Z46__device_stub__Z15intersectTime_giP8ObstaclePdiP8ObstaclePd
	.type	_Z46__device_stub__Z15intersectTime_giP8ObstaclePdiP8ObstaclePd, @function
_Z46__device_stub__Z15intersectTime_giP8ObstaclePdiP8ObstaclePd:
.LFB3673:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movl	%edi, 28(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L17
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z15intersectTime_giP8ObstaclePd(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L17:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3673:
	.size	_Z46__device_stub__Z15intersectTime_giP8ObstaclePdiP8ObstaclePd, .-_Z46__device_stub__Z15intersectTime_giP8ObstaclePdiP8ObstaclePd
	.globl	_Z15intersectTime_giP8ObstaclePd
	.type	_Z15intersectTime_giP8ObstaclePd, @function
_Z15intersectTime_giP8ObstaclePd:
.LFB3674:
	.cfi_startproc
	endbr64
	jmp	_Z46__device_stub__Z15intersectTime_giP8ObstaclePdiP8ObstaclePd
	.cfi_endproc
.LFE3674:
	.size	_Z15intersectTime_giP8ObstaclePd, .-_Z15intersectTime_giP8ObstaclePd
	.globl	_Z12gpu_discreteiP8ObstaclePd
	.type	_Z12gpu_discreteiP8ObstaclePd, @function
_Z12gpu_discreteiP8ObstaclePd:
.LFB3644:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movq	%rsi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movslq	%edi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movq	%rdx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movq	%r13, %rbp
	imulq	$40, %r13, %r13
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leal	(%rbp,%rbp), %ebx
	movslq	%ebx, %rbx
	movq	%r13, %rsi
	salq	$3, %rbx
	subq	$48, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rdi
	call	cudaMalloc@PLT
	leaq	8(%rsp), %rdi
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	movq	(%rsp), %rdi
	movq	%r13, %rdx
	movq	%r14, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movl	$256, %ecx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	leal	255(%rbp), %eax
	cltd
	idivl	%ecx
	movl	$16777217, %edx
	movl	$1, %ecx
	salq	$8, %rdx
	movl	%eax, 16(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 20(%rsp)
	movq	16(%rsp), %rdi
	movl	24(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L23
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	movl	%ebp, %edi
	call	_Z46__device_stub__Z15intersectTime_giP8ObstaclePdiP8ObstaclePd
.L23:
	call	cudaDeviceSynchronize@PLT
	movq	8(%rsp), %rsi
	movq	%rbx, %rdx
	movq	%r12, %rdi
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	je	.L24
	call	__stack_chk_fail@PLT
.L24:
	addq	$48, %rsp
	.cfi_def_cfa_offset 48
	movq	%r12, %rax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3644:
	.size	_Z12gpu_discreteiP8ObstaclePd, .-_Z12gpu_discreteiP8ObstaclePd
	.globl	_Z11gpu_unifiediP8ObstaclePd
	.type	_Z11gpu_unifiediP8ObstaclePd, @function
_Z11gpu_unifiediP8ObstaclePd:
.LFB3645:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movl	$1, %edx
	movq	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movslq	%edi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%rbp, %rbx
	imulq	$40, %rbp, %rbp
	subq	$48, %rsp
	.cfi_def_cfa_offset 80
	movq	%rbp, %rsi
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rdi
	call	cudaMallocManaged@PLT
	leal	(%rbx,%rbx), %esi
	leaq	8(%rsp), %rdi
	movl	$1, %edx
	movslq	%esi, %rsi
	salq	$3, %rsi
	call	cudaMallocManaged@PLT
	movq	(%rsp), %rdi
	movq	%rbp, %rdx
	movq	%r12, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movl	$256, %ecx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	leal	255(%rbx), %eax
	cltd
	idivl	%ecx
	movl	$16777217, %edx
	movl	$1, %ecx
	salq	$8, %rdx
	movl	%eax, 16(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 20(%rsp)
	movq	16(%rsp), %rdi
	movl	24(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L27
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	movl	%ebx, %edi
	call	_Z46__device_stub__Z15intersectTime_giP8ObstaclePdiP8ObstaclePd
.L27:
	call	cudaDeviceSynchronize@PLT
	movq	8(%rsp), %rax
	movq	40(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L28
	call	__stack_chk_fail@PLT
.L28:
	addq	$48, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3645:
	.size	_Z11gpu_unifiediP8ObstaclePd, .-_Z11gpu_unifiediP8ObstaclePd
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC4:
	.string	"_Z15intersectTime_giP8ObstaclePd"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3676:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC4(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z15intersectTime_giP8ObstaclePd(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE3676:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.text._ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_,"axG",@progbits,_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_,comdat
	.weak	_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_
	.type	_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_, @function
_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_:
.LFB3987:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rdi, %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	movq	8(%rdi), %r12
	movq	%rsi, %rdi
	movq	%rsi, 8(%rsp)
	call	strlen@PLT
	movq	8(%rsp), %rsi
	movq	%rax, %rdx
	xorl	%eax, %eax
	cmpq	%rdx, %r12
	jne	.L32
	movb	$1, %al
	testq	%r12, %r12
	je	.L32
	movq	(%rbx), %rdi
	movq	%r12, %rdx
	call	memcmp@PLT
	testl	%eax, %eax
	sete	%al
.L32:
	addq	$24, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3987:
	.size	_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_, .-_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_
	.section	.rodata.str1.1
.LC5:
	.string	"Use GPU for computation ? (Y/N)"
.LC6:
	.string	"Y"
.LC7:
	.string	"y"
.LC8:
	.string	"yes"
.LC9:
	.string	"Use unified memory? (Y/N)"
.LC10:
	.string	"N"
.LC11:
	.string	"unified gpu memory incurred.\n"
.LC12:
	.string	"n"
.LC13:
	.string	"no"
.LC14:
	.string	"invalid input. try again\n"
.LC15:
	.string	"discrete gpu memory incurred.\n"
.LC16:
	.string	"cpu memory incurred.\n"
.LC17:
	.string	" "
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB3647:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3647
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%edx, %edx
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	_ZSt3cin(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%r14, %rdi
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	leaq	72(%rsp), %rax
	leaq	12(%rsp), %rsi
	movl	%edx, 12(%rsp)
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	movq	%rax, 64(%rsp)
	movb	$0, 72(%rsp)
.LEHB0:
	call	_ZNSirsERi@PLT
	movabsq	$230584300921369395, %rax
	movslq	12(%rsp), %rbx
	cmpq	%rbx, %rax
	jb	.L38
	imulq	$40, %rbx, %rdi
	call	_Znam@PLT
	movsd	.LC2(%rip), %xmm0
	movq	%rax, %r13
	jmp	.L39
.L38:
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L66
	call	__cxa_throw_bad_array_new_length@PLT
.L39:
	subq	$1, %rbx
	jb	.L72
	movq	$0x000000000, (%rax)
	addq	$40, %rax
	movq	$0x000000000, -32(%rax)
	movsd	%xmm0, -24(%rax)
	movq	$0x000000000, -16(%rax)
	movq	$0x000000000, -8(%rax)
	jmp	.L39
.L72:
	movl	12(%rsp), %eax
	leal	(%rax,%rax), %edi
	movabsq	$1152921504606846975, %rax
	movslq	%edi, %rdi
	cmpq	%rdi, %rax
	jb	.L42
	salq	$3, %rdi
	call	_Znam@PLT
	movq	%rax, %rbx
	movq	%r13, %rbp
	leaq	16(%rsp), %r15
	xorl	%r12d, %r12d
	jmp	.L43
.L42:
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L66
	call	__cxa_throw_bad_array_new_length@PLT
.L45:
	movq	%r15, %rsi
	movq	%r14, %rdi
	call	_ZNSi10_M_extractIdEERSiRT_@PLT
	movq	%rax, %rdi
	leaq	24(%rsp), %rsi
	call	_ZNSi10_M_extractIdEERSiRT_@PLT
	movq	%rax, %rdi
	leaq	32(%rsp), %rsi
	call	_ZNSi10_M_extractIdEERSiRT_@PLT
	movq	%rax, %rdi
	leaq	40(%rsp), %rsi
	call	_ZNSi10_M_extractIdEERSiRT_@PLT
	movq	%rax, %rdi
	leaq	48(%rsp), %rsi
	call	_ZNSi10_M_extractIdEERSiRT_@PLT
	movsd	16(%rsp), %xmm0
	incl	%r12d
	addq	$40, %rbp
	movsd	%xmm0, -40(%rbp)
	movsd	24(%rsp), %xmm0
	movsd	%xmm0, -32(%rbp)
	movsd	32(%rsp), %xmm0
	movsd	%xmm0, -24(%rbp)
	movsd	40(%rsp), %xmm0
	movsd	%xmm0, -16(%rbp)
	movsd	48(%rsp), %xmm0
	movsd	%xmm0, -8(%rbp)
.L43:
	cmpl	%r12d, 12(%rsp)
	jg	.L45
	leaq	_ZSt4cout(%rip), %r12
	leaq	.LC5(%rip), %rsi
	movq	%r12, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	leaq	56(%rsp), %rbp
	movq	%r14, %rdi
	movq	%rbp, %rsi
	call	_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	leaq	.LC6(%rip), %r15
	movq	%rbp, %rdi
	movq	%r15, %rsi
	call	_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_
	testb	%al, %al
	jne	.L46
	leaq	.LC7(%rip), %rsi
	movq	%rbp, %rdi
	call	_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_
	testb	%al, %al
	jne	.L46
	leaq	.LC8(%rip), %rsi
	movq	%rbp, %rdi
	call	_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_
	testb	%al, %al
	je	.L47
.L46:
	leaq	.LC9(%rip), %rsi
	movq	%r12, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	jmp	.L73
.L47:
	leaq	.LC10(%rip), %rsi
	movq	%rbp, %rdi
	call	_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_
	testb	%al, %al
	je	.L64
	jmp	.L49
.L73:
	movq	%rbp, %rsi
	movq	%r14, %rdi
	call	_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	%r15, %rsi
	movq	%rbp, %rdi
	call	_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_
	testb	%al, %al
	jne	.L51
	leaq	.LC7(%rip), %rsi
	movq	%rbp, %rdi
	call	_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_
	testb	%al, %al
	jne	.L51
	leaq	.LC8(%rip), %rsi
	movq	%rbp, %rdi
	call	_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_
	testb	%al, %al
	jne	.L51
	leaq	.LC10(%rip), %rsi
	movq	%rbp, %rdi
	call	_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_
	testb	%al, %al
	je	.L65
	jmp	.L52
.L51:
	leaq	.LC11(%rip), %rsi
	movq	%r12, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	12(%rsp), %edi
	movq	%rbx, %rdx
	movq	%r13, %rsi
	call	_Z11gpu_unifiediP8ObstaclePd
	jmp	.L70
.L65:
	leaq	.LC12(%rip), %rsi
	movq	%rbp, %rdi
	call	_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_
	testb	%al, %al
	jne	.L52
	leaq	.LC13(%rip), %rsi
	movq	%rbp, %rdi
	call	_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_
	testb	%al, %al
	je	.L69
.L52:
	leaq	.LC15(%rip), %rsi
	movq	%r12, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	12(%rsp), %edi
	movq	%rbx, %rdx
	movq	%r13, %rsi
	call	_Z12gpu_discreteiP8ObstaclePd
.L70:
	movq	%rax, %rbx
	jmp	.L54
.L64:
	leaq	.LC12(%rip), %rsi
	movq	%rbp, %rdi
	call	_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_
	testb	%al, %al
	jne	.L49
	leaq	.LC13(%rip), %rsi
	movq	%rbp, %rdi
	call	_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_
	testb	%al, %al
	jne	.L49
.L69:
	leaq	.LC14(%rip), %rsi
	movq	%r12, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	jmp	.L54
.L49:
	leaq	.LC16(%rip), %rsi
	movq	%r12, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	12(%rsp), %edi
	movq	%rbx, %rdx
	movq	%r13, %rsi
	call	_Z15intersectTime_ciP8ObstaclePd
.L54:
	xorl	%r13d, %r13d
	leaq	.LC17(%rip), %r14
.L56:
	cmpl	%r13d, 12(%rsp)
	jle	.L74
	movl	%r13d, %esi
	movq	%r12, %rdi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	movq	%r14, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	(%rbx), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	movq	%r14, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	8(%rbx), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
.LEHE0:
	incl	%r13d
	addq	$16, %rbx
	jmp	.L56
.L74:
	movq	%rbp, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	je	.L60
	jmp	.L66
.L62:
	endbr64
	movq	%rax, %rbx
.L58:
	leaq	56(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L66
	movq	%rbx, %rdi
.LEHB1:
	call	_Unwind_Resume@PLT
.LEHE1:
.L66:
	call	__stack_chk_fail@PLT
.L60:
	addq	$104, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3647:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA3647:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3647-.LLSDACSB3647
.LLSDACSB3647:
	.uleb128 .LEHB0-.LFB3647
	.uleb128 .LEHE0-.LEHB0
	.uleb128 .L62-.LFB3647
	.uleb128 0
	.uleb128 .LEHB1-.LFB3647
	.uleb128 .LEHE1-.LEHB1
	.uleb128 0
	.uleb128 0
.LLSDACSE3647:
	.section	.text.startup
	.size	main, .-main
	.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.cst8,"aM",@progbits,8
	.align 8
.LC0:
	.long	0
	.long	1138752512
	.align 8
.LC2:
	.long	0
	.long	1072693248
	.align 8
.LC3:
	.long	0
	.long	1071644672
	.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 <iostream>
#include <ctime>
#include <string>

struct Obstacle
{
public:
    double c_x, c_y, r, v_x, v_y;

    Obstacle()
    {
	c_x = 0;
	c_y = 0;
	r = 1.0;
	v_x = 0;
	v_y = 0; 
    }

    Obstacle(double cx, double cy, double r0, double vx, double vy)
    {
        c_x = cx;
        c_y = cy;
        r = r0;
        v_x = vx;
        v_y = vy;
    }
};

__device__ double infty_g(void)
{
    const unsigned long long ieee754inf = 0x7ff0000000000000;
    return __longlong_as_double(ieee754inf);
}

double infty_c(void)
{
    const unsigned long long ieee754inf = 0x7ff0000000000000;
    return (double)(ieee754inf);
}
__global__ void intersectTime_g(int n, Obstacle points[], double list[])
{
    int index = blockIdx.x * blockDim.x + threadIdx.x;
    int stride = blockDim.x * gridDim.x;
    // process each obstacle
    for(int j = index; j < n; j += stride)
    {
        Obstacle a = points[j];

        //distance @d b/w obstacle and scooter
        double d =  sqrt(a.c_x * a.c_x + a.c_y * a.c_y);
      	double t_s = 0;
      	double t_e = 0;
      	//Case 1: object alrd collide w scooter
      	if(d <= 1)
      	{
       	    t_s = 0;
      	    t_e = infty_g();
              }
      	//Case 2: object move in opposite dir w.r.t scooter
      	else if(a.c_x * a.v_x >= 0 || a.c_y * a.v_y >= 0)
      	{
            t_s = infty_g();
      	    t_e = infty_g();
      	} else
      	{
      	    double v = sqrt(a.v_x * a.v_x + a.v_y * a.v_y);
      	    double delta_t = 2 * sqrt((1.0 + a.r) * (1.0 + a.r) - 1) / v;
      	    t_s = (sqrt(d * d - 1.0) / v) - 0.5 * delta_t;
      	    t_e = t_s + delta_t;
      	}
              //store in list[j]
              list[2 * j] = t_s;
              list[2 * j + 1] = t_e;

        //for test output
        //printf("GPU: (%.2lf, %.2lf), v = %.3lf, t_s = %.2lf, t_e = %.2lf\n", a._x, a._y, v, t_s, t_e);
    }
}

void intersectTime_c(int n, Obstacle points[], double list[])
{
    for(int j = 0; j < n; j++)
    {
        Obstacle a = points[j];

        //distance @d b/w obstacle and scooter
        double d =  sqrt(a.c_x * a.c_x + a.c_y * a.c_y);
        double t_s = 0;
        double t_e = 0;
        //Case 1: object alrd collide w scooter
        if(d <= 1)
        {
            t_s = 0;
            t_e = infty_c();
        }
        //Case 2: object move in opposite dir w.r.t scooter
        else if(a.c_x * a.v_x >= 0 || a.c_y * a.v_y >= 0)
        {
            t_s = infty_c();
            t_e = infty_c();
        } else
        {
            double v = sqrt(a.v_x * a.v_x + a.v_y * a.v_y);
            double delta_t = 2 * sqrt((1.0 + a.r) * (1.0 + a.r) - 1) / v;
            t_s = (sqrt(d * d - 1.0) / v) - 0.5 * delta_t;
            t_e = t_s + delta_t;
        }
            //store in list[j]
            list[2 * j] = t_s;
            list[2 * j + 1] = t_e;

        //for test output
        //printf("GPU: (%.2lf, %.2lf), v = %.3lf, t_s = %.2lf, t_e = %.2lf\n", a._x, a._y, v, t_s, t_e);
    }
}

double* gpu_discrete(int n, Obstacle points[], double list[])
{
    Obstacle* points_g;
    hipMalloc(&points_g, n * sizeof(Obstacle));
    double* list_g;
    hipMalloc(&list_g, n * 2 * sizeof(double));
    hipMemcpy(points_g, points, n * sizeof(Obstacle), hipMemcpyHostToDevice);
    int blockSize = 256;
    int numBlocks = (n + blockSize - 1) / blockSize;
    intersectTime_g<<<numBlocks, blockSize>>>(n, points_g, list_g);
    hipDeviceSynchronize();
    hipMemcpy(list, list_g, n * 2 * sizeof(double), hipMemcpyDeviceToHost);
    return list;
}

double* gpu_unified(int n, Obstacle points[], double list[])
{
    Obstacle* points_g;
    hipMallocManaged(&points_g, n * sizeof(Obstacle));
    double* list_g;
    hipMallocManaged(&list_g, n * 2 * sizeof(double));
    hipMemcpy(points_g, points, n * sizeof(Obstacle), hipMemcpyHostToDevice);
    int blockSize = 256;
    int numBlocks = (n + blockSize - 1) / blockSize;
    intersectTime_g<<<numBlocks, blockSize>>>(n, points_g, list_g);
    hipDeviceSynchronize();
    return list_g;
}

double* cpu(int n, Obstacle points[], double list[])
{
    intersectTime_c(n, points, list);
    return list;
}

int main(int argc, char *argv[])
{
    std::string response;
    bool valid = false;
    int n = 0;
    std::cin >> n;
    Obstacle* obstacles = new Obstacle[n];
    double* result = new double[2 * n];
    double c_x, c_y, r, v_x, v_y;
    for(int i = 0; i < n; i++)
    {
        std::cin >> c_x >> c_y >> r >> v_x >> v_y;
        obstacles[i] = Obstacle(c_x, c_y, r, v_x, v_y);
    }
    valid = true;
    // while (valid)
    {
        std::cout << "Use GPU for computation ? (Y/N)" << std::endl;
        std::cin >> response;
        if(response == "Y" || response == "y" || response == "yes")
        {
            std::cout << "Use unified memory? (Y/N)" << std::endl;
            std::cin >> response;
            if(response == "Y" || response == "y" || response == "yes")
            {
                //unified gpu memory
                std::cout << "unified gpu memory incurred.\n";
                valid = false;
                result = gpu_unified(n, obstacles, result);
            } else if (response == "N" || response == "n" || response == "no")
            {
                //discrete gpu memory
                std::cout << "discrete gpu memory incurred.\n";
                valid = false;
                result = gpu_discrete(n, obstacles, result);
            } else {
                std::cout << "invalid input. try again\n";
            }
        } else if (response == "N" || response == "n" || response == "no")
        {
            // cpu
            std::cout << "cpu memory incurred.\n";
            valid = false;
            result = cpu(n, obstacles, result);
        } else {
            std::cout << "invalid input. try again\n";
        }
    }
    //print output
    for(int i = 0; i < n; i++)
    {
        std::cout << i << " " << result[2 * i] << " " << result[2 * i + 1] << std::endl;
    }
}

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

                                        # End of file scope inline assembly
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z7infty_cv
.LCPI0_0:
	.quad	0x43dffc0000000000              # double 9.2188684372274053E+18
	.text
	.globl	_Z7infty_cv
	.type	_Z7infty_cv,@function
_Z7infty_cv:                            # @_Z7infty_cv
	.cfi_startproc
# %bb.0:
	movsd	.LCPI0_0(%rip), %xmm0           # xmm0 = mem[0],zero
	retq
.Lfunc_end0:
	.size	_Z7infty_cv, .Lfunc_end0-_Z7infty_cv
	.cfi_endproc
                                        # -- End function
	.globl	_Z30__device_stub__intersectTime_giP8ObstaclePd # -- Begin function _Z30__device_stub__intersectTime_giP8ObstaclePd
	.type	_Z30__device_stub__intersectTime_giP8ObstaclePd,@function
_Z30__device_stub__intersectTime_giP8ObstaclePd: # @_Z30__device_stub__intersectTime_giP8ObstaclePd
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	12(%rsp), %rax
	movl	%edi, (%rax)
	leaq	40(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	32(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z15intersectTime_giP8ObstaclePd, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z30__device_stub__intersectTime_giP8ObstaclePd, .Lfunc_end1-_Z30__device_stub__intersectTime_giP8ObstaclePd
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z15intersectTime_ciP8ObstaclePd
.LCPI2_0:
	.quad	0x43dffc0000000000              # double 9.2188684372274053E+18
.LCPI2_1:
	.quad	0x3ff0000000000000              # double 1
.LCPI2_2:
	.quad	0xbff0000000000000              # double -1
.LCPI2_3:
	.quad	0xbfe0000000000000              # double -0.5
	.text
	.globl	_Z15intersectTime_ciP8ObstaclePd
	.type	_Z15intersectTime_ciP8ObstaclePd,@function
_Z15intersectTime_ciP8ObstaclePd:       # @_Z15intersectTime_ciP8ObstaclePd
	.cfi_startproc
# %bb.0:
	testl	%edi, %edi
	jle	.LBB2_14
# %bb.1:                                # %.lr.ph.preheader
	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
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdx, %rbx
	movq	%rsi, %r14
	movl	%edi, %r15d
	addq	$32, %r14
	shlq	$4, %r15
	xorl	%r12d, %r12d
	movsd	.LCPI2_0(%rip), %xmm4           # xmm4 = mem[0],zero
	movsd	.LCPI2_1(%rip), %xmm5           # xmm5 = mem[0],zero
	xorpd	%xmm6, %xmm6
	movsd	.LCPI2_2(%rip), %xmm7           # xmm7 = mem[0],zero
.LBB2_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movsd	-32(%r14), %xmm2                # xmm2 = mem[0],zero
	movsd	-24(%r14), %xmm0                # xmm0 = mem[0],zero
	movapd	%xmm2, %xmm1
	mulsd	%xmm2, %xmm1
	movapd	%xmm0, %xmm3
	mulsd	%xmm0, %xmm3
	addsd	%xmm1, %xmm3
	xorps	%xmm9, %xmm9
	sqrtsd	%xmm3, %xmm9
	ucomisd	%xmm9, %xmm5
	movapd	%xmm4, %xmm8
	xorpd	%xmm1, %xmm1
	jae	.LBB2_12
# %bb.3:                                #   in Loop: Header=BB2_2 Depth=1
	movsd	-8(%r14), %xmm3                 # xmm3 = mem[0],zero
	mulsd	%xmm3, %xmm2
	ucomisd	%xmm6, %xmm2
	movapd	%xmm4, %xmm8
	movapd	%xmm4, %xmm1
	jae	.LBB2_12
# %bb.4:                                #   in Loop: Header=BB2_2 Depth=1
	movsd	(%r14), %xmm2                   # xmm2 = mem[0],zero
	mulsd	%xmm2, %xmm0
	ucomisd	%xmm6, %xmm0
	movapd	%xmm4, %xmm8
	movapd	%xmm4, %xmm1
	jae	.LBB2_12
# %bb.5:                                #   in Loop: Header=BB2_2 Depth=1
	movsd	-16(%r14), %xmm0                # xmm0 = mem[0],zero
	addsd	%xmm5, %xmm0
	mulsd	%xmm0, %xmm0
	addsd	%xmm7, %xmm0
	ucomisd	%xmm6, %xmm0
	movsd	%xmm3, 16(%rsp)                 # 8-byte Spill
	movsd	%xmm2, 8(%rsp)                  # 8-byte Spill
	jb	.LBB2_7
# %bb.6:                                #   in Loop: Header=BB2_2 Depth=1
	xorps	%xmm8, %xmm8
	sqrtsd	%xmm0, %xmm8
	jmp	.LBB2_8
.LBB2_7:                                # %call.sqrt
                                        #   in Loop: Header=BB2_2 Depth=1
	movsd	%xmm9, (%rsp)                   # 8-byte Spill
	callq	sqrt
	movsd	(%rsp), %xmm9                   # 8-byte Reload
                                        # xmm9 = mem[0],zero
	movsd	.LCPI2_2(%rip), %xmm7           # xmm7 = mem[0],zero
	xorpd	%xmm6, %xmm6
	movapd	%xmm0, %xmm8
.LBB2_8:                                # %.split
                                        #   in Loop: Header=BB2_2 Depth=1
	mulsd	%xmm9, %xmm9
	addsd	%xmm7, %xmm9
	ucomisd	%xmm6, %xmm9
	jb	.LBB2_10
# %bb.9:                                #   in Loop: Header=BB2_2 Depth=1
	xorps	%xmm0, %xmm0
	sqrtsd	%xmm9, %xmm0
	jmp	.LBB2_11
.LBB2_10:                               # %call.sqrt44
                                        #   in Loop: Header=BB2_2 Depth=1
	movapd	%xmm9, %xmm0
	movsd	%xmm8, (%rsp)                   # 8-byte Spill
	callq	sqrt
	movsd	(%rsp), %xmm8                   # 8-byte Reload
                                        # xmm8 = mem[0],zero
	movsd	.LCPI2_2(%rip), %xmm7           # xmm7 = mem[0],zero
	xorpd	%xmm6, %xmm6
.LBB2_11:                               # %.split.split
                                        #   in Loop: Header=BB2_2 Depth=1
	movsd	.LCPI2_0(%rip), %xmm4           # xmm4 = mem[0],zero
	movsd	.LCPI2_1(%rip), %xmm5           # xmm5 = mem[0],zero
	movsd	16(%rsp), %xmm1                 # 8-byte Reload
                                        # xmm1 = mem[0],zero
	movsd	8(%rsp), %xmm2                  # 8-byte Reload
                                        # xmm2 = mem[0],zero
	mulsd	%xmm1, %xmm1
	mulsd	%xmm2, %xmm2
	addsd	%xmm1, %xmm2
	xorps	%xmm1, %xmm1
	sqrtsd	%xmm2, %xmm1
	addsd	%xmm8, %xmm8
	divsd	%xmm1, %xmm8
	divsd	%xmm1, %xmm0
	movapd	%xmm8, %xmm1
	mulsd	.LCPI2_3(%rip), %xmm1
	addsd	%xmm0, %xmm1
	addsd	%xmm1, %xmm8
.LBB2_12:                               #   in Loop: Header=BB2_2 Depth=1
	movsd	%xmm1, (%rbx,%r12)
	movsd	%xmm8, 8(%rbx,%r12)
	addq	$40, %r14
	addq	$16, %r12
	cmpq	%r12, %r15
	jne	.LBB2_2
# %bb.13:
	addq	$24, %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
	.cfi_restore %rbx
	.cfi_restore %r12
	.cfi_restore %r14
	.cfi_restore %r15
.LBB2_14:                               # %._crit_edge
	retq
.Lfunc_end2:
	.size	_Z15intersectTime_ciP8ObstaclePd, .Lfunc_end2-_Z15intersectTime_ciP8ObstaclePd
	.cfi_endproc
                                        # -- End function
	.globl	_Z12gpu_discreteiP8ObstaclePd   # -- Begin function _Z12gpu_discreteiP8ObstaclePd
	.type	_Z12gpu_discreteiP8ObstaclePd,@function
_Z12gpu_discreteiP8ObstaclePd:          # @_Z12gpu_discreteiP8ObstaclePd
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rdx, %rbx
	movq	%rsi, %r12
	movl	%edi, 4(%rsp)                   # 4-byte Spill
	movslq	%edi, %r15
	leaq	(,%r15,8), %rax
	leaq	(%rax,%rax,4), %r13
	leaq	16(%rsp), %rbp
	movq	%rbp, %rdi
	movq	%r13, %rsi
	callq	hipMalloc
	leal	(%r15,%r15), %eax
	movslq	%eax, %r14
	shlq	$3, %r14
	leaq	8(%rsp), %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	movq	(%rbp), %rdi
	movq	%r12, %rsi
	movq	%r13, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	leal	255(%r15), %eax
	addl	$510, %r15d                     # imm = 0x1FE
	testl	%eax, %eax
	cmovnsl	%eax, %r15d
	sarl	$8, %r15d
	btsq	$32, %r15
	movabsq	$4294967296, %rdx               # imm = 0x100000000
	orq	$256, %rdx                      # imm = 0x100
	movq	%r15, %rdi
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB3_2
# %bb.1:
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdx
	movl	4(%rsp), %edi                   # 4-byte Reload
	callq	_Z30__device_stub__intersectTime_giP8ObstaclePd
.LBB3_2:
	callq	hipDeviceSynchronize
	movq	8(%rsp), %rsi
	movq	%rbx, %rdi
	movq	%r14, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	%rbx, %rax
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	_Z12gpu_discreteiP8ObstaclePd, .Lfunc_end3-_Z12gpu_discreteiP8ObstaclePd
	.cfi_endproc
                                        # -- End function
	.globl	_Z11gpu_unifiediP8ObstaclePd    # -- Begin function _Z11gpu_unifiediP8ObstaclePd
	.type	_Z11gpu_unifiediP8ObstaclePd,@function
_Z11gpu_unifiediP8ObstaclePd:           # @_Z11gpu_unifiediP8ObstaclePd
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rsi, %r15
	movl	%edi, %ebx
	movslq	%edi, %r14
	leaq	(,%r14,8), %rax
	leaq	(%rax,%rax,4), %r12
	leaq	8(%rsp), %r13
	movq	%r13, %rdi
	movq	%r12, %rsi
	movl	$1, %edx
	callq	hipMallocManaged
	leal	(%r14,%r14), %eax
	movslq	%eax, %rsi
	shlq	$3, %rsi
	movq	%rsp, %rdi
	movl	$1, %edx
	callq	hipMallocManaged
	movq	(%r13), %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	leal	255(%r14), %eax
	addl	$510, %r14d                     # imm = 0x1FE
	testl	%eax, %eax
	cmovnsl	%eax, %r14d
	sarl	$8, %r14d
	btsq	$32, %r14
	movabsq	$4294967296, %rdx               # imm = 0x100000000
	orq	$256, %rdx                      # imm = 0x100
	movq	%r14, %rdi
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_2
# %bb.1:
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdx
	movl	%ebx, %edi
	callq	_Z30__device_stub__intersectTime_giP8ObstaclePd
.LBB4_2:
	callq	hipDeviceSynchronize
	movq	(%rsp), %rax
	addq	$16, %rsp
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	_Z11gpu_unifiediP8ObstaclePd, .Lfunc_end4-_Z11gpu_unifiediP8ObstaclePd
	.cfi_endproc
                                        # -- End function
	.globl	_Z3cpuiP8ObstaclePd             # -- Begin function _Z3cpuiP8ObstaclePd
	.type	_Z3cpuiP8ObstaclePd,@function
_Z3cpuiP8ObstaclePd:                    # @_Z3cpuiP8ObstaclePd
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movq	%rdx, %rbx
	callq	_Z15intersectTime_ciP8ObstaclePd
	movq	%rbx, %rax
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end5:
	.size	_Z3cpuiP8ObstaclePd, .Lfunc_end5-_Z3cpuiP8ObstaclePd
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
.Lfunc_begin0:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception0
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	leaq	32(%rsp), %rax
	movq	%rax, -16(%rax)
	movq	$0, -8(%rax)
	movb	$0, (%rax)
	leaq	4(%rsp), %rsi
	movl	$0, (%rsi)
.Ltmp0:
	movl	$_ZSt3cin, %edi
	callq	_ZNSirsERi
.Ltmp1:
# %bb.1:
	movslq	4(%rsp), %r14
	movl	$40, %ecx
	movq	%r14, %rax
	mulq	%rcx
	movq	$-1, %rdi
	cmovnoq	%rax, %rdi
.Ltmp3:
	callq	_Znam
.Ltmp4:
# %bb.2:
	testl	%r14d, %r14d
	je	.LBB6_5
# %bb.3:
	leaq	(%r14,%r14,4), %rcx
	leaq	(%rax,%rcx,8), %rsi
	xorps	%xmm0, %xmm0
	movabsq	$4607182418800017408, %rcx      # imm = 0x3FF0000000000000
	movq	%rax, %rdx
.LBB6_4:                                # =>This Inner Loop Header: Depth=1
	movups	%xmm0, (%rdx)
	movq	%rcx, 16(%rdx)
	movups	%xmm0, 24(%rdx)
	addq	$40, %rdx
	cmpq	%rsi, %rdx
	jne	.LBB6_4
.LBB6_5:                                # %.loopexit
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	movq	%r14, %rax
	shlq	$4, %rax
	testl	%r14d, %r14d
	movq	$-1, %rdi
	cmovnsq	%rax, %rdi
.Ltmp6:
	callq	_Znam
.Ltmp7:
# %bb.6:
	movq	%rax, %rbx
	testl	%r14d, %r14d
	jle	.LBB6_14
# %bb.7:                                # %.lr.ph.preheader
	movq	8(%rsp), %r15                   # 8-byte Reload
	addq	$32, %r15
	xorl	%r12d, %r12d
	leaq	64(%rsp), %r13
	leaq	56(%rsp), %rbp
	leaq	48(%rsp), %r14
.LBB6_8:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
.Ltmp9:
	movl	$_ZSt3cin, %edi
	leaq	80(%rsp), %rsi
	callq	_ZNSi10_M_extractIdEERSiRT_
.Ltmp10:
# %bb.9:                                # %_ZNSirsERd.exit
                                        #   in Loop: Header=BB6_8 Depth=1
.Ltmp11:
	movq	%rax, %rdi
	leaq	72(%rsp), %rsi
	callq	_ZNSi10_M_extractIdEERSiRT_
.Ltmp12:
# %bb.10:                               # %_ZNSirsERd.exit31
                                        #   in Loop: Header=BB6_8 Depth=1
.Ltmp13:
	movq	%rax, %rdi
	movq	%r13, %rsi
	callq	_ZNSi10_M_extractIdEERSiRT_
.Ltmp14:
# %bb.11:                               # %_ZNSirsERd.exit32
                                        #   in Loop: Header=BB6_8 Depth=1
.Ltmp15:
	movq	%rax, %rdi
	movq	%rbp, %rsi
	callq	_ZNSi10_M_extractIdEERSiRT_
.Ltmp16:
# %bb.12:                               # %_ZNSirsERd.exit33
                                        #   in Loop: Header=BB6_8 Depth=1
.Ltmp17:
	movq	%rax, %rdi
	movq	%r14, %rsi
	callq	_ZNSi10_M_extractIdEERSiRT_
.Ltmp18:
# %bb.13:                               # %_ZNSirsERd.exit34
                                        #   in Loop: Header=BB6_8 Depth=1
	movsd	80(%rsp), %xmm0                 # xmm0 = mem[0],zero
	movsd	72(%rsp), %xmm1                 # xmm1 = mem[0],zero
	movsd	64(%rsp), %xmm2                 # xmm2 = mem[0],zero
	movsd	56(%rsp), %xmm3                 # xmm3 = mem[0],zero
	movsd	48(%rsp), %xmm4                 # xmm4 = mem[0],zero
	movsd	%xmm0, -32(%r15)
	movsd	%xmm1, -24(%r15)
	movsd	%xmm2, -16(%r15)
	movsd	%xmm3, -8(%r15)
	movsd	%xmm4, (%r15)
	incq	%r12
	movslq	4(%rsp), %rax
	addq	$40, %r15
	cmpq	%rax, %r12
	jl	.LBB6_8
.LBB6_14:                               # %._crit_edge
.Ltmp20:
	movl	$_ZSt4cout, %r14d
	movl	$_ZSt4cout, %edi
	movl	$.L.str, %esi
	movl	$31, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp21:
# %bb.15:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
	movq	_ZSt4cout(%rip), %rax
	addq	-24(%rax), %r14
.Ltmp22:
	movq	%r14, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp23:
# %bb.16:                               # %.noexc
.Ltmp24:
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
.Ltmp25:
# %bb.17:                               # %.noexc71
.Ltmp26:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp27:
# %bb.18:                               # %_ZNSolsEPFRSoS_E.exit
.Ltmp28:
	leaq	16(%rsp), %rsi
	movl	$_ZSt3cin, %edi
	callq	_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE
.Ltmp29:
# %bb.19:
	movq	24(%rsp), %rdx
	cmpq	$3, %rdx
	je	.LBB6_31
# %bb.20:
	cmpq	$2, %rdx
	je	.LBB6_52
# %bb.21:
	cmpq	$1, %rdx
	jne	.LBB6_26
# %bb.22:                               # %_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_.exit
	movq	16(%rsp), %r14
	cmpb	$89, (%r14)
	je	.LBB6_32
# %bb.23:                               # %_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_.exit36
	cmpb	$121, (%r14)
	je	.LBB6_32
# %bb.24:                               # %_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_.exit57
	movl	$.L.str.6, %esi
	movq	%r14, %rdi
	callq	bcmp@PLT
	testl	%eax, %eax
	je	.LBB6_53
# %bb.25:                               # %_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_.exit59
	cmpb	$110, (%r14)
	je	.LBB6_53
	jmp	.LBB6_26
.LBB6_52:                               # %_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_.exit61
	movq	16(%rsp), %rdi
	movl	$.L.str.8, %esi
	callq	bcmp@PLT
	testl	%eax, %eax
	jne	.LBB6_26
.LBB6_53:                               # %_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_.exit57.thread
.Ltmp30:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.11, %esi
	movl	$21, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp31:
# %bb.54:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit62
	movl	4(%rsp), %edi
	movq	8(%rsp), %rsi                   # 8-byte Reload
	movq	%rbx, %rdx
	callq	_Z15intersectTime_ciP8ObstaclePd
	jmp	.LBB6_55
.LBB6_31:                               # %_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_.exit38
	movq	16(%rsp), %rdi
	movl	$.L.str.3, %esi
	callq	bcmp@PLT
	testl	%eax, %eax
	jne	.LBB6_26
.LBB6_32:                               # %_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_.exit.thread
.Ltmp32:
	movl	$_ZSt4cout, %r14d
	movl	$_ZSt4cout, %edi
	movl	$.L.str.4, %esi
	movl	$25, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp33:
# %bb.33:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit39
	movq	_ZSt4cout(%rip), %rax
	addq	-24(%rax), %r14
.Ltmp34:
	movq	%r14, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp35:
# %bb.34:                               # %.noexc73
.Ltmp36:
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
.Ltmp37:
# %bb.35:                               # %.noexc74
.Ltmp38:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp39:
# %bb.36:                               # %_ZNSolsEPFRSoS_E.exit40
.Ltmp40:
	leaq	16(%rsp), %rsi
	movl	$_ZSt3cin, %edi
	callq	_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE
.Ltmp41:
# %bb.37:
	movq	24(%rsp), %rdx
	cmpq	$3, %rdx
	je	.LBB6_44
# %bb.38:
	cmpq	$2, %rdx
	je	.LBB6_49
# %bb.39:
	cmpq	$1, %rdx
	jne	.LBB6_26
# %bb.40:                               # %_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_.exit42
	movq	16(%rsp), %r14
	cmpb	$89, (%r14)
	je	.LBB6_45
# %bb.41:                               # %_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_.exit44
	cmpb	$121, (%r14)
	je	.LBB6_45
# %bb.42:                               # %_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_.exit49
	movl	$.L.str.6, %esi
	movq	%r14, %rdi
	callq	bcmp@PLT
	testl	%eax, %eax
	je	.LBB6_50
# %bb.43:                               # %_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_.exit51
	cmpb	$110, (%r14)
	je	.LBB6_50
	jmp	.LBB6_26
.LBB6_49:                               # %_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_.exit53
	movq	16(%rsp), %rdi
	movl	$.L.str.8, %esi
	callq	bcmp@PLT
	testl	%eax, %eax
	jne	.LBB6_26
.LBB6_50:                               # %_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_.exit49.thread
.Ltmp42:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.9, %esi
	movl	$30, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp43:
# %bb.51:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit54
	movl	4(%rsp), %edi
.Ltmp44:
	movq	8(%rsp), %rsi                   # 8-byte Reload
	movq	%rbx, %rdx
	callq	_Z12gpu_discreteiP8ObstaclePd
.Ltmp45:
	jmp	.LBB6_55
.LBB6_44:                               # %_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_.exit46
	movq	16(%rsp), %rdi
	movl	$.L.str.3, %esi
	callq	bcmp@PLT
	testl	%eax, %eax
	je	.LBB6_45
.LBB6_26:                               # %_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_.exit61.thread92.invoke
.Ltmp50:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.10, %esi
	movl	$25, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp51:
.LBB6_55:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit55
	cmpl	$0, 4(%rsp)
	jle	.LBB6_66
# %bb.56:                               # %.lr.ph95.preheader
	addq	$8, %rbx
	xorl	%r14d, %r14d
.LBB6_57:                               # %.lr.ph95
                                        # =>This Inner Loop Header: Depth=1
.Ltmp53:
	movl	$_ZSt4cout, %edi
	movl	%r14d, %esi
	callq	_ZNSolsEi
.Ltmp54:
# %bb.58:                               #   in Loop: Header=BB6_57 Depth=1
.Ltmp55:
	movq	%rax, %r15
	movl	$.L.str.12, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp56:
# %bb.59:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit64
                                        #   in Loop: Header=BB6_57 Depth=1
	movsd	-8(%rbx), %xmm0                 # xmm0 = mem[0],zero
.Ltmp57:
	movq	%r15, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp58:
# %bb.60:                               # %_ZNSolsEd.exit
                                        #   in Loop: Header=BB6_57 Depth=1
.Ltmp59:
	movq	%rax, %r15
	movl	$.L.str.12, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp60:
# %bb.61:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit65
                                        #   in Loop: Header=BB6_57 Depth=1
	movsd	(%rbx), %xmm0                   # xmm0 = mem[0],zero
.Ltmp61:
	movq	%r15, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp62:
# %bb.62:                               # %_ZNSolsEd.exit66
                                        #   in Loop: Header=BB6_57 Depth=1
	movq	%rax, %r15
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r15, %rdi
.Ltmp63:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp64:
# %bb.63:                               # %.noexc77
                                        #   in Loop: Header=BB6_57 Depth=1
.Ltmp65:
	movsbl	%al, %esi
	movq	%r15, %rdi
	callq	_ZNSo3putEc
.Ltmp66:
# %bb.64:                               # %.noexc78
                                        #   in Loop: Header=BB6_57 Depth=1
.Ltmp67:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp68:
# %bb.65:                               # %_ZNSolsEPFRSoS_E.exit67
                                        #   in Loop: Header=BB6_57 Depth=1
	incq	%r14
	movslq	4(%rsp), %rax
	addq	$16, %rbx
	cmpq	%rax, %r14
	jl	.LBB6_57
.LBB6_66:                               # %._crit_edge96
	movq	16(%rsp), %rdi
	leaq	32(%rsp), %rax
	cmpq	%rax, %rdi
	je	.LBB6_68
# %bb.67:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
	callq	_ZdlPv
.LBB6_68:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit
	xorl	%eax, %eax
	addq	$88, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB6_45:                               # %_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_.exit42.thread
	.cfi_def_cfa_offset 144
.Ltmp46:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.5, %esi
	movl	$29, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp47:
# %bb.46:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit47
	movl	4(%rsp), %edi
.Ltmp48:
	movq	8(%rsp), %rsi                   # 8-byte Reload
	callq	_Z11gpu_unifiediP8ObstaclePd
.Ltmp49:
# %bb.47:
	movq	%rax, %rbx
	jmp	.LBB6_55
.LBB6_29:
.Ltmp8:
	jmp	.LBB6_70
.LBB6_28:
.Ltmp5:
	jmp	.LBB6_70
.LBB6_27:
.Ltmp2:
	jmp	.LBB6_70
.LBB6_48:
.Ltmp52:
	jmp	.LBB6_70
.LBB6_30:
.Ltmp19:
	jmp	.LBB6_70
.LBB6_69:
.Ltmp69:
.LBB6_70:
	movq	%rax, %rbx
	movq	16(%rsp), %rdi
	leaq	32(%rsp), %rax
	cmpq	%rax, %rdi
	je	.LBB6_72
# %bb.71:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i68
	callq	_ZdlPv
.LBB6_72:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit70
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end6:
	.size	main, .Lfunc_end6-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table6:
.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 .Ltmp0-.Lfunc_begin0           # >> Call Site 1 <<
	.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 2 <<
	.uleb128 .Ltmp4-.Ltmp3                  #   Call between .Ltmp3 and .Ltmp4
	.uleb128 .Ltmp5-.Lfunc_begin0           #     jumps to .Ltmp5
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp6-.Lfunc_begin0           # >> Call Site 3 <<
	.uleb128 .Ltmp7-.Ltmp6                  #   Call between .Ltmp6 and .Ltmp7
	.uleb128 .Ltmp8-.Lfunc_begin0           #     jumps to .Ltmp8
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp9-.Lfunc_begin0           # >> Call Site 4 <<
	.uleb128 .Ltmp18-.Ltmp9                 #   Call between .Ltmp9 and .Ltmp18
	.uleb128 .Ltmp19-.Lfunc_begin0          #     jumps to .Ltmp19
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp20-.Lfunc_begin0          # >> Call Site 5 <<
	.uleb128 .Ltmp51-.Ltmp20                #   Call between .Ltmp20 and .Ltmp51
	.uleb128 .Ltmp52-.Lfunc_begin0          #     jumps to .Ltmp52
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp53-.Lfunc_begin0          # >> Call Site 6 <<
	.uleb128 .Ltmp68-.Ltmp53                #   Call between .Ltmp53 and .Ltmp68
	.uleb128 .Ltmp69-.Lfunc_begin0          #     jumps to .Ltmp69
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp46-.Lfunc_begin0          # >> Call Site 7 <<
	.uleb128 .Ltmp49-.Ltmp46                #   Call between .Ltmp46 and .Ltmp49
	.uleb128 .Ltmp52-.Lfunc_begin0          #     jumps to .Ltmp52
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp49-.Lfunc_begin0          # >> Call Site 8 <<
	.uleb128 .Lfunc_end6-.Ltmp49            #   Call between .Ltmp49 and .Lfunc_end6
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.text
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB7_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB7_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z15intersectTime_giP8ObstaclePd, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end7:
	.size	__hip_module_ctor, .Lfunc_end7-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB8_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB8_2:
	retq
.Lfunc_end8:
	.size	__hip_module_dtor, .Lfunc_end8-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z15intersectTime_giP8ObstaclePd,@object # @_Z15intersectTime_giP8ObstaclePd
	.section	.rodata,"a",@progbits
	.globl	_Z15intersectTime_giP8ObstaclePd
	.p2align	3, 0x0
_Z15intersectTime_giP8ObstaclePd:
	.quad	_Z30__device_stub__intersectTime_giP8ObstaclePd
	.size	_Z15intersectTime_giP8ObstaclePd, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Use GPU for computation ? (Y/N)"
	.size	.L.str, 32

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"yes"
	.size	.L.str.3, 4

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"Use unified memory? (Y/N)"
	.size	.L.str.4, 26

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"unified gpu memory incurred.\n"
	.size	.L.str.5, 30

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"N"
	.size	.L.str.6, 2

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"no"
	.size	.L.str.8, 3

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"discrete gpu memory incurred.\n"
	.size	.L.str.9, 31

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"invalid input. try again\n"
	.size	.L.str.10, 26

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"cpu memory incurred.\n"
	.size	.L.str.11, 22

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

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z15intersectTime_giP8ObstaclePd"
	.size	.L__unnamed_1, 33

	.type	__hip_fatbin_wrapper,@object    # @__hip_fatbin_wrapper
	.section	.hipFatBinSegment,"a",@progbits
	.p2align	3, 0x0
__hip_fatbin_wrapper:
	.long	1212764230                      # 0x48495046
	.long	1                               # 0x1
	.quad	__hip_fatbin
	.quad	0
	.size	__hip_fatbin_wrapper, 24

	.type	__hip_gpubin_handle,@object     # @__hip_gpubin_handle
	.local	__hip_gpubin_handle
	.comm	__hip_gpubin_handle,8,8
	.section	.init_array,"aw",@init_array
	.p2align	3, 0x0
	.quad	__hip_module_ctor
	.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 _Z30__device_stub__intersectTime_giP8ObstaclePd
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _Z15intersectTime_giP8ObstaclePd
	.addrsig_sym _ZSt3cin
	.addrsig_sym _ZSt4cout
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z15intersectTime_giP8ObstaclePd ; -- Begin function _Z15intersectTime_giP8ObstaclePd
	.globl	_Z15intersectTime_giP8ObstaclePd
	.p2align	8
	.type	_Z15intersectTime_giP8ObstaclePd,@function
_Z15intersectTime_giP8ObstaclePd:       ; @_Z15intersectTime_giP8ObstaclePd
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x24
	s_load_b32 s6, s[0:1], 0x0
	s_add_u32 s4, s0, 24
	s_addc_u32 s5, s1, 0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s7, s2, 0xffff
	s_mov_b32 s2, exec_lo
	v_mad_u64_u32 v[12:13], null, s15, s7, v[0:1]
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_i32_e64 s6, v12
	s_cbranch_execz .LBB0_7
; %bb.1:                                ; %.lr.ph.preheader
	s_load_b128 s[0:3], s[0:1], 0x8
	s_load_b32 s4, s[4:5], 0x0
	v_lshlrev_b32_e32 v13, 1, v12
	s_mov_b32 s11, 0
	s_waitcnt lgkmcnt(0)
	v_mad_i64_i32 v[0:1], null, v12, 40, s[0:1]
	s_mul_i32 s7, s4, s7
	s_mov_b32 s4, 0
	s_mov_b32 s5, 0x7ff00000
	s_lshl_b32 s8, s7, 1
	s_mul_hi_i32 s9, s7, 40
	s_mul_i32 s10, s7, 40
	s_delay_alu instid0(VALU_DEP_1)
	v_add_co_u32 v15, vcc_lo, v0, 16
	v_add_co_ci_u32_e32 v16, vcc_lo, 0, v1, vcc_lo
.LBB0_2:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	global_load_b128 v[8:11], v[15:16], off offset:-16
	s_mov_b32 s12, exec_lo
	s_waitcnt vmcnt(0)
	v_mul_f64 v[0:1], v[10:11], v[10:11]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[0:1], v[8:9], v[8:9], v[0:1]
	v_cmp_gt_f64_e32 vcc_lo, 0x10000000, v[0:1]
	v_cndmask_b32_e64 v2, 0, 1, vcc_lo
	v_cndmask_b32_e64 v14, 0, 0xffffff80, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b32_e32 v2, 8, v2
	v_ldexp_f64 v[4:5], v[0:1], v2
	s_delay_alu instid0(VALU_DEP_1)
	v_rsq_f64_e32 v[0:1], v[4:5]
	v_cmp_class_f64_e64 vcc_lo, v[4:5], 0x260
	s_waitcnt_depctr 0xfff
	v_mul_f64 v[6:7], v[4:5], v[0:1]
	v_mul_f64 v[17:18], v[0:1], 0.5
	s_clause 0x1
	global_load_b128 v[0:3], v[15:16], off
	global_load_b64 v[19:20], v[15:16], off offset:16
	v_fma_f64 v[21:22], -v[17:18], v[6:7], 0.5
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_fma_f64 v[6:7], v[6:7], v[21:22], v[6:7]
	v_fma_f64 v[17:18], v[17:18], v[21:22], v[17:18]
	v_fma_f64 v[21:22], -v[6:7], v[6:7], v[4:5]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[6:7], v[21:22], v[17:18], v[6:7]
	v_fma_f64 v[21:22], -v[6:7], v[6:7], v[4:5]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[6:7], v[21:22], v[17:18], v[6:7]
	v_ldexp_f64 v[6:7], v[6:7], v14
	s_delay_alu instid0(VALU_DEP_1)
	v_dual_cndmask_b32 v17, v6, v4 :: v_dual_cndmask_b32 v18, v7, v5
	v_mov_b32_e32 v6, 0
	v_mov_b32_e32 v4, 0
	v_mov_b32_e32 v5, 0
	v_mov_b32_e32 v7, 0x7ff00000
	v_cmpx_nge_f64_e32 1.0, v[17:18]
	s_cbranch_execz .LBB0_6
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	s_waitcnt vmcnt(1)
	v_mul_f64 v[4:5], v[8:9], v[2:3]
	s_waitcnt vmcnt(0)
	v_mul_f64 v[6:7], v[10:11], v[19:20]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_max_f64 v[4:5], v[4:5], v[6:7]
	v_cmp_nle_f64_e32 vcc_lo, 0, v[4:5]
	v_mov_b32_e32 v4, s4
	v_mov_b32_e32 v5, s5
	s_delay_alu instid0(VALU_DEP_1)
	v_dual_mov_b32 v7, v5 :: v_dual_mov_b32 v6, v4
	s_and_saveexec_b32 s13, vcc_lo
	s_cbranch_execz .LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	v_add_f64 v[0:1], v[0:1], 1.0
	v_mul_f64 v[4:5], v[19:20], v[19:20]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[0:1], v[0:1], v[0:1], -1.0
	v_fma_f64 v[2:3], v[2:3], v[2:3], v[4:5]
	v_fma_f64 v[4:5], v[17:18], v[17:18], -1.0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cmp_gt_f64_e32 vcc_lo, 0x10000000, v[0:1]
	v_cmp_gt_f64_e64 s0, 0x10000000, v[2:3]
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_cmp_gt_f64_e64 s1, 0x10000000, v[4:5]
	v_cndmask_b32_e64 v6, 0, 1, vcc_lo
	v_cndmask_b32_e64 v14, 0, 0xffffff80, vcc_lo
	v_cndmask_b32_e64 v7, 0, 1, s1
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshlrev_b32_e32 v6, 8, v6
	v_lshlrev_b32_e32 v8, 8, v7
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_ldexp_f64 v[0:1], v[0:1], v6
	v_cndmask_b32_e64 v6, 0, 1, s0
	v_ldexp_f64 v[4:5], v[4:5], v8
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b32_e32 v6, 8, v6
	v_ldexp_f64 v[2:3], v[2:3], v6
	v_rsq_f64_e32 v[6:7], v[0:1]
	v_cmp_class_f64_e64 vcc_lo, v[0:1], 0x260
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_rsq_f64_e32 v[17:18], v[4:5]
	v_rsq_f64_e32 v[8:9], v[2:3]
	s_delay_alu instid0(TRANS32_DEP_3)
	v_mul_f64 v[10:11], v[0:1], v[6:7]
	v_mul_f64 v[6:7], v[6:7], 0.5
	s_waitcnt_depctr 0xfff
	v_mul_f64 v[23:24], v[4:5], v[17:18]
	v_mul_f64 v[17:18], v[17:18], 0.5
	v_mul_f64 v[19:20], v[2:3], v[8:9]
	v_mul_f64 v[8:9], v[8:9], 0.5
	v_fma_f64 v[21:22], -v[6:7], v[10:11], 0.5
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_fma_f64 v[27:28], -v[17:18], v[23:24], 0.5
	v_fma_f64 v[25:26], -v[8:9], v[19:20], 0.5
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_fma_f64 v[10:11], v[10:11], v[21:22], v[10:11]
	v_fma_f64 v[6:7], v[6:7], v[21:22], v[6:7]
	v_fma_f64 v[23:24], v[23:24], v[27:28], v[23:24]
	v_fma_f64 v[17:18], v[17:18], v[27:28], v[17:18]
	v_fma_f64 v[19:20], v[19:20], v[25:26], v[19:20]
	v_fma_f64 v[8:9], v[8:9], v[25:26], v[8:9]
	v_fma_f64 v[21:22], -v[10:11], v[10:11], v[0:1]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[25:26], -v[19:20], v[19:20], v[2:3]
	v_fma_f64 v[10:11], v[21:22], v[6:7], v[10:11]
	v_fma_f64 v[21:22], -v[23:24], v[23:24], v[4:5]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_fma_f64 v[19:20], v[25:26], v[8:9], v[19:20]
	v_fma_f64 v[25:26], -v[10:11], v[10:11], v[0:1]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_fma_f64 v[21:22], v[21:22], v[17:18], v[23:24]
	v_fma_f64 v[23:24], -v[19:20], v[19:20], v[2:3]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_fma_f64 v[6:7], v[25:26], v[6:7], v[10:11]
	v_fma_f64 v[10:11], -v[21:22], v[21:22], v[4:5]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_fma_f64 v[8:9], v[23:24], v[8:9], v[19:20]
	v_ldexp_f64 v[6:7], v[6:7], v14
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_3) | instid1(VALU_DEP_3)
	v_fma_f64 v[10:11], v[10:11], v[17:18], v[21:22]
	v_cndmask_b32_e64 v14, 0, 0xffffff80, s0
	v_cndmask_b32_e64 v17, 0, 0xffffff80, s1
	v_cmp_class_f64_e64 s0, v[4:5], 0x260
	v_ldexp_f64 v[8:9], v[8:9], v14
	v_dual_cndmask_b32 v1, v7, v1 :: v_dual_cndmask_b32 v0, v6, v0
	v_cmp_class_f64_e64 vcc_lo, v[2:3], 0x260
	v_ldexp_f64 v[6:7], v[10:11], v17
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_add_f64 v[0:1], v[0:1], v[0:1]
	v_dual_cndmask_b32 v3, v9, v3 :: v_dual_cndmask_b32 v2, v8, v2
	v_cndmask_b32_e64 v5, v7, v5, s0
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cndmask_b32_e64 v4, v6, v4, s0
	v_div_scale_f64 v[6:7], null, v[2:3], v[2:3], v[0:1]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_div_scale_f64 v[8:9], null, v[2:3], v[2:3], v[4:5]
	v_div_scale_f64 v[23:24], vcc_lo, v[0:1], v[2:3], v[0:1]
	v_rcp_f64_e32 v[10:11], v[6:7]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_2)
	v_rcp_f64_e32 v[17:18], v[8:9]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[19:20], -v[6:7], v[10:11], 1.0
	v_fma_f64 v[21:22], -v[8:9], v[17:18], 1.0
	v_fma_f64 v[10:11], v[10:11], v[19:20], v[10:11]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[17:18], v[17:18], v[21:22], v[17:18]
	v_fma_f64 v[19:20], -v[6:7], v[10:11], 1.0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[21:22], -v[8:9], v[17:18], 1.0
	v_fma_f64 v[10:11], v[10:11], v[19:20], v[10:11]
	v_div_scale_f64 v[19:20], s0, v[4:5], v[2:3], v[4:5]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_fma_f64 v[17:18], v[17:18], v[21:22], v[17:18]
	v_mul_f64 v[21:22], v[23:24], v[10:11]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_f64 v[25:26], v[19:20], v[17:18]
	v_fma_f64 v[6:7], -v[6:7], v[21:22], v[23:24]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[8:9], -v[8:9], v[25:26], v[19:20]
	v_div_fmas_f64 v[6:7], v[6:7], v[10:11], v[21:22]
	s_mov_b32 vcc_lo, s0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_div_fmas_f64 v[8:9], v[8:9], v[17:18], v[25:26]
	v_div_fixup_f64 v[0:1], v[6:7], v[2:3], v[0:1]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fixup_f64 v[2:3], v[8:9], v[2:3], v[4:5]
	v_fma_f64 v[4:5], v[0:1], -0.5, v[2:3]
	s_delay_alu instid0(VALU_DEP_1)
	v_add_f64 v[6:7], v[0:1], v[4:5]
.LBB0_5:                                ; %Flow
                                        ;   in Loop: Header=BB0_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s13
.LBB0_6:                                ;   in Loop: Header=BB0_2 Depth=1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_3) | instid1(VALU_DEP_2)
	s_or_b32 exec_lo, exec_lo, s12
	v_ashrrev_i32_e32 v14, 31, v13
	v_add_nc_u32_e32 v12, s7, v12
	s_waitcnt vmcnt(1)
	v_lshlrev_b64 v[0:1], 3, v[13:14]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_cmp_le_i32_e32 vcc_lo, s6, v12
	v_add_nc_u32_e32 v13, s8, v13
	s_or_b32 s11, vcc_lo, s11
	v_add_co_u32 v0, s0, s2, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e64 v1, s0, s3, v1, s0
	v_add_co_u32 v15, s0, v15, s10
	v_add_co_ci_u32_e64 v16, s0, s9, v16, s0
	global_store_b128 v[0:1], v[4:7], off
	s_and_not1_b32 exec_lo, exec_lo, s11
	s_cbranch_execnz .LBB0_2
.LBB0_7:                                ; %Flow55
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z15intersectTime_giP8ObstaclePd
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 29
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z15intersectTime_giP8ObstaclePd, .Lfunc_end0-_Z15intersectTime_giP8ObstaclePd
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 1388
; NumSgprs: 18
; NumVgprs: 29
; ScratchSize: 0
; MemoryBound: 1
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 3
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 29
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.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_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .offset:         0
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         28
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         36
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         38
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         40
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         42
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         44
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         46
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         88
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z15intersectTime_giP8ObstaclePd
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z15intersectTime_giP8ObstaclePd.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     29
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
