﻿#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdlib.h>
#include <math.h>

#define ENOUGH_SMALL 0.00001f

__host__ __device__
static float func(int d, float *k, float x)
{
	int		i;
	float	ans = 0;

	for (i = 0; i <= d; i++) ans += k[i] * pow(x, i);

	return ans;
}

__host__ __device__
static int compare(const void *arg1, const void *arg2)
{
	float *p1, *p2;

	p1 = (float*)arg1;
	p2 = (float*)arg2;

	if (*p1 == *p2) return 0;
	else if (*p1 > *p2) return 1;
	else return -1;
}

__host__ __device__
void qsort2(float* base, size_t num, size_t width, int(*compare)(const void *, const void *))
{
	if (num < 2)
		return;

	for (unsigned int i = 0; i < num - 1; i++) {
		for (unsigned int j = i; j < num - 1; j++) {
			if (compare(base+ j, base + j + 1) > 0) {
				float v = base[j];
				base[j] = base[j+1];
				base[j+1] = v;
			}
		}
	}
}

__host__ __device__
static float walk(int d, float *k, float min, float max)
{
	float a, b, f, g, x, y;

	long l = 0;

	if ((f = func(d, k, max)) == 0.0f) return max;
	if ((g = func(d, k, min)) == 0.0f) return min;
	
	if (f * g > 0) {
		//MessageBox ( NULL, "Error!", "Solve_Polynomial", MB_OK );
		//exit(0);
	}
	
	a = min, b = max;
	while (1) {
		if (fabs(a - b) < ENOUGH_SMALL)
			break;

		x = (a + b) / 2;	// CPU error!?
		y = func(d, k, x);

		if (f > 0) {
			if (func(d, k, b) - y < ENOUGH_SMALL)
				break;

			if (y < 0)
				a = x;
			else
				b = x;
		}
		else {
			if (func(d, k, a) - y < ENOUGH_SMALL)
				break;

			if (y > 0)
				a = x;
			else
				b = x;
		}

		if (l++ > 100)
			break;			// for CPU bug
	}
	return x;
}

__host__ __device__
int Solve_Polynomial(int d, float *k, float min, float max, float *r)
{
	int		i, j, N, ans;
	float	D;
	float	*K, *R, *y;

	switch (d)
	{
	case 1:
		if (k[1] == 0.0f)
			return 0;

		r[0] = -k[0] / k[1];
		return (min <= r[0] && r[0] <= max) ? 1 : 0;

	case 2:
		if (k[2] == 0.0f)
		{
			if (k[1] == 0.0f) return 0;

			r[0] = -k[0] / k[1];
			return (min <= r[0] && r[0] <= max) ? 1 : 0;
		}

		D = k[1] * k[1] - 4 * k[2] * k[0];

		if (D == 0.0f)
		{
			r[0] = -k[1] / (2.0f * k[2]);
			return (min <= r[0] && r[0] <= max) ? 1 : 0;
		}
		else if (D > 0)
		{
			r[0] = (-k[1] + sqrt(D)) / (2.0f * k[2]);
			r[1] = (-k[1] - sqrt(D)) / (2.0f * k[2]);
			if (r[0] > r[1])
				D = r[0], r[0] = r[1], r[1] = D;
			i = ((min <= r[0] && r[0] <= max) ? 1 : 0) + ((min <= r[1] && r[1] <= max) ? 1 : 0);
			return i;
		}
		return 0;
	}

	K = new float[2 * d];
	R = new float[2 * d + 4];
	y = new float[2 * d + 4];

	for (i = 1; i <= d; i++)
		K[i - 1] = i * k[i] / k[d] / d;

	// 極値の個数を求める。
	N = Solve_Polynomial(d - 1, K, min, max, R + 1);
	R[0] = min, R[N + 1] = max;

	for (i = 0; i <= N + 1; i++)
		y[i] = func(d, k, R[i]);

	for (ans = i = 0; i <= N; i++)
	{
		// 解が存在しない区間の場合、次へ。
		if (y[i] * y[i + 1] > 0) continue;

		r[ans++] = walk(d, k, R[i], R[i + 1]);
	}

	qsort2(r, (size_t)ans, sizeof(float), compare);

	for (i = 0; i < ans - 1; i++)
	{
		if (r[i + 1] - r[i] <= ENOUGH_SMALL)
		{
			for (j = i; j < ans - 1; j++)
				r[j] = r[j + 1];
			i--;
			ans--;
		}
	}

	delete K;
	delete R;
	delete y;

	return ans;
}


	.file	"tmpxft_0029e5b4_00000000-6_Solve_Polynomial.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL7comparePKvS0_, @function
