// File: /workspace/github_c_makefile_star2_O3/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, %ebx
leaq 0x88c39(%rip), %rdx     # 0x8f739
callq 0x40f0
testl %eax, %eax
jle 0x6d43
leaq 0x89e29(%rip), %rcx     # 0x9093d
movq %rcx, 0x30(%rsp)
movq $0x0, 0x20(%rsp)
movl $0x1, 0x4(%rsp)
leaq 0x88c08(%rip), %r14     # 0x8f739
leaq 0x884cc(%rip), %r15     # 0x8f004
movq 0xa9481(%rip), %rbp     # 0xaffc0
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 0x6b83
movslq (%r15,%rcx,4), %rax
addq %r15, %rax
jmpq *%rax
movl $0x1, %eax
movq %rax, 0x20(%rsp)
jmp 0x6bd1
cmpl $0x51, %eax
jne 0x6e7b
movl $0x2, 0x4(%rsp)
jmp 0x6bd1
movq (%rbp), %r12
jmp 0x6bd1
movq (%rbp), %rax
movq %rax, 0x8(%rsp)
jmp 0x6bd1
movq (%rbp), %rax
movq %rax, 0x10(%rsp)
jmp 0x6bd1
movq (%rbp), %rax
movq %rax, 0x18(%rsp)
jmp 0x6bd1
movq (%rbp), %rax
movq %rax, 0x28(%rsp)
jmp 0x6bd1
movq (%rbp), %rax
movq %rax, 0x30(%rsp)
movl %ebx, %edi
movq %r13, %rsi
movq %r14, %rdx
callq 0x40f0
testl %eax, %eax
jg 0x6b66
testq %r12, %r12
je 0x6d43
movq 0xa93ee(%rip), %rax     # 0xaffe0
movslq (%rax), %r14
cmpl %r14d, %ebx
jne 0x6c35
movq %r12, %rdi
movq 0x10(%rsp), %r14
movq %r14, %rsi
movq 0x18(%rsp), %rbx
movq %rbx, %rdx
callq 0x6f08
testl %eax, %eax
jne 0x6e06
movq 0x8(%rsp), %rsi
testq %rsi, %rsi
je 0x6d3c
movq %r14, %rdi
callq 0x5e7c
jmp 0x6e63
leaq 0x88b2d(%rip), %rsi     # 0x8f769
movq 0x30(%rsp), %r15
movq %r15, %rdi
callq 0x46d0
testl %eax, %eax
je 0x6d17
leaq 0x88b21(%rip), %rsi     # 0x8f779
movq %r15, %rdi
callq 0x46d0
testl %eax, %eax
je 0x6d9d
leaq 0x88b18(%rip), %rsi     # 0x8f787
movq %r15, %rdi
callq 0x46d0
testl %eax, %eax
je 0x6dc2
leaq 0x88b0c(%rip), %rsi     # 0x8f792
movq %r15, %rdi
callq 0x46d0
testl %eax, %eax
je 0x6de4
leaq 0x88b03(%rip), %rsi     # 0x8f7a0
movq %r15, %rdi
callq 0x46d0
testl %eax, %eax
je 0x6e43
subl %r14d, %ebx
leaq (,%r14,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), %r14
movq %r14, %r9
pushq %rax
pushq %rbx
pushq %r15
callq 0x60ec
addq $0x20, %rsp
testl %eax, %eax
sete %cl
testq %r14, %r14
setne %dl
movq 0x8(%rsp), %rsi
testq %rsi, %rsi
setne %dil
andb %dl, %dil
andb %cl, %dil
cmpb $0x1, %dil
je 0x6c28
jmp 0x6e63
movq (%r13,%r14,8), %r9
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movl 0x4(%rsp), %ecx
movq 0x8(%rsp), %r8
callq 0x6749
jmp 0x6e63
xorl %eax, %eax
jmp 0x6e63
movq %r13, %rdi
callq 0x4a24
movl $0x1, %ebx
jmp 0x6e6a
movq 0xa9254(%rip), %rax     # 0xaffb0
movq (%rax), %r14
movq (%r13), %rcx
leaq 0x88617(%rip), %rsi     # 0x8f381
xorl %ebx, %ebx
movq %r14, %rdi
movq %rcx, %rdx
movq %rcx, %r8
movq %rcx, %r9
xorl %eax, %eax
callq 0x4710
leaq 0x886e0(%rip), %rdi     # 0x8f466
movl $0x2d2, %esi            # imm = 0x2D2
movl $0x1, %edx
movq %r14, %rcx
callq 0x49c0
jmp 0x6e6a
movq (%r13,%r14,8), %r9
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movl 0x4(%rsp), %ecx
movq 0x8(%rsp), %r8
callq 0x67ea
jmp 0x6e63
movq (%r13,%r14,8), %r9
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movl 0x4(%rsp), %ecx
movq 0x8(%rsp), %r8
callq 0x688b
jmp 0x6e63
movq (%r13,%r14,8), %r9
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movl 0x4(%rsp), %ecx
movq 0x8(%rsp), %r8
callq 0x695b
jmp 0x6e63
movq 0xa91cb(%rip), %rax     # 0xaffd8
testq %r14, %r14
leaq 0x8a63a(%rip), %rcx     # 0x91451
cmoveq %rcx, %r14
movq (%rax), %rdi
testq %rbx, %rbx
cmoveq %rcx, %rbx
leaq 0x8891d(%rip), %rsi     # 0x8f749
movq %r12, %rdx
movq %r14, %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x4710
movl $0x1, %eax
jmp 0x6e63
movq (%r13,%r14,8), %r9
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movl 0x4(%rsp), %ecx
movq 0x8(%rsp), %r8
callq 0x69f1
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 0x4a4b
jmp 0x6d4b