// File: /workspace/github_cpp_makefile_star2_O3/yanlinlin82[P]icpp/icpp.cpp
// Function: print_vm_env(int, int, int, int)
void print_vm_env(int ax, int ip, int sp, int bp)
{
	log("\tax = %08X, ip = %08X, sp = %08X, bp = %08X\n", ax, ip, sp, bp);
	log("\t[stack]: ");
	size_t i = 0;
	for (; i < 6 && sp + i < MEM_SIZE; ++i) {
		if (i > 0) { log(", "); }
		log("0x%08X", m[sp + i]);
	}
	if (sp + i < MEM_SIZE) {
		log(", ...");
	}
	log("\n");
	for (size_t i = 0; i < 10 && bp != MEM_SIZE; ++i) {
		log("\t[#%zd backtrace]: bp = %08X", i, bp);
		if (bp == m[bp]) break;
		log("\tm[bp] = %08X", m[bp]);
		log("\tm[bp+1] = %08X", m[bp+1]);
		log("\tm[bp+2] = %08X", m[bp+2]);
		log("\tm[bp+3] = %08X", m[bp+3]);
		log("\tm[bp+4] = %08X", m[bp+4]);
		bp = m[bp];
		log("\n");
	}
	if (i == 10) {
		log("...\n");
	}
	log("\n");
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebx
movl %edx, %r14d
movl %esi, %edx
movl %edi, %esi
leaq 0x8242(%rip), %rdi      # 0x1c121
movl %r14d, %ecx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x15114
leaq 0x825b(%rip), %rdi      # 0x1c14e
xorl %eax, %eax
callq 0x15114
cmpl $0xfffff, %r14d         # imm = 0xFFFFF
ja 0x13f71
movslq %r14d, %r12
leaq (,%r12,4), %r13
incq %r12
leaq 0x81ef(%rip), %r14      # 0x1c107
xorl %r15d, %r15d
testq %r15, %r15
je 0x13f2e
leaq 0x7328(%rip), %rdi      # 0x1b24f
xorl %eax, %eax
callq 0x15114
movq 0xf323(%rip), %rax      # 0x23258
addq %r13, %rax
movl (%rax,%r15,4), %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x15114
leaq (%r12,%r15), %rax
cmpq $0x4, %r15
ja 0x13f5b
incq %r15
cmpq $0x100000, %rax         # imm = 0x100000
jb 0x13f1b
cmpq $0xfffff, %rax          # imm = 0xFFFFF
ja 0x13f71
leaq 0x81ef(%rip), %rdi      # 0x1c159
xorl %eax, %eax
callq 0x15114
leaq 0x839a(%rip), %rdi      # 0x1c312
xorl %eax, %eax
callq 0x15114
cmpl $0x100000, %ebx         # imm = 0x100000
jne 0x13fa3
leaq 0x8384(%rip), %rdi      # 0x1c312
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x15114
leaq 0x8200(%rip), %r15      # 0x1c1aa
leaq 0x8209(%rip), %r12      # 0x1c1ba
leaq 0x835a(%rip), %r14      # 0x1c312
xorl %r13d, %r13d
leaq 0x819d(%rip), %rdi      # 0x1c15f
movq %r13, %rsi
movl %ebx, %edx
xorl %eax, %eax
callq 0x15114
movslq %ebx, %rbx
movq 0xf280(%rip), %rax      # 0x23258
movl (%rax,%rbx,4), %esi
cmpl %esi, %ebx
je 0x13f87
leaq 0x8196(%rip), %rdi      # 0x1c17c
xorl %eax, %eax
callq 0x15114
movq 0xf264(%rip), %rax      # 0x23258
movl 0x4(%rax,%rbx,4), %esi
leaq 0x818b(%rip), %rdi      # 0x1c18a
xorl %eax, %eax
callq 0x15114
movq 0xf24b(%rip), %rax      # 0x23258
movl 0x8(%rax,%rbx,4), %esi
leaq 0x8182(%rip), %rdi      # 0x1c19a
xorl %eax, %eax
callq 0x15114
movq 0xf232(%rip), %rax      # 0x23258
movl 0xc(%rax,%rbx,4), %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x15114
movq 0xf21d(%rip), %rax      # 0x23258
movl 0x10(%rax,%rbx,4), %esi
movq %r12, %rdi
xorl %eax, %eax
callq 0x15114
movq 0xf208(%rip), %rax      # 0x23258
movl (%rax,%rbx,4), %ebx
movq %r14, %rdi
xorl %eax, %eax
callq 0x15114
cmpq $0x8, %r13
ja 0x13f87
incq %r13
cmpl $0x100000, %ebx         # imm = 0x100000
jne 0x13fbb
jmp 0x13f87