#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <cuda.h>

#include <cuda_runtime.h>
#include <cuda.h>
#include <device_launch_parameters.h>

#define LIST_SIZE 10000
extern "C" __device__ unsigned long long icmpValue1List[LIST_SIZE];
extern "C" __device__ unsigned long long icmpValue2List[LIST_SIZE];
extern "C" __device__ double fcmpValue1List[LIST_SIZE];
extern "C" __device__ double fcmpValue2List[LIST_SIZE];
extern "C" __device__ unsigned long long icmpCountList[LIST_SIZE];
extern "C" __device__ unsigned long long fcmpCountList[LIST_SIZE];
extern "C" __device__ unsigned long long record_flag;

void bambooLogRecordOff(){

    long long local_record = 0;

    cudaMemcpyToSymbol(record_flag, &local_record, sizeof(long long), 0, cudaMemcpyHostToDevice);
}

void bambooLogKernelBegin(long long i) {

    i = 1;

    cudaMemcpyToSymbol(record_flag, &i, sizeof(long long), 0, cudaMemcpyHostToDevice);
}

void bambooLogKernelEnd() 
{

#ifdef KERNELTRACE
    cudaDeviceSynchronize();
#endif
    
    long long icmpValue1ListLocal[LIST_SIZE];
    long long icmpValue2ListLocal[LIST_SIZE];
    double fcmpValue1ListLocal[LIST_SIZE];
    double fcmpValue2ListLocal[LIST_SIZE];
    long long icmpCountListLocal[LIST_SIZE];
    long long fcmpCountListLocal[LIST_SIZE];
    
    cudaMemcpyFromSymbol(icmpValue1ListLocal, icmpValue1List, LIST_SIZE * sizeof(long long), 0, cudaMemcpyDeviceToHost);
    cudaMemcpyFromSymbol(icmpValue2ListLocal, icmpValue2List, LIST_SIZE * sizeof(long long), 0, cudaMemcpyDeviceToHost);
    cudaMemcpyFromSymbol(fcmpValue1ListLocal, fcmpValue1List, LIST_SIZE * sizeof(double), 0, cudaMemcpyDeviceToHost);
    cudaMemcpyFromSymbol(fcmpValue2ListLocal, fcmpValue2List, LIST_SIZE * sizeof(double), 0, cudaMemcpyDeviceToHost);
    cudaMemcpyFromSymbol(icmpCountListLocal, icmpCountList, LIST_SIZE * sizeof(long long), 0, cudaMemcpyDeviceToHost);
    cudaMemcpyFromSymbol(fcmpCountListLocal, fcmpCountList, LIST_SIZE * sizeof(long long), 0, cudaMemcpyDeviceToHost);
    
    FILE *profileFile = fopen("profile_cmp_value_result.txt", "w");
    for(long long i=0; i < LIST_SIZE; i++){
        if(icmpCountListLocal[i] != 0)
        {
            fprintf(profileFile, "icmp %lld: %lld %lld %lld\n", i, icmpValue1ListLocal[i]/icmpCountListLocal[i], icmpValue2ListLocal[i]/icmpCountListLocal[i], icmpCountListLocal[i]);
        }
        else if(fcmpCountListLocal[i] != 0)
        {
            fprintf(profileFile, "fcmp %lld: %f %f %lld\n", i, fcmpValue1ListLocal[i]/fcmpCountListLocal[i], fcmpValue2ListLocal[i]/fcmpCountListLocal[i], fcmpCountListLocal[i]);
        }
    }
    
    fclose(profileFile);
}

	.file	"tmpxft_0022b14f_00000000-6_record_data.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2032:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2032:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z18bambooLogRecordOffv
	.type	_Z18bambooLogRecordOffv, @function
_Z18bambooLogRecordOffv:
.LFB2027:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	xorl	%ecx, %ecx
	movl	$1, %r8d
	movl	$8, %edx
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	xorl	%eax, %eax
	leaq	record_flag(%rip), %rdi
	movq	%rax, (%rsp)
	call	cudaMemcpyToSymbol@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	je	.L3
	call	__stack_chk_fail@PLT
.L3:
	addq	$24, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2027:
	.size	_Z18bambooLogRecordOffv, .-_Z18bambooLogRecordOffv
	.globl	_Z20bambooLogKernelBeginx
	.type	_Z20bambooLogKernelBeginx, @function
_Z20bambooLogKernelBeginx:
.LFB2028:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, %r8d
	xorl	%ecx, %ecx
	movl	$8, %edx
	leaq	8(%rsp), %rsi
	leaq	record_flag(%rip), %rdi
	movq	$1, 8(%rsp)
	call	cudaMemcpyToSymbol@PLT
	addq	$24, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2028:
	.size	_Z20bambooLogKernelBeginx, .-_Z20bambooLogKernelBeginx
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"w"
.LC1:
	.string	"profile_cmp_value_result.txt"