_ZL7comparePKvS0_:
.LFB2009:
	.cfi_startproc
	endbr64
	movss	(%rdi), %xmm0
	comiss	(%rsi), %xmm0
	jp	.L7
	movl	$0, %eax
	je	.L1
	movl	$1, %eax
	ja	.L1
.L7:
	orl	$-1, %eax
.L1:
	ret
	.cfi_endproc
.LFE2009:
	.size	_ZL7comparePKvS0_, .-_ZL7comparePKvS0_
	.type	_ZL4funciPff, @function
_ZL4funciPff:
.LFB2008:
	.cfi_startproc
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movaps	%xmm0, %xmm3
	movq	%rsi, %r12
	xorps	%xmm2, %xmm2
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movl	%edi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	xorl	%ebx, %ebx
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
.L11:
	cmpl	%ebx, %ebp
	jl	.L14
	cvtsi2sdl	%ebx, %xmm1
	cvtss2sd	(%r12,%rbx,4), %xmm4
	movss	%xmm2, 12(%rsp)
	cvtss2sd	%xmm3, %xmm0
	movss	%xmm3, 8(%rsp)
	incq	%rbx
	movsd	%xmm4, (%rsp)
	call	pow@PLT
	movsd	(%rsp), %xmm1
	movss	12(%rsp), %xmm2
	movss	8(%rsp), %xmm3
	mulsd	%xmm0, %xmm1
	cvtss2sd	%xmm2, %xmm2
	addsd	%xmm1, %xmm2
	cvtsd2ss	%xmm2, %xmm2
	jmp	.L11
.L14:
	addq	$16, %rsp
	.cfi_def_cfa_offset 32
	movaps	%xmm2, %xmm0
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2008:
	.size	_ZL4funciPff, .-_ZL4funciPff
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2015:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2015:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z6qsort2PfmmPFiPKvS1_E
	.type	_Z6qsort2PfmmPFiPKvS1_E, @function
_Z6qsort2PfmmPFiPKvS1_E:
.LFB2010:
	.cfi_startproc
	endbr64
	cmpq	$1, %rsi
	jbe	.L23
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rcx, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rdi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-1(%rsi), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
.L18:
	movl	%r12d, %r14d
.L21:
	movl	%r14d, %ebp
	cmpq	%rbx, %rbp
	jnb	.L26
	incq	%rbp
	leaq	0(,%rbp,4), %rsi
	leaq	-4(%r13,%rsi), %rdx
	addq	%r13, %rsi
	movq	%rdx, 8(%rsp)
	movq	%rdx, %rdi
	call	*%r15
	testl	%eax, %eax
	jle	.L19
	movq	8(%rsp), %rdx
	movl	%ebp, %ebp
	leaq	0(%r13,%rbp,4), %rax
	movss	(%rdx), %xmm0
	movss	(%rax), %xmm1
	movss	%xmm1, (%rdx)
	movss	%xmm0, (%rax)
.L19:
	incl	%r14d
	jmp	.L21
.L26:
	leal	1(%r12), %eax
	movq	%rax, %r12
	cmpq	%rbx, %rax
	jb	.L18
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	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
.L23:
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	.cfi_restore 13
	.cfi_restore 14
	.cfi_restore 15
	ret
	.cfi_endproc
.LFE2010:
	.size	_Z6qsort2PfmmPFiPKvS1_E, .-_Z6qsort2PfmmPFiPKvS1_E
	.globl	_Z16Solve_PolynomialiPfffS_
	.type	_Z16Solve_PolynomialiPfffS_, @function
