// File: /workspace/github_cpp_makefile_star2_O2/zerolfx[P]P-Machine/sro.cpp
// Function: Sro::execute(StackMachine*)
void Sro::execute(StackMachine *stack)
{
	if(stack->fSP < 1)
		throw ExecutionError("instruction sro: at least 1 stackelement is required for this operation");

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

			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP])))
			{
				throw ExecutionError("instruction sro: type pointed to by SP is not of type integer.");
			}
				
			break;
		}	
		case real:
		{
			StackReal p1;

			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP])))
			{
				throw ExecutionError("instruction sro: type pointed to by SP is not of type real.");
			}

			break;
		}
		case boolean:
		{
			StackBoolean p1;
			
			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP])))
			{
				throw ExecutionError("instruction sro: type pointed to by SP is not of type boolean.");
			}

			break;
		}
		case character:
		{
			StackCharacter p1;
			
			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP])))
			{
				throw ExecutionError("instruction sro: type pointed to by SP is not of type character.");
			}


			break;
		}
		case address:
		{
			StackAddress p1;

			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP])))
			{
				throw ExecutionError("instruction sro: type pointed to by SP is not of type address.");
			}
				
			break;
		}
	}
	
	if(fQ < 0)
	{
		// address on the heap
		if(fQ < stack->fNP)
			throw ExecutionError("instruction ind: invalid heap address.");
		else
		{
			stack->fHeap[fQ] = stack->fStore[stack->fSP];
		}
	}
	else
	{
		// address on the stack
		if(fQ > stack->fSP)
			throw ExecutionError("instruction ind: invalid stack address.");
		else
		{
			stack->fStore[fQ] = stack->fStore[stack->fSP];
		}
	}
	
	stack->fStore.pop_back();

	--stack->fSP;
	
	// adding cost of this instruction
	stack->fTime.count("sro");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x38, %rsp
cmpl $0x0, 0xb4(%rsi)
jle 0x13fe6
movq %rsi, %rbx
movq %rdi, %r14
movl 0x8(%rdi), %eax
cmpq $0x4, %rax
ja 0x13f59
leaq 0xcb7e(%rip), %rcx      # 0x20958
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 0x140d4
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x1adb3(%rip), %rdi     # 0x2ebc8
callq 0x76ba
testb %al, %al
jne 0x141c7
leaq -0x30(%rbp), %rdi
callq 0x17802
jmp 0x13f59
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 0x140ca
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x1aaff(%rip), %rdi     # 0x2e960
callq 0x76ba
testb %al, %al
jne 0x140e3
leaq -0x30(%rbp), %rdi
callq 0x17070
jmp 0x13f59
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 0x140cf
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x1adeb(%rip), %rdi     # 0x2ec98
callq 0x76ba
testb %al, %al
jne 0x1412f
leaq -0x30(%rbp), %rdi
callq 0x17a3c
jmp 0x13f59
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 0x140d9
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x1ae6e(%rip), %rdi     # 0x2ed68
callq 0x76ba
testb %al, %al
jne 0x1417b
leaq -0x30(%rbp), %rdi
callq 0x17c2c
jmp 0x13f59
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 0x140de
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x1abb5(%rip), %rdi     # 0x2eaf8
callq 0x76ba
testb %al, %al
jne 0x14210
leaq -0x30(%rbp), %rdi
callq 0x175d0
movslq 0xc(%r14), %rax
testq %rax, %rax
js 0x13f7e
movl 0xb4(%rbx), %ecx
cmpl %ecx, %eax
jg 0x14032
movq 0x18(%rbx), %rdx
movq (%rdx,%rcx,8), %rsi
movq %rsi, (%rdx,%rax,8)
jmp 0x13fa1
cmpl 0xb8(%rbx), %eax
jl 0x1407e
movslq 0xb4(%rbx), %rcx
movq 0x18(%rbx), %rdx
movq 0x30(%rbx), %rsi
movq (%rdx,%rcx,8), %rdx
movq %rdx, (%rsi,%rax,8)
addq $-0x8, 0x20(%rbx)
decl %ecx
movl %ecx, 0xb4(%rbx)
leaq 0xcb3e(%rip), %rsi      # 0x20af3
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 0xc979(%rip), %rsi      # 0x20971
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 0x19a6a(%rip), %rsi     # 0x2da88
leaq 0x3cf5(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0x14257
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0xb3e7(%rip), %rsi      # 0x1f42b
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 0x19a1e(%rip), %rsi     # 0x2da88
leaq 0x3ca9(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0x14257
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0xb374(%rip), %rsi      # 0x1f404
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 0x199d2(%rip), %rsi     # 0x2da88
leaq 0x3c5d(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0x14257
callq 0x6220
callq 0x6220
callq 0x6220
callq 0x6220
callq 0x6220
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0xc9bf(%rip), %rsi      # 0x20ab4
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 0x1996d(%rip), %rsi     # 0x2da88
leaq 0x3bf8(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0x14257
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0xc8f3(%rip), %rsi      # 0x20a34
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 0x19921(%rip), %rsi     # 0x2da88
leaq 0x3bac(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0x14257
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0xc8e6(%rip), %rsi      # 0x20a73
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 0x198d5(%rip), %rsi     # 0x2da88
leaq 0x3b60(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0x14257
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0xc81f(%rip), %rsi      # 0x209f8
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 0x19889(%rip), %rsi     # 0x2da88
leaq 0x3b14(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0x14257
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0xc797(%rip), %rsi      # 0x209b9
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 0x19840(%rip), %rsi     # 0x2da88
leaq 0x3acb(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0x14286
jmp 0x14300
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0x14293
jmp 0x1430e
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0x14300
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0x1430e
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0x142b3
jmp 0x1431c
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0x1431c
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0x142d3
jmp 0x1432a
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0x1432a
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0x142f3
jmp 0x14338
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0x14338
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x175d0
jmp 0x1437c
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x17802
jmp 0x1437c
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x17c2c
jmp 0x1437c
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x17a3c
jmp 0x1437c
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x17070
jmp 0x1437c
jmp 0x1434b
jmp 0x1435e
jmp 0x1434b
jmp 0x1435e
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0x14361
jmp 0x1437c
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0x1437c
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
jmp 0x1437c
movq %rax, %rbx
movq %rbx, %rdi
callq 0x63f0