// File: vsklad[P]cgen/commands.cpp
// Function: void load_impl<bal::Anf, bal::PolyBoRiStreamReader>(bal::Anf&, 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
subq $0x320, %rsp            # imm = 0x320
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq 0x4f626(%rip), %rdi     # 0x82fa0
leaq 0x3365c(%rip), %rsi     # 0x66fdd
callq 0xd320
movq %rax, %rdi
movq -0x10(%rbp), %rsi
callq 0xd320
movq %rax, %rdi
movq 0x4f5e4(%rip), %rsi     # 0x82f80
callq 0xd360
movq -0x10(%rbp), %rdi
callq 0xd140
cmpq $0x0, %rax
jne 0x33a0c
movl $0x10, %edi
callq 0xd150
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x2e0(%rbp)
leaq 0x2e1c8(%rip), %rsi     # 0x61b96
callq 0xd5f0
jmp 0x339d5
movq -0x2e0(%rbp), %rdi
movq 0x4f5f5(%rip), %rsi     # 0x82fd8
movq 0x4f5d6(%rip), %rdx     # 0x82fc0
callq 0xd570
movq -0x2e0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
callq 0xd210
jmp 0x33c5a
movq -0x10(%rbp), %rsi
leaq -0x228(%rbp), %rdi
movq %rdi, -0x2f0(%rbp)
movl $0x8, %edx
callq 0xd5d0
movq -0x2f0(%rbp), %rdi
callq 0xd500
movb %al, -0x2e1(%rbp)
jmp 0x33a3c
movb -0x2e1(%rbp), %al
testb $0x1, %al
jne 0x33a4b
jmp 0x33bd3
leaq -0x288(%rbp), %rdi
leaq -0x228(%rbp), %rsi
callq 0x52c40
jmp 0x33a60
movq -0x8(%rbp), %rsi
leaq -0x288(%rbp), %rdi
callq 0x52d00
jmp 0x33a72
leaq -0x228(%rbp), %rdi
callq 0xd090
jmp 0x33a80
leaq -0x288(%rbp), %rdi
callq 0x531c0
jmp 0x33bd1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x33c4e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x33ac8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x288(%rbp), %rdi
callq 0x531c0
movl -0x1c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x33c4e
movq -0x18(%rbp), %rdi
movq %rdi, -0x2f8(%rbp)
callq 0xd3e0
movq %rax, %rsi
leaq -0x2d8(%rbp), %rdi
callq 0x53220
jmp 0x33af9
movq -0x2f8(%rbp), %rdi
callq 0xd110
movq 0x4f494(%rip), %rdi     # 0x82fa0
leaq 0x334d7(%rip), %rsi     # 0x66fea
callq 0xd320
movq %rax, -0x300(%rbp)
jmp 0x33b21
movq -0x300(%rbp), %rdi
leaq -0x2d8(%rbp), %rsi
callq 0x532a0
movq %rax, -0x308(%rbp)
jmp 0x33b3d
movq -0x308(%rbp), %rdi
movq 0x4f435(%rip), %rsi     # 0x82f80
callq 0xd360
jmp 0x33b52
movl $0x10, %edi
callq 0xd150
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x310(%rbp)
leaq 0x33488(%rip), %rsi     # 0x66ff8
callq 0xd5f0
jmp 0x33b77
movq -0x310(%rbp), %rdi
movq 0x4f453(%rip), %rsi     # 0x82fd8
movq 0x4f434(%rip), %rdx     # 0x82fc0
callq 0xd570
jmp 0x33c6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x33bbc
movq -0x310(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
callq 0xd210
leaq -0x2d8(%rbp), %rdi
callq 0x283c0
callq 0xd520
jmp 0x33bcf
jmp 0x33c4e
jmp 0x33c2e
movl $0x10, %edi
callq 0xd150
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x318(%rbp)
leaq 0x33425(%rip), %rsi     # 0x67016
callq 0xd5f0
jmp 0x33bf8
movq -0x318(%rbp), %rdi
movq 0x4f3d2(%rip), %rsi     # 0x82fd8
movq 0x4f3b3(%rip), %rdx     # 0x82fc0
callq 0xd570
jmp 0x33c6b
movq -0x318(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
callq 0xd210
jmp 0x33c4e
movq -0x8(%rbp), %rdi
callq 0x298a0
jmp 0x33c39
leaq -0x228(%rbp), %rdi
callq 0xd0c0
addq $0x320, %rsp            # imm = 0x320
popq %rbp
retq
leaq -0x228(%rbp), %rdi
callq 0xd0c0
movq -0x18(%rbp), %rdi
callq 0xd5a0
movq %rax, %rdi
callq 0x11090
nopl (%rax,%rax)