// File: /workspace/github_cpp_makefile_star2_O1/johan-bjareholt[P]lua-compiler/src/ir.cc
// Function: namePass(Expression*, std::map<Expression*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<Expression*>, std::allocator<std::pair<Expression* const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>&)
void namePass(Expression *tree, map<Expression*,string> &nameMap)
{
    std::string name;
    // Exp is funccall
    if (tree->kind == 'f'){
        for (Expression* exp : tree->subexp){
	        namePass(exp, nameMap);
        }
        name = newName();
    }
    // Exp is binop
    else if (tree->left != nullptr && tree->right != nullptr){
	    namePass(tree->left, nameMap);
	    namePass(tree->right, nameMap);
	    name = newName();
    }
    else {
        // Exp is string
        if (tree->name == "")
            name = to_string(tree->value);
        // Exp is var
	    else
            name = tree->name;
    }
  
    auto entry = std::pair<Expression*, string>(tree, name);
    nameMap.insert(entry);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq -0x60(%rbp), %r13
movq %r13, -0x10(%r13)
movq $0x0, -0x8(%r13)
movb $0x0, (%r13)
cmpb $0x66, 0x28(%rdi)
jne 0x6795
leaq 0x10(%r14), %r15
movq %r15, %r12
movq (%r12), %r12
cmpq %r15, %r12
je 0x67c3
movq 0x10(%r12), %rdi
movq %rbx, %rsi
callq 0x6744
jmp 0x677d
movq (%r14), %rdi
testq %rdi, %rdi
je 0x67f6
cmpq $0x0, 0x8(%r14)
je 0x67f6
movq %rbx, %rsi
callq 0x6744
movq 0x8(%r14), %rdi
movq %rbx, %rsi
callq 0x6744
leaq -0x50(%rbp), %rdi
callq 0x65d8
jmp 0x67cc
leaq -0x50(%rbp), %rdi
callq 0x65d8
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %r15
movq %r15, %rsi
callq 0x3320
movq (%r15), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x68da
callq 0x3230
jmp 0x68da
leaq 0x30(%r14), %r15
leaq 0x120fb(%rip), %rsi     # 0x188fc
movq %r15, %rdi
callq 0x30a0
testl %eax, %eax
je 0x681e
leaq -0x70(%rbp), %rdi
movq %r15, %rsi
callq 0x3150
jmp 0x68da
movl 0x2c(%r14), %r15d
movl %r15d, %r12d
negl %r12d
cmovsl %r15d, %r12d
movl $0x1, %r13d
cmpl $0xa, %r12d
jb 0x6882
movl $0x4, %r13d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %r12d, %ecx
cmpl $0x63, %ecx
jbe 0x6879
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x687f
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x6882
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r13d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x6846
addl $-0x3, %r13d
jmp 0x6882
addl $-0x2, %r13d
jmp 0x6882
decl %r13d
shrl $0x1f, %r15d
leal (%r15,%r13), %esi
leaq -0x40(%rbp), %rax
movq %rax, -0x10(%rax)
leaq -0x50(%rbp), %rdi
movl $0x2d, %edx
callq 0x32d0
leaq -0x50(%rbp), %rax
addq (%rax), %r15
movq %r15, %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0x801b
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %r15
movq %r15, %rsi
callq 0x3320
movq (%r15), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x68d6
callq 0x3230
leaq -0x60(%rbp), %r13
leaq -0x48(%rbp), %rdi
movq %r14, -0x8(%rdi)
leaq -0x38(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
addq %rsi, %rdx
callq 0x4baa
leaq -0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x882a
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x6914
callq 0x3230
movq -0x70(%rbp), %rdi
cmpq %r13, %rdi
je 0x6922
callq 0x3230
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x694e
jmp 0x694e
jmp 0x694e
jmp 0x694e
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x6951
callq 0x3230
jmp 0x6951
jmp 0x694e
movq %rax, %rbx
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x6963
callq 0x3230
movq %rbx, %rdi
callq 0x3470