// File: /workspace/github_cpp_makefile_star2_O3/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, 0x70(%rsp)
movq %rdi, %r14
callq 0x84a6
movq %r14, %rdi
callq 0x7ac8
testb %al, %al
je 0x8bd0
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 0x199bf(%rip), %rax     # 0x21f98
addq $0x10, %rax
movq %rax, 0xb8(%rsp)
movq 0xc0(%rsp), %rdi
leaq 0xfb91(%rip), %rsi      # 0x18185
callq 0x50b0
testl %eax, %eax
je 0x8bd0
movq %r14, %rdi
callq 0x7c9e
cmpl $0x1, %eax
jne 0x86f0
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x7eca
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 0x8a82
movq %rax, %rbp
movslq %ebp, %rax
cmpq %rbp, %rax
jne 0x8a93
movl (%r13), %eax
cmpl $0x22, %eax
je 0x8a93
testl %eax, %eax
leaq 0x58(%rsp), %rbx
jne 0x867b
movl %r15d, (%r13)
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x8692
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 0x16a56
movl $0x1, %r8d
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x10974(%rip), %rcx     # 0x1903c
callq 0x5320
movq %r12, 0x8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x8757
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x875f
movq %r14, %rdi
callq 0x7c9e
cmpl $0x2, %eax
jne 0x8a6d
leaq 0xc8(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x80ce
movl $0x3, %r8d
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x10907(%rip), %rcx     # 0x1902f
callq 0x5320
movq %rbx, 0x48(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x87e4
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0x87ea
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 0x70(%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 0x87cc
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x8a6d
movq 0x38(%rsp), %rsi
jmp 0x8a65
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 0x98(%rsp), %rdi
movq %r14, %rsi
callq 0x7f8c
movq 0x48(%rsp), %rcx
movl $0xf, %edi
cmpq %rbx, %rcx
je 0x8826
movq 0x58(%rsp), %rdi
movq 0x50(%rsp), %r8
movq 0x98(%rsp), %rsi
movq 0xa0(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rdi, %rax
jbe 0x8863
movl $0xf, %edi
leaq 0xa8(%rsp), %r9
cmpq %r9, %rsi
je 0x885e
movq 0xa8(%rsp), %rdi
cmpq %rdi, %rax
jbe 0x886f
leaq 0x48(%rsp), %rdi
callq 0x50c0
jmp 0x8880
leaq 0x98(%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 0x88a0
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x88a7
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 0x78(%rsp), %rdi
movq %r14, %rsi
callq 0x8314
movq 0x28(%rsp), %rcx
movl $0xf, %edi
cmpq %r15, %rcx
je 0x88e5
movq 0x38(%rsp), %rdi
movq 0x30(%rsp), %r8
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rdi, %rax
jbe 0x891f
movl $0xf, %edi
leaq 0x88(%rsp), %r9
cmpq %r9, %rsi
je 0x891a
movq 0x88(%rsp), %rdi
cmpq %rdi, %rax
jbe 0x892b
leaq 0x28(%rsp), %rdi
callq 0x50c0
jmp 0x8939
leaq 0x78(%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 0x8959
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x8961
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 0x70(%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 0x89d3
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x89f5
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x8a0c
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0x8a31
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x48(%rsp), %rdi
cmpq %rbx, %rdi
je 0x8a48
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0x8a6d
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x52c0
movq %r14, %rdi
callq 0x7ac8
testb %al, %al
jne 0x85e5
jmp 0x8bd0
leaq 0xf70c(%rip), %rdi      # 0x18195
callq 0x51a0
jmp 0x8be2
leaq 0xf6fb(%rip), %rdi      # 0x18195
callq 0x5410
jmp 0x8be2
movq %rdx, %rbp
movq %rax, %rbx
jmp 0x8ad4
movq %rdx, %rbp
movq %rax, %rbx
cmpl $0x0, (%r13)
jne 0x8abd
movl %r15d, (%r13)
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x8ad4
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x52c0
cmpl $0x1, %ebp
jne 0x8d3a
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 0x7eca
movq 0x68(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x173b6
movl %eax, %ebp
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x8b3c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x52c0
testb %bpl, %bpl
je 0x8b78
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x7eca
movq 0x68(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x173cc
movl %eax, %ebp
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x8bb7
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x52c0
jmp 0x8bb7
movl 0x74(%r14), %ebp
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x7eca
movl 0x74(%r14), %edx
movq 0x68(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x17332
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x8bb3
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x52c0
incl 0x74(%r14)
leaq 0x28(%rsp), %rdi
callq 0x54b0
callq 0x54a0
leaq 0x58(%rsp), %rbx
jmp 0x8692
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8bea
jmp 0x8c06
jmp 0x8bea
jmp 0x8c06
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x8c09
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x52c0
jmp 0x8c09
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x54b0
callq 0x54a0
jmp 0x8d3a
movq %rax, %rdi
callq 0x7171
movq %rax, %rbx
jmp 0x8ca4
movq %rax, %rbx
jmp 0x8cc9
movq %rax, %rbx
jmp 0x8ce5
movq %rax, %rbx
jmp 0x8c66
movq %rax, %rbx
jmp 0x8c88
movq %rax, %rbx
jmp 0x8d1e
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x8c66
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x8c88
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x8ca4
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0x8cc9
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x8ce5
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0x8d3a
movq 0xd8(%rsp), %rsi
jmp 0x8d32
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x8d1e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x8d3a
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x52c0
movq %rbx, %rdi
callq 0x5530