// File: /workspace/github_c_makefile_star2_O2/reactive-systems[P]aiger-ltl-model-checker/main.c
// Function: main
int main(int argc, const char* argv[]) {
    
    if (argc < 2) {
        fprintf(stderr, "Expect at least one input\n");
        print_usage(argv[0]);
        return 1;
    }
    
    const char* monitor_file_name;
    const char* implementation_file_name;
    if (argc == 3) {
        monitor_file_name = argv[1];
        implementation_file_name = argv[2];
    } else {
        assert(argc == 2);
        // monitor is given via stdin
        monitor_file_name = NULL;
        implementation_file_name = argv[1];
    }
    
    aiger* monitor = aiger_init();
    if (monitor == NULL) {
        return 1;
    }
    
    if (monitor_file_name != NULL) {
        if (aiger_open_and_read_from_file(monitor, monitor_file_name) != NULL) {
            fprintf(stderr, "error: cannot read monitor file\n");
            return 1;
        }
    } else {
        if (aiger_read_from_file(monitor, stdin) != NULL) {
            fprintf(stderr, "error: cannot read monitor file\n");
            return 1;
        }
    }
    
    aiger* implementation = aiger_init();
    if (implementation == NULL) {
        return 1;
    }
    
    if (aiger_open_and_read_from_file(implementation, implementation_file_name) != NULL) {
        fprintf(stderr, "error: cannot read implementation file\n");
        return 1;
    }
    
    aiger* combination = combine(monitor, implementation);
    if (combination == NULL) {
        return 1;
    }
    
    assert(!aiger_check(combination));

    //aiger_reencode(combination);
    aiger_write_to_file(combination, aiger_binary_mode, stdout);
    
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
cmpl $0x1, %edi
jle 0x13a4
cmpl $0x2, %edi
je 0x12f8
cmpl $0x3, %edi
jne 0x140c
movq 0x8(%rbx), %r12
pushq $0x10
popq %rax
jmp 0x12fe
pushq $0x8
popq %rax
xorl %r12d, %r12d
movq (%rbx,%rax), %r15
callq 0x1b4a
pushq $0x1
popq %rbx
testq %rax, %rax
je 0x13fe
movq %rax, %r14
testq %r12, %r12
je 0x1328
movq %r14, %rdi
movq %r12, %rsi
callq 0x5fba
jmp 0x133a
movq 0xaca9(%rip), %rax      # 0xbfd8
movq (%rax), %rsi
movq %r14, %rdi
callq 0x5f77
testq %rax, %rax
jne 0x13cd
callq 0x1b4a
testq %rax, %rax
je 0x13fe
movq %rax, %r12
movq %rax, %rdi
movq %r15, %rsi
callq 0x5fba
testq %rax, %rax
jne 0x13e2
movq %r14, %rdi
movq %r12, %rsi
callq 0x1444
testq %rax, %rax
je 0x13fe
movq %rax, %r14
movq %rax, %rdi
callq 0x2d8d
testq %rax, %rax
jne 0x1425
movq 0xac3d(%rip), %rax      # 0xbfd0
movq (%rax), %rdx
xorl %ebx, %ebx
movq %r14, %rdi
xorl %esi, %esi
callq 0x4b34
jmp 0x13fe
movq 0xac4d(%rip), %rax      # 0xbff8
movq (%rax), %rcx
leaq 0x6cb1(%rip), %rdi      # 0x8066
pushq $0x1a
popq %rsi
pushq $0x1
popq %rdx
callq 0x1190
movq (%rbx), %rdi
callq 0x12bc
pushq $0x1
popq %rbx
jmp 0x13fe
movq 0xac24(%rip), %rax      # 0xbff8
movq (%rax), %rcx
leaq 0x6cd1(%rip), %rdi      # 0x80af
pushq $0x20
jmp 0x13f5
movq 0xac0f(%rip), %rax      # 0xbff8
movq (%rax), %rcx
leaq 0x6cdd(%rip), %rdi      # 0x80d0
pushq $0x27
popq %rsi
pushq $0x1
popq %rdx
callq 0x1190
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x6c6e(%rip), %rdi      # 0x8081
leaq 0x6c71(%rip), %rsi      # 0x808b
leaq 0x6c71(%rip), %rcx      # 0x8092
pushq $0x20
jmp 0x143c
leaq 0x6ccc(%rip), %rdi      # 0x80f8
leaq 0x6c58(%rip), %rsi      # 0x808b
leaq 0x6c58(%rip), %rcx      # 0x8092
pushq $0x46
popq %rdx
callq 0x10f0
nop