// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/test/test_bgzf.c
// Function: main
int main(int argc, char **argv) {
    Files f = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 };
    int retval = EXIT_FAILURE;

    if (argc != 2) {
        fprintf(stderr, "Usage: %s <source file>\n", argv[0]);
        return EXIT_FAILURE;
    }

    if (setup(argv[1], &f) != 0) goto out;

    // Try reading an existing file
    if (test_check_EOF(f.src_bgzf, 1) != 0) goto out;
    if (test_read(&f) != 0) goto out;

    // Try writing some data and reading it back
    if (test_write_read(&f, "wu", USE_BGZF_OPEN, 0, 0) != 0) goto out;
    if (test_check_EOF(f.tmp_bgzf, 0) != 0) goto out;
    if (test_write_read(&f, "w",  USE_BGZF_OPEN, 0, 2) != 0)  goto out;
    if (test_check_EOF(f.tmp_bgzf, 1) != 0) goto out;
    if (test_write_read(&f, "w0", USE_BGZF_OPEN, 0, 2) != 0) goto out;
    if (test_check_EOF(f.tmp_bgzf, 1) != 0) goto out;
    if (test_write_read(&f, "w1", USE_BGZF_DOPEN, 0, 2) != 0) goto out;
    if (test_check_EOF(f.tmp_bgzf, 1) != 0) goto out;
    if (test_write_read(&f, "w9", USE_BGZF_HOPEN, 0, 2) != 0) goto out;
    if (test_check_EOF(f.tmp_bgzf, 1) != 0) goto out;
    if (test_write_read(&f, "wg", USE_BGZF_OPEN, 0, 1) != 0) goto out;
    if (test_check_EOF(f.tmp_bgzf, 0) != 0) goto out;

    // Try writing and reading with threads
    if (test_write_read(&f, "w", USE_BGZF_OPEN, 1, 2) != 0) goto out;
    if (test_check_EOF(f.tmp_bgzf, 1) != 0) goto out;
    if (test_write_read(&f, "w", USE_BGZF_OPEN, 2, 2) != 0) goto out;
    if (test_check_EOF(f.tmp_bgzf, 1) != 0) goto out;

    // Embedded EOF block
    if (test_embed_eof(&f, "w", 0) != 0) goto out;
    if (test_embed_eof(&f, "w", 1) != 0) goto out;
    if (test_embed_eof(&f, "w", 2) != 0) goto out;

    // Index load and dump
    if (test_index_load_dump(&f) != 0) goto out;

    // Index building on the fly and bgzf_useek
    if (test_index_useek_getc(&f, "w", 1000000, 0) != 0) goto out;

    // Index building on the fly and bgzf_useek, with threads
    if (test_index_useek_getc(&f, "w", 1000000, 1) != 0) goto out;
    if (test_index_useek_getc(&f, "w", 1000000, 2) != 0) goto out;

    // bgzf_useek on an uncompressed file
    if (test_index_useek_getc(&f, "wu", 0, 0) != 0) goto out;

    // bgzf_tell and bgzf_seek
    if (test_tell_seek_getc(&f, "w", 0, 0) != 0) goto out;
    if (test_tell_seek_getc(&f, "wu", 0, 0) != 0) goto out;
    if (test_tell_seek_getc(&f, "w", 1000000, 0) != 0) goto out;
    if (test_tell_seek_getc(&f, "wu", 1000000, 0) != 0) goto out;
    if (test_tell_seek_getc(&f, "w", 0, 1) != 0) goto out;
    if (test_tell_seek_getc(&f, "w", 0, 2) != 0) goto out;
    if (test_tell_seek_getc(&f, "wu", 0, 1) != 0) goto out;
    if (test_tell_seek_getc(&f, "wu", 0, 2) != 0) goto out;
    if (test_tell_seek_getc(&f, "w", 1000000, 1) != 0) goto out;
    if (test_tell_seek_getc(&f, "w", 1000000, 2) != 0) goto out;
    if (test_tell_seek_getc(&f, "wu", 1000000, 1) != 0) goto out;
    if (test_tell_seek_getc(&f, "wu", 1000000, 2) != 0) goto out;

    // bgzf_tell and bgzf_read
    if (test_tell_read(&f, "w") != 0) goto out;
    if (test_tell_read(&f, "wu") != 0) goto out;

    // bgzf_useek and bgzf_read_small
    if (test_useek_read_small(&f, "w") != 0) goto out;
    if (test_useek_read_small(&f, "wu") != 0) goto out;

    // getline
    if (test_bgzf_getline(&f, "w", 0) != 0) goto out;
    if (test_bgzf_getline(&f, "w", 1) != 0) goto out;
    if (test_bgzf_getline(&f, "w", 2) != 0) goto out;

    if (test_bgzf_getline_on_truncated_file(&f, "w", 0) != 0) goto out;
    if (test_bgzf_getline_on_truncated_file(&f, "w", 1) != 0) goto out;
    if (test_bgzf_getline_on_truncated_file(&f, "w", 2) != 0) goto out;

    retval = EXIT_SUCCESS;

 out:
    cleanup(&f, retval);
    return retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x60(%rbp), %rdi
