// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/test/test_faidx.c
// Function: main
int main(int argc, char **argv) {
    int opt;
    const char *fn = NULL;
    const char *fnout = NULL;
    const char *fnfai = NULL;
    const char *fngzi = NULL;
    const char *expected = NULL;
    const char *func = "";
    int flags = 0;
    enum fai_format_options format = FAI_FASTA;
    int res;

    while ((opt = getopt(argc, argv, "i:f:g:o:e:t:cQh")) > 0) {
        switch (opt) {
        case 'i':
            fn = optarg;
            break;
        case 'f':
            fnfai = optarg;
            break;
        case 'g':
            fngzi = optarg;
            break;
        case 'o':
            fnout = optarg;
            break;
        case 'e':
            expected = optarg;
            break;
        case 'c':
            flags |= FAI_CREATE;
            break;
        case 'Q':
            format = FAI_FASTQ;
            break;
        case 't':
            func = optarg;
            break;
        case 'h':
            help(stdout, argv[0]);
            return EXIT_SUCCESS;
        default:
            usage(stderr, argv[0]);
            return EXIT_FAILURE;
        }
    }

    if (!fn) {
        usage(stderr, argv[0]);
        return EXIT_FAILURE;
    }

    if (optind == argc) {
        // Index building mode
        res = fai_build3(fn, fnfai, fngzi);
        if (res) {
            fprintf(stderr, "Failed: fai_build3(%s, %s, %s)\n",
                    fn, fnfai ? fnfai : "NULL", fngzi ? fngzi : "NULL");
        } else if (expected) {
            res = file_compare(fnfai, expected);
        }
    } else {
        if (strcmp(func, "fai_line_length") == 0) {
            res = test_fai_line_length(fn, fnfai, fngzi, format, expected,
                                       argv[optind]);
        } else if (strcmp(func, "faidx_has_seq") == 0) {
            res = test_faidx_has_seq(fn, fnfai, fngzi, format, expected,
                                     argv[optind]);
        } else if (strcmp(func, "faidx_iseq") == 0) {
            res = test_faidx_iseq(fn, fnfai, fngzi, format, expected,
                                  argv[optind]);
        } else if (strcmp(func, "faidx_seq_len") == 0) {
            res = test_faidx_seq_len(fn, fnfai, fngzi, format, expected,
                                     argv[optind]);
        } else if (strcmp(func, "faidx_seq_len64") == 0) {
            res = test_faidx_seq_len64(fn, fnfai, fngzi, format, expected,
                                       argv[optind]);
        } else {
            res =  do_retrieval(fn, fnfai, fngzi, flags, format, fnout,
                                func, argc - optind, &argv[optind]);
            if (res == 0 && fnout && expected) {
                res = file_compare(fnout, expected);
            }
        }
    }
    return res == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r13
movl %edi, %ebp
leaq 0x8bc11(%rip), %rdx     # 0x92739
callq 0x40f0
testl %eax, %eax
jle 0x6c06
leaq 0x8cda1(%rip), %rcx     # 0x938dd
movq %rcx, 0x30(%rsp)
movq $0x0, 0x20(%rsp)
movl $0x1, 0x4(%rsp)
leaq 0x8bbe0(%rip), %r14     # 0x92739
leaq 0x8b4a4(%rip), %r15     # 0x92004
movq 0xac459(%rip), %rbx     # 0xb2fc0
movq $0x0, 0x8(%rsp)
movq $0x0, 0x18(%rsp)
movq $0x0, 0x10(%rsp)
movq $0x0, 0x28(%rsp)
xorl %r12d, %r12d
leal -0x63(%rax), %ecx
cmpl $0x11, %ecx
ja 0x6bab
movslq (%r15,%rcx,4), %rax
addq %r15, %rax
jmpq *%rax
movl $0x1, %eax
movq %rax, 0x20(%rsp)
jmp 0x6bf3
cmpl $0x51, %eax
jne 0x6ee7
movl $0x2, 0x4(%rsp)
jmp 0x6bf3
movq (%rbx), %r12
jmp 0x6bf3
movq (%rbx), %rax
movq %rax, 0x8(%rsp)
jmp 0x6bf3
movq (%rbx), %rax
movq %rax, 0x10(%rsp)
jmp 0x6bf3
movq (%rbx), %rax
movq %rax, 0x18(%rsp)
jmp 0x6bf3
movq (%rbx), %rax
movq %rax, 0x28(%rsp)
jmp 0x6bf3
movq (%rbx), %rax
movq %rax, 0x30(%rsp)
movl %ebp, %edi
movq %r13, %rsi
movq %r14, %rdx
callq 0x40f0
testl %eax, %eax
jg 0x6b8e
jmp 0x6c4a
movl $0x1, 0x4(%rsp)
xorl %r12d, %r12d
leaq 0x8ccc5(%rip), %rax     # 0x938dd
movq %rax, 0x30(%rsp)
movq $0x0, 0x28(%rsp)
movq $0x0, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movq $0x0, 0x8(%rsp)
movq $0x0, 0x20(%rsp)
testq %r12, %r12
je 0x6e3e
movq 0xac386(%rip), %rax     # 0xb2fe0
movslq (%rax), %rbx
cmpl %ebx, %ebp
jne 0x6c9c
movq %r12, %rdi
movq 0x10(%rsp), %r14
movq %r14, %rsi
movq 0x18(%rsp), %rbx
movq %rbx, %rdx
callq 0x6f74
testl %eax, %eax
jne 0x6e72
movq 0x8(%rsp), %rsi
testq %rsi, %rsi
je 0x6da5
movq %r14, %rdi
callq 0x5e8c
jmp 0x6ecf
leaq 0x8bac6(%rip), %rsi     # 0x92769
movq 0x30(%rsp), %r14
movq %r14, %rdi
callq 0x46d0
testl %eax, %eax
je 0x6d80
leaq 0x8baba(%rip), %rsi     # 0x92779
movq %r14, %rdi
callq 0x46d0
testl %eax, %eax
je 0x6dac
leaq 0x8bab1(%rip), %rsi     # 0x92787
movq %r14, %rdi
callq 0x46d0
testl %eax, %eax
je 0x6e19
leaq 0x8baa5(%rip), %rsi     # 0x92792
movq %r14, %rdi
callq 0x46d0
testl %eax, %eax
je 0x6e50
leaq 0x8ba9c(%rip), %rsi     # 0x927a0
movq %r14, %rdi
callq 0x46d0
testl %eax, %eax
je 0x6eaf
subl %ebx, %ebp
leaq (,%rbx,8), %rax
addq %r13, %rax
subq $0x8, %rsp
movq %r12, %rdi
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq 0x28(%rsp), %rcx
movl 0xc(%rsp), %r8d
movq 0x30(%rsp), %rbx
movq %rbx, %r9
pushq %rax
pushq %rbp
pushq %r14
callq 0x60ec
addq $0x20, %rsp
testl %eax, %eax
sete %cl
testq %rbx, %rbx
setne %dl
movq 0x8(%rsp), %rsi
testq %rsi, %rsi
setne %dil
andb %dl, %dil
andb %cl, %dil
cmpb $0x1, %dil
jne 0x6ecf
movq %rbx, %rdi
jmp 0x6c92
movq (%r13,%rbx,8), %r9
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movl 0x4(%rsp), %ecx
movq 0x8(%rsp), %r8
callq 0x6771
jmp 0x6ecf
xorl %eax, %eax
jmp 0x6ecf
movq (%r13,%rbx,8), %r9
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movl 0x4(%rsp), %ecx
movq 0x8(%rsp), %r8
callq 0x6812
jmp 0x6ecf
movq 0xac1d8(%rip), %rax     # 0xb2fb0
movq (%rax), %r14
movq (%r13), %rcx
leaq 0x8b59b(%rip), %rsi     # 0x92381
xorl %ebx, %ebx
movq %r14, %rdi
movq %rcx, %rdx
movq %rcx, %r8
movq %rcx, %r9
xorl %eax, %eax
callq 0x4710
leaq 0x8b664(%rip), %rdi     # 0x92466
movl $0x2d2, %esi            # imm = 0x2D2
movl $0x1, %edx
movq %r14, %rcx
callq 0x49c0
jmp 0x6ed6
movq (%r13,%rbx,8), %r9
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movl 0x4(%rsp), %ecx
movq 0x8(%rsp), %r8
callq 0x68b3
jmp 0x6ecf
movq %r13, %rdi
callq 0x4a48
movl $0x1, %ebx
jmp 0x6ed6
movq (%r13,%rbx,8), %r9
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movl 0x4(%rsp), %ecx
movq 0x8(%rsp), %r8
callq 0x6983
jmp 0x6ecf
movq 0xac15f(%rip), %rax     # 0xb2fd8
testq %r14, %r14
leaq 0x8d56e(%rip), %rcx     # 0x943f1
cmoveq %rcx, %r14
movq (%rax), %rdi
testq %rbx, %rbx
cmoveq %rcx, %rbx
leaq 0x8b8b1(%rip), %rsi     # 0x92749
movq %r12, %rdx
movq %r14, %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x4710
movl $0x1, %eax
jmp 0x6ecf
movq (%r13,%rbx,8), %r9
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movl 0x4(%rsp), %ecx
movq 0x8(%rsp), %r8
callq 0x6a19
xorl %ebx, %ebx
testl %eax, %eax
setne %bl
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, %rdi
callq 0x4a6f
jmp 0x6e46