// File: /workspace/github_cpp_makefile_star2_O1/vsklad[P]cgen/commands.cpp
// Function: void load_impl<bal::Cnf, bal::DimacsStreamReader>(bal::Cnf&, char const*)
void load_impl(Formula& formula, const char* const file_name) {
    std::cout << "Input file: " << file_name << std::endl;
    
    if (std::strlen(file_name) == 0) {
        throw std::invalid_argument(ERROR_MISSING_INPUT_FILE_NAME);
    };
    
    std::ifstream file(file_name);
    if (file.is_open()) {
        try {
            Reader reader(file);
            reader.read(formula);
            file.close();
        }
        catch (TextReaderException e) {
            std::cout << "Parse error: " << e << std::endl;
            throw std::invalid_argument("Failed to load the input file");
        }
    }
    else {
        throw std::invalid_argument("Failed to open the input file");
    };
    print_statistics(formula);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x270, %rsp            # imm = 0x270
movq %rsi, %r14
movq %rdi, %rbx
movq 0x37c85(%rip), %r15     # 0x5efa8
leaq 0x256b7(%rip), %rsi     # 0x4c9e1
movl $0xc, %edx
movq %r15, %rdi
callq 0xc320
testq %r14, %r14
je 0x27358
movq %r14, %rdi
callq 0xc110
movq 0x37c5d(%rip), %rdi     # 0x5efa8
movq %r14, %rsi
movq %rax, %rdx
callq 0xc320
jmp 0x27370
movq (%r15), %rax
movq -0x18(%rax), %rax
leaq (%r15,%rax), %rdi
movl 0x20(%r15,%rax), %esi
orl $0x1, %esi
callq 0xc4a0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0xc2a0
movsbl %al, %esi
movq %r15, %rdi
callq 0xc030
movq %rax, %rdi
callq 0xc1a0
cmpb $0x0, (%r14)
je 0x2747b
leaq -0x288(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
movl $0x8, %edx
callq 0xc500
leaq -0x210(%rbp), %rdi
callq 0xc080
testb %al, %al
je 0x274ad
leaq -0x40(%rbp), %r12
movq $-0x1, -0x20(%r12)
xorl %eax, %eax
movq %rax, -0x18(%r12)
movq %r12, -0x10(%r12)
movq %rax, -0x8(%r12)
movb $0x0, (%r12)
movq %rax, 0x10(%r12)
movl $0x0, 0x18(%r12)
movq %r15, -0x30(%r12)
leaq 0x3751f(%rip), %rax     # 0x5e928
movq %rax, -0x40(%r12)
leaq 0x37553(%rip), %rax     # 0x5e968
movq %rax, -0x38(%r12)
leaq 0x37587(%rip), %rax     # 0x5e9a8
movq %rax, -0x28(%r12)
leaq -0x80(%rbp), %rdi
movq %rbx, %rsi
callq 0x3b5a6
leaq -0x288(%rbp), %rdi
callq 0xc070
leaq 0x3748b(%rip), %rax     # 0x5e8d0
movq %rax, -0x68(%rbp)
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
je 0x27457
callq 0xc280
movq %rbx, %rdi
callq 0x1f912
leaq -0x288(%rbp), %rdi
callq 0xc090
addq $0x270, %rsp            # imm = 0x270
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0xc130
movq %rax, %r14
leaq 0x206df(%rip), %rsi     # 0x47b6e
movq %rax, %rdi
callq 0xc520
movq 0x37b32(%rip), %rsi     # 0x5efd0
movq 0x37b13(%rip), %rdx     # 0x5efb8
movq %r14, %rdi
callq 0xc4b0
movl $0x10, %edi
callq 0xc130
movq %rax, %r14
leaq 0x25559(%rip), %rsi     # 0x4ca1a
movq %rax, %rdi
callq 0xc520
movq 0x37b00(%rip), %rsi     # 0x5efd0
movq 0x37ae1(%rip), %rdx     # 0x5efb8
movq %r14, %rdi
callq 0xc4b0
jmp 0x275b3
movq %rax, %rbx
movq %r14, %rdi
callq 0xc1e0
jmp 0x275d1
movq %rax, %rbx
movq %r14, %rdi
callq 0xc1e0
jmp 0x275dd
movq %rax, %rbx
jmp 0x275d1
movq %rdx, %r14
movq %rax, %rbx
leaq 0x373b7(%rip), %rax     # 0x5e8d0
movq %rax, -0x68(%rbp)
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
je 0x2752b
callq 0xc280
cmpl $0x1, %r14d
jne 0x275d1
movq %rbx, %rdi
callq 0xc370
leaq -0x80(%rbp), %rdi
movq %rax, %rsi
callq 0x3a928
movq %rbx, %rdi
callq 0xc100
movq 0x37a50(%rip), %rdi     # 0x5efa8
leaq 0x2548f(%rip), %rsi     # 0x4c9ee
movl $0xd, %edx
callq 0xc320
movq 0x37a38(%rip), %rdi     # 0x5efa8
leaq -0x80(%rbp), %rsi
callq 0x3a99b
movq %rax, %rdi
callq 0xc120
movl $0x10, %edi
callq 0xc130
movq %rax, %r14
leaq 0x25467(%rip), %rsi     # 0x4c9fc
movq %rax, %rdi
callq 0xc520
movq 0x37a2c(%rip), %rsi     # 0x5efd0
movq 0x37a0d(%rip), %rdx     # 0x5efb8
movq %r14, %rdi
callq 0xc4b0
movq %rax, %rbx
movq %r14, %rdi
callq 0xc1e0
jmp 0x275c3
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x1f1ce
callq 0xc460
leaq -0x288(%rbp), %rdi
callq 0xc090
movq %rbx, %rdi
callq 0xc4e0
movq %rax, %rdi
callq 0x1f0db