// File: /workspace/github_cpp_makefile_star2_O1/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 0xef7c(%rip), %xmm0     # 0x4d980
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 0x2014d(%rip), %rax     # 0x5ebf0
movq %rax, -0x48(%r12)
leaq 0x20119(%rip), %rax     # 0x5ebc8
leaq 0x20162(%rip), %rcx     # 0x5ec18
movq %rcx, -0x40(%r12)
addq $0x80, %rax
movq %rax, -0x28(%r12)
leaq -0x138(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x1b224
movl -0xd0(%rbp), %eax
cmpq $0x4, %rax
ja 0x3ee30
leaq 0xeea0(%rip), %rcx      # 0x4d990
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x204a8(%rip), %rbx     # 0x5efa8
leaq 0xf323(%rip), %rsi      # 0x4de2a
movl $0x14, %edx
movq %rbx, %rdi
callq 0xc320
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0xc2a0
movsbl %al, %esi
movq 0x20476(%rip), %rdi     # 0x5efa8
callq 0xc030
movq %rax, %rdi
callq 0xc1a0
callq 0x3e2c6
cmpl $0x0, -0xcc(%rbp)
je 0x3ee8b
leaq -0xd0(%rbp), %rdi
callq 0x3e67a
cmpq $0x0, -0x50(%rbp)
je 0x3eea9
cmpb $0x0, -0x38(%rbp)
je 0x3eedb
movq 0x2042f(%rip), %rdi     # 0x5efa8
leaq 0xf341(%rip), %rsi      # 0x4dec1
movl $0x9, %edx
callq 0xc320
xorl %eax, %eax
cmpl $0x1, -0xcc(%rbp)
setne %al
leaq 0xbdf1(%rip), %rcx      # 0x4a98e
leaq 0xcff9(%rip), %rsi      # 0x4bb9d
cmoveq %rcx, %rsi
leaq 0x5(,%rax,2), %rdx
movq 0x203f1(%rip), %rdi     # 0x5efa8
callq 0xc320
movq 0x203e5(%rip), %rdi     # 0x5efa8
leaq 0xf301(%rip), %rsi      # 0x4decb
movl $0x6, %edx
callq 0xc320
cmpl $0x0, -0xc8(%rbp)
leaq 0x8cf8(%rip), %rax      # 0x478da
leaq 0x8ced(%rip), %rsi      # 0x478d6
cmoveq %rax, %rsi
movq 0x203b4(%rip), %rbx     # 0x5efa8
movl $0x3, %edx
movq %rbx, %rdi
callq 0xc320
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0xc2a0
movsbl %al, %esi
movq 0x20389(%rip), %rdi     # 0x5efa8
callq 0xc030
movq %rax, %rdi
callq 0xc1a0
movl -0xc8(%rbp), %eax
cmpl $0x1, %eax
je 0x3eda2
testl %eax, %eax
jne 0x3ef19
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 0x21aad
addq $0x30, %rsp
leaq -0x68(%rbp), %r14
jmp 0x3ee30
callq 0x3e250
jmp 0x3ee30
cmpb $0x0, -0x38(%rbp)
je 0x3eefa
leaq -0xd0(%rbp), %rdi
callq 0x3e67a
movq 0x202e5(%rip), %rdi     # 0x5efa8
leaq 0xf208(%rip), %rsi      # 0x4ded2
movl $0xb, %edx
callq 0xc320
cmpl $0x0, -0xc8(%rbp)
leaq 0x8bf8(%rip), %rax      # 0x478da
leaq 0x8bed(%rip), %rsi      # 0x478d6
cmoveq %rax, %rsi
movq 0x202b4(%rip), %rdi     # 0x5efa8
movl $0x3, %edx
callq 0xc320
movq 0x202a3(%rip), %rbx     # 0x5efa8
leaq 0x8ee2(%rip), %rsi      # 0x47bee
movl $0x8, %edx
movq %rbx, %rdi
callq 0xc320
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0xc2a0
movsbl %al, %esi
movq 0x20271(%rip), %rdi     # 0x5efa8
callq 0xc030
movq %rax, %rdi
callq 0xc1a0
movl -0xc8(%rbp), %eax
cmpl $0x1, %eax
je 0x3edf8
testl %eax, %eax
jne 0x3ef38
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 0x220ec
addq $0x10, %rsp
jmp 0x3ee30
callq 0x3e2c6
jmp 0x3ee30
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 0x214d2
addq $0x30, %rsp
jmp 0x3ee30
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 0x21f04
addq $0x10, %rsp
leaq 0x1fa99(%rip), %rax     # 0x5e8d0
movq %rax, -0x118(%rbp)
movq -0x100(%rbp), %rdi
cmpq %r12, %rdi
je 0x3ee4f
callq 0xc280
movq -0x58(%rbp), %rdi
cmpq %r15, %rdi
je 0x3ee5d
callq 0xc280
movq -0x78(%rbp), %rdi
cmpq %r14, %rdi
je 0x3ee6b
callq 0xc280
leaq -0xb8(%rbp), %rdi
callq 0x3f2fc
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 0xc130
movq %rax, %r15
leaq 0xefa0(%rip), %rsi      # 0x4de3f
movq %rax, %rdi
callq 0xc520
jmp 0x3eec5
movl $0x10, %edi
callq 0xc130
movq %rax, %r15
leaq 0xefa7(%rip), %rsi      # 0x4de64
movq %rax, %rdi
callq 0xc520
movq 0x20104(%rip), %rsi     # 0x5efd0
movq 0x200e5(%rip), %rdx     # 0x5efb8
movq %r15, %rdi
callq 0xc4b0
leaq 0xefa4(%rip), %rdi      # 0x4de86
leaq 0xeeee(%rip), %rsi      # 0x4ddd7
leaq 0xefb4(%rip), %rcx      # 0x4dea4
movl $0x77, %edx
callq 0xc180
leaq 0xef85(%rip), %rdi      # 0x4de86
leaq 0xeecf(%rip), %rsi      # 0x4ddd7
leaq 0xef95(%rip), %rcx      # 0x4dea4
movl $0x94, %edx
callq 0xc180
leaq 0xad72(%rip), %rdi      # 0x49c92
leaq 0xeeb0(%rip), %rsi      # 0x4ddd7
leaq 0xef76(%rip), %rcx      # 0x4dea4
movl $0x90, %edx
callq 0xc180
leaq 0xad53(%rip), %rdi      # 0x49c92
leaq 0xee91(%rip), %rsi      # 0x4ddd7
leaq 0xef57(%rip), %rcx      # 0x4dea4
movl $0xa2, %edx
callq 0xc180
jmp 0x3ef59
movq %rdx, %r14
movq %rax, %rbx
movq %r15, %rdi
callq 0xc1e0
jmp 0x3ef6f
movq %rdx, %r14
movq %rax, %rbx
leaq 0x1f95a(%rip), %rax     # 0x5e8d0
movq %rax, -0x118(%rbp)
movq -0x100(%rbp), %rdi
cmpq %r12, %rdi
je 0x3ef8e
callq 0xc280
leaq -0xd0(%rbp), %rdi
callq 0x3f232
cmpl $0x3, %r14d
jne 0x3f09c
movq %rbx, %rdi
callq 0xc370
leaq -0xd0(%rbp), %rdi
movq %rax, %rsi
callq 0x3a928
movq %rbx, %rdi
callq 0xc100
movq 0x2001e(%rip), %rdi     # 0x5efe8
leaq 0xef20(%rip), %rsi      # 0x4def1
movl $0x1a, %edx
callq 0xc320
movq 0x20006(%rip), %rdi     # 0x5efe8
leaq 0x93d0(%rip), %rsi      # 0x483b9
movl $0x2, %edx
callq 0xc320
movq -0xc0(%rbp), %rsi
movq 0x1ffe7(%rip), %rdi     # 0x5efe8
callq 0xc2b0
movq %rax, %rdi
callq 0xc120
movq 0x1ffd3(%rip), %rdi     # 0x5efe8
leaq 0xeef0(%rip), %rsi      # 0x4df0c
movl $0x9, %edx
callq 0xc320
movq -0xc8(%rbp), %rsi
movq 0x1ffb4(%rip), %rdi     # 0x5efe8
callq 0xc190
movq %rax, %rbx
leaq 0x9376(%rip), %rsi      # 0x483b9
movl $0x2, %edx
movq %rax, %rdi
callq 0xc320
movq -0xa0(%rbp), %rsi
movq %rbx, %rdi
callq 0xc2b0
movq %rax, %rdi
callq 0xc120
movq 0x1ff7a(%rip), %rdi     # 0x5efe8
leaq 0xeea1(%rip), %rsi      # 0x4df16
movl $0x18, %edx
callq 0xc320
movq 0x1ff62(%rip), %rdi     # 0x5efe8
callq 0xc120
leaq -0xd0(%rbp), %rdi
callq 0x1f1ce
jmp 0x3f1d3
cmpl $0x2, %r14d
jne 0x3f13a
movq %rbx, %rdi
callq 0xc370
leaq -0xd0(%rbp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0xc480
movq 0x1fed1(%rip), %rax     # 0x5ef98
addq $0x10, %rax
movq %rax, (%r14)
movq %rbx, %rdi
callq 0xc100
movq 0x1ff0b(%rip), %rdi     # 0x5efe8
leaq 0xee07(%rip), %rsi      # 0x4deeb
movl $0x5, %edx
callq 0xc320
movq 0x1fef3(%rip), %rdi     # 0x5efe8
leaq 0x92bd(%rip), %rsi      # 0x483b9
movl $0x2, %edx
callq 0xc320
leaq -0xd0(%rbp), %rdi
callq 0xc3d0
movq 0x1fecf(%rip), %rdi     # 0x5efe8
movq %rax, %rsi
callq 0xc2b0
movq %rax, %rdi
callq 0xc120
leaq -0xd0(%rbp), %rdi
callq 0xc560
jmp 0x3f1d3
cmpl $0x1, %r14d
jne 0x3f222
movq %rbx, %rdi
callq 0xc370
leaq -0xd0(%rbp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0xc480
movq 0x1fe3b(%rip), %rax     # 0x5efa0
addq $0x10, %rax
movq %rax, (%r14)
movq %rbx, %rdi
callq 0xc100
movq 0x1fe6d(%rip), %rdi     # 0x5efe8
leaq 0xed5c(%rip), %rsi      # 0x4dede
movl $0xc, %edx
callq 0xc320
movq 0x1fe55(%rip), %rdi     # 0x5efe8
leaq 0x921f(%rip), %rsi      # 0x483b9
movl $0x2, %edx
callq 0xc320
leaq -0xd0(%rbp), %rdi
callq 0xc3d0
movq 0x1fe31(%rip), %rdi     # 0x5efe8
movq %rax, %rsi
callq 0xc2b0
movq %rax, %rdi
callq 0xc120
leaq -0xd0(%rbp), %rdi
callq 0xc558
callq 0xc460
movl $0x1, %eax
jmp 0x3ee79
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0xc558
callq 0xc460
jmp 0x3f222
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0xc560
callq 0xc460
jmp 0x3f222
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x1f1ce
callq 0xc460
movq %rbx, %rdi
callq 0xc4e0
movq %rax, %rdi
callq 0x1f0db