// File: /workspace/github_c_makefile_star2_O3/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 0x891b2(%rip), %rsi     # 0x8f04c
callq 0x45c0
testq %rax, %rax
je 0x5ff3
movq %rax, %rbx
leaq 0x8919a(%rip), %rsi     # 0x8f04c
movq %r15, %rdi
callq 0x45c0
testq %rax, %rax
je 0x5ffd
movq %rax, %r14
movq %r12, 0x8(%rsp)
movq %r15, (%rsp)
movl $0x1, %ebp
leaq 0x10(%rsp), %r12
movl $0x1, %esi
movl $0x400, %edx            # imm = 0x400
leaq 0x410(%rsp), %rdi
movq %rbx, %rcx
callq 0x47a0
movq %rax, %r13
movl $0x1, %esi
movl $0x400, %edx            # imm = 0x400
movq %r12, %rdi
movq %r14, %rcx
callq 0x47a0
movq %rax, %r15
testq %r13, %r13
setne %cl
testq %rax, %rax
setne %al
andb %cl, %al
cmpb $0x1, %al
jne 0x5f96
leaq -0x1(%r15), %rdx
leaq -0x1(%r13), %rcx
cmpq %rcx, %rdx
cmovbq %rdx, %rcx
movb 0x410(%rsp), %dl
movb $0x1, %sil
cmpb 0x10(%rsp), %dl
jne 0x5f83
negq %rcx
movl $0x1, %edi
movl %ebp, %r8d
movq %rdi, %rsi
addq %rcx, %rdi
xorl %ebp, %ebp
cmpb $0xa, %dl
sete %bpl
addl %r8d, %ebp
cmpq $0x1, %rdi
je 0x5f73
movb 0x410(%rsp,%rsi), %dl
leaq 0x1(%rsi), %rdi
cmpb 0x10(%rsp,%rsi), %dl
je 0x5f47
cmpq %r13, %rsi
setb %cl
cmpq %r15, %rsi
setb %sil
orb %cl, %sil
testb %sil, %sil
jne 0x6015
testb %al, %al
jne 0x5ed9
jmp 0x5f9e
movq %r13, %rax
orq %r15, %rax
jne 0x6015
movq %rbx, %rdi
callq 0x4970
testl %eax, %eax
jne 0x603b
movq %r14, %rdi
callq 0x4970
testl %eax, %eax
jne 0x6042
xorl %r12d, %r12d
orq %r13, %r15
je 0x6051
movq 0xaa007(%rip), %rax     # 0xaffd8
movq (%rax), %rdi
testq %r13, %r13
movq (%rsp), %rdx
cmoveq 0x8(%rsp), %rdx
leaq 0x89084(%rip), %rsi     # 0x8f06c
movl %ebp, %ecx
xorl %eax, %eax
callq 0x4710
jmp 0x604b
movq %r12, %rdi
callq 0x43e0
jmp 0x600d
movq %r15, %rdi
callq 0x43e0
movq %rbx, %rdi
callq 0x44c0
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
jmp 0x6061
movq 0xa9fbc(%rip), %rax     # 0xaffd8
movq (%rax), %rdi
leaq 0x89029(%rip), %rsi     # 0x8f04f
movq 0x8(%rsp), %rdx
movq (%rsp), %rcx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x4710
jmp 0x604b
movq 0x8(%rsp), %rdi
jmp 0x6046
movq (%rsp), %rdi
callq 0x43e0
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movq %rbx, %rdi
callq 0x44c0
movq %r14, %rdi
callq 0x44c0
movl %r12d, %eax
addq $0x818, %rsp            # imm = 0x818
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq