// File: AndrewAlbert[P]Compiler-Theory/SourceCode/codeGenerator.cpp
// Function: codeGenerator::popStack[abi:cxx11](char, int)
string codeGenerator::popStack( char stackID, int type ){
	if( !ShouldGenerate() ) return "";
	string returnStr;
	switch( stackID ){
		case 'L':
			if(leftStack.size() == 0){
				cout << "LEFT STACK EMPTY!\n";
				return "";
			}
			returnStr = leftStack.top();
			leftStack.pop();
			return returnStr;
		case 'E':
			if(exprStack.size() == 0){
				cout << "EXPR STACK EMPTY!\n";
				return "";
			}
			returnStr = exprStack.top();
			exprStack.pop();
			if( type == TYPE_FLOAT) freg_in_use--;
			else ireg_in_use--;
			return returnStr;
		case 'R':
			if(rightStack.size() == 0){
				cout << "RIGHT STACK EMPTY!\n";
				return "";
			}
			returnStr = rightStack.top();
			rightStack.pop();
			return returnStr;
		default:
			cout << "INVALID STACK ID!\n";
			return "invalid stack id";
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x78(%rbp)
movb %dl, %al
movq %rdi, %rdx
movq %rdx, -0x70(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movl %ecx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x68(%rbp)
callq 0x19590
testb $0x1, %al
jne 0x1a822
leaq -0x19(%rbp), %rdi
movq %rdi, -0x80(%rbp)
callq 0x3430
movq -0x78(%rbp), %rdi
movq -0x80(%rbp), %rdx
leaq 0xc48e(%rip), %rsi      # 0x26c81
callq 0x62d0
jmp 0x1a7fa
leaq -0x19(%rbp), %rdi
callq 0x32e0
jmp 0x1abd8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x19(%rbp), %rdi
callq 0x32e0
jmp 0x1abe5
leaq -0x50(%rbp), %rdi
callq 0x3370
movsbl -0x11(%rbp), %eax
movl %eax, -0x84(%rbp)
subl $0x45, %eax
je 0x1a95b
jmp 0x1a840
movl -0x84(%rbp), %eax
subl $0x4c, %eax
je 0x1a861
jmp 0x1a84d
movl -0x84(%rbp), %eax
subl $0x52, %eax
je 0x1aa75
jmp 0x1ab5b
movq -0x68(%rbp), %rdi
addq $0x1d0, %rdi            # imm = 0x1D0
callq 0x1f370
movq %rax, -0x90(%rbp)
jmp 0x1a87a
movq -0x90(%rbp), %rax
cmpq $0x0, %rax
jne 0x1a905
movq 0x18742(%rip), %rdi     # 0x32fd0
leaq 0xc805(%rip), %rsi      # 0x2709a
callq 0x3270
jmp 0x1a89c
leaq -0x51(%rbp), %rdi
movq %rdi, -0x98(%rbp)
callq 0x3430
movq -0x78(%rbp), %rdi
movq -0x98(%rbp), %rdx
leaq 0xc3c3(%rip), %rsi      # 0x26c81
callq 0x62d0
jmp 0x1a8c5
leaq -0x51(%rbp), %rdi
callq 0x32e0
movl $0x1, -0x58(%rbp)
jmp 0x1abc2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x1abcd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x51(%rbp), %rdi
callq 0x32e0
jmp 0x1abcd
movq -0x68(%rbp), %rdi
addq $0x1d0, %rdi            # imm = 0x1D0
callq 0x1f390
movq %rax, -0xa0(%rbp)
jmp 0x1a91e
movq -0xa0(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0x3050
jmp 0x1a930
movq -0x68(%rbp), %rdi
addq $0x1d0, %rdi            # imm = 0x1D0
callq 0x1f3b0
jmp 0x1a942
movq -0x78(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3180
movl $0x1, -0x58(%rbp)
jmp 0x1abc2
movq -0x68(%rbp), %rdi
addq $0x130, %rdi            # imm = 0x130
callq 0x1f370
movq %rax, -0xa8(%rbp)
jmp 0x1a974
movq -0xa8(%rbp), %rax
cmpq $0x0, %rax
jne 0x1a9ee
movq 0x18648(%rip), %rdi     # 0x32fd0
leaq 0xc71e(%rip), %rsi      # 0x270ad
callq 0x3270
jmp 0x1a996
leaq -0x59(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x3430
movq -0x78(%rbp), %rdi
movq -0xb0(%rbp), %rdx
leaq 0xc2c9(%rip), %rsi      # 0x26c81
callq 0x62d0
jmp 0x1a9bf
leaq -0x59(%rbp), %rdi
callq 0x32e0
movl $0x1, -0x58(%rbp)
jmp 0x1abc2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x59(%rbp), %rdi
callq 0x32e0
jmp 0x1abcd
movq -0x68(%rbp), %rdi
addq $0x130, %rdi            # imm = 0x130
callq 0x1f390
movq %rax, -0xb8(%rbp)
jmp 0x1aa07
movq -0xb8(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0x3050
jmp 0x1aa19
movq -0x68(%rbp), %rdi
addq $0x130, %rdi            # imm = 0x130
callq 0x1f3b0
jmp 0x1aa2b
cmpl $0x10b, -0x18(%rbp)     # imm = 0x10B
jne 0x1aa49
movq -0x68(%rbp), %rax
movl 0x124(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x124(%rax)
jmp 0x1aa5c
movq -0x68(%rbp), %rax
movl 0x120(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x120(%rax)
movq -0x78(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3180
movl $0x1, -0x58(%rbp)
jmp 0x1abc2
movq -0x68(%rbp), %rdi
addq $0x180, %rdi            # imm = 0x180
callq 0x1f370
movq %rax, -0xc0(%rbp)
jmp 0x1aa8e
movq -0xc0(%rbp), %rax
cmpq $0x0, %rax
jne 0x1ab08
movq 0x1852e(%rip), %rdi     # 0x32fd0
leaq 0xc617(%rip), %rsi      # 0x270c0
callq 0x3270
jmp 0x1aab0
leaq -0x5a(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0x3430
movq -0x78(%rbp), %rdi
movq -0xc8(%rbp), %rdx
leaq 0xc1af(%rip), %rsi      # 0x26c81
callq 0x62d0
jmp 0x1aad9
leaq -0x5a(%rbp), %rdi
callq 0x32e0
movl $0x1, -0x58(%rbp)
jmp 0x1abc2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x5a(%rbp), %rdi
callq 0x32e0
jmp 0x1abcd
movq -0x68(%rbp), %rdi
addq $0x180, %rdi            # imm = 0x180
callq 0x1f390
movq %rax, -0xd0(%rbp)
jmp 0x1ab21
movq -0xd0(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0x3050
jmp 0x1ab33
movq -0x68(%rbp), %rdi
addq $0x180, %rdi            # imm = 0x180
callq 0x1f3b0
jmp 0x1ab45
movq -0x78(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3180
movl $0x1, -0x58(%rbp)
jmp 0x1abc2
movq 0x1846e(%rip), %rdi     # 0x32fd0
leaq 0xc56b(%rip), %rsi      # 0x270d4
callq 0x3270
jmp 0x1ab70
leaq -0x5b(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
callq 0x3430
movq -0x78(%rbp), %rdi
movq -0xd8(%rbp), %rdx
leaq 0xc555(%rip), %rsi      # 0x270e7
callq 0x62d0
jmp 0x1ab99
leaq -0x5b(%rbp), %rdi
callq 0x32e0
movl $0x1, -0x58(%rbp)
jmp 0x1abc2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x5b(%rbp), %rdi
callq 0x32e0
jmp 0x1abcd
leaq -0x50(%rbp), %rdi
callq 0x31a0
jmp 0x1abd8
leaq -0x50(%rbp), %rdi
callq 0x31a0
jmp 0x1abe5
movq -0x70(%rbp), %rax
addq $0xe0, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0x3420
nop