// File: /workspace/github_cpp_makefile_star2_O3/Infinidat[P]slimfastq/config.cpp
// Function: Config::init(int, char**)
void Config::init(int argc, char **argv) {
    if (initialized)
        croak("Internal error: 2nd Config init");

    initialized = true;

    std::string usr, fil;
    bool overwrite = false;
    bool statistics = false;

    if (argc == 1) usage();
    // TODO? long options
    // const char* short_opt = "POvhd 1234 u:f:s:p:l:";
    const char* short_opt = "qPsvhdO 1234 u:f:l:";
    for ( int opt = getopt(argc, argv, short_opt);
          opt != -1;
          opt     = getopt(argc, argv, short_opt))
        switch (opt) {
        case 'u': usr = optarg ; break;
        case 'f': fil = optarg ; break;

        case 'l': level = strtoll(optarg, 0, 0);  break;
        case '1': case '2' : case '3': case '4':
            level = opt - '0'; break;

        case 'd': encode     = false; break;
        case 'O': overwrite  = true ; break;
        case 'P': profiling  = true ; break;
        case 'q': quiet      = true ; break;
        case 'v':
            printf("Version %s\nInternal format version=%u\n", user_version, version);
            exit(0);
        case 'h':
            usage();
        case 's': statistics = true; encode = false; break;

        default:
            croak("Ilagal args: use -h for help");
        }

    while (optind < argc) {
        // DWIM guessing ...
        char *file = argv[optind ++];
        FILE* fh = fopen(file, "rb");
        if (! fh) {
            if  (not encode and not usr.length())
                usr = file;
            else if (encode and not fil.length())
                fil = file;
            else {
                fprintf(stderr, "What am I suppose to do with '%s'?\n (please specify explicitly with -f/-u prefix)\n(Note: not an existing file)\n",
                        file);
                exit(1);
            }
            continue;
        }
        const char* sfqstamp = "whoami=slimfastq" ;
        char initline[20];
        BZERO(initline);
        size_t cnt = fread(initline, 1, 19, fh);
        if (cnt and
            not fil.length() and
            0 == strncmp(initline, sfqstamp, strlen(sfqstamp))) {
            fil = file;
            encode = !! usr.length();
        }
        else if (cnt and
                 not usr.length() and
                 initline[0] == '@') {
            usr = file;
        }
        else if (not usr.length() and
                 not encode and
                 (not cnt or overwrite)) {
            usr = file;
        }
        else if (encode and
                 usr.length() and
                 not fil.length() and
                 (not cnt or overwrite)) {
            fil = file;
        }
        else {
            fprintf(stderr, "What am I suppose to do with '%s'?\n (please specify explicitly with -f/-u prefix)\n(Note: file exists!)\n", file);
            exit(1);
        }
    }
    check_op(fil.length(), 'f');

    const char* wr_flags = overwrite ? "wb" : "wbx" ;
    if (encode) {
        FILE* fh = fopen(fil.c_str(), wr_flags);
        check_fh(fh, fil, false);
        FilerSave::init(fh);
        m_info_filer = new FilerSave(42);
        set_info("whoami", "slimfastq");
        set_info("version", version);
        set_info("config.level", range_level(level));

        if (usr.length()) {
            set_info("orig.filename", usr.c_str());
            f_usr = fopen(usr.c_str(), "rb") ;
            check_fh(f_usr, usr, true);
            fseek(f_usr, 0L, SEEK_END);
            set_info("orig.size", ftell(f_usr));
            fseek(f_usr, 0L, SEEK_SET);
          }
        else {
            set_info("orig.filename", "<< stdin >>");
            f_usr = stdin ;
        }
    }
    else {
        FILE* fh = fopen(fil.c_str(), "rb");
        check_fh(fh, fil, true);
        fseek(fh, 0L, SEEK_END);
        UINT64 file_size = ftell(fh);
        fseek(fh, 0L, SEEK_SET);

        FilerLoad::init(fh);
        load_info();
        if (statistics)
            statistics_dump();

        level = range_level(get_long("config.level", 2));

        f_usr = usr.length() ? fopen(usr.c_str(), wr_flags) : stdout;
        check_fh(f_usr, usr);

        UINT64 comp_size = get_long("comp.size", 0);
        if (comp_size > 0 and
            comp_size != file_size)
            croak("expected compressed file size to be %lld", comp_size);

        decoder_version = conf.get_long("version");
        if (decoder_version and
            decoder_version > version)
            croak("%s was compressed with slimfastq version %d. My version is %d. Please upgrade me before decoing",
                  fil.c_str(), decoder_version, version);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
cmpb $0x1, 0xc84c(%rip)      # 0x111e0
je 0x5122
movl %esi, %ebp
movb $0x1, 0xc83d(%rip)      # 0x111e0
leaq 0x18(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x38(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
cmpl $0x1, %esi
je 0x50e4
movq %rdx, %r13
movq %rdi, %rbx
leaq 0x6fe5(%rip), %r15      # 0xb9be
movl %ebp, %edi
movq %rdx, %rsi
movq %r15, %rdx
callq 0x20b0
movq $0x0, 0x50(%rsp)
leaq 0x66ca(%rip), %r14      # 0xb0c0
movq $0x0, 0x58(%rsp)
movq %rbx, (%rsp)
movq %r13, 0x48(%rsp)
cmpl $0x4f, %eax
jg 0x4a20
leal -0x31(%rax), %ecx
cmpl $0x4, %ecx
jae 0x4a3f
addl $-0x30, %eax
movl %eax, 0x4(%rbx)
jmp 0x4ac0
leal -0x64(%rax), %ecx
cmpl $0x12, %ecx
ja 0x4a51
movslq (%r14,%rcx,4), %rax
addq %r14, %rax
leaq 0x28(%rsp), %r12
jmpq *%rax
movb $0x0, 0xc(%rbx)
jmp 0x4ac0
cmpl $0x4f, %eax
jne 0x4ad2
movb $0x1, %al
movq %rax, 0x58(%rsp)
jmp 0x4ac0
cmpl $0x50, %eax
jne 0x50d6
movb $0x1, 0xd(%rbx)
jmp 0x4ac0
movb $0x0, 0xc(%rbx)
movb $0x1, %al
movq %rax, 0x50(%rsp)
jmp 0x4ac0
movq 0xc544(%rip), %rax      # 0x10fb8
movq (%rax), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2080
jmp 0x4a18
movb $0x1, 0xe(%rbx)
jmp 0x4ac0
leaq 0x8(%rsp), %r12
movq 0xc524(%rip), %rax      # 0x10fb8
movq (%rax), %r13
movq 0x8(%r12), %rbx
movq %r13, %rdi
callq 0x20f0
movq %r12, %rdi
xorl %esi, %esi
movq %rbx, %rdx
movq (%rsp), %rbx
movq %r13, %rcx
movq 0x48(%rsp), %r13
movq %rax, %r8
callq 0x2290
movl %ebp, %edi
movq %r13, %rsi
movq %r15, %rdx
callq 0x20b0
jmp 0x4a08
cmpl $-0x1, %eax
jne 0x50d6
movq 0xc4f6(%rip), %rbx      # 0x10fd8
movl (%rbx), %eax
cmpl %ebp, %eax
movq 0x58(%rsp), %r14
jge 0x4c7c
leaq 0x6f1e(%rip), %r15      # 0xba16
leal 0x1(%rax), %ecx
movl %ecx, (%rbx)
cltq
movq (%r13,%rax,8), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x2200
testq %rax, %rax
je 0x4b84
pxor %xmm0, %xmm0
movdqa %xmm0, 0x60(%rsp)
movl $0x0, 0x70(%rsp)
movl $0x1, %esi
movl $0x13, %edx
leaq 0x60(%rsp), %rdi
movq %rax, %rcx
callq 0x2270
testq %rax, %rax
je 0x4ba0
cmpq $0x0, 0x30(%rsp)
jne 0x4b68
movdqa 0x60(%rsp), %xmm0
pcmpeqb 0x6548(%rip), %xmm0     # 0xb0a0
pmovmskb %xmm0, %ecx
cmpl $0xffff, %ecx           # imm = 0xFFFF
je 0x4c50
movq 0x10(%rsp), %rcx
testq %rcx, %rcx
jne 0x4ba5
cmpb $0x40, 0x60(%rsp)
leaq 0x8(%rsp), %r13
je 0x4c25
jmp 0x4ba5
movq (%rsp), %rax
cmpb $0x0, 0xc(%rax)
je 0x4bd5
cmpq $0x0, 0x30(%rsp)
leaq 0x28(%rsp), %r13
je 0x4be6
jmp 0x511a
movq 0x10(%rsp), %rcx
movq (%rsp), %rdx
movb 0xc(%rdx), %dl
testq %rcx, %rcx
je 0x4c07
testb %dl, %dl
je 0x5112
testq %rax, %rax
sete %al
cmpq $0x0, 0x30(%rsp)
jne 0x5112
orb %r14b, %al
leaq 0x28(%rsp), %r13
jmp 0x4c1d
cmpq $0x0, 0x10(%rsp)
leaq 0x8(%rsp), %r13
jne 0x511a
movq %r12, %rdi
callq 0x20f0
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
movq %r12, %rcx
movq %rax, %r8
callq 0x2290
movq 0x48(%rsp), %r13
jmp 0x4c44
testq %rax, %rax
sete %al
testb %dl, %dl
jne 0x5112
orb %r14b, %al
leaq 0x8(%rsp), %r13
testb $0x1, %al
je 0x5112
movq %r12, %rdi
callq 0x20f0
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
movq %r12, %rcx
movq %rax, %r8
callq 0x2290
movq 0x48(%rsp), %r13
movl (%rbx), %eax
cmpl %ebp, %eax
jl 0x4af8
jmp 0x4c7c
movq %r12, %rdi
callq 0x20f0
leaq 0x28(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
movq %r12, %rcx
movq %rax, %r8
callq 0x2290
cmpq $0x0, 0x10(%rsp)
movq (%rsp), %rax
setne 0xc(%rax)
jmp 0x4c44
cmpl $0x0, 0x30(%rsp)
je 0x5127
leaq 0x6e74(%rip), %rax      # 0xbb02
leaq 0x6e70(%rip), %r15      # 0xbb05
testb $0x1, %r14b
cmovneq %rax, %r15
movq 0x28(%rsp), %rdi
movq (%rsp), %rax
cmpb $0x1, 0xc(%rax)
jne 0x4eb5
movq %r15, %rsi
callq 0x2200
movq %rax, %r14
leaq 0xf8(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
addq %rsi, %rdx
leaq 0xe8(%rsp), %rdi
callq 0x547c
movq 0xe8(%rsp), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x51a5
movq 0xe8(%rsp), %rdi
cmpq %rbx, %rdi
je 0x4d10
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x21c0
movq %r14, %rdi
callq 0x5a68
movl $0x4040, %edi           # imm = 0x4040
callq 0x21b0
movq %rax, %r14
movq %rax, %rdi
movl $0x2a, %esi
callq 0x5c72
movq (%rsp), %rdi
movq %r14, 0x18(%rdi)
leaq 0x6dc8(%rip), %rsi      # 0xbb09
leaq 0x6d48(%rip), %rdx      # 0xba90
callq 0x47e8
movq (%rsp), %r14
movslq (%r14), %rdx
leaq 0x6e0e(%rip), %rsi      # 0xbb69
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x20a0
leaq 0x6d9f(%rip), %rsi      # 0xbb10
movq %r14, %rdi
movq %rbx, %rdx
callq 0x47e8
movq (%rsp), %r14
movl 0x4(%r14), %eax
cmpl $0x2, %eax
movl $0x1, %ecx
cmovgel %eax, %ecx
cmpl $0x4, %ecx
movl $0x4, %edx
cmovll %ecx, %edx
leaq 0x6dc8(%rip), %rsi      # 0xbb69
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x20a0
leaq 0x6d61(%rip), %rsi      # 0xbb18
movq %r14, %rdi
movq %rbx, %rdx
callq 0x47e8
cmpq $0x0, 0x10(%rsp)
je 0x5063
movq 0x8(%rsp), %rdx
leaq 0x6357(%rip), %rsi      # 0xb131
movq (%rsp), %rdi
callq 0x47e8
movq 0x8(%rsp), %rdi
leaq 0x6c27(%rip), %rsi      # 0xba16
callq 0x2200
movq %rax, %r14
movq (%rsp), %rax
movq %r14, 0x10(%rax)
leaq 0xd8(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
leaq 0xc8(%rsp), %rdi
callq 0x547c
movq 0xc8(%rsp), %rsi
movq %r14, %rdi
movl $0x1, %edx
callq 0x51a5
movq 0xc8(%rsp), %rdi
cmpq %rbx, %rdi
je 0x4e57
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x21c0
movq (%rsp), %r14
movq 0x10(%r14), %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x21f0
movq 0x10(%r14), %rdi
callq 0x2030
leaq 0x6cee(%rip), %rsi      # 0xbb69
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x20a0
leaq 0x6c91(%rip), %rsi      # 0xbb25
movq %r14, %rdi
movq %rbx, %rdx
callq 0x47e8
movq (%rsp), %rax
movq 0x10(%rax), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x21f0
jmp 0x508c
leaq 0x6b5a(%rip), %rsi      # 0xba16
callq 0x2200
movq %rax, %r12
leaq 0xb8(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
addq %rsi, %rdx
leaq 0xa8(%rsp), %rdi
callq 0x547c
movq 0xa8(%rsp), %rsi
movq %r12, %rdi
movl $0x1, %edx
callq 0x51a5
movq 0xa8(%rsp), %rdi
cmpq %rbx, %rdi
je 0x4f1c
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x21c0
movq %r12, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x21f0
movq %r12, %rdi
callq 0x2030
movq %rax, %r14
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x21f0
movq %r12, %rdi
callq 0x5aac
callq 0x444a
testb $0x1, 0x50(%rsp)
jne 0x512c
leaq 0x6bb7(%rip), %rsi      # 0xbb18
movl $0x2, %edx
callq 0x46e8
cmpl $0x2, %eax
movl $0x1, %ecx
cmovgel %eax, %ecx
cmpl $0x4, %ecx
movl $0x4, %eax
cmovll %ecx, %eax
movq (%rsp), %rbx
movl %eax, 0x4(%rbx)
cmpq $0x0, 0x10(%rsp)
je 0x4fa7
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x2200
movq %rax, %r15
movq 0x10(%rsp), %rdx
jmp 0x4fb3
movq 0xbffa(%rip), %rax      # 0x10fa8
movq (%rax), %r15
xorl %edx, %edx
movq %r15, 0x10(%rbx)
leaq 0x98(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq 0x8(%rsp), %rsi
addq %rsi, %rdx
leaq 0x88(%rsp), %rdi
callq 0x547c
movq 0x88(%rsp), %rsi
movq %r15, %rdi
xorl %edx, %edx
callq 0x51a5
movq 0x88(%rsp), %rdi
cmpq %rbx, %rdi
je 0x5007
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x6b2d(%rip), %rsi      # 0xbb3b
xorl %edx, %edx
callq 0x46e8
movq (%rsp), %rbx
testq %rax, %rax
je 0x5027
cmpq %r14, %rax
jne 0x5131
leaq 0x6ae2(%rip), %rsi      # 0xbb10
xorl %edx, %edx
callq 0x46e8
movl %eax, 0x8(%rbx)
testl %eax, %eax
setne %dl
movl (%rbx), %ecx
cmpl %eax, %ecx
setl %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x508c
movq 0x28(%rsp), %rsi
leaq 0x6b14(%rip), %rdi      # 0xbb6e
movl %eax, %edx
xorl %eax, %eax
callq 0x2300
leaq 0x60c7(%rip), %rsi      # 0xb131
leaq 0x6abe(%rip), %rdx      # 0xbb2f
movq (%rsp), %rdi
callq 0x47e8
movq 0xbf47(%rip), %rax      # 0x10fc8
movq (%rax), %rax
movq (%rsp), %rcx
movq %rax, 0x10(%rcx)
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x50a8
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x50c4
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21c0
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x691c(%rip), %rdi      # 0xb9f9
xorl %eax, %eax
callq 0x2300
leaq 0x609f(%rip), %rdi      # 0xb18a
xorl %eax, %eax
callq 0x2070
jmp 0x510b
movl (%rbx), %edx
leaq 0x68d5(%rip), %rdi      # 0xb9d2
leaq 0x6aca(%rip), %rsi      # 0xbbce
xorl %eax, %eax
callq 0x2070
xorl %edi, %edi
callq 0x2210
movq %r12, %rdi
callq 0x2404
movq %r12, %rdi
callq 0x2428
callq 0x2470
callq 0x244c
callq 0x43be
leaq 0x6a0d(%rip), %rdi      # 0xbb45
movq %rax, %rsi
xorl %eax, %eax
callq 0x2300
movq %rax, %rbx
movl $0x4040, %esi           # imm = 0x4040
movq %r14, %rdi
callq 0x21c0
jmp 0x5165
jmp 0x5162
jmp 0x5162
jmp 0x5162
jmp 0x5162
jmp 0x5162
jmp 0x5162
jmp 0x5162
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x5181
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x519d
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x22c0