#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_GLOBAL 5000000
#define LIST_SIZE 10000
extern "C" __device__ unsigned  long long load_store_index[LIST_SIZE];
extern "C" __device__ unsigned long long load_store_value[LIST_SIZE];
extern "C" __device__ double load_store_double[LIST_SIZE];
extern "C" __device__ unsigned long long load_store_double_index[LIST_SIZE];
extern "C" __device__ unsigned long long record_flag;
extern "C" __device__ unsigned long long call_count;

int memPro_kernel = 0;

void bambooLogRecordOff(){

    long long local_record = 0;

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


void bambooLogKernelBegin(long long i) {

    cudaMemcpyToSymbol(call_count, &i, sizeof(long long), 0, cudaMemcpyHostToDevice);

    i = 1;

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

void bambooLogKernelEnd()
{

    unsigned long long loadStoreIndex[LIST_SIZE] = {0};
    unsigned long long loadStoreValue[LIST_SIZE] = {0};

    unsigned long long loadStoreIndex_double[LIST_SIZE] = {0};
    double loadStoreValue_double[LIST_SIZE] = {0};

    FILE *profileFile = fopen("profile_mem_val_result.txt", "a");

    
    for (int j=0; j < LIST_SIZE_GLOBAL; j+=LIST_SIZE)
    {
        cudaMemcpyFromSymbol(&loadStoreIndex, load_store_index, LIST_SIZE * sizeof(unsigned long long), j*sizeof(unsigned long long), cudaMemcpyDeviceToHost);
        cudaMemcpyFromSymbol(&loadStoreValue, load_store_value, LIST_SIZE * sizeof(unsigned long long), j*sizeof(unsigned long long), cudaMemcpyDeviceToHost);
    
        for(long long i=0; i < LIST_SIZE && loadStoreIndex[i] != 0; i++)
        {

           fprintf(profileFile, "%lld %lld\n", loadStoreIndex[i], loadStoreValue[i]);   
        }
    }
    
    for (int j=0; j < LIST_SIZE_GLOBAL; j+=LIST_SIZE)
    {
        cudaMemcpyFromSymbol(&loadStoreIndex_double, load_store_double_index, LIST_SIZE * sizeof(unsigned long long), j*sizeof(unsigned long long), cudaMemcpyDeviceToHost);
        cudaMemcpyFromSymbol(&loadStoreValue_double, load_store_double, LIST_SIZE * sizeof(double), j*sizeof(double), cudaMemcpyDeviceToHost);
    
        for(long long i=0; i < LIST_SIZE && loadStoreIndex_double[i] != 0; i++)
        {

           fprintf(profileFile, "%lld %.40f\n", loadStoreIndex_double[i], loadStoreValue_double[i]);   
        }
    }
    
    fclose(profileFile);
}

	.file	"tmpxft_003407bb_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
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movl	$1, %r8d
	xorl	%ecx, %ecx
	movl	$8, %edx
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	leaq	8(%rsp), %rbx
	movq	%rdi, 8(%rsp)
	leaq	call_count(%rip), %rdi
	movq	%rbx, %rsi
	call	cudaMemcpyToSymbol@PLT
	movq	%rbx, %rsi
	movl	$1, %r8d
	xorl	%ecx, %ecx
	movl	$8, %edx
	leaq	record_flag(%rip), %rdi
	movq	$1, 8(%rsp)
	call	cudaMemcpyToSymbol@PLT
	addq	$16, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2028:
	.size	_Z20bambooLogKernelBeginx, .-_Z20bambooLogKernelBeginx
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"a"
.LC1:
	.string	"profile_mem_val_result.txt"
.LC2:
	.string	"%lld %lld\n"
.LC3:
	.string	"%lld %.40f\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	-319488(%rsp), %r11
	.cfi_def_cfa 11, 319544
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$552, %rsp
	.cfi_def_cfa_offset 320096
	movl	$20000, %ecx
	leaq	.LC0(%rip), %rsi
	xorl	%ebx, %ebx
	movq	%fs:40, %rax
	movq	%rax, 320024(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rdi
	leaq	24(%rsp), %r13
	leaq	80024(%rsp), %r14
	leaq	160024(%rsp), %rbp
	leaq	240024(%rsp), %r12
	rep stosl
	leaq	80024(%rsp), %rdi
	movl	$20000, %ecx
	rep stosl
	leaq	160024(%rsp), %rdi
	movl	$20000, %ecx
	rep stosl
	leaq	240024(%rsp), %rdi
	movl	$20000, %ecx
	rep stosl
	leaq	.LC1(%rip), %rdi
	call	fopen@PLT
	movq	%rax, 8(%rsp)
.L10:
	movl	$2, %r8d
	movq	%rbx, %rcx
	movq	%r13, %rdi
	xorl	%r15d, %r15d
	movl	$80000, %edx
	leaq	load_store_index(%rip), %rsi
	call	cudaMemcpyFromSymbol@PLT
	movq	%rbx, %rcx
	movl	$80000, %edx
	movq	%r14, %rdi
	movl	$2, %r8d
	leaq	load_store_value(%rip), %rsi
	call	cudaMemcpyFromSymbol@PLT
.L9:
	movq	0(%r13,%r15,8), %rcx
	testq	%rcx, %rcx
	je	.L13
	movq	(%r14,%r15,8), %r8
	movq	8(%rsp), %rdi
	movl	$2, %esi
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rdx
	incq	%r15
	call	__fprintf_chk@PLT
	cmpq	$10000, %r15
	jne	.L9
.L13:
	addq	$80000, %rbx
	cmpq	$40000000, %rbx
	jne	.L10
	xorl	%ebx, %ebx
	leaq	load_store_double_index(%rip), %r13
.L11:
	movl	$2, %r8d
	movq	%rbx, %rcx
	movq	%r13, %rsi
	movq	%rbp, %rdi
	movl	$80000, %edx
	xorl	%r15d, %r15d
	leaq	.LC3(%rip), %r14
	call	cudaMemcpyFromSymbol@PLT
	movq	%rbx, %rcx
	movl	$80000, %edx
	movq	%r12, %rdi
	movl	$2, %r8d
	leaq	load_store_double(%rip), %rsi
	call	cudaMemcpyFromSymbol@PLT
.L14:
	movq	0(%rbp,%r15,8), %rcx
	testq	%rcx, %rcx
	je	.L17
	movsd	(%r12,%r15,8), %xmm0
	movq	8(%rsp), %rdi
	movq	%r14, %rdx
	movb	$1, %al
	movl	$2, %esi
	incq	%r15
	call	__fprintf_chk@PLT
	cmpq	$10000, %r15
	jne	.L14
.L17:
	addq	$80000, %rbx
	cmpq	$40000000, %rbx
	jne	.L11
	movq	8(%rsp), %rdi
	call	fclose@PLT
	movq	320024(%rsp), %rax
	subq	%fs:40, %rax
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	addq	$320040, %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	"load_store_index"
.LC5:
	.string	"load_store_value"
.LC6:
	.string	"load_store_double"
.LC7:
	.string	"load_store_double_index"
.LC8:
	.string	"record_flag"
.LC9:
	.string	"call_count"
	.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	load_store_index(%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	load_store_value(%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	load_store_double(%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	load_store_double_index(%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	$8, %r9d
	movq	%rdx, %rcx
	movl	$1, %r8d
	leaq	record_flag(%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	$8, %r9d
	movq	%rdx, %rcx
	movl	$1, %r8d
	leaq	call_count(%rip), %rsi
	call	__cudaRegisterVar@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	popq	%rax
	.cfi_def_cfa_offset 24
	popq	%rdx
	.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
	.globl	memPro_kernel
	.bss
	.align 4
	.type	memPro_kernel, @object
	.size	memPro_kernel, 4
memPro_kernel:
	.zero	4
	.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_GLOBAL 5000000
#define LIST_SIZE 10000
extern "C" __device__ unsigned  long long load_store_index[LIST_SIZE];
extern "C" __device__ unsigned long long load_store_value[LIST_SIZE];
extern "C" __device__ double load_store_double[LIST_SIZE];
extern "C" __device__ unsigned long long load_store_double_index[LIST_SIZE];
extern "C" __device__ unsigned long long record_flag;
extern "C" __device__ unsigned long long call_count;

int memPro_kernel = 0;

void bambooLogRecordOff(){

    long long local_record = 0;

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


void bambooLogKernelBegin(long long i) {

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

    i = 1;

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

void bambooLogKernelEnd()
{

    unsigned long long loadStoreIndex[LIST_SIZE] = {0};
    unsigned long long loadStoreValue[LIST_SIZE] = {0};

    unsigned long long loadStoreIndex_double[LIST_SIZE] = {0};
    double loadStoreValue_double[LIST_SIZE] = {0};

    FILE *profileFile = fopen("profile_mem_val_result.txt", "a");

    
    for (int j=0; j < LIST_SIZE_GLOBAL; j+=LIST_SIZE)
    {
        hipMemcpyFromSymbol(&loadStoreIndex, HIP_SYMBOL(load_store_index), LIST_SIZE * sizeof(unsigned long long), j*sizeof(unsigned long long), hipMemcpyDeviceToHost);
        hipMemcpyFromSymbol(&loadStoreValue, HIP_SYMBOL(load_store_value), LIST_SIZE * sizeof(unsigned long long), j*sizeof(unsigned long long), hipMemcpyDeviceToHost);
    
        for(long long i=0; i < LIST_SIZE && loadStoreIndex[i] != 0; i++)
        {

           fprintf(profileFile, "%lld %lld\n", loadStoreIndex[i], loadStoreValue[i]);   
        }
    }
    
    for (int j=0; j < LIST_SIZE_GLOBAL; j+=LIST_SIZE)
    {
        hipMemcpyFromSymbol(&loadStoreIndex_double, HIP_SYMBOL(load_store_double_index), LIST_SIZE * sizeof(unsigned long long), j*sizeof(unsigned long long), hipMemcpyDeviceToHost);
        hipMemcpyFromSymbol(&loadStoreValue_double, HIP_SYMBOL(load_store_double), LIST_SIZE * sizeof(double), j*sizeof(double), hipMemcpyDeviceToHost);
    
        for(long long i=0; i < LIST_SIZE && loadStoreIndex_double[i] != 0; i++)
        {

           fprintf(profileFile, "%lld %.40f\n", loadStoreIndex_double[i], loadStoreValue_double[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	%rbx
	.cfi_def_cfa_offset 16
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -16
	leaq	8(%rsp), %rbx
	movq	%rdi, (%rbx)
	movl	$call_count, %edi
	movl	$8, %edx
	movq	%rbx, %rsi
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	movq	$1, (%rbx)
	movl	$record_flag, %edi
	movl	$8, %edx
	movq	%rbx, %rsi
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	addq	$16, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.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	%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	$320000, %rsp                   # imm = 0x4E200
	.cfi_def_cfa_offset 320048
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	240000(%rsp), %r14
	movl	$80000, %edx                    # imm = 0x13880
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
	leaq	160000(%rsp), %r15
	movl	$80000, %edx                    # imm = 0x13880
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
	leaq	80000(%rsp), %rdi
	movl	$80000, %edx                    # imm = 0x13880
	xorl	%esi, %esi
	callq	memset@PLT
	movq	%rsp, %rdi
	movl	$80000, %edx                    # imm = 0x13880
	xorl	%esi, %esi
	callq	memset@PLT
	movl	$.L.str, %edi
	movl	$.L.str.1, %esi
	callq	fopen
	movq	%rax, %rbx
	xorl	%r13d, %r13d
.LBB2_1:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_2 Depth 2
	leaq	(,%r13,8), %r12
	movl	$load_store_index, %esi
	movl	$80000, %edx                    # imm = 0x13880
	movq	%r14, %rdi
	movq	%r12, %rcx
	movl	$2, %r8d
	callq	hipMemcpyFromSymbol
	movl	$load_store_value, %esi
	movl	$80000, %edx                    # imm = 0x13880
	movq	%r15, %rdi
	movq	%r12, %rcx
	movl	$2, %r8d
	callq	hipMemcpyFromSymbol
	xorl	%r12d, %r12d
.LBB2_2:                                #   Parent Loop BB2_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	240000(%rsp,%r12,8), %rdx
	testq	%rdx, %rdx
	je	.LBB2_3
# %bb.9:                                #   in Loop: Header=BB2_2 Depth=2
	movq	160000(%rsp,%r12,8), %rcx
	movl	$.L.str.2, %esi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	callq	fprintf
	incq	%r12
	cmpq	$10000, %r12                    # imm = 0x2710
	jne	.LBB2_2
.LBB2_3:                                # %.critedge
                                        #   in Loop: Header=BB2_1 Depth=1
	leaq	10000(%r13), %rax
	cmpq	$4990000, %r13                  # imm = 0x4C2430
	movq	%rax, %r13
	jb	.LBB2_1
# %bb.4:                                # %.preheader.preheader
	xorl	%r13d, %r13d
	leaq	80000(%rsp), %r14
	movq	%rsp, %r15
.LBB2_5:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_6 Depth 2
	leaq	(,%r13,8), %r12
	movl	$load_store_double_index, %esi
	movl	$80000, %edx                    # imm = 0x13880
	movq	%r14, %rdi
	movq	%r12, %rcx
	movl	$2, %r8d
	callq	hipMemcpyFromSymbol
	movl	$load_store_double, %esi
	movl	$80000, %edx                    # imm = 0x13880
	movq	%r15, %rdi
	movq	%r12, %rcx
	movl	$2, %r8d
	callq	hipMemcpyFromSymbol
	xorl	%r12d, %r12d
.LBB2_6:                                #   Parent Loop BB2_5 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	80000(%rsp,%r12,8), %rdx
	testq	%rdx, %rdx
	je	.LBB2_7
# %bb.10:                               #   in Loop: Header=BB2_6 Depth=2
	movsd	(%rsp,%r12,8), %xmm0            # xmm0 = mem[0],zero
	movl	$.L.str.3, %esi
	movq	%rbx, %rdi
	movb	$1, %al
	callq	fprintf
	incq	%r12
	cmpq	$10000, %r12                    # imm = 0x2710
	jne	.LBB2_6
.LBB2_7:                                # %.critedge2
                                        #   in Loop: Header=BB2_5 Depth=1
	leaq	10000(%r13), %rax
	cmpq	$4990000, %r13                  # imm = 0x4C2430
	movq	%rax, %r13
	jb	.LBB2_5
# %bb.8:
	movq	%rbx, %rdi
	callq	fclose
	addq	$320000, %rsp                   # imm = 0x4E200
	.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_end2:
	.size	_Z18bambooLogKernelEndv, .Lfunc_end2-_Z18bambooLogKernelEndv
	.cfi_endproc
                                        # -- End function
	.type	memPro_kernel,@object           # @memPro_kernel
	.bss
	.globl	memPro_kernel
	.p2align	2, 0x0
memPro_kernel:
	.long	0                               # 0x0
	.size	memPro_kernel, 4

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"profile_mem_val_result.txt"
	.size	.L.str, 27

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

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

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

	.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 call_count
	.addrsig_sym load_store_index
	.addrsig_sym load_store_value
	.addrsig_sym load_store_double_index
	.addrsig_sym load_store_double
	.addrsig_sym __hip_cuid_

	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.protected	record_flag             ; @record_flag
	.type	record_flag,@object
	.section	.bss,"aw",@nobits
	.globl	record_flag
	.p2align	3, 0x0
record_flag:
	.quad	0                               ; 0x0
	.size	record_flag, 8

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

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

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

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

	.protected	load_store_double_index ; @load_store_double_index
	.type	load_store_double_index,@object
	.globl	load_store_double_index
	.p2align	4, 0x0
load_store_double_index:
	.zero	80000
	.size	load_store_double_index, 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 record_flag
	.addrsig_sym call_count
	.addrsig_sym load_store_double
	.addrsig_sym load_store_index
	.addrsig_sym load_store_value
	.addrsig_sym load_store_double_index
	.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
