// File: /workspace/github_cpp_makefile_star2_O1/ELD[P]HackAssembler/src/parser.cpp
// Function: hack::Parser::translateAssembly(std::ostream&)
void Parser::translateAssembly(std::ostream& oss)
    {
        collectLabels();
        while (advance()) {
            if (_currentCommand == "GARBAGE") {
                return;
            }

            if (commandType() == A_COMMAND) {
                int value;

                try {
                    value = stoi(getSymbol());
                } catch (std::invalid_argument exc) {
                    if (_symbols.contains(getSymbol())) {
                        value = _symbols.retrieveSymbol(getSymbol());
                    } else {
                        value = _mem;
                        _symbols.addSymbol(getSymbol(), _mem);
                        ++_mem;
                    }
                }

                oss << "0" + translateACode(value) << std::endl;
            } else if (commandType() == C_COMMAND) {
                oss << "111" + getCompBits() + getDestBits() + getJumpBits() << std::endl;
            }
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rsi, 0xb0(%rsp)
movq %rdi, %r14
callq 0x84e4
movq %r14, %rdi
callq 0x7adc
testb %al, %al
je 0x8c1b
leaq 0x8(%r14), %rax
movq %rax, 0xc0(%rsp)
leaq 0x58(%rsp), %rbx
leaq 0x38(%rsp), %r15
leaq 0x18(%rsp), %r12
leaq 0x78(%r14), %rax
movq %rax, 0x68(%rsp)
movq 0x1997e(%rip), %rax     # 0x21f98
addq $0x10, %rax
movq %rax, 0xb8(%rsp)
movq 0xc0(%rsp), %rdi
leaq 0xfb50(%rip), %rsi      # 0x18185
callq 0x50b0
testl %eax, %eax
je 0x8c1b
movq %r14, %rdi
callq 0x7cc8
cmpl $0x1, %eax
jne 0x8731
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x7f08
movq 0x8(%rsp), %rbx
callq 0x5060
movq %rax, %r13
movl (%rax), %r15d
movl $0x0, (%rax)
movq %rbx, %rdi
leaq 0x28(%rsp), %rsi
movl $0xa, %edx
callq 0x53d0
cmpq %rbx, 0x28(%rsp)
je 0x8acd
movq %rax, %rbp
movslq %ebp, %rax
cmpq %rbp, %rax
jne 0x8ade
movl (%r13), %eax
cmpl $0x22, %eax
je 0x8ade
testl %eax, %eax
leaq 0x58(%rsp), %rbx
jne 0x86bc
movl %r15d, (%r13)
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x86d3
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x52c0
leaq 0x38(%rsp), %r15
andl $0x7fff, %ebp           # imm = 0x7FFF
movq %rbp, 0x48(%rsp)
leaq 0x28(%rsp), %r13
movq %r13, %rdi
leaq 0x48(%rsp), %rsi
callq 0x16a84
movl $0x1, %r8d
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x10933(%rip), %rcx     # 0x1903c
callq 0x5320
movq %r12, 0x8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x8798
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x87a0
movq %r14, %rdi
callq 0x7cc8
cmpl $0x2, %eax
jne 0x8ab8
leaq 0xc8(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x810c
movl $0x3, %r8d
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x108c6(%rip), %rcx     # 0x1902f
callq 0x5320
movq %rbx, 0x48(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x8828
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0x882e
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0xb0(%rsp), %rdi
callq 0x5340
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x52a0
movsbl %al, %esi
movq %r13, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x51e0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x8810
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x8ab8
movq 0x38(%rsp), %rsi
jmp 0x8ab0
movups (%rcx), %xmm0
movups %xmm0, (%rbx)
movq 0x8(%rax), %rdx
movq %rdx, 0x50(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x90(%rsp), %rdi
movq %r14, %rsi
callq 0x7fca
movq 0x48(%rsp), %rcx
movl $0xf, %esi
cmpq %rbx, %rcx
je 0x886a
movq 0x58(%rsp), %rsi
movq 0x50(%rsp), %r8
movq 0x98(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
jbe 0x88a4
movl $0xf, %esi
leaq 0xa0(%rsp), %rdi
cmpq %rdi, 0x90(%rsp)
je 0x889f
movq 0xa0(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x88b8
movq 0x90(%rsp), %rsi
leaq 0x48(%rsp), %rdi
callq 0x50c0
jmp 0x88c9
leaq 0x90(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5320
movq %r15, 0x28(%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x88e9
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x88f0
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x30(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x70(%rsp), %rdi
movq %r14, %rsi
callq 0x8352
movq 0x28(%rsp), %rcx
movl $0xf, %esi
cmpq %r15, %rcx
je 0x892e
movq 0x38(%rsp), %rsi
movq 0x30(%rsp), %r8
movq 0x78(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
jbe 0x8962
movl $0xf, %esi
leaq 0x80(%rsp), %rdi
cmpq %rdi, 0x70(%rsp)
je 0x895d
movq 0x80(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x8973
movq 0x70(%rsp), %rsi
leaq 0x28(%rsp), %rdi
callq 0x50c0
jmp 0x8981
leaq 0x70(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5320
movq %r12, 0x8(%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x89a1
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x89a9
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0xb0(%rsp), %rdi
callq 0x5340
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x52a0
movsbl %al, %esi
movq %r13, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x51e0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x8a1e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x8a40
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x8a57
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x8a7c
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x48(%rsp), %rdi
cmpq %rbx, %rdi
je 0x8a93
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0x8ab8
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x52c0
movq %r14, %rdi
callq 0x7adc
testb %al, %al
jne 0x8626
jmp 0x8c1b
leaq 0xf6c1(%rip), %rdi      # 0x18195
callq 0x51a0
jmp 0x8c2d
leaq 0xf6b0(%rip), %rdi      # 0x18195
callq 0x5410
jmp 0x8c2d
movq %rdx, %rbp
movq %rax, %rbx
jmp 0x8b1f
movq %rdx, %rbp
movq %rax, %rbx
cmpl $0x0, (%r13)
jne 0x8b08
movl %r15d, (%r13)
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x8b1f
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x52c0
cmpl $0x1, %ebp
jne 0x8d85
movq %rbx, %rdi
callq 0x5380
leaq 0x28(%rsp), %rdi
movq %rax, %rsi
callq 0x54c0
movq 0xb8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq %rbx, %rdi
callq 0x5120
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x7f08
movq 0x68(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x173de
movl %eax, %ebp
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x8b87
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x52c0
testb %bpl, %bpl
je 0x8bc3
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x7f08
movq 0x68(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x173f4
movl %eax, %ebp
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x8c02
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x52c0
jmp 0x8c02
movl 0x74(%r14), %ebp
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x7f08
movl 0x74(%r14), %edx
movq 0x68(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x1735a
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x8bfe
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x52c0
incl 0x74(%r14)
leaq 0x28(%rsp), %rdi
callq 0x54b0
callq 0x54a0
leaq 0x58(%rsp), %rbx
jmp 0x86d3
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8c35
jmp 0x8c51
jmp 0x8c35
jmp 0x8c51
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x8c54
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x52c0
jmp 0x8c54
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x54b0
callq 0x54a0
jmp 0x8d85
movq %rax, %rdi
callq 0x7191
movq %rax, %rbx
jmp 0x8cef
movq %rax, %rbx
jmp 0x8d14
movq %rax, %rbx
jmp 0x8d30
movq %rax, %rbx
jmp 0x8cb1
movq %rax, %rbx
jmp 0x8cd3
movq %rax, %rbx
jmp 0x8d69
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x8cb1
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x8cd3
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x8cef
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x8d14
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x8d30
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0x8d85
movq 0xd8(%rsp), %rsi
jmp 0x8d7d
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x8d69
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x8d85
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x52c0
movq %rbx, %rdi
callq 0x5530
nop