// File: johan-bjareholt[P]lua-compiler/src/convert.cc
// Function: formatSymbol(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&, bool)
void formatSymbol(std::string& val, std::set<std::string>& symbolTable, bool localScope){
    auto lvar = localVars.find(val);
    if (is_digits(val)){
        std::stringstream tempss;
        tempss << "$" << val;
        val = tempss.str();
	}
    else if (localScope && lvar != localVars.end()){
        std::stringstream tempss;
        tempss << (*lvar).second << "(%%rsp)";
        val = tempss.str();
    }
    else if (localScope){
        localVars.insert(std::make_pair(val, varoffset));
        std::stringstream tmpss;
        tmpss << varoffset << "(%%rsp)";
        val = tmpss.str();
        varoffset+=8;
    }
	else {
        if (is_string(val)){
            symbolTable.erase(val);
            val = newString(val);
        }
        else {
            regVar(val);
        }
	    symbolTable.insert(val);
        add_brackets(val);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x630, %rsp            # imm = 0x630
movb %dl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
andb $0x1, %al
movb %al, -0x11(%rbp)
movq -0x8(%rbp), %rsi
leaq 0x293f3(%rip), %rdi     # 0x3e448
callq 0x15d10
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
callq 0x14eb0
testb $0x1, %al
jne 0x15070
jmp 0x1510f
leaq -0x1a8(%rbp), %rdi
callq 0x31d0
leaq -0x198(%rbp), %rdi
leaq 0x167bf(%rip), %rsi     # 0x2b849
callq 0x3260
movq %rax, -0x5e0(%rbp)
jmp 0x15098
movq -0x5e0(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x3220
jmp 0x150aa
leaq -0x1d8(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
callq 0x3250
jmp 0x150bf
movq -0x8(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0x3340
leaq -0x1d8(%rbp), %rdi
callq 0x3528
leaq -0x1a8(%rbp), %rdi
callq 0x31e0
jmp 0x1545f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b0(%rbp)
movl %eax, -0x1b4(%rbp)
leaq -0x1a8(%rbp), %rdi
callq 0x31e0
jmp 0x15468
xorl %eax, %eax
testb $0x1, -0x11(%rbp)
movb %al, -0x5e1(%rbp)
je 0x15146
leaq 0x29324(%rip), %rdi     # 0x3e448
callq 0x15d70
movq %rax, -0x1e0(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x1e0(%rbp), %rsi
callq 0x15d40
movb %al, -0x5e1(%rbp)
movb -0x5e1(%rbp), %al
testb $0x1, %al
jne 0x15155
jmp 0x1520a
leaq -0x368(%rbp), %rdi
callq 0x31d0
leaq -0x358(%rbp), %rax
movq %rax, -0x5f8(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x15da0
movq -0x5f8(%rbp), %rdi
movl 0x20(%rax), %esi
callq 0x3490
movq %rax, -0x5f0(%rbp)
jmp 0x15190
movq -0x5f0(%rbp), %rdi
leaq 0x166b2(%rip), %rsi     # 0x2b850
callq 0x3260
jmp 0x151a5
leaq -0x388(%rbp), %rdi
leaq -0x368(%rbp), %rsi
callq 0x3250
jmp 0x151ba
movq -0x8(%rbp), %rdi
leaq -0x388(%rbp), %rsi
callq 0x3340
leaq -0x388(%rbp), %rdi
callq 0x3528
leaq -0x368(%rbp), %rdi
callq 0x31e0
jmp 0x1545d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b0(%rbp)
movl %eax, -0x1b4(%rbp)
leaq -0x368(%rbp), %rdi
callq 0x31e0
jmp 0x15468
testb $0x1, -0x11(%rbp)
je 0x1534d
movq -0x8(%rbp), %rsi
leaq 0x29225(%rip), %rdx     # 0x3e444
leaq -0x3b0(%rbp), %rdi
movq %rdi, -0x610(%rbp)
callq 0x15c30
movq -0x610(%rbp), %rsi
leaq 0x29208(%rip), %rdi     # 0x3e448
callq 0x15bf0
movb %dl, -0x601(%rbp)
movq %rax, -0x600(%rbp)
jmp 0x15254
movb -0x601(%rbp), %al
movq -0x600(%rbp), %rcx
movq %rcx, -0x3c0(%rbp)
movb %al, -0x3b8(%rbp)
leaq -0x3b0(%rbp), %rdi
callq 0x15c70
leaq -0x548(%rbp), %rdi
callq 0x31d0
leaq -0x538(%rbp), %rdi
movl 0x291b1(%rip), %esi     # 0x3e444
callq 0x3490
movq %rax, -0x618(%rbp)
jmp 0x152a1
movq -0x618(%rbp), %rdi
leaq 0x165a1(%rip), %rsi     # 0x2b850
callq 0x3260
jmp 0x152b6
leaq -0x568(%rbp), %rdi
leaq -0x548(%rbp), %rsi
callq 0x3250
jmp 0x152cb
movq -0x8(%rbp), %rdi
leaq -0x568(%rbp), %rsi
callq 0x3340
leaq -0x568(%rbp), %rdi
callq 0x3528
movl 0x29157(%rip), %eax     # 0x3e444
addl $0x8, %eax
movl %eax, 0x2914e(%rip)     # 0x3e444
leaq -0x548(%rbp), %rdi
callq 0x31e0
jmp 0x1545b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b0(%rbp)
movl %eax, -0x1b4(%rbp)
leaq -0x3b0(%rbp), %rdi
callq 0x15c70
jmp 0x15468
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b0(%rbp)
movl %eax, -0x1b4(%rbp)
leaq -0x548(%rbp), %rdi
callq 0x31e0
jmp 0x15468
movq -0x8(%rbp), %rdi
callq 0x14f00
testb $0x1, %al
jne 0x1535f
jmp 0x153e5
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x15ab0
movq -0x8(%rbp), %rsi
leaq -0x5a8(%rbp), %rdi
movq %rdi, -0x620(%rbp)
callq 0x3100
movq -0x620(%rbp), %rsi
leaq -0x588(%rbp), %rdi
callq 0x15480
jmp 0x15398
movq -0x8(%rbp), %rdi
leaq -0x588(%rbp), %rsi
callq 0x3340
leaq -0x588(%rbp), %rdi
callq 0x3528
leaq -0x5a8(%rbp), %rdi
callq 0x3528
jmp 0x15438
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b0(%rbp)
movl %eax, -0x1b4(%rbp)
leaq -0x5a8(%rbp), %rdi
callq 0x3528
jmp 0x15468
movq -0x8(%rbp), %rsi
leaq -0x5c8(%rbp), %rdi
movq %rdi, -0x628(%rbp)
callq 0x3100
movq -0x628(%rbp), %rdi
callq 0x15640
jmp 0x1540a
leaq -0x5c8(%rbp), %rdi
callq 0x3528
jmp 0x15438
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b0(%rbp)
movl %eax, -0x1b4(%rbp)
leaq -0x5c8(%rbp), %rdi
callq 0x3528
jmp 0x15468
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x15dc0
movq %rax, -0x5d8(%rbp)
movb %dl, -0x5d0(%rbp)
movq -0x8(%rbp), %rdi
callq 0x14f50
jmp 0x1545d
jmp 0x1545f
addq $0x630, %rsp            # imm = 0x630
popq %rbp
retq
movq -0x1b0(%rbp), %rdi
callq 0x34b0
nopw %cs:(%rax,%rax)