xorl %esi, %esi
movl $0x50, %edx
callq 0x4240
movl $0x1, -0x64(%rbp)
cmpl $0x2, -0x8(%rbp)
je 0x5b1e
movq 0x1024e6(%rip), %rax    # 0x107fe0
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
leaq 0xe44fe(%rip), %rsi     # 0xea009
movb $0x0, %al
callq 0x46d0
movl $0x1, -0x4(%rbp)
jmp 0x60f1
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x60(%rbp), %rsi
callq 0x6100
cmpl $0x0, %eax
je 0x5b39
jmp 0x60df
movq -0x58(%rbp), %rdi
movl $0x1, %esi
callq 0x6410
cmpl $0x0, %eax
je 0x5b51
jmp 0x60df
leaq -0x60(%rbp), %rdi
callq 0x64c0
cmpl $0x0, %eax
je 0x5b64
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe44b3(%rip), %rsi     # 0xea022
xorl %r8d, %r8d
movl %r8d, %edx
movl %r8d, %ecx
callq 0x6670
cmpl $0x0, %eax
je 0x5b87
jmp 0x60df
movq -0x48(%rbp), %rdi
xorl %esi, %esi
callq 0x6410
cmpl $0x0, %eax
je 0x5b9c
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe7bf5(%rip), %rsi     # 0xed79c
xorl %ecx, %ecx
movl $0x2, %r8d
movl %ecx, %edx
callq 0x6670
cmpl $0x0, %eax
je 0x5bc0
jmp 0x60df
movq -0x48(%rbp), %rdi
movl $0x1, %esi
callq 0x6410
cmpl $0x0, %eax
je 0x5bd8
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe4442(%rip), %rsi     # 0xea025
xorl %ecx, %ecx
movl $0x2, %r8d
movl %ecx, %edx
callq 0x6670
cmpl $0x0, %eax
je 0x5bfc
jmp 0x60df
movq -0x48(%rbp), %rdi
movl $0x1, %esi
callq 0x6410
cmpl $0x0, %eax
je 0x5c14
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe4409(%rip), %rsi     # 0xea028
movl $0x1, %edx
xorl %ecx, %ecx
movl $0x2, %r8d
callq 0x6670
cmpl $0x0, %eax
je 0x5c3b
jmp 0x60df
movq -0x48(%rbp), %rdi
movl $0x1, %esi
callq 0x6410
cmpl $0x0, %eax
je 0x5c53
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe43cd(%rip), %rsi     # 0xea02b
movl $0x2, %r8d
xorl %ecx, %ecx
movl %r8d, %edx
callq 0x6670
cmpl $0x0, %eax
je 0x5c78
jmp 0x60df
movq -0x48(%rbp), %rdi
movl $0x1, %esi
callq 0x6410
cmpl $0x0, %eax
je 0x5c90
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe4393(%rip), %rsi     # 0xea02e
xorl %ecx, %ecx
movl $0x1, %r8d
movl %ecx, %edx
callq 0x6670
cmpl $0x0, %eax
je 0x5cb4
jmp 0x60df
movq -0x48(%rbp), %rdi
xorl %esi, %esi
callq 0x6410
cmpl $0x0, %eax
je 0x5cc9
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe7ac8(%rip), %rsi     # 0xed79c
xorl %edx, %edx
movl $0x1, %ecx
movl $0x2, %r8d
callq 0x6670
cmpl $0x0, %eax
je 0x5cf0
jmp 0x60df
movq -0x48(%rbp), %rdi
movl $0x1, %esi
callq 0x6410
cmpl $0x0, %eax
je 0x5d08
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe7a89(%rip), %rsi     # 0xed79c
xorl %edx, %edx
movl $0x2, %r8d
movl %r8d, %ecx
callq 0x6670
cmpl $0x0, %eax
je 0x5d2d
jmp 0x60df
movq -0x48(%rbp), %rdi
movl $0x1, %esi
callq 0x6410
cmpl $0x0, %eax
je 0x5d45
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe7a4c(%rip), %rsi     # 0xed79c
xorl %edx, %edx
callq 0x69f0
cmpl $0x0, %eax
je 0x5d61
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe7a30(%rip), %rsi     # 0xed79c
movl $0x1, %edx
callq 0x69f0
cmpl $0x0, %eax
je 0x5d80
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe7a11(%rip), %rsi     # 0xed79c
movl $0x2, %edx
callq 0x69f0
cmpl $0x0, %eax
je 0x5d9f
jmp 0x60df
leaq -0x60(%rbp), %rdi
callq 0x6e20
cmpl $0x0, %eax
je 0x5db2
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe79df(%rip), %rsi     # 0xed79c
movl $0xf4240, %edx          # imm = 0xF4240
xorl %ecx, %ecx
callq 0x7050
cmpl $0x0, %eax
je 0x5dd3
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe79be(%rip), %rsi     # 0xed79c
movl $0xf4240, %edx          # imm = 0xF4240
movl $0x1, %ecx
callq 0x7050
cmpl $0x0, %eax
je 0x5df7
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe799a(%rip), %rsi     # 0xed79c
movl $0xf4240, %edx          # imm = 0xF4240
movl $0x2, %ecx
callq 0x7050
cmpl $0x0, %eax
je 0x5e1b
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe41fc(%rip), %rsi     # 0xea022
xorl %ecx, %ecx
movl %ecx, %edx
callq 0x7050
cmpl $0x0, %eax
je 0x5e39
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe7958(%rip), %rsi     # 0xed79c
xorl %ecx, %ecx
movl %ecx, %edx
callq 0x7600
cmpl $0x0, %eax
je 0x5e57
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe41c0(%rip), %rsi     # 0xea022
xorl %ecx, %ecx
movl %ecx, %edx
callq 0x7600
cmpl $0x0, %eax
je 0x5e75
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe791c(%rip), %rsi     # 0xed79c
movl $0xf4240, %edx          # imm = 0xF4240
xorl %ecx, %ecx
callq 0x7600
cmpl $0x0, %eax
je 0x5e96
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe4181(%rip), %rsi     # 0xea022
movl $0xf4240, %edx          # imm = 0xF4240
xorl %ecx, %ecx
callq 0x7600
cmpl $0x0, %eax
je 0x5eb7
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe78da(%rip), %rsi     # 0xed79c
xorl %edx, %edx
movl $0x1, %ecx
callq 0x7600
cmpl $0x0, %eax
je 0x5ed8
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe78b9(%rip), %rsi     # 0xed79c
xorl %edx, %edx
movl $0x2, %ecx
callq 0x7600
cmpl $0x0, %eax
je 0x5ef9
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe411e(%rip), %rsi     # 0xea022
xorl %edx, %edx
movl $0x1, %ecx
callq 0x7600
cmpl $0x0, %eax
je 0x5f1a
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe40fd(%rip), %rsi     # 0xea022
xorl %edx, %edx
movl $0x2, %ecx
callq 0x7600
cmpl $0x0, %eax
je 0x5f3b
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe7856(%rip), %rsi     # 0xed79c
movl $0xf4240, %edx          # imm = 0xF4240
movl $0x1, %ecx
callq 0x7600
cmpl $0x0, %eax
je 0x5f5f
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe7832(%rip), %rsi     # 0xed79c
movl $0xf4240, %edx          # imm = 0xF4240
movl $0x2, %ecx
callq 0x7600
cmpl $0x0, %eax
je 0x5f83
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe4094(%rip), %rsi     # 0xea022
movl $0xf4240, %edx          # imm = 0xF4240
movl $0x1, %ecx
callq 0x7600
cmpl $0x0, %eax
je 0x5fa7
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe4070(%rip), %rsi     # 0xea022
movl $0xf4240, %edx          # imm = 0xF4240
movl $0x2, %ecx
callq 0x7600
cmpl $0x0, %eax
je 0x5fcb
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe77c6(%rip), %rsi     # 0xed79c
callq 0x7d00
cmpl $0x0, %eax
je 0x5fe5
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe4032(%rip), %rsi     # 0xea022
callq 0x7d00
cmpl $0x0, %eax
je 0x5fff
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe7792(%rip), %rsi     # 0xed79c
callq 0x8010
cmpl $0x0, %eax
je 0x6019
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe3ffe(%rip), %rsi     # 0xea022
callq 0x8010
cmpl $0x0, %eax
je 0x6033
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe775e(%rip), %rsi     # 0xed79c
xorl %edx, %edx
callq 0x8260
cmpl $0x0, %eax
je 0x604f
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe7742(%rip), %rsi     # 0xed79c
movl $0x1, %edx
callq 0x8260
cmpl $0x0, %eax
je 0x606b
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe7726(%rip), %rsi     # 0xed79c
movl $0x2, %edx
callq 0x8260
cmpl $0x0, %eax
je 0x6087
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe770a(%rip), %rsi     # 0xed79c
xorl %edx, %edx
callq 0x85b0
cmpl $0x0, %eax
je 0x60a0
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe76f1(%rip), %rsi     # 0xed79c
movl $0x1, %edx
callq 0x85b0
cmpl $0x0, %eax
je 0x60bc
jmp 0x60df
leaq -0x60(%rbp), %rdi
leaq 0xe76d5(%rip), %rsi     # 0xed79c
movl $0x2, %edx
callq 0x85b0
cmpl $0x0, %eax
je 0x60d8
jmp 0x60df
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %esi
leaq -0x60(%rbp), %rdi
callq 0x8a50
movl -0x64(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)