// File: /workspace/github_c_makefile_star2_O3/xtanitfy[P]Murphy/src/log.c
// Function: LOG_compBinFile
int LOG_compBinFile(char *binFile1,char *binFile2,int size)
{
	int f1 = open(binFile1,O_RDONLY,0666);
	CHECK_EXPR_RET(f1 < 0,-1);
	
	int f2 = open(binFile2,O_RDONLY,0666);
	CHECK_EXPR_RET(f1 < 0,-1);

	double *buffer1 = (double *)malloc(sizeof(double)*size);
	CHECK_EXPR_RET(buffer1 == NULL,-1);

	double *buffer2 = (double *)malloc(sizeof(double)*size);
	CHECK_EXPR_RET(buffer2 == NULL,-1);
	
	int nreadFile1 = read(f1,buffer1,size);
	CHECK_EXPR_RET(nreadFile1 != size,-1);

	int nreadFile2 = read(f2,buffer2,size);
	CHECK_EXPR_RET(nreadFile2 != size,-1);

	BOOL flag = TRUE;
	int i = 0;
	for ( i = 0;i < size;i++) {
		if (fabsf(buffer1[i] - buffer2[i]) > 0.00000001) {
			printf("NotEquale:[%s %.10lf] != [%s %.10lf] offset:%d diff:%lf\n",
						binFile1,buffer1[i],binFile2,buffer2[i],i,buffer1[i]-buffer2[i]);
			flag = FALSE;
			return -1;
		}
	}

	if (flag == TRUE) {
		printf("Equale %s == %s\n",binFile1,binFile2);
	}
	free(buffer2);
	free(buffer1);

	close(f2);
	close(f1);

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %r13d
movq %rsi, %rbx
movq %rdi, %r14
xorl %esi, %esi
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0x1080
testl %eax, %eax
js 0x1898
movl %eax, %ebp
movq %rbx, 0x10(%rsp)
movq %rbx, %rdi
xorl %esi, %esi
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0x1080
movl %eax, 0xc(%rsp)
movslq %r13d, %rbx
leaq (,%rbx,8), %r15
movq %r15, %rdi
callq 0x10a0
testq %rax, %rax
je 0x18b4
movq %rax, %r12
movq %r15, %rdi
callq 0x10a0
testq %rax, %rax
je 0x18d0
movq %rax, %r15
movl %ebp, %edi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x10c0
cmpl %ebx, %eax
jne 0x18ec
movl 0xc(%rsp), %edi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x10c0
cmpl %ebx, %eax
jne 0x1908
testl %r13d, %r13d
jle 0x185b
movl %r13d, %eax
xorl %ecx, %ecx
movaps 0x1801(%rip), %xmm3     # 0x3020
movsd 0x1809(%rip), %xmm4     # 0x3030
movsd (%r12,%rcx,8), %xmm0
movsd (%r15,%rcx,8), %xmm1
movapd %xmm0, %xmm2
subsd %xmm1, %xmm2
xorps %xmm5, %xmm5
cvtsd2ss %xmm2, %xmm5
andps %xmm3, %xmm5
cvtss2sd %xmm5, %xmm5
ucomisd %xmm4, %xmm5
ja 0x193f
incq %rcx
cmpq %rcx, %rax
jne 0x1827
leaq 0x188a(%rip), %rdi      # 0x30ec
xorl %ebx, %ebx
movq %r14, %rsi
movq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x1030
movq %r15, %rdi
callq 0x1090
movq %r12, %rdi
callq 0x1090
movl 0xc(%rsp), %edi
callq 0x10e0
movl %ebp, %edi
callq 0x10e0
jmp 0x192e
leaq 0x17a1(%rip), %rdi      # 0x3040
leaq 0x17b0(%rip), %rsi      # 0x3056
leaq 0x17f6(%rip), %rdx      # 0x30a3
movl $0x67, %ecx
jmp 0x1922
leaq 0x1785(%rip), %rdi      # 0x3040
leaq 0x1794(%rip), %rsi      # 0x3056
leaq 0x17da(%rip), %rdx      # 0x30a3
movl $0x6d, %ecx
jmp 0x1922
leaq 0x1769(%rip), %rdi      # 0x3040
leaq 0x1778(%rip), %rsi      # 0x3056
leaq 0x17be(%rip), %rdx      # 0x30a3
movl $0x70, %ecx
jmp 0x1922
leaq 0x174d(%rip), %rdi      # 0x3040
leaq 0x175c(%rip), %rsi      # 0x3056
leaq 0x17a2(%rip), %rdx      # 0x30a3
movl $0x73, %ecx
jmp 0x1922
leaq 0x1731(%rip), %rdi      # 0x3040
leaq 0x1740(%rip), %rsi      # 0x3056
leaq 0x1786(%rip), %rdx      # 0x30a3
movl $0x76, %ecx
xorl %eax, %eax
callq 0x1030
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x176d(%rip), %rdi      # 0x30b3
movq %r14, %rsi
movq 0x10(%rsp), %rdx
movb $0x3, %al
callq 0x1030
jmp 0x1929
nop