_Z16Solve_PolynomialiPfffS_:
.LFB2012:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rdx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rsi, %rbx
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movss	%xmm0, (%rsp)
	cmpl	$1, %edi
	je	.L28
	movl	%edi, %r15d
	cmpl	$2, %edi
	je	.L29
	jmp	.L104
.L28:
	movss	4(%rsi), %xmm2
	xorps	%xmm0, %xmm0
	jmp	.L103
.L29:
	movss	8(%rsi), %xmm3
	xorps	%xmm0, %xmm0
	movss	4(%rsi), %xmm2
	ucomiss	%xmm0, %xmm3
	jp	.L36
	jne	.L36
.L103:
	ucomiss	%xmm0, %xmm2
	jp	.L81
	jne	.L81
.L34:
	xorl	%r12d, %r12d
	jmp	.L27
.L81:
	movss	(%rbx), %xmm0
	xorps	.LC1(%rip), %xmm0
	divss	%xmm2, %xmm0
	comiss	(%rsp), %xmm0
	movss	%xmm0, 0(%rbp)
	jb	.L34
	comiss	%xmm0, %xmm1
	jmp	.L99
.L36:
	movss	.LC2(%rip), %xmm4
	movaps	%xmm2, %xmm0
	mulss	%xmm2, %xmm0
	mulss	%xmm3, %xmm4
	mulss	(%rbx), %xmm4
	subss	%xmm4, %xmm0
	movd	%xmm0, %r12d
	xorps	%xmm0, %xmm0
	movd	%r12d, %xmm7
	comiss	%xmm0, %xmm7
	jp	.L34
	je	.L40
	ja	.L41
	jmp	.L34
.L40:
	addss	%xmm3, %xmm3
	xorps	.LC1(%rip), %xmm2
	divss	%xmm3, %xmm2
	comiss	(%rsp), %xmm2
	movss	%xmm2, 0(%rbp)
	jb	.L34
	comiss	%xmm2, %xmm1
	jmp	.L99
.L41:
	movd	%r12d, %xmm0
	movss	%xmm1, 24(%rsp)
	movss	%xmm2, 8(%rsp)
	movss	%xmm3, 4(%rsp)
	call	sqrtf@PLT
	movss	8(%rsp), %xmm2
	movss	4(%rsp), %xmm3
	movaps	%xmm0, %xmm4
	movd	%r12d, %xmm0
	subss	%xmm2, %xmm4
	addss	%xmm3, %xmm3
	divss	%xmm3, %xmm4
	movss	%xmm4, 0(%rbp)
	movss	4(%rbx), %xmm2
	xorps	.LC1(%rip), %xmm2
	movss	%xmm4, 8(%rsp)
	movss	%xmm2, 4(%rsp)
	call	sqrtf@PLT
	movss	4(%rsp), %xmm2
	movss	8(%rsp), %xmm4
	movss	24(%rsp), %xmm1
	subss	%xmm0, %xmm2
	movss	8(%rbx), %xmm0
	addss	%xmm0, %xmm0
	divss	%xmm0, %xmm2
	comiss	%xmm2, %xmm4
	movss	%xmm2, 4(%rbp)
	jbe	.L46
	movss	%xmm2, 0(%rbp)
	movss	%xmm4, 4(%rbp)
	jmp	.L46
.L99:
	setnb	%r12b
	movzbl	%r12b, %r12d
	jmp	.L27
.L46:
	movss	0(%rbp), %xmm0
	xorl	%r12d, %r12d
	comiss	(%rsp), %xmm0
	jb	.L48
	xorl	%r12d, %r12d
	comiss	%xmm0, %xmm1
	setnb	%r12b
.L48:
	movss	4(%rbp), %xmm0
	xorl	%eax, %eax
	comiss	(%rsp), %xmm0
	jb	.L50
	xorl	%eax, %eax
	comiss	%xmm0, %xmm1
	setnb	%al
.L50:
	addl	%eax, %r12d
	jmp	.L27
