// File: /workspace/github_cpp_makefile_star2_O2/zerolfx[P]P-Machine/ixa.cpp
// Function: Ixa::execute(StackMachine*)
void Ixa::execute(StackMachine *stack)
{
	StackAddress p1;
	StackInteger p2;
	
	if(typeid(p1) != typeid(*(stack->fStore[stack->fSP - 1])))
		throw ExecutionError("instruction ixa: STORE[SP-1] does not contain an element of type address.");
		
	if(typeid(p2) != typeid(*(stack->fStore[stack->fSP])))
		throw ExecutionError("instruction ixa: STORE[SP] does not contain an element of type integer.");
		
	StackInteger temp(fQ);
	
	int newaddress = stack->fStore[stack->fSP - 1]->getValue() + stack->fStore[stack->fSP]->getValue() * fQ;
	
	delete stack->fStore[stack->fSP - 1];
	delete stack->fStore[stack->fSP];
	stack->fStore.pop_back();
	
	--stack->fSP;
	
	stack->fStore[stack->fSP] = new StackAddress(newaddress);
	
	// adding cost of this instruction
	stack->fTime.count("ixa");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x60, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq -0x78(%rbp), %rdi
xorl %esi, %esi
callq 0x1704c
leaq -0x68(%rbp), %rdi
xorl %esi, %esi
callq 0x175ac
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq -0x8(%rcx,%rax,8), %rax
testq %rax, %rax
je 0xcbf2
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x21ec8(%rip), %rdi     # 0x2e960
callq 0x76ba
testb %al, %al
jne 0xcbf7
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0xcbf2
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x2202d(%rip), %rdi     # 0x2eaf8
callq 0x76ba
testb %al, %al
jne 0xcc40
movl 0x8(%r14), %esi
leaq -0x38(%rbp), %rdi
callq 0x175ac
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq -0x8(%rcx,%rax,8), %rdi
movq (%rdi), %rax
callq *0x68(%rax)
movl %eax, %r15d
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rdi
movq (%rdi), %rax
callq *0x68(%rax)
movl %eax, %r12d
imull 0x8(%r14), %r12d
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq -0x8(%rcx,%rax,8), %r14
testq %r14, %r14
je 0xcb38
movq %r14, %rdi
callq 0x17248
pushq $0x8
popq %rsi
movq %r14, %rdi
callq 0x61e0
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %r14
testq %r14, %r14
je 0xcb5f
movq %r14, %rdi
callq 0x17248
pushq $0x8
popq %rsi
movq %r14, %rdi
callq 0x61e0
addq $-0x8, 0x20(%rbx)
decl 0xb4(%rbx)
pushq $0x10
popq %rdi
callq 0x61d0
movq %rax, %r14
addl %r15d, %r12d
movq %rax, %rdi
movl %r12d, %esi
callq 0x1704c
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq %r14, (%rcx,%rax,8)
leaq 0x12a66(%rip), %rsi     # 0x1f60a
leaq -0x58(%rbp), %rdi
leaq -0x21(%rbp), %rdx
callq 0x72a6
addq $0x78, %rbx
leaq -0x58(%rbp), %rsi
movq %rbx, %rdi
callq 0x1925e
leaq -0x58(%rbp), %rdi
callq 0x60d0
leaq -0x38(%rbp), %rdi
callq 0x175d0
leaq -0x68(%rbp), %rdi
callq 0x175d0
leaq -0x78(%rbp), %rdi
callq 0x17070
addq $0x60, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
callq 0x6220
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0x1296f(%rip), %rsi     # 0x1f578
leaq -0x58(%rbp), %rdi
leaq -0x38(%rbp), %rdx
callq 0x72a6
movb $0x1, %r15b
leaq -0x58(%rbp), %rsi
movq %r14, %rdi
callq 0x17d10
xorl %r15d, %r15d
leaq 0x20e59(%rip), %rsi     # 0x2da88
leaq 0xb0e4(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0xcc87
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0x12970(%rip), %rsi     # 0x1f5c2
leaq -0x58(%rbp), %rdi
leaq -0x38(%rbp), %rdx
callq 0x72a6
movb $0x1, %r15b
leaq -0x58(%rbp), %rsi
movq %r14, %rdi
callq 0x17d10
xorl %r15d, %r15d
leaq 0x20e10(%rip), %rsi     # 0x2da88
leaq 0xb09b(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0xcc8b
jmp 0xcc9e
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0xcca1
jmp 0xcce3
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0xcce3
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x60d0
jmp 0xccda
jmp 0xccd7
movq %rax, %rbx
pushq $0x10
popq %rsi
movq %r14, %rdi
callq 0x61e0
jmp 0xccda
jmp 0xccd2
movq %rax, %rbx
jmp 0xccec
movq %rax, %rbx
jmp 0xcce3
movq %rax, %rbx
leaq -0x38(%rbp), %rdi
callq 0x175d0
leaq -0x68(%rbp), %rdi
callq 0x175d0
leaq -0x78(%rbp), %rdi
callq 0x17070
movq %rbx, %rdi
callq 0x63f0
nop