// File: /workspace/github_c_makefile_star2_O1/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 0x1894
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 0x18b0
movq %rax, %r12
movq %r15, %rdi
callq 0x10a0
testq %rax, %rax
je 0x18cc
movq %rax, %r15
movl %ebp, %edi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x10c0
cmpl %ebx, %eax
jne 0x18e8
movl 0xc(%rsp), %edi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x10c0
cmpl %ebx, %eax
jne 0x1904
testl %r13d, %r13d
jle 0x1857
movl %r13d, %eax
xorl %ecx, %ecx
movaps 0x1805(%rip), %xmm3     # 0x3020
movsd 0x180d(%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 0x193b
incq %rcx
cmpq %rcx, %rax
jne 0x1823
leaq 0x188e(%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 0x192a
leaq 0x17a5(%rip), %rdi      # 0x3040
leaq 0x17b4(%rip), %rsi      # 0x3056
leaq 0x17fa(%rip), %rdx      # 0x30a3
movl $0x67, %ecx
jmp 0x191e
leaq 0x1789(%rip), %rdi      # 0x3040
leaq 0x1798(%rip), %rsi      # 0x3056
leaq 0x17de(%rip), %rdx      # 0x30a3
movl $0x6d, %ecx
jmp 0x191e
leaq 0x176d(%rip), %rdi      # 0x3040
leaq 0x177c(%rip), %rsi      # 0x3056
leaq 0x17c2(%rip), %rdx      # 0x30a3
movl $0x70, %ecx
jmp 0x191e
leaq 0x1751(%rip), %rdi      # 0x3040
leaq 0x1760(%rip), %rsi      # 0x3056
leaq 0x17a6(%rip), %rdx      # 0x30a3
movl $0x73, %ecx
jmp 0x191e
leaq 0x1735(%rip), %rdi      # 0x3040
leaq 0x1744(%rip), %rsi      # 0x3056
leaq 0x178a(%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 0x1771(%rip), %rdi      # 0x30b3
movq %r14, %rsi
movq 0x10(%rsp), %rdx
movb $0x3, %al
callq 0x1030
jmp 0x1925
nop