.L104:
	leal	(%rdi,%rdi), %r12d
	movss	%xmm1, 4(%rsp)
	movabsq	$2305843009213693950, %rax
	movslq	%r12d, %r12
	cmpq	%r12, %rax
	jb	.L52
	salq	$2, %r12
	movq	%r12, %rdi
	addq	$16, %r12
	call	_Znam@PLT
	movq	%r12, %rdi
	movq	%rax, 16(%rsp)
	call	_Znam@PLT
	movq	%r12, %rdi
	movq	%rax, %r13
	call	_Znam@PLT
	movss	4(%rsp), %xmm1
	movq	%rax, 8(%rsp)
	movslq	%r15d, %rax
	leaq	(%rbx,%rax,4), %rdx
	movl	$1, %eax
	jmp	.L53
.L52:
	call	__cxa_throw_bad_array_new_length@PLT
.L53:
	cmpl	%eax, %r15d
	jl	.L105
	cvtsi2ssl	%r15d, %xmm2
	movq	16(%rsp), %rcx
	cvtsi2ssl	%eax, %xmm0
	mulss	(%rbx,%rax,4), %xmm0
	divss	(%rdx), %xmm0
	divss	%xmm2, %xmm0
	movss	%xmm0, -4(%rcx,%rax,4)
	incq	%rax
	jmp	.L53
.L105:
	movss	(%rsp), %xmm0
	leaq	4(%r13), %rdx
	leal	-1(%r15), %edi
	xorl	%r14d, %r14d
	movq	16(%rsp), %rsi
	movss	%xmm1, 4(%rsp)
	call	_Z16Solve_PolynomialiPfffS_
	movss	(%rsp), %xmm5
	movss	4(%rsp), %xmm1
	movl	%eax, 28(%rsp)
	cltq
	movss	%xmm5, 0(%r13)
	movss	%xmm1, 4(%r13,%rax,4)
	movl	28(%rsp), %eax
	leal	1(%rax), %r12d
.L55:
	cmpl	%r14d, %r12d
	jl	.L106
	movss	0(%r13,%r14,4), %xmm0
	movq	%rbx, %rsi
	movl	%r15d, %edi
	call	_ZL4funciPff
	movq	8(%rsp), %rax
	movss	%xmm0, (%rax,%r14,4)
	incq	%r14
	jmp	.L55
.L106:
	xorl	%r14d, %r14d
	xorl	%r12d, %r12d
.L57:
	cmpl	%r14d, 28(%rsp)
	jl	.L107
	movq	8(%rsp), %rax
	xorps	%xmm1, %xmm1
	movss	(%rax,%r14,4), %xmm0
	mulss	4(%rax,%r14,4), %xmm0
	comiss	%xmm1, %xmm0
	ja	.L58
	movss	4(%r13,%r14,4), %xmm6
	movss	0(%r13,%r14,4), %xmm7
	movq	%rbx, %rsi
	movl	%r15d, %edi
	movaps	%xmm6, %xmm0
	movss	%xmm6, (%rsp)
	movss	%xmm7, 4(%rsp)
	call	_ZL4funciPff
	xorps	%xmm1, %xmm1
	ucomiss	%xmm1, %xmm0
	movss	%xmm0, 40(%rsp)
	jp	.L87
	je	.L59
.L87:
	movss	4(%rsp), %xmm0
	movq	%rbx, %rsi
	movl	%r15d, %edi
	call	_ZL4funciPff
	movaps	%xmm0, %xmm1
	xorps	%xmm0, %xmm0
	ucomiss	%xmm0, %xmm1
	jp	.L88
	je	.L78
.L88:
	movq	$102, 32(%rsp)
	movss	(%rsp), %xmm6
	movss	%xmm6, 24(%rsp)
