#include <stdio.h>
int measureSimilarity(int *a, int *b, int len1, int len2)
{
    if(len1 == 0 || len2 ==0)
        return 0;
    else if(a[0]==b[0])
        return (1 + measureSimilarity(&a[1], &b[1], len1-1, len2-1));
    else if(a[0]>b[0])
        return (measureSimilarity(&a[1], b, len1-1, len2));
    else
        return (measureSimilarity(a, &b[1], len1, len2-1));
}
int measurePeriodicSimilarity(int *a, int *b, int period, int len1, int len2)
{
    if(len1 == 0 || len2 ==0)
        return 0;
    else
        return measureSimilarity(a, b, period, period) + measurePeriodicSimilarity(&a[period], &b[period], period, len1-period, len2-period);
}
/*
int main()
{
    int a[20] = {30, 25, 22, 20, 20, 20, 20, 20, 17, 17, 17, 17, 17, 17, 17, 17, 15, 15, 15, 12};
    int b[20] = {22, 20, 20, 20, 20, 20, 17, 17, 17, 17, 17, 17, 17, 17, 15, 15, 12, 12, 12, 12};
    int c = measureSimilarity(a,b, 20, 20);
    printf("Similarity  : %d\n", c);
    

    int d[40] = {30, 25, 22, 20, 20, 20, 20, 20, 17, 17, 17, 17, 17, 17, 17, 17, 15, 15, 15, 12, 30, 25, 22, 20, 20, 20, 20, 20, 17, 17, 17, 17, 17, 17, 17, 17, 15, 15, 15, 12};
    int e[40] = {22, 20, 20, 20, 20, 20, 17, 17, 17, 17, 17, 17, 17, 17, 15, 15, 12, 12, 12, 12, 22, 20, 20, 20, 20, 20, 17, 17, 17, 17, 17, 17, 17, 17, 15, 15, 12, 12, 12, 12};
    int g = measurePeriodicSimilarity(d,e, 20, 40, 40);
    printf("Similarity  : %d\n", g);
}
*/

	.file	"tmpxft_0027b617_00000000-6_MeasureError.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2031:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2031:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z17measureSimilarityPiS_ii
	.type	_Z17measureSimilarityPiS_ii, @function
_Z17measureSimilarityPiS_ii:
.LFB2027:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
.L3:
	testl	%edx, %edx
	je	.L2
	testl	%ecx, %ecx
	je	.L2
	movl	(%rsi), %r8d
	cmpl	%r8d, (%rdi)
	jne	.L6
	decl	%ecx
	decl	%edx
	addq	$4, %rsi
	addq	$4, %rdi
	incl	%eax
	jmp	.L3
.L6:
	jle	.L8
	decl	%edx
	addq	$4, %rdi
	jmp	.L3
.L8:
	decl	%ecx
	addq	$4, %rsi
	jmp	.L3
.L2:
	ret
	.cfi_endproc
.LFE2027:
	.size	_Z17measureSimilarityPiS_ii, .-_Z17measureSimilarityPiS_ii
	.globl	_Z25measurePeriodicSimilarityPiS_iii
	.type	_Z25measurePeriodicSimilarityPiS_iii, @function
_Z25measurePeriodicSimilarityPiS_iii:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	subl	%ecx, %r8d
	movq	%rdi, %r11
	movl	%ecx, %r9d
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movl	%r8d, %r13d
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movslq	%edx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rbp, %r10
	movq	%rsi, %rbx
	salq	$2, %rbp
.L13:
	movl	%r13d, %eax
	addl	%r9d, %eax
	je	.L10
	testl	%r9d, %r9d
	je	.L10
	movq	%rbx, %rsi
	movq	%r11, %rdi
	movl	%r10d, %ecx
	movl	%r10d, %edx
	call	_Z17measureSimilarityPiS_ii
	subl	%r10d, %r9d
	addq	%rbp, %rbx
	addq	%rbp, %r11
	addl	%eax, %r12d
	jmp	.L13
.L10:
	popq	%rbx
	.cfi_def_cfa_offset 32
	movl	%r12d, %eax
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2028:
	.size	_Z25measurePeriodicSimilarityPiS_iii, .-_Z25measurePeriodicSimilarityPiS_iii
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2054:
	.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
.LFE2054:
	.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 <hip/hip_runtime.h>
#include <stdio.h>
int measureSimilarity(int *a, int *b, int len1, int len2)
{
    if(len1 == 0 || len2 ==0)
        return 0;
    else if(a[0]==b[0])
        return (1 + measureSimilarity(&a[1], &b[1], len1-1, len2-1));
    else if(a[0]>b[0])
        return (measureSimilarity(&a[1], b, len1-1, len2));
    else
        return (measureSimilarity(a, &b[1], len1, len2-1));
}
int measurePeriodicSimilarity(int *a, int *b, int period, int len1, int len2)
{
    if(len1 == 0 || len2 ==0)
        return 0;
    else
        return measureSimilarity(a, b, period, period) + measurePeriodicSimilarity(&a[period], &b[period], period, len1-period, len2-period);
}
/*
int main()
{
    int a[20] = {30, 25, 22, 20, 20, 20, 20, 20, 17, 17, 17, 17, 17, 17, 17, 17, 15, 15, 15, 12};
    int b[20] = {22, 20, 20, 20, 20, 20, 17, 17, 17, 17, 17, 17, 17, 17, 15, 15, 12, 12, 12, 12};
    int c = measureSimilarity(a,b, 20, 20);
    printf("Similarity  : %d\n", c);
    

    int d[40] = {30, 25, 22, 20, 20, 20, 20, 20, 17, 17, 17, 17, 17, 17, 17, 17, 15, 15, 15, 12, 30, 25, 22, 20, 20, 20, 20, 20, 17, 17, 17, 17, 17, 17, 17, 17, 15, 15, 15, 12};
    int e[40] = {22, 20, 20, 20, 20, 20, 17, 17, 17, 17, 17, 17, 17, 17, 15, 15, 12, 12, 12, 12, 22, 20, 20, 20, 20, 20, 17, 17, 17, 17, 17, 17, 17, 17, 15, 15, 12, 12, 12, 12};
    int g = measurePeriodicSimilarity(d,e, 20, 40, 40);
    printf("Similarity  : %d\n", g);
}
*/

	.text
	.file	"MeasureError.hip"
	.globl	_Z17measureSimilarityPiS_ii     # -- Begin function _Z17measureSimilarityPiS_ii
	.type	_Z17measureSimilarityPiS_ii,@function
