// File: AndrewAlbert[P]Compiler-Theory/SourceCode/codeGenerator.cpp
// Function: codeGenerator::popArguments(int)
void codeGenerator::popArguments(int SPoffset){
	if( !ShouldGenerate() ) return;
	
	while( argListStack.size() != 0 ){
		
		savedArgument = argListStack.top();
		argListStack.pop();
		
		if( savedArgument.index < 0 && savedArgument.size > 1 && !savedArgument.indirect ){
			SPoffset -= savedArgument.size;
		}
		else{
			SPoffset -= 1;
		}

		if( savedArgument.paramType == TYPE_PARAM_OUT || savedArgument.paramType == TYPE_PARAM_INOUT ){
			comment("Pop argument.");
			mm2reg(savedArgument.type, savedArgument.size, SPoffset, false, savedArgument.index, false, TYPE_INTEGER, true );
			reg2mm(savedArgument.type, savedArgument.type, savedArgument.size, savedArgument.size, savedArgument.offset, savedArgument.isGlobal);
		}
	}
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x90(%rbp)
callq 0x19590
testb $0x1, %al
jne 0x1ec8b
jmp 0x1ee92
jmp 0x1ec8d
movq -0x90(%rbp), %rdi
addq $0x2b8, %rdi            # imm = 0x2B8
callq 0x1f4d0
cmpq $0x0, %rax
je 0x1ee90
movq -0x90(%rbp), %rdi
addq $0x2b8, %rdi            # imm = 0x2B8
callq 0x1f4f0
movq -0x90(%rbp), %rdi
movq (%rax), %rcx
movq %rcx, 0x2a0(%rdi)
movq 0x8(%rax), %rcx
movq %rcx, 0x2a8(%rdi)
movq 0x10(%rax), %rax
movq %rax, 0x2b0(%rdi)
addq $0x2b8, %rdi            # imm = 0x2B8
callq 0x1f510
movq -0x90(%rbp), %rax
cmpl $0x0, 0x2ac(%rax)
jge 0x1ed37
movq -0x90(%rbp), %rax
cmpl $0x1, 0x2a8(%rax)
jle 0x1ed37
movq -0x90(%rbp), %rax
testb $0x1, 0x2b4(%rax)
jne 0x1ed37
movq -0x90(%rbp), %rax
movl 0x2a8(%rax), %ecx
movl -0xc(%rbp), %eax
subl %ecx, %eax
movl %eax, -0xc(%rbp)
jmp 0x1ed40
movl -0xc(%rbp), %eax
subl $0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x90(%rbp), %rax
cmpl $0x120, 0x2a0(%rax)     # imm = 0x120
je 0x1ed6a
movq -0x90(%rbp), %rax
cmpl $0x121, 0x2a0(%rax)     # imm = 0x121
jne 0x1ee8b
leaq -0x31(%rbp), %rdi
movq %rdi, -0x98(%rbp)
callq 0x3430
movq -0x98(%rbp), %rdx
leaq 0x86c9(%rip), %rsi      # 0x27451
leaq -0x30(%rbp), %rdi
callq 0x62d0
jmp 0x1ed93
movq -0x90(%rbp), %rdi
leaq -0x30(%rbp), %rsi
xorl %edx, %edx
callq 0x19bb0
leaq -0x30(%rbp), %rdi
callq 0x31a0
leaq -0x31(%rbp), %rdi
callq 0x32e0
movq -0x90(%rbp), %rsi
movl 0x2a4(%rsi), %edx
movl 0x2a8(%rsi), %ecx
movl -0xc(%rbp), %r8d
movl 0x2ac(%rsi), %eax
leaq -0x68(%rbp), %rdi
xorl %r9d, %r9d
movl %eax, (%rsp)
movl $0x0, 0x8(%rsp)
movl $0x10a, 0x10(%rsp)      # imm = 0x10A
movl $0x1, 0x18(%rsp)
callq 0x1c760
leaq -0x68(%rbp), %rdi
callq 0x31a0
movq -0x90(%rbp), %rsi
movl 0x2a4(%rsi), %edx
movl 0x2a4(%rsi), %ecx
movl 0x2a8(%rsi), %r8d
movl 0x2a8(%rsi), %r9d
movl 0x2b0(%rsi), %r10d
movb 0x2b5(%rsi), %al
leaq -0x88(%rbp), %rdi
xorl %r11d, %r11d
andb $0x1, %al
movl %r10d, (%rsp)
movzbl %al, %eax
movl %eax, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
movl $0x10a, 0x18(%rsp)      # imm = 0x10A
movl $0x0, 0x20(%rsp)
callq 0x1d2f0
leaq -0x88(%rbp), %rdi
callq 0x31a0
jmp 0x1ee8b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x31(%rbp), %rdi
callq 0x32e0
jmp 0x1ee9b
jmp 0x1ec8d
jmp 0x1ee92
addq $0xc0, %rsp
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x3420
nopw %cs:(%rax,%rax)