// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
subq $0x38, %rsp
cmpl $0x0, 0xb4(%rsi)
jle 0x138ef
movq %rsi, %rbx
movl 0x8(%rdi), %eax
cmpq $0x4, %rax
ja 0x13862
leaq 0xd0d1(%rip), %rcx      # 0x207b4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x30(%rbp), %rdi
xorps %xmm0, %xmm0
callq 0x177d4
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x13945
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x1b4aa(%rip), %rdi     # 0x2ebc8
callq 0x76ba
testb %al, %al
jne 0x13a38
leaq -0x30(%rbp), %rdi
callq 0x17802
jmp 0x13862
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
callq 0x1704c
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x1393b
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x1b1f6(%rip), %rdi     # 0x2e960
callq 0x76ba
testb %al, %al
jne 0x13954
leaq -0x30(%rbp), %rdi
callq 0x17070
jmp 0x13862
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
callq 0x17a18
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x13940
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x1b4e2(%rip), %rdi     # 0x2ec98
callq 0x76ba
testb %al, %al
jne 0x139a0
leaq -0x30(%rbp), %rdi
callq 0x17a3c
jmp 0x13862
leaq -0x30(%rbp), %rdi
pushq $0x61
popq %rsi
callq 0x17c08
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x1394a
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x1b565(%rip), %rdi     # 0x2ed68
callq 0x76ba
testb %al, %al
jne 0x139ec
leaq -0x30(%rbp), %rdi
callq 0x17c2c
jmp 0x13862
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
callq 0x175ac
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x1394f
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x1b2ac(%rip), %rdi     # 0x2eaf8
callq 0x76ba
testb %al, %al
jne 0x13a81
leaq -0x30(%rbp), %rdi
callq 0x175d0
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq -0x8(%rcx,%rax,8), %r14
testq %r14, %r14
je 0x1387f
movq %r14, %rdi
callq 0x17248
pushq $0x8
popq %rsi
movq %r14, %rdi
callq 0x61e0
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
andq $0x0, -0x8(%rcx,%rax,8)
leaq -0x1(%rax), %rcx
movq 0x18(%rbx), %rdx
movq (%rdx,%rax,8), %rsi
movq %rsi, -0x8(%rdx,%rax,8)
addq $-0x8, 0x20(%rbx)
movl %ecx, 0xb4(%rbx)
leaq 0xd082(%rip), %rsi      # 0x20940
leaq -0x50(%rbp), %rdi
leaq -0x30(%rbp), %rdx
callq 0x72a6
addq $0x78, %rbx
leaq -0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x1925e
leaq -0x50(%rbp), %rdi
callq 0x60d0
addq $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0xcecc(%rip), %rsi      # 0x207cd
leaq -0x50(%rbp), %rdi
leaq -0x30(%rbp), %rdx
callq 0x72a6
movb $0x1, %r15b
leaq -0x50(%rbp), %rsi
movq %r14, %rdi
callq 0x17d10
xorl %r15d, %r15d
leaq 0x1a161(%rip), %rsi     # 0x2da88
leaq 0x43ec(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0x13ac8
callq 0x6220
callq 0x6220
callq 0x6220
callq 0x6220
callq 0x6220
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0xcf9b(%rip), %rsi      # 0x20901
leaq -0x50(%rbp), %rdi
leaq -0x19(%rbp), %rdx
callq 0x72a6
movb $0x1, %r15b
leaq -0x50(%rbp), %rsi
movq %r14, %rdi
callq 0x17d10
xorl %r15d, %r15d
leaq 0x1a0fc(%rip), %rsi     # 0x2da88
leaq 0x4387(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0x13ac8
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0xcecf(%rip), %rsi      # 0x20881
leaq -0x50(%rbp), %rdi
leaq -0x19(%rbp), %rdx
callq 0x72a6
movb $0x1, %r15b
leaq -0x50(%rbp), %rsi
movq %r14, %rdi
callq 0x17d10
xorl %r15d, %r15d
leaq 0x1a0b0(%rip), %rsi     # 0x2da88
leaq 0x433b(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0x13ac8
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0xcec2(%rip), %rsi      # 0x208c0
leaq -0x50(%rbp), %rdi
leaq -0x19(%rbp), %rdx
callq 0x72a6
movb $0x1, %r15b
leaq -0x50(%rbp), %rsi
movq %r14, %rdi
callq 0x17d10
xorl %r15d, %r15d
leaq 0x1a064(%rip), %rsi     # 0x2da88
leaq 0x42ef(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0x13ac8
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0xcdfb(%rip), %rsi      # 0x20845
leaq -0x50(%rbp), %rdi
leaq -0x19(%rbp), %rdx
callq 0x72a6
movb $0x1, %r15b
leaq -0x50(%rbp), %rsi
movq %r14, %rdi
callq 0x17d10
xorl %r15d, %r15d
leaq 0x1a018(%rip), %rsi     # 0x2da88
leaq 0x42a3(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0x13ac8
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0xcd73(%rip), %rsi      # 0x20806
leaq -0x50(%rbp), %rdi
leaq -0x19(%rbp), %rdx
callq 0x72a6
movb $0x1, %r15b
leaq -0x50(%rbp), %rsi
movq %r14, %rdi
callq 0x17d10
xorl %r15d, %r15d
leaq 0x19fcf(%rip), %rsi     # 0x2da88
leaq 0x425a(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0x13af7
jmp 0x13b71
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0x13b04
jmp 0x13b7f
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0x13b71
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0x13b7f
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0x13b24
jmp 0x13b8d
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0x13b8d
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0x13b44
jmp 0x13b9b
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0x13b9b
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0x13b64
jmp 0x13ba9
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0x13ba9
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x175d0
jmp 0x13be5
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x17802
jmp 0x13be5
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x17c2c
jmp 0x13be5
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x17a3c
jmp 0x13be5
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x17070
jmp 0x13be5
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0x13bca
jmp 0x13be5
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0x13be5
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
jmp 0x13be5
movq %rax, %rbx
movq %rbx, %rdi
callq 0x63f0
nop