// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/test/test_faidx.c
// Function: file_compare
int file_compare(const char *file1, const char *file2) {
    FILE *f1 = NULL;
    FILE *f2 = NULL;
    unsigned int lno = 1;
    size_t got1, got2, i;
    char buf1[1024], buf2[1024];
    int ret = -1;

    f1 = fopen(file1, "rb");
    if (!f1) {
        perror(file1);
        goto out;
    }
    f2 = fopen(file2, "rb");
    if (!f2) {
        perror(file2);
        goto out;
    }

    do {
        got1 = fread(buf1, 1, sizeof(buf1), f1);
        got2 = fread(buf2, 1, sizeof(buf2), f2);

        for (i = 0; i < got1 && i < got2 && buf1[i] == buf2[i]; i++)
            lno += (buf1[i] == '\n');
        if (i < got1 || i < got2) {
            fprintf(stderr, "%s and %s differ at line %u\n",
                    file1, file2, lno);
            goto out;
        }
    } while (got1 > 0 && got2 > 0);

    if (ferror(f1)) {
        perror(file1);
        goto out;
    }
    if (ferror(f2)) {
        perror(file2);
        goto out;
    }

    if (got1 > 0 || got2 > 0) {
        fprintf(stderr, "EOF on %s at line %u\n",
                got1 ? file2 : file1, lno);
        goto out;
    }

    ret = 0;
 out:
    if (f1) fclose(f1);
    if (f2) fclose(f2);
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x818, %rsp            # imm = 0x818
movq %rsi, %r15
movq %rdi, %r12
leaq 0x6c552(%rip), %rsi     # 0x7204c
callq 0x45c0
testq %rax, %rax
je 0x5be9
movq %rax, %rbx
leaq 0x6c53a(%rip), %rsi     # 0x7204c
movq %r15, %rdi
callq 0x45c0
movq %rax, %r14
testq %rax, %rax
je 0x5bf7
movq %r12, 0x8(%rsp)
movq %r15, (%rsp)
pushq $0x1
popq %rbp
pushq $0x1
popq %r12
leaq 0x10(%rsp), %r15
movl $0x400, %edx            # imm = 0x400
leaq 0x410(%rsp), %rdi
movq %r12, %rsi
movq %rbx, %rcx
callq 0x47a0
movq %rax, %r13
movl $0x400, %edx            # imm = 0x400
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rcx
callq 0x47a0
cmpq %r13, %rax
movq %r13, %rdx
cmovbq %rax, %rdx
xorl %ecx, %ecx
cmpq %rcx, %rdx
je 0x5b9a
movb 0x410(%rsp,%rcx), %sil
cmpb 0x10(%rsp,%rcx), %sil
jne 0x5b9a
xorl %edi, %edi
cmpb $0xa, %sil
sete %dil
addl %edi, %ebp
incq %rcx
jmp 0x5b75
cmpq %r13, %rcx
jb 0x5bfc
cmpq %rax, %rcx
jb 0x5bfc
testq %rax, %rax
jne 0x5b3b
movq %rbx, %rdi
callq 0x4970
testl %eax, %eax
jne 0x5c22
movq %r14, %rdi
callq 0x4970
testl %eax, %eax
jne 0x5c29
xorl %r15d, %r15d
testq %r13, %r13
je 0x5c36
movq 0x93408(%rip), %rax     # 0x98fd8
movq (%rax), %rdi
leaq 0x6c492(%rip), %rsi     # 0x7206c
movq (%rsp), %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x4710
jmp 0x5c32
movq %r12, %rdi
callq 0x43e0
pushq $-0x1
popq %r15
jmp 0x5c4b
movq %r15, %rdi
jmp 0x5c2d
movq 0x933d5(%rip), %rax     # 0x98fd8
movq (%rax), %rdi
leaq 0x6c442(%rip), %rsi     # 0x7204f
movq 0x8(%rsp), %rdx
movq (%rsp), %rcx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x4710
jmp 0x5c32
movq 0x8(%rsp), %rdi
jmp 0x5c2d
movq (%rsp), %rdi
callq 0x43e0
pushq $-0x1
popq %r15
movq %rbx, %rdi
callq 0x44c0
testq %r14, %r14
je 0x5c4b
movq %r14, %rdi
callq 0x44c0
movl %r15d, %eax
addq $0x818, %rsp            # imm = 0x818
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq