// File: /workspace/github_cpp_makefile_star2_O1/sighingnow[P]compile-pascal/pl0_allocator.cpp
// Function: SimpleAllocator::addr(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
std::string SimpleAllocator::addr(std::string name) {
    int d = env.depth(name);
    LOC loc;
    env.find(name, true, loc);
    if (d == env.depth()) {
        if (loc.is_ref) {
            this->spill("ebx");
            out.emit("    mov ebx, dword [ebp" + loc.offset +"]");
            return "[ebx]";
        }
        else {
            return "[ebp" + loc.offset + "]";
        }
    }
    else {
        this->spill("ebx");
        out.emit("    mov ebx, dword [ebp-" + to_string(d*4) + "]");
        if (loc.is_ref) {
            out.emit("    mov ebx, dword [ebx" + loc.offset + "]");
        }
        return "[ebx" + loc.offset + "]";
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rsi), %rdi
movq %rdx, %rsi
callq 0x8758a
movl %eax, %r15d
leaq 0xe0(%rsp), %r13
movq %r13, %rdi
callq 0x86d84
movq 0x8(%r14), %rdi
movq %r12, %rsi
movl $0x1, %edx
movq %r13, %rcx
callq 0x870be
movq 0x8(%r14), %rax
movq 0x20(%rax), %rcx
subq 0x18(%rax), %rcx
shrq $0x2, %rcx
decl %ecx
cmpl %ecx, %r15d
jne 0x866a0
cmpb $0x1, 0x120(%rsp)
jne 0x86761
leaq 0xd0(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x12b9c(%rip), %rsi     # 0x99199
leaq 0x12b98(%rip), %rdx     # 0x9919c
leaq 0xc0(%rsp), %rdi
callq 0x2670a
movq (%r14), %rax
leaq 0xc0(%rsp), %rsi
movq %r14, %rdi
callq *0x28(%rax)
movq 0xc0(%rsp), %rdi
cmpq %r15, %rdi
je 0x8663f
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x5260
movq 0x10(%r14), %r14
leaq 0x100(%rsp), %rdx
leaq 0x1275d(%rip), %rsi     # 0x98daf
movq %rsp, %rdi
callq 0x1621e
leaq 0x125c7(%rip), %rsi     # 0x98c28
movq %rsp, %rdi
callq 0x5420
leaq 0x90(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x867dd
movq %rdx, 0x80(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x90(%rsp)
jmp 0x867e4
leaq 0xb0(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x12ae5(%rip), %rsi     # 0x99199
leaq 0x12ae1(%rip), %rdx     # 0x9919c
leaq 0xa0(%rsp), %rdi
callq 0x2670a
movq (%r14), %rax
leaq 0xa0(%rsp), %rsi
movq %r14, %rdi
callq *0x28(%rax)
movq 0xa0(%rsp), %rdi
cmpq %r12, %rdi
je 0x866f6
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x5260
shll $0x2, %r15d
movl %r15d, %ebp
negl %ebp
cmovsl %r15d, %ebp
movl $0x1, %r13d
cmpl $0xa, %ebp
jb 0x8686e
movl $0x4, %r13d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebp, %ecx
cmpl $0x63, %ecx
jbe 0x86865
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x8686b
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x8686e
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r13d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x8671f
addl $-0x3, %r13d
jmp 0x8686e
leaq 0x100(%rsp), %rdx
leaq 0x12652(%rip), %rsi     # 0x98dc2
movq %rsp, %rdi
callq 0x1621e
leaq 0x124a9(%rip), %rsi     # 0x98c28
movq %rsp, %rdi
callq 0x5420
leaq 0x10(%rbx), %rdx
movq %rdx, (%rbx)
movq (%rax), %rsi
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rsi
je 0x867a9
movq %rsi, (%rbx)
movq (%rcx), %rdx
movq %rdx, 0x10(%rbx)
jmp 0x867af
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)
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x86ad6
jmp 0x86ae3
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0x80(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r14, %rdi
callq 0x8707c
movq 0x80(%rsp), %rdi
cmpq %r15, %rdi
je 0x86828
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x5260
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x86843
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x5260
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x12576(%rip), %rsi     # 0x98dc7
leaq 0x12574(%rip), %rdx     # 0x98dcc
movq %rbx, %rdi
callq 0x2670a
jmp 0x86ae3
addl $-0x2, %r13d
jmp 0x8686e
decl %r13d
movq 0x10(%r14), %r12
shrl $0x1f, %r15d
leal (%r15,%r13), %esi
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x20(%rsp), %rdi
movl $0x2d, %edx
callq 0x5300
movl %r15d, %edi
leaq 0x20(%rsp), %r15
addq (%r15), %rdi
movl %r13d, %esi
movl %ebp, %edx
callq 0x6b096
leaq 0x1251f(%rip), %rcx     # 0x98dcd
movl $0x18, %r8d
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x52c0
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x868e6
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x868ed
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rsp, %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x1231a(%rip), %rsi     # 0x98c28
callq 0x5420
leaq 0x70(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x8693a
movq %rdx, 0x60(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x70(%rsp)
jmp 0x86942
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq 0x60(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r12, %rdi
callq 0x8707c
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0x8697d
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x5260
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x86993
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x5260
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x869af
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x5260
cmpb $0x1, 0x120(%rsp)
jne 0x86a68
movq 0x10(%r14), %r14
leaq 0x100(%rsp), %rdx
leaq 0x12416(%rip), %rsi     # 0x98de6
movq %rsp, %rdi
callq 0x1621e
leaq 0x12249(%rip), %rsi     # 0x98c28
movq %rsp, %rdi
callq 0x5420
leaq 0x50(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x86a0f
movq %rdx, 0x40(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x50(%rsp)
jmp 0x86a17
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
leaq 0x40(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r14, %rdi
callq 0x8707c
movq 0x40(%rsp), %rdi
cmpq %r12, %rdi
je 0x86a52
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x5260
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x86a68
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x5260
leaq 0x100(%rsp), %rdx
leaq 0x12382(%rip), %rsi     # 0x98df9
movq %rsp, %rdi
callq 0x1621e
leaq 0x121a2(%rip), %rsi     # 0x98c28
movq %rsp, %rdi
callq 0x5420
leaq 0x10(%rbx), %rdx
movq %rdx, (%rbx)
movq (%rax), %rsi
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rsi
je 0x86ab0
movq %rsi, (%rbx)
movq (%rcx), %rdx
movq %rdx, 0x10(%rbx)
jmp 0x86ab6
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 (%rsp), %rdi
cmpq %r15, %rdi
je 0x86ae3
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x5260
leaq 0x110(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x86b04
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x5260
leaq 0xf0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x86b25
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x5260
movq %rbx, %rax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r12, %rdi
je 0x86bd3
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x5260
jmp 0x86bd3
jmp 0x86bd0
jmp 0x86c5f
jmp 0x86c5f
movq %rax, %rbx
movq 0x80(%rsp), %rdi
cmpq %r15, %rdi
je 0x86b92
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x5260
jmp 0x86b92
jmp 0x86b8f
jmp 0x86c5f
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x86be0
jmp 0x86c62
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
cmpq %r15, %rdi
je 0x86c62
movq 0xd0(%rsp), %rsi
jmp 0x86c53
jmp 0x86c5f
jmp 0x86c5f
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x86c62
movq 0x10(%rsp), %rsi
jmp 0x86c53
jmp 0x86c5f
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0x86c08
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x5260
jmp 0x86c08
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x86c23
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x5260
jmp 0x86c23
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x86c62
movq 0x30(%rsp), %rsi
jmp 0x86c53
jmp 0x86c5f
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
cmpq %r12, %rdi
je 0x86c62
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x5260
jmp 0x86c62
jmp 0x86c5f
movq %rax, %rbx
leaq 0xe0(%rsp), %rdi
callq 0x86ef2
movq %rbx, %rdi
callq 0x53d0
nop