// File: /workspace/github_cpp_makefile_star2_O1/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 0x8ffa(%rip), %rdi      # 0x1d121
xorl %r15d, %r15d
movl %r14d, %ecx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x15504
leaq 0x9010(%rip), %rdi      # 0x1d14e
xorl %eax, %eax
callq 0x15504
cmpl $0x100000, %r14d        # imm = 0x100000
setb %al
jae 0x141c0
movslq %r14d, %r12
leaq (,%r12,4), %r13
incq %r12
leaq 0x8fa1(%rip), %r14      # 0x1d107
xorl %r15d, %r15d
testq %r15, %r15
je 0x1417c
leaq 0x80da(%rip), %rdi      # 0x1c24f
xorl %eax, %eax
callq 0x15504
movq 0x100d5(%rip), %rax     # 0x24258
addq %r13, %rax
movl (%rax,%r15,4), %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x15504
leaq 0x1(%r15), %rcx
leaq (%r12,%r15), %rdx
cmpq $0x100000, %rdx         # imm = 0x100000
setb %al
cmpq $0x4, %r15
ja 0x141b8
movq %rcx, %r15
cmpq $0x100000, %rdx         # imm = 0x100000
jb 0x14169
cmpq $0xa, %rcx
sete %r15b
movl %r15d, -0x2c(%rbp)
testb %al, %al
je 0x141d6
leaq 0x8f8a(%rip), %rdi      # 0x1d159
xorl %eax, %eax
callq 0x15504
leaq 0x9135(%rip), %rdi      # 0x1d312
xorl %eax, %eax
callq 0x15504
cmpl $0x100000, %ebx         # imm = 0x100000
jne 0x1421c
cmpb $0x0, -0x2c(%rbp)
je 0x14200
leaq 0x92ee(%rip), %rdi      # 0x1d4e7
xorl %eax, %eax
callq 0x15504
leaq 0x910b(%rip), %rdi      # 0x1d312
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x15504
leaq 0x8f87(%rip), %r15      # 0x1d1aa
leaq 0x8f90(%rip), %r12      # 0x1d1ba
leaq 0x90e1(%rip), %r14      # 0x1d312
xorl %r13d, %r13d
leaq 0x8f24(%rip), %rdi      # 0x1d15f
movq %r13, %rsi
movl %ebx, %edx
xorl %eax, %eax
callq 0x15504
movslq %ebx, %rbx
movq 0x10007(%rip), %rax     # 0x24258
movl (%rax,%rbx,4), %esi
cmpl %esi, %ebx
je 0x141ec
leaq 0x8f1d(%rip), %rdi      # 0x1d17c
xorl %eax, %eax
callq 0x15504
movq 0xffeb(%rip), %rax      # 0x24258
movl 0x4(%rax,%rbx,4), %esi
leaq 0x8f12(%rip), %rdi      # 0x1d18a
xorl %eax, %eax
callq 0x15504
movq 0xffd2(%rip), %rax      # 0x24258
movl 0x8(%rax,%rbx,4), %esi
leaq 0x8f09(%rip), %rdi      # 0x1d19a
xorl %eax, %eax
callq 0x15504
movq 0xffb9(%rip), %rax      # 0x24258
movl 0xc(%rax,%rbx,4), %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x15504
movq 0xffa4(%rip), %rax      # 0x24258
movl 0x10(%rax,%rbx,4), %esi
movq %r12, %rdi
xorl %eax, %eax
callq 0x15504
movq 0xff8f(%rip), %rax      # 0x24258
movl (%rax,%rbx,4), %ebx
movq %r14, %rdi
xorl %eax, %eax
callq 0x15504
cmpq $0x8, %r13
ja 0x141ec
incq %r13
cmpl $0x100000, %ebx         # imm = 0x100000
jne 0x14234
jmp 0x141ec