// File: /workspace/github_cpp_makefile_star2_O3/zerolfx[P]P-Machine/ldd.cpp
// Function: Ldd::execute(StackMachine*)
void Ldd::execute(StackMachine *stack) 
{
	if(stack->fSP < 2)
		throw ExecutionError("instruction ldd: requires 3 stackelements to be present.");
	
	StackAddress p1;
	if(typeid(p1) != typeid(*(stack->fStore[stack->fSP - 2])))
		throw ExecutionError("instruction add: SP-2 does not point to element of type address.");
		
	++stack->fSP;
	
	stack->fStore.push_back(new StackInteger(stack->fStore[stack->fSP -3]->getValue() + fQ));
	
	// adding cost of this instruction
	stack->fTime.count("ldd");

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
cmpl $0x1, 0xb4(%rsi)
jle 0x19603
movq %rsi, %rbx
movq %rdi, %r14
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
callq 0x1a104
movslq 0xb4(%rbx), %r12
movq 0x18(%rbx), %rax
movq -0x10(%rax,%r12,8), %r15
testq %r15, %r15
je 0x19657
movq (%r15), %r13
movq -0x8(%r13), %rax
leaq 0x1a46e(%rip), %rcx     # 0x33960
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x19515
cmpb $0x2a, (%rdi)
je 0x195ad
callq 0x6310
testl %eax, %eax
jne 0x195ad
incl %r12d
movl %r12d, 0xb4(%rbx)
movl $0x10, %edi
callq 0x6200
movq %rax, %r12
movq %r15, %rdi
callq *0x68(%r13)
addl 0x8(%r14), %eax
movq %r12, %rdi
movl %eax, %esi
callq 0x1a9d4
leaq 0x18(%rbx), %rdi
leaq -0x48(%rbp), %rsi
movq %r12, (%rsi)
callq 0xa334
leaq -0x38(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0xcd3f(%rip), %rsi      # 0x2629f
leaq 0xcd3b(%rip), %rdx      # 0x262a2
leaq -0x48(%rbp), %rdi
callq 0x746c
addq $0x78, %rbx
leaq -0x48(%rbp), %rsi
movq %rbx, %rdi
callq 0x1cbc8
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x19595
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x6210
leaq -0x58(%rbp), %rdi
callq 0x1a128
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x38(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0xcc95(%rip), %rsi      # 0x2625e
leaq 0xccce(%rip), %rdx      # 0x2629e
leaq -0x48(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x48(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x19496(%rip), %rsi     # 0x32a88
leaq 0x1b71(%rip), %rdx      # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0x19657
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x38(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0xcc06(%rip), %rsi      # 0x26225
leaq 0xcc37(%rip), %rdx      # 0x2625d
leaq -0x48(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x48(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x19440(%rip), %rsi     # 0x32a88
leaq 0x1b1b(%rip), %rdx      # 0x1b16a
movq %r14, %rdi
callq 0x63e0
callq 0x6250
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0x19674
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0x1967e
jmp 0x196eb
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0x196eb
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0x196a0
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0x196aa
jmp 0x196e2
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0x196e2
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x196e2
movq -0x38(%rbp), %rsi
incq %rsi
jmp 0x196dd
jmp 0x196cd
jmp 0x196cd
movq %rax, %rbx
jmp 0x196e2
movq %rax, %rbx
movl $0x10, %esi
movq %r12, %rdi
callq 0x6210
leaq -0x58(%rbp), %rdi
callq 0x1a128
movq %rbx, %rdi
callq 0x6410
nop