// File: /workspace/github_c_makefile_star2_O2/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, %rbp
movl %edi, %ebx
pushq $0x1
popq %r13
movq $0x0, 0x30(%rsp)
leaq 0x6d297(%rip), %rax     # 0x73976
movq %rax, 0x28(%rsp)
leaq 0x6c04e(%rip), %r14     # 0x72739
leaq 0x6b912(%rip), %r12     # 0x72004
movq $0x0, 0x20(%rsp)
movq $0x0, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movq $0x0, 0x8(%rsp)
xorl %eax, %eax
movl %r13d, 0x4(%rsp)
movl %eax, %r15d
movl %ebx, %edi
movq %rbp, %rsi
movq %r14, %rdx
callq 0x40f0
testl %eax, %eax
jle 0x67df
leal -0x63(%rax), %ecx
cmpl $0x11, %ecx
ja 0x675d
movslq (%r12,%rcx,4), %rcx
addq %r12, %rcx
movl %r13d, %eax
jmpq *%rcx
movq 0x92870(%rip), %rax     # 0x98fc0
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movl %r15d, %eax
jmp 0x671d
cmpl $0x51, %eax
jne 0x6833
movl %r15d, %eax
pushq $0x2
popq %rcx
movl %ecx, 0x4(%rsp)
jmp 0x671d
movq 0x92847(%rip), %rax     # 0x98fc0
movq (%rax), %rax
movq %rax, 0x30(%rsp)
movl %r15d, %eax
jmp 0x671d
movq 0x92833(%rip), %rax     # 0x98fc0
movq (%rax), %rax
movq %rax, 0x28(%rsp)
movl %r15d, %eax
jmp 0x671d
movq 0x9281f(%rip), %rax     # 0x98fc0
movq (%rax), %rax
movq %rax, 0x18(%rsp)
movl %r15d, %eax
jmp 0x671d
movq 0x92808(%rip), %rax     # 0x98fc0
movq (%rax), %rax
movq %rax, 0x10(%rsp)
movl %r15d, %eax
jmp 0x671d
movq 0x927f1(%rip), %rax     # 0x98fc0
movq (%rax), %rax
movq %rax, 0x20(%rsp)
movl %r15d, %eax
jmp 0x671d
movq 0x30(%rsp), %r12
testq %r12, %r12
je 0x6833
movq 0x927f0(%rip), %rax     # 0x98fe0
movslq (%rax), %r14
cmpl %r14d, %ebx
jne 0x684e
movq %r12, %rdi
movq 0x10(%rsp), %r14
movq %r14, %rsi
movq 0x18(%rsp), %rbx
movq %rbx, %rdx
callq 0x6ac8
testl %eax, %eax
jne 0x69dd
movq 0x8(%rsp), %rsi
testq %rsi, %rsi
je 0x696d
movq %r14, %rdi
callq 0x5adc
jmp 0x6a38
movq 0x9279e(%rip), %rax     # 0x98fd8
movq (%rax), %rdi
movq (%rbp), %rsi
callq 0x667d
pushq $0x1
popq %rcx
jmp 0x6a3f
leaq 0x6bf14(%rip), %rsi     # 0x72769
movq 0x28(%rsp), %r13
movq %r13, %rdi
callq 0x46d0
testl %eax, %eax
je 0x6948
leaq 0x6bf08(%rip), %rsi     # 0x72779
movq %r13, %rdi
callq 0x46d0
testl %eax, %eax
je 0x6974
leaq 0x6beff(%rip), %rsi     # 0x72787
movq %r13, %rdi
callq 0x46d0
testl %eax, %eax
je 0x6999
leaq 0x6bef3(%rip), %rsi     # 0x72792
movq %r13, %rdi
callq 0x46d0
testl %eax, %eax
je 0x69bb
leaq 0x6beea(%rip), %rsi     # 0x727a0
movq %r13, %rdi
callq 0x46d0
testl %eax, %eax
je 0x6a18
subl %r14d, %ebx
leaq (,%r14,8), %rax
addq %rbp, %rax
subq $0x8, %rsp
movq %r12, %rdi
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
movl %r15d, %ecx
movl 0xc(%rsp), %r8d
movq 0x28(%rsp), %r14
movq %r14, %r9
pushq %rax
pushq %rbx
pushq %r13
callq 0x5cd6
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 0x6826
jmp 0x6a38
movq 0x9267b(%rip), %rax     # 0x98fb0
movq (%rax), %rdi
movq (%rbp), %rsi
callq 0x6697
xorl %ecx, %ecx
jmp 0x6a3f
movq (%rbp,%r14,8), %r9
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movl 0x4(%rsp), %ecx
movq 0x8(%rsp), %r8
callq 0x6356
jmp 0x6a38
xorl %eax, %eax
jmp 0x6a38
movq (%rbp,%r14,8), %r9
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movl 0x4(%rsp), %ecx
movq 0x8(%rsp), %r8
callq 0x63ed
jmp 0x6a38
movq (%rbp,%r14,8), %r9
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movl 0x4(%rsp), %ecx
movq 0x8(%rsp), %r8
callq 0x6487
jmp 0x6a38
movq (%rbp,%r14,8), %r9
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movl 0x4(%rsp), %ecx
movq 0x8(%rsp), %r8
callq 0x6553
jmp 0x6a38
movq 0x925f4(%rip), %rax     # 0x98fd8
testq %r14, %r14
leaq 0x6daa4(%rip), %rcx     # 0x74492
cmoveq %rcx, %r14
movq (%rax), %rdi
testq %rbx, %rbx
cmoveq %rcx, %rbx
leaq 0x6bd46(%rip), %rsi     # 0x72749
movq %r12, %rdx
movq %r14, %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x4710
pushq $0x1
popq %rax
jmp 0x6a38
movq (%rbp,%r14,8), %r9
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movl 0x4(%rsp), %ecx
movq 0x8(%rsp), %r8
callq 0x65e4
xorl %ecx, %ecx
testl %eax, %eax
setne %cl
movl %ecx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq