// File: /workspace/github_c_makefile_star2_O2/arq5x[P]grabix/grabix_main.cpp
// Function: main
int main (int argc, char **argv)
{
    if (argc == 1) { return usage(); }
    if (argc >= 3)
    {
        // create input file for the purpose of the example
        string bgzf_file = argv[2];

        string sub_command = argv[1];
        if (sub_command == "index")
        {
            create_grabix_index(bgzf_file);
        }
        else if (sub_command == "grab")
        {
            int64_t from_line = atol(argv[3]);
            int64_t to_line = from_line;
            if (argc == 5)
                to_line = atol(argv[4]);

            grab(bgzf_file, from_line, to_line);
        }
        else if (sub_command == "random")
        {
            size_t N = atoi(argv[3]);
            random(bgzf_file, N);
        }
        else if (sub_command == "check")
        {
          cout << ((bgzf_is_bgzf(bgzf_file.c_str()) == 1) ? "yes" : "no") << "\n";
        }
        else if (sub_command == "size")
        {
          cout << size(bgzf_file) << "\n";
        } else {
          cout << "unknown command: " << sub_command << endl;
          cout << "available commands are: index, grab, random, check, size" << endl;
        }
    }

    return EXIT_SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xc8, %rsp
cmpl $0x1, %edi
jne 0x25c0
addq $0xc8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2914
movl %edi, %ebp
cmpl $0x3, %edi
jl 0x26de
movq %rsi, %rbx
movq 0x10(%rsi), %rsi
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x2836
movq 0x8(%rbx), %rsi
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x2836
leaq 0x2a09(%rip), %rsi      # 0x5004
leaq 0x8(%rsp), %rdi
callq 0x2871
testb %al, %al
je 0x262b
leaq 0xa8(%rsp), %rbx
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x2330
movq %rbx, %rdi
callq 0x2afc
jmp 0x26c2
leaq 0x29d8(%rip), %rsi      # 0x500a
leaq 0x8(%rsp), %rdi
callq 0x2871
testb %al, %al
je 0x2685
movq 0x18(%rbx), %rdi
callq 0x22d0
movq %rax, %r14
movq %rax, %r15
cmpl $0x5, %ebp
jne 0x2660
movq 0x20(%rbx), %rdi
callq 0x22d0
movq %rax, %r15
leaq 0x88(%rsp), %rbx
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x2330
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2fa7
jmp 0x26c2
leaq 0x2983(%rip), %rsi      # 0x500f
leaq 0x8(%rsp), %rdi
callq 0x2871
testb %al, %al
je 0x26ee
movq 0x18(%rbx), %rdi
callq 0x23a0
movl %eax, %ebp
leaq 0x68(%rsp), %rbx
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x2330
movslq %ebp, %rsi
movq %rbx, %rdi
callq 0x31dc
movq %rbx, %rdi
callq 0x20e0
leaq 0x8(%rsp), %rdi
callq 0x20e0
leaq 0x28(%rsp), %rdi
callq 0x20e0
xorl %eax, %eax
addq $0xc8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2921(%rip), %rsi      # 0x5016
leaq 0x8(%rsp), %rdi
callq 0x2871
testb %al, %al
je 0x273f
movq 0x28(%rsp), %rdi
callq 0x41fc
cmpl $0x1, %eax
leaq 0x2905(%rip), %rax      # 0x501c
leaq 0x2902(%rip), %rsi      # 0x5020
cmoveq %rax, %rsi
movq 0x58a7(%rip), %rdi      # 0x7fd0
callq 0x2220
leaq 0x28ee(%rip), %rsi      # 0x5023
movq %rax, %rdi
callq 0x2220
jmp 0x26ca
leaq 0x2925(%rip), %rsi      # 0x506b
leaq 0x8(%rsp), %rdi
callq 0x2871
testb %al, %al
je 0x2792
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x2330
leaq 0x48(%rsp), %rbx
movq %rbx, %rdi
callq 0x3493
movq 0x5859(%rip), %rdi      # 0x7fd0
movl %eax, %esi
callq 0x23e0
leaq 0x289e(%rip), %rsi      # 0x5023
movq %rax, %rdi
callq 0x2220
jmp 0x26c2
movq 0x5837(%rip), %rdi      # 0x7fd0
leaq 0x2885(%rip), %rsi      # 0x5025
callq 0x2220
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x21e0
movq %rax, %rdi
callq 0x2100
movq 0x580f(%rip), %rdi      # 0x7fd0
leaq 0x286f(%rip), %rsi      # 0x5037
callq 0x2220
movq %rax, %rdi
callq 0x2100
jmp 0x26ca
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
jmp 0x280a
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
jmp 0x280a
jmp 0x2811
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
jmp 0x280a
jmp 0x2811
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x20e0
jmp 0x2814
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x20e0
jmp 0x2823
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x20e0
movq %rbx, %rdi
callq 0x23f0
nop