// File: /workspace/github_cpp_makefile_star2_O3/zerolfx[P]P-Machine/sli.cpp
// Function: Sli::execute(StackMachine*)
void Sli::execute(StackMachine *stack)
{
	if(stack->fSP < 1)
		throw ExecutionError("instruction sli: requires 2 stackelements to be present.");

	switch(fType)
	{
		case integer:
		{
			StackInteger p1;

			// check if uppermost stackentry is of type integer
			if(typeid(p1) != typeid(*stack->fStore[stack->fSP]))
				throw ExecutionError("instruction sli: SP does not point to element of type integer.");

			break;
		}	
		case real:
		{
			StackReal p1;
			// check if uppermost stackentry is of type real
			if(typeid(p1) != typeid(*stack->fStore[stack->fSP]))
				throw ExecutionError("instruction sli: SP does not point to element of type real.");

			break;
		}
		case boolean:
		{
			StackBoolean p1;
			
			// check if uppermost stackentry is of type boolean
			if(typeid(p1) != typeid(*stack->fStore[stack->fSP]))
				throw ExecutionError("instruction sli: SP does not point to element of type boolean.");

			break;
		}
		case character:
		{
			StackCharacter p1;
			
			// check if uppermost stackentry is of type character
			if(typeid(p1) != typeid(*stack->fStore[stack->fSP]))
				throw ExecutionError("instruction sli: SP does not point to element of type character.");

			break;
		}
		case address:
		{
			StackAddress p1;

			// check if constant is of type address
			if(typeid(p1) != typeid(*stack->fStore[stack->fSP]))
				throw ExecutionError("instruction sli: SP does not point to element of type address.");

			break;
		}
	}
	
	// actual operation
	delete stack->fStore[stack->fSP - 1];
	stack->fStore[stack->fSP - 1] = 0;
	stack->fStore[stack->fSP - 1] = stack->fStore[stack->fSP];
	stack->fStore.pop_back();
	
	// fSP = fSP - 1
	--stack->fSP;
	
	// adding cost of this instruction
	stack->fTime.count("sli");

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
cmpl $0x0, 0xb4(%rsi)
jle 0x15f0c
movq %rsi, %rbx
movl 0x8(%rdi), %eax
cmpq $0x4, %rax
ja 0x15e62
leaq 0xfb41(%rip), %rcx      # 0x257b4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x50(%rbp), %rdi
xorps %xmm0, %xmm0
callq 0x1abfc
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x16124
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x1df1a(%rip), %rcx     # 0x33bc8
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x15cd1
cmpb $0x2a, (%rdi)
je 0x16017
callq 0x6310
testl %eax, %eax
jne 0x16017
leaq -0x50(%rbp), %rdi
callq 0x1ac2a
jmp 0x15e62
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0x1a104
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x1611a
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x1dc50(%rip), %rcx     # 0x33960
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x15d33
cmpb $0x2a, (%rdi)
je 0x15f65
callq 0x6310
testl %eax, %eax
jne 0x15f65
leaq -0x50(%rbp), %rdi
callq 0x1a128
jmp 0x15e62
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0x1ae40
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x1611f
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x1df26(%rip), %rcx     # 0x33c98
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x15d95
cmpb $0x2a, (%rdi)
je 0x15fbe
callq 0x6310
testl %eax, %eax
jne 0x15fbe
leaq -0x50(%rbp), %rdi
callq 0x1ae64
jmp 0x15e62
leaq -0x50(%rbp), %rdi
movl $0x61, %esi
callq 0x1b03c
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x16129
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x1df91(%rip), %rcx     # 0x33d68
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x15dfa
cmpb $0x2a, (%rdi)
je 0x16070
callq 0x6310
testl %eax, %eax
jne 0x16070
leaq -0x50(%rbp), %rdi
callq 0x1b060
jmp 0x15e62
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0x1a9d4
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x1612e
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x1dcc2(%rip), %rcx     # 0x33af8
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x15e59
cmpb $0x2a, (%rdi)
je 0x160c6
callq 0x6310
testl %eax, %eax
jne 0x160c6
leaq -0x50(%rbp), %rdi
callq 0x1a9f8
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq -0x8(%rcx,%rax,8), %r14
testq %r14, %r14
je 0x15e7f
movq %r14, %rdi
callq 0x1a300
movl $0x8, %esi
movq %r14, %rdi
callq 0x6210
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq $0x0, -0x8(%rcx,%rax,8)
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rdx
movq %rdx, -0x8(%rcx,%rax,8)
addq $-0x8, 0x20(%rbx)
decq %rax
movl %eax, 0xb4(%rbx)
leaq -0x30(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0xfa76(%rip), %rsi      # 0x25940
leaq 0xfa72(%rip), %rdx      # 0x25943
leaq -0x40(%rbp), %rdi
callq 0x746c
addq $0x78, %rbx
leaq -0x40(%rbp), %rsi
movq %rbx, %rdi
callq 0x1cbc8
movq -0x40(%rbp), %rdi
cmpq %r14, %rdi
je 0x15eff
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0xf8a5(%rip), %rsi      # 0x257cd
leaq 0xf8d6(%rip), %rdx      # 0x25805
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x1cb37(%rip), %rsi     # 0x32a88
leaq 0x5212(%rip), %rdx      # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0x1611a
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0xf980(%rip), %rsi      # 0x25901
leaq 0xf9b7(%rip), %rdx      # 0x2593f
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x1cade(%rip), %rsi     # 0x32a88
leaq 0x51b9(%rip), %rdx      # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0x1611a
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0xf8a7(%rip), %rsi      # 0x25881
leaq 0xf8de(%rip), %rdx      # 0x258bf
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x1ca85(%rip), %rsi     # 0x32a88
leaq 0x5160(%rip), %rdx      # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0x1611a
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0xf812(%rip), %rsi      # 0x25845
leaq 0xf846(%rip), %rdx      # 0x25880
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x1ca2c(%rip), %rsi     # 0x32a88
leaq 0x5107(%rip), %rdx      # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0x1611a
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0xf834(%rip), %rsi      # 0x258c0
leaq 0xf86d(%rip), %rdx      # 0x25900
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x1c9d3(%rip), %rsi     # 0x32a88
leaq 0x50ae(%rip), %rdx      # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0x1611a
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0xf724(%rip), %rsi      # 0x25806
leaq 0xf75b(%rip), %rdx      # 0x25844
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x1c97d(%rip), %rsi     # 0x32a88
leaq 0x5058(%rip), %rdx      # 0x1b16a
movq %r14, %rdi
callq 0x63e0
callq 0x6250
callq 0x6250
callq 0x6250
callq 0x6250
callq 0x6250
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0x1614b
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0x16158
jmp 0x1621e
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0x1621e
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0x1617d
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0x1618a
jmp 0x1623d
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0x1623d
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0x161af
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0x161b9
jmp 0x1622f
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0x1622f
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0x161db
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0x161e5
jmp 0x1624b
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0x1624b
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0x16207
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0x16211
jmp 0x16259
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0x16259
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1a9f8
jmp 0x162ad
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1ac2a
jmp 0x162ad
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1b060
jmp 0x162ad
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1ae64
jmp 0x162ad
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1a128
jmp 0x162ad
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0x1627c
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0x16286
jmp 0x162ad
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0x162ad
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r14, %rdi
je 0x162ad
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0x162ad
movq %rax, %rbx
movq %rbx, %rdi
callq 0x6410
nop