// File: ELD[P]HackAssembler/src/parser.cpp
// Function: hack::Parser::advance()
bool Parser::advance()
    {
        if (hasMoreCommands()) {
            if (commandType() != L_COMMAND) {
                _pc += 1;
            }
            std::string tempCommand;
            do {
                getline(_file, tempCommand);
                trimCommand(tempCommand);
            } while ((isWhitespace(tempCommand) || tempCommand.substr(0,2) == "//") && hasMoreCommands());
            if (tempCommand != "") {
                trimComments(tempCommand);
                trimCommand(tempCommand);
                _currentCommand = tempCommand;
                return true;
            } else {
                _currentCommand = "GARBAGE";
                return false;
            }
        }

        return false;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0xa4b0
testb $0x1, %al
jne 0xa505
jmp 0xa6a5
movq -0x70(%rbp), %rdi
callq 0xa6c0
cmpl $0x0, %eax
je 0xa520
movq -0x70(%rbp), %rax
movl 0x70(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x70(%rax)
leaq -0x30(%rbp), %rdi
callq 0x6590
movq -0x70(%rbp), %rax
movq (%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x60c0
jmp 0xa53b
movq -0x70(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0xa730
jmp 0xa54a
jmp 0xa54c
movq -0x70(%rbp), %rdi
movb $0x0, -0x61(%rbp)
leaq -0x30(%rbp), %rsi
callq 0xa840
movb %al, -0x71(%rbp)
jmp 0xa562
movb -0x71(%rbp), %al
testb $0x1, %al
jne 0xa5ab
jmp 0xa56b
xorl %eax, %eax
movl %eax, %edx
leaq -0x60(%rbp), %rdi
leaq -0x30(%rbp), %rsi
movl $0x2, %ecx
callq 0x6440
jmp 0xa583
movb $0x1, -0x61(%rbp)
leaq 0x2fc84(%rip), %rsi     # 0x3a212
leaq -0x60(%rbp), %rdi
callq 0xba70
movb %al, -0x72(%rbp)
jmp 0xa59c
movb -0x72(%rbp), %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x73(%rbp)
jne 0xa5ab
jmp 0xa5c1
movq -0x70(%rbp), %rdi
callq 0xa4b0
movb %al, -0x74(%rbp)
jmp 0xa5b9
movb -0x74(%rbp), %al
movb %al, -0x73(%rbp)
jmp 0xa5c1
movb -0x73(%rbp), %al
movb %al, -0x75(%rbp)
testb $0x1, -0x61(%rbp)
jne 0xa5cf
jmp 0xa5d8
leaq -0x60(%rbp), %rdi
callq 0x62b0
movb -0x75(%rbp), %al
testb $0x1, %al
jne 0xa529
jmp 0xa5e5
leaq 0x2fc84(%rip), %rsi     # 0x3a270
leaq -0x30(%rbp), %rdi
callq 0xbaa0
movb %al, -0x76(%rbp)
jmp 0xa5fa
movb -0x76(%rbp), %al
testb $0x1, %al
jne 0xa603
jmp 0xa66e
movq -0x70(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0xa8d0
jmp 0xa612
movq -0x70(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0xa730
jmp 0xa621
movq -0x70(%rbp), %rdi
addq $0x8, %rdi
leaq -0x30(%rbp), %rsi
callq 0x6070
jmp 0xa634
movb $0x1, -0x1(%rbp)
movl $0x1, -0x68(%rbp)
jmp 0xa68f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xa69a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
testb $0x1, -0x61(%rbp)
jne 0xa663
jmp 0xa66c
leaq -0x60(%rbp), %rdi
callq 0x62b0
jmp 0xa69a
movq -0x70(%rbp), %rdi
addq $0x8, %rdi
leaq 0x2fb98(%rip), %rsi     # 0x3a215
callq 0x6580
jmp 0xa684
movb $0x0, -0x1(%rbp)
movl $0x1, -0x68(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x62b0
jmp 0xa6a9
leaq -0x30(%rbp), %rdi
callq 0x62b0
jmp 0xa6b7
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x80, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x6710