// File: /workspace/github_c_makefile_star2_O2/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, %r15d
movq %rsi, %rbx
movq %rdi, %r14
xorl %esi, %esi
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0x1080
testl %eax, %eax
js 0x1782
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 %r15d, %rbx
leaq (,%rbx,8), %r12
movq %r12, %rdi
callq 0x10a0
testq %rax, %rax
je 0x179b
movq %rax, %r13
movq %r12, %rdi
callq 0x10a0
testq %rax, %rax
je 0x17b4
movq %rax, %r12
movl %ebp, %edi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x10c0
cmpl %ebx, %eax
jne 0x17cd
movl 0xc(%rsp), %edi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x10c0
cmpl %ebx, %eax
jne 0x17e6
xorl %ecx, %ecx
testl %r15d, %r15d
cmovlel %ecx, %r15d
movaps 0x8de(%rip), %xmm3      # 0x2020
movsd 0x8e6(%rip), %xmm4      # 0x2030
cmpq %rcx, %r15
je 0x1819
movsd (%r13,%rcx,8), %xmm0
movsd (%r12,%rcx,8), %xmm1
movapd %xmm0, %xmm2
subsd %xmm1, %xmm2
cvtsd2ss %xmm2, %xmm5
andps %xmm3, %xmm5
cvtss2sd %xmm5, %xmm5
ucomisd %xmm4, %xmm5
ja 0x1853
incq %rcx
jmp 0x174a
leaq 0x8b7(%rip), %rdi       # 0x2040
leaq 0x8c6(%rip), %rsi       # 0x2056
leaq 0x90c(%rip), %rdx       # 0x20a3
pushq $0x67
jmp 0x17fd
leaq 0x89e(%rip), %rdi       # 0x2040
leaq 0x8ad(%rip), %rsi       # 0x2056
leaq 0x8f3(%rip), %rdx       # 0x20a3
pushq $0x6d
jmp 0x17fd
leaq 0x885(%rip), %rdi       # 0x2040
leaq 0x894(%rip), %rsi       # 0x2056
leaq 0x8da(%rip), %rdx       # 0x20a3
pushq $0x70
jmp 0x17fd
leaq 0x86c(%rip), %rdi       # 0x2040
leaq 0x87b(%rip), %rsi       # 0x2056
leaq 0x8c1(%rip), %rdx       # 0x20a3
pushq $0x73
jmp 0x17fd
leaq 0x853(%rip), %rdi       # 0x2040
leaq 0x862(%rip), %rsi       # 0x2056
leaq 0x8a8(%rip), %rdx       # 0x20a3
pushq $0x76
popq %rcx
xorl %eax, %eax
callq 0x1030
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8cc(%rip), %rdi       # 0x20ec
xorl %ebx, %ebx
movq %r14, %rsi
movq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x1030
movq %r12, %rdi
callq 0x1090
movq %r13, %rdi
callq 0x1090
movl 0xc(%rsp), %edi
callq 0x10e0
movl %ebp, %edi
callq 0x10e0
jmp 0x1808
leaq 0x859(%rip), %rdi       # 0x20b3
movq %r14, %rsi
movq 0x10(%rsp), %rdx
movb $0x3, %al
callq 0x1030
jmp 0x1805
nop