// File: /workspace/github_cpp_makefile_star2_O1/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 0x16114
movq %rsi, %rbx
movl 0x8(%rdi), %eax
cmpq $0x4, %rax
ja 0x1606a
leaq 0xf939(%rip), %rcx      # 0x257b4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x50(%rbp), %rdi
xorps %xmm0, %xmm0
callq 0x1aec8
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x16332
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x1dd12(%rip), %rcx     # 0x33bc8
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x15ed9
cmpb $0x2a, (%rdi)
je 0x16222
callq 0x6310
testl %eax, %eax
jne 0x16222
leaq -0x50(%rbp), %rdi
callq 0x1aef6
jmp 0x1606a
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0x1a3d0
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x16328
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x1da48(%rip), %rcx     # 0x33960
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x15f3b
cmpb $0x2a, (%rdi)
je 0x1616e
callq 0x6310
testl %eax, %eax
jne 0x1616e
leaq -0x50(%rbp), %rdi
callq 0x1a3f4
jmp 0x1606a
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0x1b10c
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x1632d
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x1dd1e(%rip), %rcx     # 0x33c98
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x15f9d
cmpb $0x2a, (%rdi)
je 0x161c8
callq 0x6310
testl %eax, %eax
jne 0x161c8
leaq -0x50(%rbp), %rdi
callq 0x1b130
jmp 0x1606a
leaq -0x50(%rbp), %rdi
movl $0x61, %esi
callq 0x1b308
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x16337
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x1dd89(%rip), %rcx     # 0x33d68
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x16002
cmpb $0x2a, (%rdi)
je 0x1627c
callq 0x6310
testl %eax, %eax
jne 0x1627c
leaq -0x50(%rbp), %rdi
callq 0x1b32c
jmp 0x1606a
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0x1aca0
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x1633c
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x1daba(%rip), %rcx     # 0x33af8
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x16061
cmpb $0x2a, (%rdi)
je 0x162d3
callq 0x6310
testl %eax, %eax
jne 0x162d3
leaq -0x50(%rbp), %rdi
callq 0x1acc4
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq -0x8(%rcx,%rax,8), %r14
testq %r14, %r14
je 0x16094
movq %r14, %rdi
callq 0x1a5cc
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 0xf86e(%rip), %rsi      # 0x25940
leaq 0xf86a(%rip), %rdx      # 0x25943
leaq -0x40(%rbp), %rdi
callq 0x746c
addq $0x78, %rbx
leaq -0x40(%rbp), %rsi
movq %rbx, %rdi
callq 0x1ce78
movq -0x40(%rbp), %rdi
cmpq %r14, %rdi
je 0x16107
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), %r12
movq %r12, -0x10(%r12)
leaq 0xf69c(%rip), %rsi      # 0x257cd
leaq 0xf6cd(%rip), %rdx      # 0x25805
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x1c92e(%rip), %rsi     # 0x32a88
leaq 0x52d5(%rip), %rdx      # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0x16328
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0xf776(%rip), %rsi      # 0x25901
leaq 0xf7ad(%rip), %rdx      # 0x2593f
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x1c8d4(%rip), %rsi     # 0x32a88
leaq 0x527b(%rip), %rdx      # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0x16328
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0xf69c(%rip), %rsi      # 0x25881
leaq 0xf6d3(%rip), %rdx      # 0x258bf
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x1c87a(%rip), %rsi     # 0x32a88
leaq 0x5221(%rip), %rdx      # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0x16328
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0xf606(%rip), %rsi      # 0x25845
leaq 0xf63a(%rip), %rdx      # 0x25880
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x1c820(%rip), %rsi     # 0x32a88
leaq 0x51c7(%rip), %rdx      # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0x16328
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0xf627(%rip), %rsi      # 0x258c0
leaq 0xf660(%rip), %rdx      # 0x25900
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x1c7c6(%rip), %rsi     # 0x32a88
leaq 0x516d(%rip), %rdx      # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0x16328
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0xf516(%rip), %rsi      # 0x25806
leaq 0xf54d(%rip), %rdx      # 0x25844
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x1c76f(%rip), %rsi     # 0x32a88
leaq 0x5116(%rip), %rdx      # 0x1b436
movq %r14, %rdi
callq 0x63e0
callq 0x6250
callq 0x6250
callq 0x6250
callq 0x6250
callq 0x6250
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0x16361
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0x16361
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0x1643d
movq %r14, %rdi
callq 0x6170
jmp 0x1643d
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0x16397
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0x16397
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0x1645c
movq %r14, %rdi
callq 0x6170
jmp 0x1645c
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0x163cd
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0x163cd
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0x1644e
movq %r14, %rdi
callq 0x6170
jmp 0x1644e
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0x163fc
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0x163fc
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0x1646a
movq %r14, %rdi
callq 0x6170
jmp 0x1646a
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0x1642b
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0x1642b
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0x16478
movq %r14, %rdi
callq 0x6170
jmp 0x16478
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1acc4
jmp 0x164cf
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1aef6
jmp 0x164cf
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1b32c
jmp 0x164cf
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1b130
jmp 0x164cf
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1a3f4
jmp 0x164cf
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0x164a3
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0x164a3
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0x164cf
movq %r14, %rdi
callq 0x6170
jmp 0x164cf
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r14, %rdi
je 0x164cf
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0x164cf
movq %rax, %rbx
movq %rbx, %rdi
callq 0x6410
nop