// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/test/test_index.c
// Function: main
int main(int argc, char **argv) {
    int c, min_shift = 14;

    while ((c = getopt(argc, argv, "bctm:")) >= 0) {
        switch (c) {
        case 't': case 'b': min_shift = 0; break;
        case 'c': min_shift = 14; break;
        case 'm': min_shift = atoi(optarg); break;
        case 'h': usage(stdout);
        default:  usage(stderr);
        }
    }

    if (optind >= argc) usage(stderr);

    htsFile *in = hts_open(argv[optind], "r");
    if (!in) {
        fprintf(stderr, "Error opening \"%s\"\n", argv[optind]);
        exit(1);
    }

    int ret;
    if (in->format.format == sam ||
        in->format.format == bam ||
        in->format.format == cram) {
        ret = sam_index_build(argv[optind], min_shift);
    } else {
        ret = bcf_index_build(argv[optind], min_shift);
    }

    if (ret < 0) {
        fprintf(stderr, "Failed to build index for \"%s\"\n", argv[optind]);
        exit(1);
    }

    if (hts_close(in) < 0) {
        fprintf(stderr, "Error closing \"%s\"\n", argv[optind]);
        exit(1);
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0xe, -0x18(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0xfd5cd(%rip), %rdx     # 0x103178
callq 0x40c0
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
jl 0x5c26
movl -0x14(%rbp), %eax
addl $-0x62, %eax
movl %eax, %ecx
movq %rcx, -0x30(%rbp)
subl $0x12, %eax
ja 0x5c12
movq -0x30(%rbp), %rax
leaq 0xfd430(%rip), %rcx     # 0x103004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x0, -0x18(%rbp)
jmp 0x5c21
movl $0xe, -0x18(%rbp)
jmp 0x5c21
movq 0x11f3c2(%rip), %rax    # 0x124fb8
movq (%rax), %rdi
callq 0x47f0
movl %eax, -0x18(%rbp)
jmp 0x5c21
movq 0x11f39e(%rip), %rax    # 0x124fa8
movq (%rax), %rdi
callq 0x5ae0
movq 0x11f3b7(%rip), %rax    # 0x124fd0
movq (%rax), %rdi
callq 0x5ae0
jmp 0x5b9d
movq 0x11f3ab(%rip), %rax    # 0x124fd8
movl (%rax), %eax
cmpl -0x8(%rbp), %eax
jl 0x5c43
movq 0x11f395(%rip), %rax    # 0x124fd0
movq (%rax), %rdi
callq 0x5ae0
movq -0x10(%rbp), %rax
movq 0x11f38a(%rip), %rcx    # 0x124fd8
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x100664(%rip), %rsi    # 0x1062c0
callq 0x9b40
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x5ca0
movq 0x11f35d(%rip), %rax    # 0x124fd0
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x11f357(%rip), %rcx    # 0x124fd8
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0xfd4ef(%rip), %rsi     # 0x10317e
movb $0x0, %al
callq 0x4700
movl $0x1, %edi
callq 0x45e0
movq -0x20(%rbp), %rax
cmpl $0x3, 0x4c(%rax)
je 0x5cbe
movq -0x20(%rbp), %rax
cmpl $0x4, 0x4c(%rax)
je 0x5cbe
movq -0x20(%rbp), %rax
cmpl $0x6, 0x4c(%rax)
jne 0x5cdd
movq -0x10(%rbp), %rax
movq 0x11f30f(%rip), %rcx    # 0x124fd8
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdi
movl -0x18(%rbp), %esi
callq 0x20b40
movl %eax, -0x24(%rbp)
jmp 0x5cfa
movq -0x10(%rbp), %rax
movq 0x11f2f0(%rip), %rcx    # 0x124fd8
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdi
movl -0x18(%rbp), %esi
callq 0x4a930
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jge 0x5d34
movq 0x11f2c9(%rip), %rax    # 0x124fd0
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x11f2c3(%rip), %rcx    # 0x124fd8
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0xfd46f(%rip), %rsi     # 0x103192
movb $0x0, %al
callq 0x4700
movl $0x1, %edi
callq 0x45e0
movq -0x20(%rbp), %rdi
callq 0xbc60
cmpl $0x0, %eax
jge 0x5d76
movq 0x11f287(%rip), %rax    # 0x124fd0
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x11f281(%rip), %rcx    # 0x124fd8
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0xfd44d(%rip), %rsi     # 0x1031b2
movb $0x0, %al
callq 0x4700
movl $0x1, %edi
callq 0x45e0
xorl %eax, %eax
addq $0x30, %rsp
popq %rbp
retq
nop