// File: /workspace/github_cpp_makefile_star2_O3/vsklad[P]cgen/main.cpp
// Function: main
int main(int argc, const char * argv[]) {
    try {
        CGenCommandInfo info;
        CGenCommandLineReader command_line_reader(argc, argv);
        command_line_reader.parse(info);
        
        switch(info.command) {
            case cmdNone:
                std::cout << ERROR_COMMAND_NONE << std::endl;
                print_help();
            case cmdEncode:
                if (info.algorithm == algNone) {
                    throw std::invalid_argument(ERROR_MISSING_ALGORITHM);
                };
                
                generate_output_file_name(info);
                if (info.output_file_name.empty()) {
                    throw std::invalid_argument(ERROR_MISSING_OUTPUT_FILE_NAME);
                };
                
                _assert_level_1(info.b_formula_type_specified);
                std::cout << "Encoding " << (info.algorithm == algSHA1 ? "SHA-1" : "SHA-256");
                std::cout << " into " << get_formula_type_title(info.formula_type) << std::endl;
                
                if (info.formula_type == ftCnf) {
                    encode_cnf(info.algorithm, info.rounds,
                               info.variables_map,
                               info.add_max_args, info.xor_max_args,
                               info.output_file_name.c_str(),
                               info.output_format, info.trace_format,
                               info.b_reindex_variables,
                               info.b_normalize_variables_specified,
                               info.b_assign_after_encoding,
                               info.mode);
                } else if (info.formula_type == ftAnf) {
                    encode_anf(info.algorithm, info.rounds,
                               info.variables_map,
                               info.add_max_args, info.xor_max_args,
                               info.output_file_name.c_str(),
                               info.output_format, info.trace_format,
                               info.b_reindex_variables,
                               info.b_normalize_variables_specified,
                               info.b_assign_after_encoding,
                               info.mode);
                } else {
                    _assert_level_1(false);
                };
                break;
            case cmdProcess:
                _assert_level_1(info.b_formula_type_specified);
                generate_output_file_name(info);
                std::cout << "Processing " << get_formula_type_title(info.formula_type) << " formula" << std::endl;
                if (info.formula_type == ftCnf) {
                    process_cnf(info.variables_map,
                                info.input_file_name.data(), info.output_file_name.data(),
                                info.output_format, info.trace_format,
                                info.b_reindex_variables, info.b_normalize_variables_specified, info.mode);
                } else if (info.formula_type == ftAnf) {
                    process_anf(info.variables_map,
                                info.input_file_name.data(), info.output_file_name.data(),
                                info.output_format, info.trace_format,
                                info.b_reindex_variables, info.b_normalize_variables_specified, info.mode);
                } else {
                    _assert_level_1(false);
                };
                break;
            case cmdHelp:
                print_help();
                break;
            case cmdVersion:
                print_version();
                break;
        };
    }
    catch (TextReaderException e) {
        std::cerr << ERROR_COMMAND_LINE_PARSE << ": " << e.get_line() << std::endl;
        std::cerr << "Position " << e.get_pos() << ": " << e.get_message() << std::endl;
        std::cerr << "See --help for reference" << std::endl;
        return 1;
    }
    catch (std::invalid_argument e) {
        std::cerr << ERROR_INVALID_ARGUMENT << ": " << e.what() << std::endl;
        return 1;
    }
    catch (std::out_of_range e) {
        std::cerr << ERROR_OUT_OF_RANGE << ": " << e.what() << std::endl;
        return 1;
    };
    
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movaps 0xee7a(%rip), %xmm0     # 0x4b880
leaq -0xb0(%rbp), %rcx
movups %xmm0, -0x20(%rcx)
xorl %eax, %eax
movl %eax, -0x10(%rcx)
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
leaq -0x68(%rbp), %r14
xorps %xmm0, %xmm0
movups %xmm0, -0x28(%r14)
movl %eax, -0x18(%r14)
movq %r14, -0x10(%r14)
movq %rax, -0x8(%r14)
movb %al, (%r14)
leaq -0x48(%rbp), %r15
movq %r15, -0x10(%r15)
movq %rax, -0x8(%r15)
movb %al, (%r15)
movl $0x10000, 0x10(%r15)    # imm = 0x10000
movb %al, 0x14(%r15)
movl $0x2, 0x18(%r15)
leaq -0xf0(%rbp), %r12
movq $-0x1, -0x20(%r12)
movq %rax, -0x18(%r12)
movq %r12, -0x10(%r12)
movq %rax, -0x8(%r12)
movb %al, (%r12)
movq %rax, 0x10(%r12)
movl %eax, 0x18(%r12)
movl %eax, -0x38(%r12)
movl %edi, -0x34(%r12)
movq %rsi, -0x30(%r12)
leaq 0x1f22b(%rip), %rax     # 0x5bcd0
movq %rax, -0x40(%r12)
leaq 0x1f1cf(%rip), %rax     # 0x5bc80
addq $0x80, %rax
movq %rax, -0x28(%r12)
leaq 0x1f1e5(%rip), %rax     # 0x5bca8
movq %rax, -0x48(%r12)
leaq -0x138(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x19bfe
movl -0xd0(%rbp), %eax
cmpq $0x4, %rax
ja 0x3ce32
leaq 0xed9e(%rip), %rcx      # 0x4b890
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x1f4ae(%rip), %rbx     # 0x5bfb0
leaq 0xf221(%rip), %rsi      # 0x4bd2a
movl $0x14, %edx
movq %rbx, %rdi
callq 0xb320
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0xb2a0
movsbl %al, %esi
movq 0x1f47c(%rip), %rdi     # 0x5bfb0
callq 0xb030
movq %rax, %rdi
callq 0xb1a0
callq 0x3c2da
cmpl $0x0, -0xcc(%rbp)
je 0x3ce8d
leaq -0xd0(%rbp), %rdi
callq 0x3c685
cmpq $0x0, -0x50(%rbp)
je 0x3ceab
cmpb $0x0, -0x38(%rbp)
je 0x3cedd
movq 0x1f435(%rip), %rdi     # 0x5bfb0
leaq 0xf23f(%rip), %rsi      # 0x4bdc1
movl $0x9, %edx
callq 0xb320
xorl %eax, %eax
cmpl $0x1, -0xcc(%rbp)
setne %al
leaq 0xbdff(%rip), %rcx      # 0x4899e
leaq 0xcf6d(%rip), %rsi      # 0x49b13
cmoveq %rcx, %rsi
leaq 0x5(,%rax,2), %rdx
movq 0x1f3f7(%rip), %rdi     # 0x5bfb0
callq 0xb320
movq 0x1f3eb(%rip), %rdi     # 0x5bfb0
leaq 0xf1ff(%rip), %rsi      # 0x4bdcb
movl $0x6, %edx
callq 0xb320
cmpl $0x0, -0xc8(%rbp)
leaq 0x8d06(%rip), %rax      # 0x458ea
leaq 0x8cfb(%rip), %rsi      # 0x458e6
cmoveq %rax, %rsi
movq 0x1f3ba(%rip), %rbx     # 0x5bfb0
movl $0x3, %edx
movq %rbx, %rdi
callq 0xb320
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0xb2a0
movsbl %al, %esi
movq 0x1f38f(%rip), %rdi     # 0x5bfb0
callq 0xb030
movq %rax, %rdi
callq 0xb1a0
movl -0xc8(%rbp), %eax
cmpl $0x1, %eax
je 0x3cda4
testl %eax, %eax
jne 0x3cf1b
leaq -0xb8(%rbp), %rdx
movl 0x30(%rdx), %esi
movl 0x34(%rdx), %ecx
movl 0x38(%rdx), %r8d
movq 0x60(%rdx), %r9
movl -0x14(%rdx), %edi
movl -0xc(%rdx), %eax
movl -0x8(%rdx), %r10d
movzbl 0x82(%rdx), %r11d
movzbl 0x83(%rdx), %ebx
movzbl 0x81(%rdx), %r13d
movl 0x88(%rdx), %r14d
pushq %r14
pushq %r13
pushq %rbx
pushq %r11
pushq %r10
pushq %rax
callq 0x2036b
addq $0x30, %rsp
leaq -0x68(%rbp), %r14
jmp 0x3ce32
callq 0x3c264
jmp 0x3ce32
cmpb $0x0, -0x38(%rbp)
je 0x3cefc
leaq -0xd0(%rbp), %rdi
callq 0x3c685
movq 0x1f2eb(%rip), %rdi     # 0x5bfb0
leaq 0xf106(%rip), %rsi      # 0x4bdd2
movl $0xb, %edx
callq 0xb320
cmpl $0x0, -0xc8(%rbp)
leaq 0x8c06(%rip), %rax      # 0x458ea
leaq 0x8bfb(%rip), %rsi      # 0x458e6
cmoveq %rax, %rsi
movq 0x1f2ba(%rip), %rdi     # 0x5bfb0
movl $0x3, %edx
callq 0xb320
movq 0x1f2a9(%rip), %rbx     # 0x5bfb0
leaq 0x8ef0(%rip), %rsi      # 0x45bfe
movl $0x8, %edx
movq %rbx, %rdi
callq 0xb320
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0xb2a0
movsbl %al, %esi
movq 0x1f277(%rip), %rdi     # 0x5bfb0
callq 0xb030
movq %rax, %rdi
callq 0xb1a0
movl -0xc8(%rbp), %eax
cmpl $0x1, %eax
je 0x3cdfa
testl %eax, %eax
jne 0x3cf3a
leaq -0xb8(%rbp), %rdi
movq 0x40(%rdi), %rsi
movq 0x60(%rdi), %rdx
movl -0xc(%rdi), %ecx
movl -0x8(%rdi), %r8d
movzbl 0x82(%rdi), %r9d
movzbl 0x83(%rdi), %eax
movl 0x88(%rdi), %r10d
pushq %r10
pushq %rax
callq 0x209a2
addq $0x10, %rsp
jmp 0x3ce32
callq 0x3c2da
jmp 0x3ce32
leaq -0xb8(%rbp), %rdx
movl 0x30(%rdx), %esi
movl 0x34(%rdx), %ecx
movl 0x38(%rdx), %r8d
movq 0x60(%rdx), %r9
movl -0x14(%rdx), %edi
movl -0xc(%rdx), %eax
movl -0x8(%rdx), %r10d
movzbl 0x82(%rdx), %r11d
movzbl 0x83(%rdx), %ebx
movzbl 0x81(%rdx), %r14d
movl 0x88(%rdx), %r13d
pushq %r13
pushq %r14
leaq -0x68(%rbp), %r14
pushq %rbx
pushq %r11
pushq %r10
pushq %rax
callq 0x1fdcc
addq $0x30, %rsp
jmp 0x3ce32
leaq -0xb8(%rbp), %rdi
movq 0x40(%rdi), %rsi
movq 0x60(%rdi), %rdx
movl -0xc(%rdi), %ecx
movl -0x8(%rdi), %r8d
movzbl 0x82(%rdi), %r9d
movzbl 0x83(%rdi), %eax
movl 0x88(%rdi), %r10d
pushq %r10
pushq %rax
callq 0x207ba
addq $0x10, %rsp
leaq 0x1ec4f(%rip), %rax     # 0x5ba88
movq %rax, -0x118(%rbp)
movq -0x100(%rbp), %rdi
cmpq %r12, %rdi
je 0x3ce51
callq 0xb280
movq -0x58(%rbp), %rdi
cmpq %r15, %rdi
je 0x3ce5f
callq 0xb280
movq -0x78(%rbp), %rdi
cmpq %r14, %rdi
je 0x3ce6d
callq 0xb280
leaq -0xb8(%rbp), %rdi
callq 0x3d2fe
xorl %eax, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0xb130
movq %rax, %r15
leaq 0xee9e(%rip), %rsi      # 0x4bd3f
movq %rax, %rdi
callq 0xb520
jmp 0x3cec7
movl $0x10, %edi
callq 0xb130
movq %rax, %r15
leaq 0xeea5(%rip), %rsi      # 0x4bd64
movq %rax, %rdi
callq 0xb520
movq 0x1f10a(%rip), %rsi     # 0x5bfd8
movq 0x1f0eb(%rip), %rdx     # 0x5bfc0
movq %r15, %rdi
callq 0xb4b0
leaq 0xeea2(%rip), %rdi      # 0x4bd86
leaq 0xedec(%rip), %rsi      # 0x4bcd7
leaq 0xeeb2(%rip), %rcx      # 0x4bda4
movl $0x77, %edx
callq 0xb180
leaq 0xee83(%rip), %rdi      # 0x4bd86
leaq 0xedcd(%rip), %rsi      # 0x4bcd7
leaq 0xee93(%rip), %rcx      # 0x4bda4
movl $0x94, %edx
callq 0xb180
leaq 0xad80(%rip), %rdi      # 0x47ca2
leaq 0xedae(%rip), %rsi      # 0x4bcd7
leaq 0xee74(%rip), %rcx      # 0x4bda4
movl $0x90, %edx
callq 0xb180
leaq 0xad61(%rip), %rdi      # 0x47ca2
leaq 0xed8f(%rip), %rsi      # 0x4bcd7
leaq 0xee55(%rip), %rcx      # 0x4bda4
movl $0xa2, %edx
callq 0xb180
jmp 0x3cf5b
movq %rdx, %r14
movq %rax, %rbx
movq %r15, %rdi
callq 0xb1e0
jmp 0x3cf71
movq %rdx, %r14
movq %rax, %rbx
leaq 0x1eb10(%rip), %rax     # 0x5ba88
movq %rax, -0x118(%rbp)
movq -0x100(%rbp), %rdi
cmpq %r12, %rdi
je 0x3cf90
callq 0xb280
leaq -0xd0(%rbp), %rdi
callq 0x3d234
cmpl $0x3, %r14d
jne 0x3d09e
movq %rbx, %rdi
callq 0xb370
leaq -0xd0(%rbp), %rdi
movq %rax, %rsi
callq 0x38926
movq %rbx, %rdi
callq 0xb100
movq 0x1f024(%rip), %rdi     # 0x5bff0
leaq 0xee1e(%rip), %rsi      # 0x4bdf1
movl $0x1a, %edx
callq 0xb320
movq 0x1f00c(%rip), %rdi     # 0x5bff0
leaq 0x93de(%rip), %rsi      # 0x463c9
movl $0x2, %edx
callq 0xb320
movq -0xc0(%rbp), %rsi
movq 0x1efed(%rip), %rdi     # 0x5bff0
callq 0xb2b0
movq %rax, %rdi
callq 0xb120
movq 0x1efd9(%rip), %rdi     # 0x5bff0
leaq 0xedee(%rip), %rsi      # 0x4be0c
movl $0x9, %edx
callq 0xb320
movq -0xc8(%rbp), %rsi
movq 0x1efba(%rip), %rdi     # 0x5bff0
callq 0xb190
movq %rax, %rbx
leaq 0x9384(%rip), %rsi      # 0x463c9
movl $0x2, %edx
movq %rax, %rdi
callq 0xb320
movq -0xa0(%rbp), %rsi
movq %rbx, %rdi
callq 0xb2b0
movq %rax, %rdi
callq 0xb120
movq 0x1ef80(%rip), %rdi     # 0x5bff0
leaq 0xed9f(%rip), %rsi      # 0x4be16
movl $0x18, %edx
callq 0xb320
movq 0x1ef68(%rip), %rdi     # 0x5bff0
callq 0xb120
leaq -0xd0(%rbp), %rdi
callq 0x1d9de
jmp 0x3d1d5
cmpl $0x2, %r14d
jne 0x3d13c
movq %rbx, %rdi
callq 0xb370
leaq -0xd0(%rbp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0xb480
movq 0x1eed7(%rip), %rax     # 0x5bfa0
addq $0x10, %rax
movq %rax, (%r14)
movq %rbx, %rdi
callq 0xb100
movq 0x1ef11(%rip), %rdi     # 0x5bff0
leaq 0xed05(%rip), %rsi      # 0x4bdeb
movl $0x5, %edx
callq 0xb320
movq 0x1eef9(%rip), %rdi     # 0x5bff0
leaq 0x92cb(%rip), %rsi      # 0x463c9
movl $0x2, %edx
callq 0xb320
leaq -0xd0(%rbp), %rdi
callq 0xb3d0
movq 0x1eed5(%rip), %rdi     # 0x5bff0
movq %rax, %rsi
callq 0xb2b0
movq %rax, %rdi
callq 0xb120
leaq -0xd0(%rbp), %rdi
callq 0xb560
jmp 0x3d1d5
cmpl $0x1, %r14d
jne 0x3d224
movq %rbx, %rdi
callq 0xb370
leaq -0xd0(%rbp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0xb480
movq 0x1ee41(%rip), %rax     # 0x5bfa8
addq $0x10, %rax
movq %rax, (%r14)
movq %rbx, %rdi
callq 0xb100
movq 0x1ee73(%rip), %rdi     # 0x5bff0
leaq 0xec5a(%rip), %rsi      # 0x4bdde
movl $0xc, %edx
callq 0xb320
movq 0x1ee5b(%rip), %rdi     # 0x5bff0
leaq 0x922d(%rip), %rsi      # 0x463c9
movl $0x2, %edx
callq 0xb320
leaq -0xd0(%rbp), %rdi
callq 0xb3d0
movq 0x1ee37(%rip), %rdi     # 0x5bff0
movq %rax, %rsi
callq 0xb2b0
movq %rax, %rdi
callq 0xb120
leaq -0xd0(%rbp), %rdi
callq 0xb558
callq 0xb460
movl $0x1, %eax
jmp 0x3ce7b
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0xb558
callq 0xb460
jmp 0x3d224
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0xb560
callq 0xb460
jmp 0x3d224
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x1d9de
callq 0xb460
movq %rbx, %rdi
callq 0xb4e0
movq %rax, %rdi
callq 0x1d8eb