// File: pajlads[P]pajlang/compiler.cpp
// Function: main
int main(int argc, char *argv[])
{
    if (argc <= 1) { 
        std::cout << "no input files" << std::endl;
        return 1;
    }
    std::string file = argv[1];

    std::ifstream inFile;
    inFile.open(file);
    std::stringstream strStream;
    strStream << inFile.rdbuf();
    std::string str = strStream.str();

    auto instructions = split(str, ';');

    for (auto it = instructions.begin(); it != instructions.end(); ++it) {
        std::cout << *it;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x440, %rsp            # imm = 0x440
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x1, -0x8(%rbp)
jg 0x25dd
movq 0x3a22(%rip), %rdi      # 0x5fd8
leaq 0x1a47(%rip), %rsi      # 0x4004
callq 0x2190
movq %rax, %rdi
movq 0x39fc(%rip), %rsi      # 0x5fc8
callq 0x21c0
movl $0x1, -0x4(%rbp)
jmp 0x280a
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x430(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0x428(%rbp)
callq 0x22b0
movq -0x430(%rbp), %rsi
movq -0x428(%rbp), %rdx
leaq -0x30(%rbp), %rdi
callq 0x2930
jmp 0x2615
leaq -0x31(%rbp), %rdi
callq 0x21e0
leaq -0x250(%rbp), %rdi
callq 0x2210
jmp 0x262c
leaq -0x250(%rbp), %rdi
leaq -0x30(%rbp), %rsi
movl $0x8, %edx
callq 0x2150
jmp 0x2643
leaq -0x3d8(%rbp), %rdi
callq 0x20f0
jmp 0x2651
leaq -0x3c8(%rbp), %rax
movq %rax, -0x440(%rbp)
leaq -0x250(%rbp), %rdi
callq 0x2270
movq %rax, -0x438(%rbp)
jmp 0x2674
movq -0x438(%rbp), %rsi
movq -0x440(%rbp), %rdi
callq 0x2040
jmp 0x2689
leaq -0x3f8(%rbp), %rdi
leaq -0x3d8(%rbp), %rsi
callq 0x2180
jmp 0x269e
leaq -0x410(%rbp), %rdi
leaq -0x3f8(%rbp), %rsi
movl $0x3b, %edx
callq 0x2430
jmp 0x26b8
leaq -0x410(%rbp), %rdi
callq 0x29e0
movq %rax, -0x418(%rbp)
leaq -0x410(%rbp), %rdi
callq 0x2a50
movq %rax, -0x420(%rbp)
leaq -0x418(%rbp), %rdi
leaq -0x420(%rbp), %rsi
callq 0x2a10
testb $0x1, %al
jne 0x26fa
jmp 0x2799
leaq -0x418(%rbp), %rdi
callq 0x2a80
movq %rax, %rsi
movq 0x38c8(%rip), %rdi      # 0x5fd8
callq 0x2170
jmp 0x2717
jmp 0x2719
leaq -0x418(%rbp), %rdi
callq 0x2aa0
jmp 0x26cb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x31(%rbp), %rdi
callq 0x21e0
jmp 0x2816
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x27ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x27f3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x27e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x27db
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x410(%rbp), %rdi
callq 0x28d0
jmp 0x27db
movl $0x0, -0x4(%rbp)
leaq -0x410(%rbp), %rdi
callq 0x28d0
leaq -0x3f8(%rbp), %rdi
callq 0x20d0
leaq -0x3d8(%rbp), %rdi
callq 0x2110
leaq -0x250(%rbp), %rdi
callq 0x2050
leaq -0x30(%rbp), %rdi
callq 0x20d0
jmp 0x280a
leaq -0x3f8(%rbp), %rdi
callq 0x20d0
leaq -0x3d8(%rbp), %rdi
callq 0x2110
leaq -0x250(%rbp), %rdi
callq 0x2050
leaq -0x30(%rbp), %rdi
callq 0x20d0
jmp 0x2816
movl -0x4(%rbp), %eax
addq $0x440, %rsp            # imm = 0x440
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x22a0
nop