.L69:
	movss	4(%rsp), %xmm0
	movss	.LC4(%rip), %xmm5
	subss	24(%rsp), %xmm0
	andps	.LC3(%rip), %xmm0
	comiss	%xmm0, %xmm5
	ja	.L59
	movss	4(%rsp), %xmm0
	addss	24(%rsp), %xmm0
	movq	%rbx, %rsi
	movl	%r15d, %edi
	mulss	.LC5(%rip), %xmm0
	movss	%xmm0, (%rsp)
	call	_ZL4funciPff
	movss	40(%rsp), %xmm7
	xorps	%xmm5, %xmm5
	movss	%xmm0, 44(%rsp)
	comiss	%xmm5, %xmm7
	jbe	.L95
	movss	24(%rsp), %xmm0
	movq	%rbx, %rsi
	movl	%r15d, %edi
	call	_ZL4funciPff
	movss	44(%rsp), %xmm1
	movss	.LC4(%rip), %xmm6
	subss	%xmm1, %xmm0
	comiss	%xmm0, %xmm6
	ja	.L59
	xorps	%xmm7, %xmm7
	comiss	%xmm1, %xmm7
	jmp	.L98
.L95:
	movss	4(%rsp), %xmm0
	movq	%rbx, %rsi
	movl	%r15d, %edi
	call	_ZL4funciPff
	movss	44(%rsp), %xmm1
	movss	.LC4(%rip), %xmm3
	subss	%xmm1, %xmm0
	comiss	%xmm0, %xmm3
	ja	.L59
	xorps	%xmm5, %xmm5
	comiss	%xmm5, %xmm1
.L98:
	jbe	.L66
	movss	(%rsp), %xmm6
	movss	%xmm6, 4(%rsp)
	jmp	.L68
.L66:
	movss	(%rsp), %xmm7
	movss	%xmm7, 24(%rsp)
.L68:
	decq	32(%rsp)
	jne	.L69
	jmp	.L59
.L78:
	movss	4(%rsp), %xmm3
	movss	%xmm3, (%rsp)
.L59:
	movss	(%rsp), %xmm5
	movslq	%r12d, %rax
	incl	%r12d
	movss	%xmm5, 0(%rbp,%rax,4)
.L58:
	incq	%r14
	jmp	.L57
.L107:
	movl	$4, %edx
	movslq	%r12d, %rsi
	leaq	_ZL7comparePKvS0_(%rip), %rcx
	movq	%rbp, %rdi
	call	_Z6qsort2PfmmPFiPKvS1_E
	movss	.LC4(%rip), %xmm1
	xorl	%edx, %edx
.L71:
	leal	-1(%r12), %ecx
	cmpl	%edx, %ecx
	jle	.L108
	movslq	%edx, %rax
	movss	4(%rbp,%rax,4), %xmm0
	subss	0(%rbp,%rax,4), %xmm0
	comiss	%xmm0, %xmm1
	jb	.L73
.L72:
	cmpl	%eax, %ecx
	jle	.L109
	movss	4(%rbp,%rax,4), %xmm0
	movss	%xmm0, 0(%rbp,%rax,4)
	incq	%rax
	jmp	.L72
.L109:
	decl	%edx
	movl	%ecx, %r12d
.L73:
	incl	%edx
	jmp	.L71
.L108:
	movq	16(%rsp), %rdi
	movl	$4, %esi
	call	_ZdlPvm@PLT
	movl	$4, %esi
	movq	%r13, %rdi
	call	_ZdlPvm@PLT
	movq	8(%rsp), %rdi
	movl	$4, %esi
	call	_ZdlPvm@PLT
.L27:
	addq	$56, %rsp
	.cfi_def_cfa_offset 56
	movl	%r12d, %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
.LFE2012:
	.size	_Z16Solve_PolynomialiPfffS_, .-_Z16Solve_PolynomialiPfffS_
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2038:
	.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
.LFE2038:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.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.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	-2147483648
	.long	0
	.long	0
	.long	0
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC2:
	.long	1082130432
	.section	.rodata.cst16
	.align 16
.LC3:
	.long	2147483647
	.long	0
	.long	0
	.long	0
	.section	.rodata.cst4
	.align 4
.LC4:
	.long	925353388
	.align 4
.LC5:
	.long	1056964608
	.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>
__host__ __device__
int Solve_Polynomial(int d, float *k, float min, float max, float *r);

	.text
	.file	"Solve_Polynomial.hip"
	.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 __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