.LC2:
	.string	"icmp %lld: %lld %lld %lld\n"
.LC3:
	.string	"fcmp %lld: %f %f %lld\n"
	.text
	.globl	_Z18bambooLogKernelEndv
	.type	_Z18bambooLogKernelEndv, @function
_Z18bambooLogKernelEndv:
.LFB2029:
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-479232(%rsp), %r11
	.cfi_def_cfa 11, 479288
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$808, %rsp
	.cfi_def_cfa_offset 480096
	movl	$2, %r8d
	xorl	%ecx, %ecx
	movl	$80000, %edx
	leaq	icmpValue1List(%rip), %rsi
	xorl	%r14d, %r14d
	movq	%fs:40, %rax
	movq	%rax, 480024(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rbx
	leaq	80024(%rsp), %rbp
	movq	%rbx, %rdi
	leaq	160024(%rsp), %r12
	leaq	240024(%rsp), %r13
	call	cudaMemcpyFromSymbol@PLT
	movl	$2, %r8d
	xorl	%ecx, %ecx
	movq	%rbp, %rdi
	movl	$80000, %edx
	leaq	icmpValue2List(%rip), %rsi
	leaq	400024(%rsp), %r15
	call	cudaMemcpyFromSymbol@PLT
	movl	$2, %r8d
	xorl	%ecx, %ecx
	movq	%r12, %rdi
	movl	$80000, %edx
	leaq	fcmpValue1List(%rip), %rsi
	call	cudaMemcpyFromSymbol@PLT
	movl	$2, %r8d
	xorl	%ecx, %ecx
	movq	%r13, %rdi
	movl	$80000, %edx
	leaq	fcmpValue2List(%rip), %rsi
	call	cudaMemcpyFromSymbol@PLT
	leaq	320024(%rsp), %rax
	movl	$2, %r8d
	xorl	%ecx, %ecx
	movl	$80000, %edx
	leaq	icmpCountList(%rip), %rsi
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
	call	cudaMemcpyFromSymbol@PLT
	movl	$2, %r8d
	xorl	%ecx, %ecx
	movq	%r15, %rdi
	movl	$80000, %edx
	leaq	fcmpCountList(%rip), %rsi
	call	cudaMemcpyFromSymbol@PLT
	leaq	.LC0(%rip), %rsi
	leaq	.LC1(%rip), %rdi
	call	fopen@PLT
	movq	%rax, (%rsp)
.L11:
	movq	8(%rsp), %rax
	movq	(%rax,%r14,8), %rsi
	testq	%rsi, %rsi
	je	.L9
	movq	0(%rbp,%r14,8), %rax
	movq	%r14, %rcx
	cqto
	idivq	%rsi
	movq	%rax, %r9
	movq	(%rbx,%r14,8), %rax
	cqto
	idivq	%rsi
	pushq	%rdx
	.cfi_def_cfa_offset 480104
	movq	%rax, %r8
	leaq	.LC2(%rip), %rdx
	xorl	%eax, %eax
	pushq	%rsi
	.cfi_def_cfa_offset 480112
	movq	16(%rsp), %rdi
	movl	$2, %esi
	call	__fprintf_chk@PLT
	popq	%rcx
	.cfi_def_cfa_offset 480104
	popq	%rsi
	.cfi_def_cfa_offset 480096
	jmp	.L10
.L9:
	movq	(%r15,%r14,8), %r8
	testq	%r8, %r8
	je	.L10
	cvtsi2sdq	%r8, %xmm2
	movsd	(%r12,%r14,8), %xmm0
	movq	%r14, %rcx
	movb	$2, %al
	movsd	0(%r13,%r14,8), %xmm1
	movq	(%rsp), %rdi
	movl	$2, %esi
	leaq	.LC3(%rip), %rdx
	divsd	%xmm2, %xmm0
	divsd	%xmm2, %xmm1
	call	__fprintf_chk@PLT
.L10:
	incq	%r14
	cmpq	$10000, %r14
	jne	.L11
	movq	(%rsp), %rdi
	call	fclose@PLT
	movq	480024(%rsp), %rax
	subq	%fs:40, %rax
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	addq	$480040, %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
	.cfi_endproc
.LFE2029:
	.size	_Z18bambooLogKernelEndv, .-_Z18bambooLogKernelEndv
	.section	.rodata.str1.1
.LC4:
	.string	"icmpValue1List"
.LC5:
	.string	"icmpValue2List"
.LC6:
	.string	"fcmpValue1List"
.LC7:
	.string	"fcmpValue2List"
.LC8:
	.string	"icmpCountList"
.LC9:
	.string	"fcmpCountList"
.LC10:
	.string	"record_flag"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2055:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC4(%rip), %rdx
	movl	$80000, %r9d
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	movq	%rax, %rdi
	movl	$1, %r8d
	leaq	icmpValue1List(%rip), %rsi
	movq	%rax, %rbx
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterVar@PLT
	popq	%rax
	.cfi_def_cfa_offset 24
	popq	%rdx
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC5(%rip), %rdx
	movq	%rbx, %rdi
	movl	$80000, %r9d
	movq	%rdx, %rcx
	movl	$1, %r8d
	leaq	icmpValue2List(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%rcx
	.cfi_def_cfa_offset 24
	popq	%rsi
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC6(%rip), %rdx
	movq	%rbx, %rdi
	movl	$80000, %r9d
	movq	%rdx, %rcx
	movl	$1, %r8d
	leaq	fcmpValue1List(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%rdi
	.cfi_def_cfa_offset 24
	popq	%r8
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC7(%rip), %rdx
	movq	%rbx, %rdi
	movl	$80000, %r9d
	movq	%rdx, %rcx
	movl	$1, %r8d
	leaq	fcmpValue2List(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%r9
	.cfi_def_cfa_offset 24
	popq	%r10
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC8(%rip), %rdx
	movq	%rbx, %rdi
	movl	$80000, %r9d
	movq	%rdx, %rcx
	movl	$1, %r8d
	leaq	icmpCountList(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%r11
	.cfi_def_cfa_offset 24
	popq	%rax
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC9(%rip), %rdx
	movq	%rbx, %rdi
	movl	$80000, %r9d
	movq	%rdx, %rcx
	movl	$1, %r8d
	leaq	fcmpCountList(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%rax
	.cfi_def_cfa_offset 24
	popq	%rdx
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC10(%rip), %rdx
	movq	%rbx, %rdi
	movl	$8, %r9d
	movq	%rdx, %rcx
	movl	$1, %r8d
	leaq	record_flag(%rip), %rsi
	call	__cudaRegisterVar@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	popq	%rcx
	.cfi_def_cfa_offset 24
	popq	%rsi
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2055:
	.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
	.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 <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <hip/hip_runtime.h>





#define LIST_SIZE 10000
extern "C" __device__ unsigned long long icmpValue1List[LIST_SIZE];
extern "C" __device__ unsigned long long icmpValue2List[LIST_SIZE];
extern "C" __device__ double fcmpValue1List[LIST_SIZE];
extern "C" __device__ double fcmpValue2List[LIST_SIZE];
extern "C" __device__ unsigned long long icmpCountList[LIST_SIZE];
extern "C" __device__ unsigned long long fcmpCountList[LIST_SIZE];
extern "C" __device__ unsigned long long record_flag;

void bambooLogRecordOff(){

    long long local_record = 0;

    hipMemcpyToSymbol(HIP_SYMBOL(record_flag), &local_record, sizeof(long long), 0, hipMemcpyHostToDevice);
}

void bambooLogKernelBegin(long long i) {

    i = 1;

    hipMemcpyToSymbol(HIP_SYMBOL(record_flag), &i, sizeof(long long), 0, hipMemcpyHostToDevice);
}

void bambooLogKernelEnd() 
{

#ifdef KERNELTRACE
    hipDeviceSynchronize();
#endif
    
    long long icmpValue1ListLocal[LIST_SIZE];
    long long icmpValue2ListLocal[LIST_SIZE];
    double fcmpValue1ListLocal[LIST_SIZE];
    double fcmpValue2ListLocal[LIST_SIZE];
    long long icmpCountListLocal[LIST_SIZE];
    long long fcmpCountListLocal[LIST_SIZE];
    
    hipMemcpyFromSymbol(icmpValue1ListLocal, HIP_SYMBOL(icmpValue1List), LIST_SIZE * sizeof(long long), 0, hipMemcpyDeviceToHost);
    hipMemcpyFromSymbol(icmpValue2ListLocal, HIP_SYMBOL(icmpValue2List), LIST_SIZE * sizeof(long long), 0, hipMemcpyDeviceToHost);
    hipMemcpyFromSymbol(fcmpValue1ListLocal, HIP_SYMBOL(fcmpValue1List), LIST_SIZE * sizeof(double), 0, hipMemcpyDeviceToHost);
    hipMemcpyFromSymbol(fcmpValue2ListLocal, HIP_SYMBOL(fcmpValue2List), LIST_SIZE * sizeof(double), 0, hipMemcpyDeviceToHost);
    hipMemcpyFromSymbol(icmpCountListLocal, HIP_SYMBOL(icmpCountList), LIST_SIZE * sizeof(long long), 0, hipMemcpyDeviceToHost);
    hipMemcpyFromSymbol(fcmpCountListLocal, HIP_SYMBOL(fcmpCountList), LIST_SIZE * sizeof(long long), 0, hipMemcpyDeviceToHost);
    
    FILE *profileFile = fopen("profile_cmp_value_result.txt", "w");
    for(long long i=0; i < LIST_SIZE; i++){
        if(icmpCountListLocal[i] != 0)
        {
            fprintf(profileFile, "icmp %lld: %lld %lld %lld\n", i, icmpValue1ListLocal[i]/icmpCountListLocal[i], icmpValue2ListLocal[i]/icmpCountListLocal[i], icmpCountListLocal[i]);
        }
        else if(fcmpCountListLocal[i] != 0)
        {
            fprintf(profileFile, "fcmp %lld: %f %f %lld\n", i, fcmpValue1ListLocal[i]/fcmpCountListLocal[i], fcmpValue2ListLocal[i]/fcmpCountListLocal[i], fcmpCountListLocal[i]);
        }
    }
    
    fclose(profileFile);
}

	.text
	.file	"record_data.hip"
	.globl	_Z18bambooLogRecordOffv         # -- Begin function _Z18bambooLogRecordOffv
	.type	_Z18bambooLogRecordOffv,@function
_Z18bambooLogRecordOffv:                # @_Z18bambooLogRecordOffv
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	%rsp, %rsi
	movq	$0, (%rsi)
	movl	$record_flag, %edi
	movl	$8, %edx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	popq	%rax
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z18bambooLogRecordOffv, .Lfunc_end0-_Z18bambooLogRecordOffv
	.cfi_endproc
                                        # -- End function
	.globl	_Z20bambooLogKernelBeginx       # -- Begin function _Z20bambooLogKernelBeginx
	.type	_Z20bambooLogKernelBeginx,@function
_Z20bambooLogKernelBeginx:              # @_Z20bambooLogKernelBeginx
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	%rsp, %rsi
	movq	$1, (%rsi)
	movl	$record_flag, %edi
	movl	$8, %edx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	popq	%rax
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z20bambooLogKernelBeginx, .Lfunc_end1-_Z20bambooLogKernelBeginx
	.cfi_endproc
                                        # -- End function
	.globl	_Z18bambooLogKernelEndv         # -- Begin function _Z18bambooLogKernelEndv
	.type	_Z18bambooLogKernelEndv,@function
_Z18bambooLogKernelEndv:                # @_Z18bambooLogKernelEndv
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	subq	$480008, %rsp                   # imm = 0x75308
	.cfi_def_cfa_offset 480032
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	leaq	400000(%rsp), %rdi
	movl	$icmpValue1List, %esi
	movl	$80000, %edx                    # imm = 0x13880
	xorl	%ecx, %ecx
	movl	$2, %r8d
	callq	hipMemcpyFromSymbol
	leaq	320000(%rsp), %rdi
	movl	$icmpValue2List, %esi
	movl	$80000, %edx                    # imm = 0x13880
	xorl	%ecx, %ecx
	movl	$2, %r8d
	callq	hipMemcpyFromSymbol
	leaq	240000(%rsp), %rdi
	movl	$fcmpValue1List, %esi
	movl	$80000, %edx                    # imm = 0x13880
	xorl	%ecx, %ecx
	movl	$2, %r8d
	callq	hipMemcpyFromSymbol
	leaq	160000(%rsp), %rdi
	movl	$fcmpValue2List, %esi
	movl	$80000, %edx                    # imm = 0x13880
	xorl	%ecx, %ecx
	movl	$2, %r8d
	callq	hipMemcpyFromSymbol
	leaq	80000(%rsp), %rdi
	movl	$icmpCountList, %esi
	movl	$80000, %edx                    # imm = 0x13880
	xorl	%ecx, %ecx
	movl	$2, %r8d
	callq	hipMemcpyFromSymbol
	movq	%rsp, %rdi
	movl	$fcmpCountList, %esi
	movl	$80000, %edx                    # imm = 0x13880
	xorl	%ecx, %ecx
	movl	$2, %r8d
	callq	hipMemcpyFromSymbol
	movl	$.L.str, %edi
	movl	$.L.str.1, %esi
	callq	fopen
	movq	%rax, %rbx
	xorl	%r14d, %r14d
.LBB2_1:                                # =>This Inner Loop Header: Depth=1
	movq	80000(%rsp,%r14,8), %r9
	testq	%r9, %r9
	je	.LBB2_3
# %bb.2:                                #   in Loop: Header=BB2_1 Depth=1
	movq	400000(%rsp,%r14,8), %rax
	cqto
	idivq	%r9
	movq	%rax, %rcx
	movq	320000(%rsp,%r14,8), %rax
	cqto
	idivq	%r9
	movl	$.L.str.2, %esi
	movq	%rbx, %rdi
	movq	%r14, %rdx
	movq	%rax, %r8
	xorl	%eax, %eax
	callq	fprintf
	jmp	.LBB2_5
.LBB2_3:                                #   in Loop: Header=BB2_1 Depth=1
	movq	(%rsp,%r14,8), %rcx
	testq	%rcx, %rcx
	je	.LBB2_5
# %bb.4:                                #   in Loop: Header=BB2_1 Depth=1
	xorps	%xmm2, %xmm2
	cvtsi2sd	%rcx, %xmm2
	movsd	240000(%rsp,%r14,8), %xmm0      # xmm0 = mem[0],zero
	divsd	%xmm2, %xmm0
	movsd	160000(%rsp,%r14,8), %xmm1      # xmm1 = mem[0],zero
	divsd	%xmm2, %xmm1
	movl	$.L.str.3, %esi
	movq	%rbx, %rdi
	movq	%r14, %rdx
	movb	$2, %al
	callq	fprintf
.LBB2_5:                                #   in Loop: Header=BB2_1 Depth=1
	incq	%r14
	cmpq	$10000, %r14                    # imm = 0x2710
	jne	.LBB2_1
# %bb.6:
	movq	%rbx, %rdi
	callq	fclose
	addq	$480008, %rsp                   # imm = 0x75308
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z18bambooLogKernelEndv, .Lfunc_end2-_Z18bambooLogKernelEndv
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"profile_cmp_value_result.txt"
	.size	.L.str, 29

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

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"icmp %lld: %lld %lld %lld\n"
	.size	.L.str.2, 27

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"fcmp %lld: %f %f %lld\n"
	.size	.L.str.3, 23

	.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 record_flag
	.addrsig_sym icmpValue1List
	.addrsig_sym icmpValue2List
	.addrsig_sym fcmpValue1List
	.addrsig_sym fcmpValue2List
	.addrsig_sym icmpCountList
	.addrsig_sym fcmpCountList
	.addrsig_sym __hip_cuid_

	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.protected	fcmpValue2List          ; @fcmpValue2List
	.type	fcmpValue2List,@object
	.section	.bss,"aw",@nobits
	.globl	fcmpValue2List
	.p2align	4, 0x0
fcmpValue2List:
	.zero	80000
	.size	fcmpValue2List, 80000

	.protected	record_flag             ; @record_flag
	.type	record_flag,@object
	.globl	record_flag
	.p2align	3, 0x0
record_flag:
	.quad	0                               ; 0x0
	.size	record_flag, 8

	.protected	icmpValue1List          ; @icmpValue1List
	.type	icmpValue1List,@object
	.globl	icmpValue1List
	.p2align	4, 0x0
icmpValue1List:
	.zero	80000
	.size	icmpValue1List, 80000

	.protected	icmpCountList           ; @icmpCountList
	.type	icmpCountList,@object
	.globl	icmpCountList
	.p2align	4, 0x0
icmpCountList:
	.zero	80000
	.size	icmpCountList, 80000

	.protected	fcmpValue1List          ; @fcmpValue1List
	.type	fcmpValue1List,@object
	.globl	fcmpValue1List
	.p2align	4, 0x0
fcmpValue1List:
	.zero	80000
	.size	fcmpValue1List, 80000

	.protected	fcmpCountList           ; @fcmpCountList
	.type	fcmpCountList,@object
	.globl	fcmpCountList
	.p2align	4, 0x0
fcmpCountList:
	.zero	80000
	.size	fcmpCountList, 80000

	.protected	icmpValue2List          ; @icmpValue2List
	.type	icmpValue2List,@object
	.globl	icmpValue2List
	.p2align	4, 0x0
icmpValue2List:
	.zero	80000
	.size	icmpValue2List, 80000

	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.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 fcmpValue2List
	.addrsig_sym record_flag
	.addrsig_sym icmpValue1List
	.addrsig_sym icmpCountList
	.addrsig_sym fcmpValue1List
	.addrsig_sym fcmpCountList
	.addrsig_sym icmpValue2List
	.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
