// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x2, -0x8(%rbp)
jge 0x132c
movq 0xecf5(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0xad59(%rip), %rsi      # 0xc066
movb $0x0, %al
callq 0x1130
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x12b0
movl $0x1, -0x4(%rbp)
jmp 0x14df
cmpl $0x3, -0x8(%rbp)
jne 0x134c
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x1387
cmpl $0x2, -0x8(%rbp)
jne 0x1354
jmp 0x1373
leaq 0xad26(%rip), %rdi      # 0xc081
leaq 0xad29(%rip), %rsi      # 0xc08b
movl $0x20, %edx
leaq 0xad24(%rip), %rcx      # 0xc092
callq 0x10f0
movq $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
callq 0x22d0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x13a3
movl $0x1, -0x4(%rbp)
jmp 0x14df
cmpq $0x0, -0x18(%rbp)
je 0x13e3
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x97b0
cmpq $0x0, %rax
je 0x13e1
movq 0xec34(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0xace1(%rip), %rsi      # 0xc0af
movb $0x0, %al
callq 0x1130
movl $0x1, -0x4(%rbp)
jmp 0x14df
jmp 0x1422
movq -0x28(%rbp), %rdi
movq 0xebea(%rip), %rax      # 0xffd8
movq (%rax), %rsi
callq 0x9730
cmpq $0x0, %rax
je 0x1420
movq 0xebf5(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0xaca2(%rip), %rsi      # 0xc0af
movb $0x0, %al
callq 0x1130
movl $0x1, -0x4(%rbp)
jmp 0x14df
jmp 0x1422
callq 0x22d0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x143e
movl $0x1, -0x4(%rbp)
jmp 0x14df
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x97b0
cmpq $0x0, %rax
je 0x1472
movq 0xeba0(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0xac6e(%rip), %rsi      # 0xc0d0
movb $0x0, %al
callq 0x1130
movl $0x1, -0x4(%rbp)
jmp 0x14df
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x14f0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x1493
movl $0x1, -0x4(%rbp)
jmp 0x14df
movq -0x38(%rbp), %rdi
callq 0x3fc0
cmpq $0x0, %rax
jne 0x14a4
jmp 0x14c3
leaq 0xac4d(%rip), %rdi      # 0xc0f8
leaq 0xabd9(%rip), %rsi      # 0xc08b
movl $0x46, %edx
leaq 0xabd4(%rip), %rcx      # 0xc092
callq 0x10f0
movq -0x38(%rbp), %rdi
movq 0xeb02(%rip), %rax      # 0xffd0
movq (%rax), %rdx
xorl %esi, %esi
callq 0x73f0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)