LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/parser.cpp
// Function: Parser::expect(TokenType const&)
void Parser::expect(const TokenType & type) {
    if (t.type != type) {
        std::string err("Expected: ");
        std::string nodeString;
        auto search = tokenToStrMap.find(type);
        if (search != tokenToStrMap.end()) {
            nodeString = search->second;
        } else {
            nodeString = "NOTFOUND";
        }
        err.append(nodeString);
        reject(err);
    } else {
        // Consume
        next();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
movl 0x18(%rdi), %eax
cmpl (%rsi), %eax
jne 0x8fc7
movq %rbx, %rdi
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x899a
movq %rsi, %r14
leaq -0x50(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x9479(%rip), %rsi      # 0x12452
leaq 0x947c(%rip), %rdx      # 0x1245c
leaq -0x60(%rbp), %rdi
callq 0x82f0
leaq -0x30(%rbp), %r12
movq %r12, -0x10(%r12)
movq $0x0, -0x8(%r12)
movb $0x0, (%r12)
movq 0xf3c9(%rip), %rcx      # 0x183d0
testq %rcx, %rcx
je 0x903d
movl (%r14), %eax
leaq 0xf3b2(%rip), %rsi      # 0x183c8
xorl %edx, %edx
cmpl %eax, 0x20(%rcx)
setl %dl
cmovgeq %rcx, %rsi
movq 0x10(%rcx,%rdx,8), %rcx
testq %rcx, %rcx
jne 0x9016
leaq 0xf395(%rip), %rcx      # 0x183c8
cmpq %rcx, %rsi
je 0x903d
cmpl 0x20(%rsi), %eax
jge 0x9074
leaq 0x9419(%rip), %rcx      # 0x1245d
leaq -0x40(%rbp), %rdi
movl $0x8, %r8d
xorl %esi, %esi
xorl %edx, %edx
callq 0x3390
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
leaq -0x60(%rbp), %rdi
callq 0x30f0
leaq -0x60(%rbp), %rsi
movq %rbx, %rdi
callq 0x8ad6
addq $0x28, %rsi
leaq -0x40(%rbp), %rdi
callq 0x3180
jmp 0x9057
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0x9094
callq 0x3250
movq -0x60(%rbp), %rdi
cmpq %r15, %rdi
je 0x90a2
callq 0x3250
movq %rbx, %rdi
callq 0x3420
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/parser.cpp
// Function: Parser::type()
ASTNode * Parser::type() {
    /*
        Terminal
    */
    TypeNode * node = new TypeNode();
    switch(t.type) {
        case T_INT: {
            node->varType = VT_INT;
            break;
        }
        case T_CHAR: {
            node->varType = VT_CHAR;
            break;
        }
        default: {
            reject("Type not recognized");
        }
    }

    next();
    return node;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movl $0x28, %edi
callq 0x3290
movq %rax, %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movq $0x0, 0x18(%rax)
movl $0x6, (%rax)
movl 0x18(%rbx), %ecx
movl $0x1, %eax
cmpl $0xe, %ecx
je 0x90f3
cmpl $0x10, %ecx
jne 0x910d
movl $0x2, %eax
movl %eax, 0x20(%r14)
movq %rbx, %rdi
callq 0x899a
movq %r14, %rax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq -0x28(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x9309(%rip), %rsi      # 0x12425
leaq 0x9315(%rip), %rdx      # 0x12438
leaq -0x38(%rbp), %r14
movq %r14, %rdi
callq 0x82f0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8ad6
movq %rax, %rbx
movq -0x38(%rbp), %rdi
cmpq %r15, %rdi
je 0x914b
callq 0x3250
movq %rbx, %rdi
callq 0x3420
nop
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/parser.cpp
// Function: Parser::identifier()
ASTNode * Parser::identifier() {
    /*
        Terminal
    */
    if (t.type != TokenType::T_IDENT) {
        reject("Expected identifier");
    }

    IdentifierNode * node = new IdentifierNode();
    node->name = t.stringVal;

    next();
    return node;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
cmpl $0x9, 0x18(%rdi)
jne 0x91bf
movl $0x40, %edi
callq 0x3290
movq %rax, %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
xorl %eax, %eax
movq %rax, 0x18(%r14)
movl $0x4, (%r14)
leaq 0x20(%r14), %rdi
leaq 0x30(%r14), %rcx
movq %rcx, 0x20(%r14)
movq %rax, 0x28(%r14)
movb $0x0, 0x30(%r14)
leaq 0x20(%rbx), %rsi
callq 0x3180
movq %rbx, %rdi
callq 0x899a
movq %r14, %rax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq -0x28(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x9243(%rip), %rsi      # 0x12411
leaq 0x924f(%rip), %rdx      # 0x12424
leaq -0x38(%rbp), %r14
movq %r14, %rdi
callq 0x82f0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8ad6
movq %rax, %rbx
movq -0x38(%rbp), %rdi
cmpq %r15, %rdi
je 0x91fd
callq 0x3250
movq %rbx, %rdi
callq 0x3420
nop
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/parser.cpp
// Function: Parser::parameterList()
ASTNode * Parser::parameterList() {
    /*
        "(" [<parameter> {"," <parameter> }] ")"
    */
    ASTNode * node = new ASTNode(AST_PARAMETERLIST);

    expect(T_LPAREN);

    if(t.type != T_RPAREN) {
        // We have one or more parameters
        node->children.push_back(parameter());

        // Consume the rest of the params
        while(t.type == T_COMMA) {
            expect(T_COMMA);
            node->children.push_back(parameter());
        }
    }

    
    expect(T_RPAREN);

    return node;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl $0x20, %edi
callq 0x3290
movq %rax, %r15
movq %rax, %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movq $0x0, 0x18(%rax)
movl $0x7, (%rax)
leaq -0x28(%rbp), %rsi
movl $0x4, (%rsi)
movq %rbx, %rdi
callq 0x8f9a
cmpl $0x5, 0x18(%rbx)
je 0x92bf
addq $0x8, %r15
movq %rbx, %rdi
callq 0x97de
leaq -0x28(%rbp), %rdx
movq %rax, (%rdx)
movq %r15, %rdi
xorl %esi, %esi
callq 0xadac
cmpl $0xa, 0x18(%rbx)
jne 0x92bf
leaq -0x28(%rbp), %r12
movl $0xa, -0x28(%rbp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x8f9a
movq %rbx, %rdi
callq 0x97de
movq %rax, -0x28(%rbp)
movq 0x10(%r14), %rsi
cmpq 0x18(%r14), %rsi
je 0x92ae
movq %rax, (%rsi)
addq $0x8, 0x10(%r14)
jmp 0x92b9
movq %r15, %rdi
movq %r12, %rdx
callq 0xadac
cmpl $0xa, 0x18(%rbx)
je 0x927c
leaq -0x28(%rbp), %rsi
movl $0x5, (%rsi)
movq %rbx, %rdi
callq 0x8f9a
movq %r14, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/parser.cpp
// Function: Parser::functionBody()
ASTNode * Parser::functionBody() {
    /*
        "{" { <statement> } "}
    */
    ASTNode * node = new ASTNode(AST_FUNCTIONBODY);
    expect(T_LCURLY);

    // 0 or more statements
    while (t.type != T_RCURLY) {
        node->children.push_back(statement());
    }
    
    expect(T_RCURLY);

    return node;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl $0x20, %edi
callq 0x3290
movq %rax, %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movq $0x0, 0x18(%rax)
movl $0x10, (%rax)
leaq -0x28(%rbp), %rsi
movl $0x6, (%rsi)
movq %rbx, %rdi
callq 0x8f9a
cmpl $0x7, 0x18(%rbx)
je 0x936a
movq %r14, %r15
addq $0x8, %r15
leaq -0x28(%rbp), %r12
movq %rbx, %rdi
callq 0x938c
movq %rax, -0x28(%rbp)
movq 0x10(%r14), %rsi
cmpq 0x18(%r14), %rsi
je 0x9359
movq %rax, (%rsi)
addq $0x8, 0x10(%r14)
jmp 0x9364
movq %r15, %rdi
movq %r12, %rdx
callq 0xadac
cmpl $0x7, 0x18(%rbx)
jne 0x9339
leaq -0x28(%rbp), %rsi
movl $0x7, (%rsi)
movq %rbx, %rdi
callq 0x8f9a
movq %r14, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/parser.cpp
// Function: Parser::parameter()
ASTNode * Parser::parameter() {
    /*
        <typeSpecifier> <identifier>
    */
    ASTNode * node = new ASTNode(AST_PARAMETER);

    node->children.push_back(type());
    node->children.push_back(identifier());

    return node;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r15
movl $0x20, %edi
callq 0x3290
movq %rax, %rbx
leaq 0x8(%rax), %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movq $0x0, 0x18(%rax)
movl $0x8, (%rax)
movq %r15, %rdi
callq 0x90aa
leaq -0x28(%rbp), %r12
movq %rax, (%r12)
movq %r14, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0xadac
movq %r15, %rdi
callq 0x9154
movq %rax, (%r12)
movq 0x10(%rbx), %rsi
cmpq 0x18(%rbx), %rsi
je 0x9853
movq %rax, (%rsi)
addq $0x8, 0x10(%rbx)
jmp 0x985f
leaq -0x28(%rbp), %rdx
movq %r14, %rdi
callq 0xadac
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/parser.cpp
// Function: Parser::variableDeclaration()
ASTNode * Parser::variableDeclaration() {
    /*
        <identifier> [ "[" <number> "]" ]
    */
    ASTNode * node = new ASTNode(AST_VARDECLARATION);

    node->children.push_back(identifier());

    // Check if its an array
    if(t.type == T_LSQUARE) {
        expect(T_LSQUARE);
        node->children.push_back(number());
        expect(T_RSQUARE);
    }

    return node;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movl $0x20, %edi
callq 0x3290
movq %rax, %rbx
leaq 0x8(%rax), %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movq $0x0, 0x18(%rax)
movl $0xf, (%rax)
movq %r14, %rdi
callq 0x9154
leaq -0x30(%rbp), %rdx
movq %rax, (%rdx)
movq %r15, %rdi
xorl %esi, %esi
callq 0xadac
cmpl $0xc, 0x18(%r14)
jne 0x9956
leaq -0x30(%rbp), %r13
movl $0xc, (%r13)
movq %r14, %rdi
movq %r13, %rsi
callq 0x8f9a
movl $0x28, %edi
callq 0x3290
movq %rax, %r12
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movq $0x0, 0x18(%rax)
movl $0x5, (%rax)
movl 0x40(%r14), %eax
movl %eax, 0x20(%r12)
movl $0xf, (%r13)
movq %r14, %rdi
movq %r13, %rsi
callq 0x8f9a
movq %r12, (%r13)
movq 0x10(%rbx), %rsi
cmpq 0x18(%rbx), %rsi
je 0x9938
movq %r12, (%rsi)
addq $0x8, 0x10(%rbx)
jmp 0x9944
leaq -0x30(%rbp), %rdx
movq %r15, %rdi
callq 0xadac
leaq -0x30(%rbp), %rsi
movl $0xd, (%rsi)
movq %r14, %rdi
callq 0x8f9a
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/parser.cpp
// Function: Parser::assignment()
ASTNode * Parser::assignment() {
    /*
        <identifier> ["[" <arrayIndex> "]"] "=" <expression>
    */
    ASTNode * node = new ASTNode(AST_ASSIGNMENT);

    node->children.push_back(identifier());

    // Check if its an array
    if (t.type == T_LSQUARE) {
        expect(T_LSQUARE);
        node->children.push_back(arrayIndex());
        expect(T_RSQUARE);
    }

    expect(T_ASSIGN);
    node->children.push_back(expression());
    expect(T_SEMI);

    return node;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl $0x20, %edi
callq 0x3290
movq %rax, %r14
leaq 0x8(%rax), %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movq $0x0, 0x18(%rax)
movl $0xa, (%rax)
movq %rbx, %rdi
callq 0x9154
leaq -0x28(%rbp), %rdx
movq %rax, (%rdx)
movq %r15, %rdi
xorl %esi, %esi
callq 0xadac
cmpl $0xc, 0x18(%rbx)
jne 0x9d0a
leaq -0x28(%rbp), %r12
movl $0xc, (%r12)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x8f9a
movq %rbx, %rdi
callq 0x9d70
movq %rax, (%r12)
movq 0x10(%r14), %rsi
cmpq 0x18(%r14), %rsi
je 0x9cec
movq %rax, (%rsi)
addq $0x8, 0x10(%r14)
jmp 0x9cf8
leaq -0x28(%rbp), %rdx
movq %r15, %rdi
callq 0xadac
leaq -0x28(%rbp), %rsi
movl $0xd, (%rsi)
movq %rbx, %rdi
callq 0x8f9a
leaq -0x28(%rbp), %r12
movl $0x0, (%r12)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x8f9a
movq %rbx, %rdi
callq 0x99be
movq %rax, (%r12)
movq 0x10(%r14), %rsi
cmpq 0x18(%r14), %rsi
je 0x9d41
movq %rax, (%rsi)
addq $0x8, 0x10(%r14)
jmp 0x9d4d
leaq -0x28(%rbp), %rdx
movq %r15, %rdi
callq 0xadac
leaq -0x28(%rbp), %rsi
movl $0x3, (%rsi)
movq %rbx, %rdi
callq 0x8f9a
movq %r14, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/parser.cpp
// Function: Parser::arrayIndex()
ASTNode * Parser::arrayIndex() {
    /*
        <expression>
    */
    ASTNode * node = new ASTNode(AST_ARRAYINDEX);

    node->children.push_back(expression());

    return node;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x20, %edi
callq 0x3290
movq %rax, %r14
leaq 0x8(%rax), %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movq $0x0, 0x18(%rax)
movl $0x11, (%rax)
movq %rbx, %rdi
callq 0x99be
leaq -0x20(%rbp), %rdx
movq %rax, (%rdx)
movq %r15, %rdi
xorl %esi, %esi
callq 0xadac
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/parser.cpp
// Function: Parser::op()
ASTNode * Parser::op() {
    /*
        Terminal
        "+" | "-" etc.
    */
    OpNode * node = new OpNode();

    switch(t.type) {
        case T_PLUS: {
            node->operation = "+";
            break;
        }
        case T_MINUS: {
            node->operation = "-";
            break;
        }
        default: {
            reject("Operation not supported");
        }
    }

    next();
    return node;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movl $0x40, %edi
callq 0x3290
movq %rax, %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
xorl %eax, %eax
movq %rax, 0x18(%r14)
movl $0xd, (%r14)
leaq 0x30(%r14), %rcx
movq %rcx, 0x20(%r14)
movq %rax, 0x28(%r14)
movb $0x0, 0x30(%r14)
movl 0x18(%rbx), %eax
cmpl $0x1, %eax
je 0x9e78
cmpl $0x2, %eax
jne 0x9eab
leaq 0x86b9(%rip), %rcx      # 0x1252f
jmp 0x9e7f
leaq 0x862b(%rip), %rcx      # 0x124aa
movq %r14, %rdi
addq $0x20, %rdi
movl $0x1, %r8d
xorl %esi, %esi
xorl %edx, %edx
callq 0x3390
movq %rbx, %rdi
callq 0x899a
movq %r14, %rax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq -0x28(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x85f2(%rip), %rsi      # 0x124ac
leaq 0x8602(%rip), %rdx      # 0x124c3
leaq -0x38(%rbp), %r14
movq %r14, %rdi
callq 0x82f0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8ad6
movq %rax, %rbx
movq -0x38(%rbp), %rdi
cmpq %r15, %rdi
je 0x9ee9
callq 0x3250
movq %rbx, %rdi
callq 0x3420
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/symbolTable.cpp
// Function: SymbolTable::addEntry(STEntryType, VarType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void SymbolTable::addEntry(STEntryType entryType, VarType varType, std::string varName) {
    STEntry * scopeIterator = currentScope;
    while (scopeIterator->next != nullptr) {
        if (scopeIterator->next->name == varName) {
            std::cout << "Object name already exists in scope: " << varName << std::endl;
            return; 
        } else {
            scopeIterator = scopeIterator->next;
        }
    }
    STTypeDescriptor * typeDescriptor = new STTypeDescriptor(varType);
    STEntry * newEntry = new STEntry();
    newEntry->name = varName;
    newEntry->entryType = entryType;
    newEntry->scopeId = currentScopeId;
    newEntry->typeDescriptor = typeDescriptor;
    scopeIterator->next = newEntry;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %rbx
movl %edx, %r12d
movl %esi, -0x2c(%rbp)
movq %rdi, %r14
movq 0x8(%rdi), %r15
movq 0x10(%r15), %rax
testq %rax, %rax
je 0xbe6c
movq 0x8(%rbx), %r13
movq %rax, %r15
cmpq %r13, 0x40(%rax)
jne 0xbe63
testq %r13, %r13
je 0xbefb
movq (%rbx), %rsi
movq 0x38(%r15), %rdi
movq %r13, %rdx
callq 0x32a0
testl %eax, %eax
je 0xbefb
movq 0x10(%r15), %rax
testq %rax, %rax
jne 0xbe3a
movq %r14, -0x38(%rbp)
addq $0x10, %r15
movl $0xc, %edi
callq 0x3290
movq %rax, %r13
movl %r12d, (%rax)
xorl %r14d, %r14d
movq %r14, 0x4(%rax)
movl $0x58, %edi
callq 0x3290
movq %rax, %r12
movq %r14, 0x10(%rax)
addq $0x20, %rax
movq %rax, 0x28(%r12)
movq %rax, 0x20(%r12)
movq %r14, 0x30(%r12)
leaq 0x38(%r12), %rdi
leaq 0x48(%r12), %rax
movq %rax, 0x38(%r12)
movq %r14, 0x40(%r12)
movb $0x0, 0x48(%r12)
movq %rbx, %rsi
callq 0x3180
movl -0x2c(%rbp), %eax
movl %eax, (%r12)
movq -0x38(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, 0x4(%r12)
movq %r13, 0x8(%r12)
movq %r12, (%r15)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xc0ce(%rip), %r14      # 0x17fd0
leaq 0x6765(%rip), %rsi      # 0x1266e
movl $0x25, %edx
movq %r14, %rdi
callq 0x32d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x32d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3260
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x31a0
nop
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/symbolTable.cpp
// Function: SymbolTable::lookup(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
STEntry * SymbolTable::lookup(std::string name) {
    STEntry * head = currentScope;
    STEntry * currentEntry;
    while (head != nullptr) {
         currentEntry = head->next;
         while (currentEntry != nullptr) {
             if (currentEntry->name == name) {
                 return currentEntry;
             }
             currentEntry = currentEntry->next;
         }
         if(head == universe) {
             break;
         }

        head = head->parentScope;
    }
    return nullptr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x8(%rdi), %r12
testq %r12, %r12
je 0xc165
movq %rsi, %rbx
movq (%rdi), %r13
movq 0x10(%r12), %r14
testq %r14, %r14
je 0xc156
movq 0x8(%rbx), %r15
cmpq %r15, 0x40(%r14)
jne 0xc14d
testq %r15, %r15
je 0xc168
movq (%rbx), %rsi
movq 0x38(%r14), %rdi
movq %r15, %rdx
callq 0x32a0
testl %eax, %eax
je 0xc168
movq 0x10(%r14), %r14
testq %r14, %r14
jne 0xc12f
cmpq %r13, %r12
je 0xc165
movq 0x18(%r12), %r12
testq %r12, %r12
jne 0xc121
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/symbolTable.cpp
// Function: SymbolTable::lookupScope(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
STEntry * SymbolTable::lookupScope(std::string functionName) {
    STEntry * head = universe;
    for (auto & child : universe->childScopes) {
        if (child->name == functionName) {
            return child;
        }
    }
    return nullptr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq (%rdi), %r12
movq 0x20(%r12), %r13
addq $0x20, %r12
cmpq %r12, %r13
je 0xc1cb
movq %rsi, %rbx
movq 0x8(%rsi), %r14
movq 0x10(%r13), %r15
cmpq %r14, 0x40(%r15)
jne 0xc1c2
testq %r14, %r14
je 0xc1ce
movq (%rbx), %rsi
movq 0x38(%r15), %rdi
movq %r14, %rdx
callq 0x32a0
testl %eax, %eax
je 0xc1ce
movq (%r13), %r13
cmpq %r12, %r13
jne 0xc1a0
xorl %r15d, %r15d
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/symbolTable.cpp
// Function: SymbolTable::print()
void SymbolTable::print() {
    STEntry * head = currentScope;
    STEntry * currentEntry;
    std::cout << "innerScope" << std::endl;
    while (head != nullptr) {
        std::cout << "| " << std::endl;
        std::cout << "[ Head ]";
        currentEntry = head->next;
        while (currentEntry != nullptr) {
            std::cout << " -> ";
            std::cout << " [ " << currentEntry->name << " ] ";
            currentEntry = currentEntry->next;
         }
         std::cout << " -> guard " << std::endl;
         head = head->parentScope;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x8(%rdi), %r12
movq 0xbdd7(%rip), %rbx      # 0x17fd0
leaq 0x6494(%rip), %rsi      # 0x12694
movl $0xa, %edx
movq %rbx, %rdi
callq 0x32d0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3260
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31a0
testq %r12, %r12
je 0xc340
leaq 0x6464(%rip), %r13      # 0x126a8
leaq 0x6462(%rip), %r14      # 0x126ad
leaq 0x645f(%rip), %r15      # 0x126b1
movl $0x2, %edx
movq %rbx, %rdi
leaq 0x62d3(%rip), %rsi      # 0x12534
callq 0x32d0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3260
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31a0
movl $0x8, %edx
movq %rbx, %rdi
leaq 0x6403(%rip), %rsi      # 0x1269f
callq 0x32d0
movq %r12, -0x30(%rbp)
movq 0x10(%r12), %r12
testq %r12, %r12
je 0xc2f3
movl $0x4, %edx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x32d0
movl $0x3, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x32d0
movq 0x38(%r12), %rsi
movq 0x40(%r12), %rdx
movq %rbx, %rdi
callq 0x32d0
movl $0x3, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x32d0
jmp 0xc2a5
movl $0xa, %edx
movq %rbx, %rdi
leaq 0x63b3(%rip), %rsi      # 0x126b5
callq 0x32d0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3260
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31a0
movq -0x30(%rbp), %r12
movq 0x18(%r12), %r12
testq %r12, %r12
jne 0xc252
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/irGenerator.cpp
// Function: IRGenerator::genTAC(ASTNode*)
void IRGenerator::genTAC(ASTNode * node) {
    switch(node->nodeType) {
        case AST_EXPRESSION:
            {
                genTACExpression(node);
                break;
            }
        case AST_STATEMENT:
            {
                genTACStatement(node);
                break;
            }
        case AST_FUNCTION:
            {
                genTACFunction(node);
                break;
            }
        case AST_DECLARATION:
            {
                genTACDeclaration(node);
                break;
            }
        default:
            {
                for(auto child : node->children) {
                    genTAC(child);
                }
            }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rdx
movq %rdi, %rbx
movl (%rsi), %eax
addl $-0x2, %eax
cmpl $0x9, %eax
ja 0xc933
leaq 0x5e44(%rip), %rcx      # 0x12704
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rbx, %rdi
movq %rdx, %rsi
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xdac0
movq %rbx, %rdi
movq %rdx, %rsi
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xcd06
movq %rbx, %rdi
movq %rdx, %rsi
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xddf4
leaq -0x38(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0xc952
movq (%r14), %rdi
leaq -0x28(%rbp), %rax
cmpq %rax, %rdi
je 0xc928
callq 0x3250
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rdx), %r14
movq 0x10(%rdx), %r15
cmpq %r15, %r14
je 0xc928
movq (%r14), %rsi
movq %rbx, %rdi
callq 0xc89c
addq $0x8, %r14
jmp 0xc93b
nop
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/irGenerator.cpp
// Function: IRGenerator::genTACDeclaration(ASTNode*)
void IRGenerator::genTACDeclaration(ASTNode * declaration) {
    TypeNode * typeNode = (TypeNode *)declaration->children[0];
    auto child = declaration->children.begin() + 1;
    while (child != declaration->children.end()) {
        IdentifierNode * id = (IdentifierNode *)((*child)->children[0]);
        intermediateCode.push_back({ IR_DECLARATION, id->name, varTypeToString[typeNode->varType] });
        child++;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq 0x8(%rsi), %rax
leaq 0x8(%rax), %r12
cmpq 0x10(%rsi), %r12
je 0xdef2
movq %rsi, %rbx
movq %rdi, %r14
movq (%rax), %r15
addq $0x10, %r14
addq $0x20, %r15
leaq -0x38(%rbp), %r13
movq (%r12), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
movl $0xc, -0x90(%rbp)
leaq -0x78(%rbp), %rcx
movq %rcx, -0x88(%rbp)
movq 0x20(%rax), %rsi
movq 0x28(%rax), %rdx
addq %rsi, %rdx
leaq -0x88(%rbp), %rdi
callq 0x6906
leaq 0xa68e(%rip), %rdi      # 0x184f8
movq %r15, %rsi
callq 0xb836
leaq -0x58(%rbp), %rcx
movq %rcx, -0x68(%rbp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x68(%rbp), %rdi
callq 0x6906
movq %r13, -0x48(%rbp)
movq $0x0, -0x40(%rbp)
movb $0x0, -0x38(%rbp)
movq %r14, %rdi
movq %r14, %rsi
leaq -0x90(%rbp), %rdx
callq 0xe2c0
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0xdebd
callq 0x3250
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0xdecf
callq 0x3250
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0xdee4
callq 0x3250
addq $0x8, %r12
cmpq 0x10(%rbx), %r12
jne 0xde2c
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0xe1ce
jmp 0xdf2a
movq %rax, %rbx
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0xdf2a
callq 0x3250
movq %rbx, %rdi
callq 0x3420
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/irGenerator.cpp
// Function: IRGenerator::genLabel[abi:cxx11]()
std::string IRGenerator::genLabel() {
    // if (labelCounts.find(nodeType) == labelCounts.end()) {
    //     labelCounts[nodeType] = 0;
    // }
    // return "_" + nodeType + std::to_string(labelCounts[nodeType]++);
    return "LABEL" + std::to_string(labelCount++);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movl 0x28(%rsi), %r13d
leal 0x1(%r13), %eax
movl %eax, 0x28(%rsi)
movl %r13d, %r14d
negl %r14d
cmovsl %r13d, %r14d
movl $0x1, %r15d
cmpl $0xa, %r14d
jb 0xdfb1
movl $0x4, %r15d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %r14d, %ecx
cmpl $0x63, %ecx
jbe 0xdfa8
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0xdfae
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0xdfb1
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r15d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0xdf75
addl $-0x3, %r15d
jmp 0xdfb1
addl $-0x2, %r15d
jmp 0xdfb1
decl %r15d
shrl $0x1f, %r13d
movl %r13d, %esi
addl %r15d, %esi
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
leaq -0x48(%rbp), %r12
movq %r12, %rdi
movl $0x2d, %edx
callq 0x32e0
movq (%r12), %rdi
addq %r13, %rdi
movl %r15d, %esi
movl %r14d, %edx
callq 0xa88a
leaq 0x476f(%rip), %rcx      # 0x1275c
movl $0x5, %r8d
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x32c0
leaq 0x10(%rbx), %rdx
movq %rdx, (%rbx)
movq (%rax), %rsi
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rsi
je 0xe021
movq %rsi, (%rbx)
movq (%rcx), %rdx
movq %rdx, 0x10(%rbx)
jmp 0xe027
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rbx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xe050
callq 0x3250
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xe077
callq 0x3250
movq %rbx, %rdi
callq 0x3420
nop
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/codeGenerator.cpp
// Function: CodeGenerator::generate[abi:cxx11]()
std::string CodeGenerator::generate() {
    // Make it easy to tell when our code starts
    code << "; Code begins now" << nl;
    code << "NOP" << nl << "NOP" << nl << "NOP" << nl;
    // First set up our stack
    initializeStack();

    // Now run through the code line by line
    for (auto & tac : intermediateCode) {
        generateCodeFromTAC(tac);
    }
    return code.str();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %r14
movq %rdi, -0x30(%rbp)
leaq 0x80(%rsi), %r15
leaq 0x40ec(%rip), %rsi      # 0x12860
movl $0x11, %edx
movq %r15, %rdi
callq 0x32d0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %r15, %rdi
callq 0x32d0
leaq 0x40db(%rip), %rbx      # 0x12872
movl $0x3, %edx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x32d0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %r15, %rdi
callq 0x32d0
movq %rax, %r15
movl $0x3, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x32d0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %r15, %rdi
callq 0x32d0
movq %rax, %r15
movl $0x3, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x32d0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %r15, %rdi
callq 0x32d0
movq %r14, %rdi
callq 0xe930
leaq 0x68(%r14), %r12
movq 0x68(%r14), %r13
cmpq %r12, %r13
je 0xe8c4
leaq -0x60(%rbp), %rbx
leaq -0x40(%rbp), %r15
movl 0x10(%r13), %eax
movl %eax, -0x98(%rbp)
leaq -0x80(%rbp), %rax
movq %rax, -0x90(%rbp)
movq 0x18(%r13), %rsi
movq 0x20(%r13), %rdx
addq %rsi, %rdx
leaq -0x90(%rbp), %rdi
callq 0x6906
movq %rbx, -0x70(%rbp)
movq 0x38(%r13), %rsi
movq 0x40(%r13), %rdx
addq %rsi, %rdx
leaq -0x70(%rbp), %rdi
callq 0x6906
movq %r15, -0x50(%rbp)
movq 0x58(%r13), %rsi
movq 0x60(%r13), %rdx
addq %rsi, %rdx
leaq -0x50(%rbp), %rdi
callq 0x6906
movq %r14, %rdi
leaq -0x98(%rbp), %rsi
callq 0xe9fa
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
je 0xe894
callq 0x3250
movq -0x70(%rbp), %rdi
cmpq %rbx, %rdi
je 0xe8a2
callq 0x3250
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0xe8b7
callq 0x3250
movq (%r13), %r13
cmpq %r12, %r13
jne 0xe81b
addq $0x88, %r14
movq -0x30(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x33a0
movq %rbx, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0xe902
movq %rax, %r14
movq -0x70(%rbp), %rdi
cmpq %rbx, %rdi
je 0xe902
callq 0x3250
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0xe928
callq 0x3250
jmp 0xe928
movq %rax, %r14
leaq -0x98(%rbp), %rdi
callq 0xe1ce
movq %r14, %rdi
callq 0x3420
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/codeGenerator.cpp
// Function: CodeGenerator::initializeStack()
void CodeGenerator::initializeStack() {
    // The stack should start with one "fake" item on it - the old FP, to which the current FP points
    code << "; Initialize the stack" << nl;
    code << "LDA #$FF" << nl;
    code << "STA " << cSP << nl;
    code << "STA " << cFP << nl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x80(%rdi), %r14
leaq 0x3fd8(%rip), %rsi      # 0x12923
movl $0x16, %edx
movq %r14, %rdi
callq 0x32d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x32d0
leaq 0x3fcc(%rip), %rsi      # 0x1293a
movl $0x8, %edx
movq %r14, %rdi
callq 0x32d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x32d0
leaq 0x3fb2(%rip), %r15      # 0x12943
movl $0x4, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x32d0
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq %r14, %rdi
callq 0x32d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %rax, %rdi
callq 0x32d0
movl $0x4, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x32d0
movq 0x40(%rbx), %rsi
movq 0x48(%rbx), %rdx
movq %r14, %rdi
callq 0x32d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x32d0
nop
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/codeGenerator.cpp
// Function: CodeGenerator::allocateGlobal(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void CodeGenerator::allocateGlobal(std::string name, std::string type) {
    code << "; global " << name << nl;
    int address = currentGlobalOffset;
    loadConstIntoA(0);
    storeAIntoGlobal(address);
    globalToAddressMap[name] = address;
    currentGlobalOffset++; //Will vary depending on type in the future
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x80(%rdi), %r15
leaq 0x3409(%rip), %rsi      # 0x12ac7
movl $0x9, %edx
movq %r15, %rdi
callq 0x32d0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %r15, %rdi
callq 0x32d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %rax, %rdi
callq 0x32d0
movl 0x294(%rbx), %r15d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x10d7c
movq %rbx, %rdi
movl %r15d, %esi
callq 0x10ce0
leaq 0x1f8(%rbx), %rdi
movq %r14, %rsi
callq 0x111ba
movl %r15d, (%rax)
incl 0x294(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/codeGenerator.cpp
// Function: CodeGenerator::generateBranchOnCondition(TAC, bool)
void CodeGenerator::generateBranchOnCondition(TAC tac, bool condition) {
    code << "; branch if " << tac.first << " is " << condition << nl;
    CodeVar var = lookup(tac.first);
    loadLocalIntoA(var.value);
    code << "CMP #" << condition << nl;
    code << "BEQ " << tac.second << nl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %r12d
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x80(%rdi), %r14
leaq 0x2710(%rip), %rsi      # 0x12a06
movl $0xc, %edx
movq %r14, %rdi
callq 0x32d0
movq 0x8(%r15), %rsi
movq 0x10(%r15), %rdx
movq %r14, %rdi
callq 0x32d0
movq %rax, %r13
leaq 0x26f6(%rip), %rsi      # 0x12a13
movl $0x4, %edx
movq %rax, %rdi
callq 0x32d0
movq %r13, %rdi
movl %r12d, -0x2c(%rbp)
movl %r12d, %esi
callq 0x33e0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %rax, %rdi
callq 0x32d0
leaq -0x40(%rbp), %r12
movq %r12, -0x10(%r12)
movq 0x8(%r15), %rsi
movq 0x10(%r15), %rdx
addq %rsi, %rdx
leaq -0x50(%rbp), %r13
movq %r13, %rdi
callq 0x6906
movq %rbx, %rdi
movq %r13, %rsi
callq 0x10a76
movq %rax, %r13
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
je 0x10384
callq 0x3250
shrq $0x20, %r13
movq %rbx, %rdi
movl %r13d, %esi
callq 0x10c3e
leaq 0x267e(%rip), %rsi      # 0x12a18
movl $0x5, %edx
movq %r14, %rdi
callq 0x32d0
movzbl -0x2c(%rbp), %esi
movq %r14, %rdi
callq 0x33e0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %rax, %rdi
callq 0x32d0
leaq 0x2655(%rip), %rsi      # 0x12a1e
movl $0x4, %edx
movq %r14, %rdi
callq 0x32d0
movq 0x28(%r15), %rsi
movq 0x30(%r15), %rdx
movq %r14, %rdi
callq 0x32d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %rax, %rdi
callq 0x32d0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
je 0x10415
callq 0x3250
movq %rbx, %rdi
callq 0x3420
nop
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/codeGenerator.cpp
// Function: CodeGenerator::generatePushParam(TAC)
void CodeGenerator::generatePushParam(TAC tac) {
    CodeVar param = lookup(tac.first);
    code << "; push param " << tac.first << nl;
    loadLocalIntoA(param.value);
    pushAToStack();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq -0x30(%rbp), %r12
movq %r12, -0x10(%r12)
movq 0x8(%rsi), %rsi
movq 0x10(%r14), %rdx
addq %rsi, %rdx
leaq -0x40(%rbp), %r15
movq %r15, %rdi
callq 0x6906
movq %rbx, %rdi
movq %r15, %rsi
callq 0x10a76
movq %rax, %r15
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0x104f7
callq 0x3250
shrq $0x20, %r15
leaq 0x80(%rbx), %r12
leaq 0x251a(%rip), %rsi      # 0x12a23
movl $0xd, %edx
movq %r12, %rdi
callq 0x32d0
movq 0x8(%r14), %rsi
movq 0x10(%r14), %rdx
movq %r12, %rdi
callq 0x32d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %rax, %rdi
callq 0x32d0
movq %rbx, %rdi
movl %r15d, %esi
callq 0x10c3e
movq %rbx, %rdi
callq 0x109d8
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0x10566
callq 0x3250
movq %rbx, %rdi
callq 0x3420
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/codeGenerator.cpp
// Function: CodeGenerator::generateSubroutineCall(TAC)
void CodeGenerator::generateSubroutineCall(TAC tac) {
    code << "; push FP, call, restore FP" << nl;

    // Push cFP to stack
    code << "LDA " << cFP << nl;
    pushAToStack();
    
    // Set cFP to cSP
    code << "LDA " << cSP << nl;
    code << "STA " << cFP << nl;

    // Call function
    code << "JSR " << tac.first << nl;

    // Restore FP
    popStackToA();
    code << "STA " << cFP << nl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x80(%rdi), %r14
leaq 0x23d7(%rip), %rsi      # 0x12a50
movl $0x1b, %edx
movq %r14, %rdi
callq 0x32d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x32d0
leaq 0x23d0(%rip), %r12      # 0x12a6c
movl $0x4, %edx
movq %r14, %rdi
movq %r12, %rsi
callq 0x32d0
movq 0x40(%rbx), %rsi
movq 0x48(%rbx), %rdx
movq %r14, %rdi
callq 0x32d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %rax, %rdi
callq 0x32d0
movq %rbx, %rdi
callq 0x109d8
movl $0x4, %edx
movq %r14, %rdi
movq %r12, %rsi
callq 0x32d0
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq %r14, %rdi
callq 0x32d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %rax, %rdi
callq 0x32d0
leaq 0x223a(%rip), %r12      # 0x12943
movl $0x4, %edx
movq %r14, %rdi
movq %r12, %rsi
callq 0x32d0
movq 0x40(%rbx), %rsi
movq 0x48(%rbx), %rdx
movq %r14, %rdi
callq 0x32d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %rax, %rdi
callq 0x32d0
leaq 0x2332(%rip), %rsi      # 0x12a71
movl $0x4, %edx
movq %r14, %rdi
callq 0x32d0
movq 0x8(%r15), %rsi
movq 0x10(%r15), %rdx
movq %r14, %rdi
callq 0x32d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %rax, %rdi
callq 0x32d0
movq %rbx, %rdi
callq 0x1093a
movl $0x4, %edx
movq %r14, %rdi
movq %r12, %rsi
callq 0x32d0
movq 0x40(%rbx), %rsi
movq 0x48(%rbx), %rdx
movq %r14, %rdi
callq 0x32d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %rax, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x32d0
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/codeGenerator.cpp
// Function: CodeGenerator::generateEndFunc(TAC)
void CodeGenerator::generateEndFunc(TAC tac) {
    code << "; endFunc" << nl;
    int paramSize = stoi(tac.first);

    // Deallocate space for locals
    deallocateStackSpace(paramSize);

    code << "RTS" << nl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r15
movq %rdi, %r14
leaq 0x80(%rdi), %rbx
leaq 0x22ee(%rip), %rsi      # 0x12abd
movl $0x9, %edx
movq %rbx, %rdi
callq 0x32d0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %rbx, %rdi
callq 0x32d0
movq 0x8(%r15), %r12
callq 0x3050
movq %rax, %r15
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
movl $0x0, (%r15)
leaq -0x38(%rbp), %r13
movq %r12, %rdi
movq %r13, %rsi
movl $0xa, %edx
callq 0x3330
cmpq %r12, (%r13)
je 0x10872
movslq %eax, %rcx
cmpq %rax, %rcx
jne 0x1087e
movl (%r15), %ecx
cmpl $0x22, %ecx
je 0x1087e
testl %ecx, %ecx
jne 0x10837
movl -0x2c(%rbp), %ecx
movl %ecx, (%r15)
movq %r14, %rdi
movl %eax, %esi
callq 0x10f06
leaq 0x203c(%rip), %rsi      # 0x12884
movl $0x3, %edx
movq %rbx, %rdi
callq 0x32d0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x32d0
leaq 0x225d(%rip), %rdi      # 0x12ad6
callq 0x3190
leaq 0x2251(%rip), %rdi      # 0x12ad6
callq 0x3350
cmpl $0x0, (%r15)
jne 0x10896
movl -0x2c(%rbp), %ecx
movl %ecx, (%r15)
movq %rax, %rdi
callq 0x3420
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/codeGenerator.cpp
// Function: CodeGenerator::popStackToA()
void CodeGenerator::popStackToA() {
    // X <- cSP
    code << "LDX " << cSP << nl;

    // A <- M[cSP]
    code << "LDA $0,X" << nl;

    // cSP++
    code << "INC " << cSP << nl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x80(%rdi), %r14
leaq 0x1ff6(%rip), %rsi      # 0x12948
movl $0x4, %edx
movq %r14, %rdi
callq 0x32d0
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq %r14, %rdi
callq 0x32d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %rax, %rdi
callq 0x32d0
leaq 0x1fc8(%rip), %rsi      # 0x1294d
movl $0x8, %edx
movq %r14, %rdi
callq 0x32d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x32d0
leaq 0x1fae(%rip), %rsi      # 0x12956
movl $0x4, %edx
movq %r14, %rdi
callq 0x32d0
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq %r14, %rdi
callq 0x32d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %rax, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x32d0
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/codeGenerator.cpp
// Function: CodeGenerator::pushAToStack()
void CodeGenerator::pushAToStack() {
    // cSP--
    code << "DEC " << cSP << nl;
    
    // X <- cSP
    code << "LDX " << cSP << nl;

    // M[$0 + $cSP] <- A
    // This effectively means we put the new item at the stack pointer in memory
    code << "STA $0,X" << nl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x80(%rdi), %r14
leaq 0x1f6b(%rip), %rsi      # 0x1295b
movl $0x4, %edx
movq %r14, %rdi
callq 0x32d0
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq %r14, %rdi
callq 0x32d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %rax, %rdi
callq 0x32d0
leaq 0x1f25(%rip), %rsi      # 0x12948
movl $0x4, %edx
movq %r14, %rdi
callq 0x32d0
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq %r14, %rdi
callq 0x32d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %rax, %rdi
callq 0x32d0
leaq 0x1f0a(%rip), %rsi      # 0x12960
movl $0x8, %edx
movq %r14, %rdi
callq 0x32d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x32d0
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/codeGenerator.cpp
// Function: CodeGenerator::lookup(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
CodeVar CodeGenerator::lookup(std::string varName) {
    if (isNumber(varName)) {
        int value = std::stoi(varName);
        return {CVT_CONST, value};  
    }
    if (currentParamMap.find(varName) != currentParamMap.end()) {
        return {CVT_PARAM, currentParamMap[varName]};
    }
    if (globalToAddressMap.find(varName) != globalToAddressMap.end()) {
        return {CVT_GLOBAL, globalToAddressMap[varName]};
    }
    if (localToOffsetMap.find(varName) != localToOffsetMap.end()) {
        return {CVT_LOCAL, localToOffsetMap[varName]};
    }
    localToOffsetMap[varName] = currentLocalOffset;
    currentLocalOffset++;
    return {CVT_LOCAL, localToOffsetMap[varName]};
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rsi), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %r15
movq %r15, %rdi
callq 0x6906
movq (%r15), %rdi
movq 0x8(%r15), %rcx
leaq (%rdi,%rcx), %rax
movq %rdi, %rdx
testq %rcx, %rcx
je 0x10adc
movq %rcx, %rsi
movq %rdi, %rdx
movsbl (%rdx), %r8d
addl $-0x30, %r8d
cmpl $0x9, %r8d
ja 0x10adc
incq %rdx
decq %rsi
jne 0x10ac3
movq %rax, %rdx
testq %rcx, %rcx
setne %cl
cmpq %rax, %rdx
sete %r15b
andb %cl, %r15b
cmpq %r12, %rdi
je 0x10af6
callq 0x3250
testb %r15b, %r15b
je 0x10b54
movq (%rbx), %r14
callq 0x3050
movq %rax, %rbx
movl (%rax), %r12d
movl $0x0, (%rax)
leaq -0x28(%rbp), %r15
movq %r14, %rdi
movq %r15, %rsi
movl $0xa, %edx
callq 0x3330
cmpq %r14, (%r15)
je 0x10c15
movslq %eax, %rcx
cmpq %rax, %rcx
jne 0x10c21
movl (%rbx), %ecx
cmpl $0x22, %ecx
je 0x10c21
testl %ecx, %ecx
jne 0x10b4a
movl %r12d, (%rbx)
movl $0x2, %ecx
jmp 0x10c01
leaq 0x258(%r14), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x116a8
leaq 0x260(%r14), %rcx
cmpq %rcx, %rax
je 0x10b86
movq %r15, %rdi
movq %rbx, %rsi
callq 0x111ba
movl (%rax), %eax
movl $0x3, %ecx
jmp 0x10c01
leaq 0x1f8(%r14), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x116a8
leaq 0x200(%r14), %rcx
cmpq %rcx, %rax
je 0x10bb8
movq %r15, %rdi
movq %rbx, %rsi
callq 0x111ba
movl (%rax), %eax
movl $0x1, %ecx
jmp 0x10c01
leaq 0x228(%r14), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x116a8
leaq 0x230(%r14), %rcx
cmpq %rcx, %rax
jne 0x10bf2
movl 0x298(%r14), %r12d
movq %r15, %rdi
movq %rbx, %rsi
callq 0x111ba
movl %r12d, (%rax)
incl 0x298(%r14)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x111ba
movl (%rax), %eax
xorl %ecx, %ecx
shlq $0x20, %rax
orq %rcx, %rax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1eba(%rip), %rdi      # 0x12ad6
callq 0x3190
leaq 0x1eae(%rip), %rdi      # 0x12ad6
callq 0x3350
cmpl $0x0, (%rbx)
jne 0x10c35
movl %r12d, (%rbx)
movq %rax, %rdi
callq 0x3420
nop
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/codeGenerator.cpp
// Function: CodeGenerator::loadLocalIntoA(int)
void CodeGenerator::loadLocalIntoA(int offset){
    // Locals are located below the frame pointer in memory
    /*
        [ Locals ]
        [ FP ]
        [ Params ]
    */
    // X <- cFP
    code << "LDX " << cFP << nl;
    
    // Subtracting is the same as adding 255 - num
    // e.g. we want to load cFP - 3
    // cFP = $F9
    // cFP = $F9 - $3 = 0xF6
    // $F9 + $FC = 0xF6
    // $FD = $FF - $3 = 255 - 3 = 252
    int adjustedOffset = 256 - offset;
    code << "LDA " << adjustedOffset << ",X" << nl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %r15d
movq %rdi, %rbx
leaq 0x80(%rdi), %r14
leaq 0x1ceb(%rip), %rsi      # 0x12948
movl $0x4, %edx
movq %r14, %rdi
callq 0x32d0
movq 0x40(%rbx), %rsi
movq 0x48(%rbx), %rdx
movq %r14, %rdi
callq 0x32d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %rax, %rdi
callq 0x32d0
movl $0x100, %r12d           # imm = 0x100
subl %r15d, %r12d
leaq 0x1dd3(%rip), %rsi      # 0x12a6c
movl $0x4, %edx
movq %r14, %rdi
callq 0x32d0
movq %r14, %rdi
movl %r12d, %esi
callq 0x3410
movq %rax, %r14
leaq 0x1c98(%rip), %rsi      # 0x12953
movl $0x2, %edx
movq %rax, %rdi
callq 0x32d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x32d0
nop
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/codeGenerator.cpp
// Function: CodeGenerator::storeAIntoLocal(int)
void CodeGenerator::storeAIntoLocal(int offset) {
    // Locals are below the frame pointer in memory
    // Offset can't be 0 - locals start at 1
    code << "LDX " << cFP << nl;
    int adjustedOffset = 256 - offset;
    code << "STA " << adjustedOffset << ",X" << nl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %r15d
movq %rdi, %rbx
leaq 0x80(%rdi), %r14
leaq 0x1b5f(%rip), %rsi      # 0x12948
movl $0x4, %edx
movq %r14, %rdi
callq 0x32d0
movq 0x40(%rbx), %rsi
movq 0x48(%rbx), %rdx
movq %r14, %rdi
callq 0x32d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %rax, %rdi
callq 0x32d0
movl $0x100, %r12d           # imm = 0x100
subl %r15d, %r12d
leaq 0x1b1e(%rip), %rsi      # 0x12943
movl $0x4, %edx
movq %r14, %rdi
callq 0x32d0
movq %r14, %rdi
movl %r12d, %esi
callq 0x3410
movq %rax, %r14
leaq 0x1b0c(%rip), %rsi      # 0x12953
movl $0x2, %edx
movq %rax, %rdi
callq 0x32d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x32d0
nop
// File: /workspace/github_cpp_makefile_star2_O3/taurheim[P]AgNES/codeGenerator.cpp
// Function: CodeGenerator::loadParamIntoA(int)
void CodeGenerator::loadParamIntoA(int offset) {
    // Params are located above the frame pointer in memory
    /*
        [ Locals ]
        [ FP ]
        [ Params ]
    */
    code << "LDX " << cFP << nl;
    code << "LDA " << offset << ",X" << nl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
leaq 0x80(%rdi), %r15
leaq 0x1abe(%rip), %rsi      # 0x12948
movl $0x4, %edx
movq %r15, %rdi
callq 0x32d0
movq 0x40(%rbx), %rsi
movq 0x48(%rbx), %rdx
movq %r15, %rdi
callq 0x32d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %rax, %rdi
callq 0x32d0
leaq 0x1baf(%rip), %rsi      # 0x12a6c
movl $0x4, %edx
movq %r15, %rdi
callq 0x32d0
movq %r15, %rdi
movl %r14d, %esi
callq 0x3410
movq %rax, %r14
leaq 0x1a74(%rip), %rsi      # 0x12953
movl $0x2, %edx
movq %rax, %rdi
callq 0x32d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x32d0
nop