_Z17measureSimilarityPiS_ii:            # @_Z17measureSimilarityPiS_ii
	.cfi_startproc
# %bb.0:
                                        # kill: def $ecx killed $ecx def $rcx
	xorl	%eax, %eax
	testl	%edx, %edx
	je	.LBB0_11
# %bb.1:
	testl	%ecx, %ecx
	je	.LBB0_11
# %bb.2:                                # %.lr.ph.lr.ph.preheader
	xorl	%eax, %eax
	movq	%rsi, %r8
.LBB0_3:                                # %.lr.ph
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_4 Depth 2
	movl	(%rdi), %r10d
	movl	%ecx, %ecx
	xorl	%r9d, %r9d
.LBB0_4:                                #   Parent Loop BB0_3 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	cmpl	(%rsi,%r9,4), %r10d
	je	.LBB0_5
# %bb.7:                                #   in Loop: Header=BB0_4 Depth=2
	jg	.LBB0_8
# %bb.10:                               # %tailrecurse
                                        #   in Loop: Header=BB0_4 Depth=2
	addq	$4, %r8
	incq	%r9
	cmpl	%r9d, %ecx
	jne	.LBB0_4
	jmp	.LBB0_11
.LBB0_5:                                # %tailrecurse.outer
                                        #   in Loop: Header=BB0_3 Depth=1
	incl	%eax
	decl	%edx
	je	.LBB0_11
# %bb.6:                                # %tailrecurse.outer
                                        #   in Loop: Header=BB0_3 Depth=1
	addq	$4, %rdi
	addq	$4, %r8
	movl	%r9d, %r10d
	notl	%r10d
	addl	%ecx, %r10d
	decl	%ecx
	movq	%r8, %rsi
	cmpl	%r9d, %ecx
	movl	%r10d, %ecx
	jne	.LBB0_3
	jmp	.LBB0_11
.LBB0_8:                                # %tailrecurse.outer26
                                        #   in Loop: Header=BB0_3 Depth=1
	decl	%edx
	je	.LBB0_11
# %bb.9:                                # %tailrecurse.outer26
                                        #   in Loop: Header=BB0_3 Depth=1
	addq	$4, %rdi
	movq	%r8, %rsi
	subl	%r9d, %ecx
	jne	.LBB0_3
.LBB0_11:                               # %tailrecurse.outer26._crit_edge
                                        # kill: def $eax killed $eax killed $rax
	retq
.Lfunc_end0:
	.size	_Z17measureSimilarityPiS_ii, .Lfunc_end0-_Z17measureSimilarityPiS_ii
	.cfi_endproc
                                        # -- End function
	.globl	_Z25measurePeriodicSimilarityPiS_iii # -- Begin function _Z25measurePeriodicSimilarityPiS_iii
	.type	_Z25measurePeriodicSimilarityPiS_iii,@function
_Z25measurePeriodicSimilarityPiS_iii:   # @_Z25measurePeriodicSimilarityPiS_iii
	.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
	xorl	%eax, %eax
	movl	%ecx, 12(%rsp)                  # 4-byte Spill
	testl	%ecx, %ecx
	je	.LBB1_5
# %bb.1:
	movl	%r8d, %r13d
	testl	%r8d, %r8d
	je	.LBB1_5
# %bb.2:                                # %.lr.ph
	movl	%edx, %ebx
	movq	%rsi, %r15
	movq	%rdi, %r12
	movslq	%edx, %rax
	shlq	$2, %rax
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	xorl	%eax, %eax
	movl	%edx, %r14d
.LBB1_3:                                # %tailrecurse
                                        # =>This Inner Loop Header: Depth=1
	movl	%eax, %ebp
	movq	%r12, %rdi
	movq	%r15, %rsi
	movl	%ebx, %edx
	movl	%ebx, %ecx
	callq	_Z17measureSimilarityPiS_ii
	addl	%ebp, %eax
	cmpl	%r14d, 12(%rsp)                 # 4-byte Folded Reload
	je	.LBB1_5
# %bb.4:                                # %tailrecurse
                                        #   in Loop: Header=BB1_3 Depth=1
	leal	(%r14,%rbx), %ecx
	movq	16(%rsp), %rdx                  # 8-byte Reload
	addq	%rdx, %r15
	addq	%rdx, %r12
	cmpl	%r14d, %r13d
	movl	%ecx, %r14d
	jne	.LBB1_3
.LBB1_5:                                # %tailrecurse._crit_edge
	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_end1:
	.size	_Z25measurePeriodicSimilarityPiS_iii, .Lfunc_end1-_Z25measurePeriodicSimilarityPiS_iii
	.cfi_endproc
                                        # -- End function
	.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
