// File: /workspace/github_cpp_makefile_star2_O3/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 0x6762
leaq 0x10(%r14), %r15
movq %r15, %r12
movq (%r12), %r12
cmpq %r15, %r12
je 0x6790
movq 0x10(%r12), %rdi
movq %rbx, %rsi
callq 0x6711
jmp 0x674a
movq (%r14), %rdi
testq %rdi, %rdi
je 0x67c3
cmpq $0x0, 0x8(%r14)
je 0x67c3
movq %rbx, %rsi
callq 0x6711
movq 0x8(%r14), %rdi
movq %rbx, %rsi
callq 0x6711
leaq -0x50(%rbp), %rdi
callq 0x65a5
jmp 0x6799
leaq -0x50(%rbp), %rdi
callq 0x65a5
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %r15
movq %r15, %rsi
callq 0x3320
movq (%r15), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x68a7
callq 0x3230
jmp 0x68a7
leaq 0x30(%r14), %r15
leaq 0x1110e(%rip), %rsi     # 0x178dc
movq %r15, %rdi
callq 0x30a0
testl %eax, %eax
je 0x67eb
leaq -0x70(%rbp), %rdi
movq %r15, %rsi
callq 0x3150
jmp 0x68a7
movl 0x2c(%r14), %r15d
movl %r15d, %r12d
negl %r12d
cmovsl %r15d, %r12d
movl $0x1, %r13d
cmpl $0xa, %r12d
jb 0x684f
movl $0x4, %r13d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %r12d, %ecx
cmpl $0x63, %ecx
jbe 0x6846
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x684c
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x684f
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r13d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x6813
addl $-0x3, %r13d
jmp 0x684f
addl $-0x2, %r13d
jmp 0x684f
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 0x7ff7
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %r15
movq %r15, %rsi
callq 0x3320
movq (%r15), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x68a3
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 0x8800
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x68e1
callq 0x3230
movq -0x70(%rbp), %rdi
cmpq %r13, %rdi
je 0x68ef
callq 0x3230
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x691b
jmp 0x691b
jmp 0x691b
jmp 0x691b
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x691e
callq 0x3230
jmp 0x691e
jmp 0x691b
movq %rax, %rbx
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x6930
callq 0x3230
movq %rbx, %rdi
callq 0x3470