// File: /workspace/github_c_makefile_star2_O2/tyabu12[P]pl0compiler/codegen.c
// Function: printMemory
void printMemory(const Mem *m) { /* 目的コード（命令語）の実行メモリの表示 */
    int screenIndex = 0, i;
    printf("\n\nsteps:%d pc:%d top:%d exitCode:%d\n", m->stepCount, m->pc, m->top, m->exitCode);
    printf("----------------------------------------------------------------\n");
    printf("Code:\t\t\tStack:\t\tDisplay:\tScreen:\n");
    for (i = 0;
      i < cIndex
      || (i < MAXMEM && m->stack[i] != -1)
      || (i < MAXLEVEL && m->display[i] != -1)
      || (m->screen[screenIndex] != '\0'); i++) {
      if (i < cIndex) { /* 目的コード（命令語）の表示 */
        printf("%c%3d[", (i == m->breakPoint ? '*' : ' '), i);
        printCode(stdout, i, '\0');
        printf("\t]");
        if (i == m->pc && !m->exitCode) printf("<-");
      } else printf("\t\t");
      if (i < MAXMEM && i <= m->topMax) { /* スタックの表示 */
        if (m->stack[i] != -1)
          printf("\t%4d[%4d]", i, m->stack[i]);
        else
          printf("\t%4d[----]", i);
        if (i == m->top && !m->exitCode) printf("<-");
      } else printf("\t\t");
      if (i < MAXLEVEL && m->display[i] != -1) { /* ディスプレイの表示 */
        printf("\t%3d[%3d]", i, m->display[i]);
      } else printf("\t\t");
      if (m->screen[screenIndex] != '\0') { /* スクリーンの表示 */
        printf("\t  ");
        while (m->screen[screenIndex] != '\0' && m->screen[screenIndex] != '\n') {
          putchar(m->screen[screenIndex++]);
        }
        if (m->screen[screenIndex] == '\n') screenIndex++;
      }
      printf("\n");
    }
    printf("----------------------------------------------------------------\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x1f64(%rdi), %esi
movl 0x1f54(%rdi), %edx
movl 0x1f58(%rdi), %ecx
movl 0x1f60(%rdi), %r8d
leaq 0x190c(%rip), %rdi      # 0x4181
xorl %eax, %eax
callq 0x2090
leaq 0x19f8(%rip), %rdi      # 0x427b
callq 0x2060
leaq 0x19cb(%rip), %rdi      # 0x425a
callq 0x2060
leaq 0x1f68(%rbx), %r15
leaq 0x1911(%rip), %r12      # 0x41b3
xorl %r14d, %r14d
xorl %r13d, %r13d
movslq 0x4821(%rip), %rax      # 0x70d0
movslq %r13d, %rbp
cmpq %rax, %r14
jge 0x2919
movl 0x2168(%rbx), %eax
cmpq %rax, %r14
pushq $0x20
popq %rsi
pushq $0x2a
popq %rax
cmovel %eax, %esi
leaq 0x18d6(%rip), %rdi      # 0x41a6
movl %r14d, %edx
xorl %eax, %eax
callq 0x2090
movq 0x46df(%rip), %rax      # 0x6fc0
movq (%rax), %rdi
movl %r14d, %esi
xorl %edx, %edx
callq 0x2413
leaq 0x18b8(%rip), %rdi      # 0x41ad
xorl %eax, %eax
callq 0x2090
movl 0x1f54(%rbx), %eax
cmpq %rax, %r14
jne 0x2958
cmpl $0x0, 0x1f60(%rbx)
leaq 0x189b(%rip), %rdi      # 0x41b0
jne 0x2958
jmp 0x2951
cmpq $0x7cf, %r14            # imm = 0x7CF
ja 0x2940
cmpl $-0x1, (%rbx,%r14,4)
movq %r12, %rdi
jne 0x2951
cmpq $0x4, %r14
ja 0x2940
cmpl $-0x1, 0x1f40(%rbx,%r14,4)
movq %r12, %rdi
jne 0x2951
cmpb $0x0, 0x1f68(%rbx,%rbp)
movq %r12, %rdi
je 0x2a55
xorl %eax, %eax
callq 0x2090
movq %r12, %rdi
cmpq $0x7cf, %r14            # imm = 0x7CF
ja 0x2977
movslq 0x1f5c(%rbx), %rax
movq %r12, %rdi
cmpq %rax, %r14
jle 0x2a00
xorl %eax, %eax
callq 0x2090
cmpq $0x4, %r14
ja 0x29a4
movl 0x1f40(%rbx,%r14,4), %edx
cmpl $-0x1, %edx
je 0x29a4
leaq 0x1833(%rip), %rdi      # 0x41cb
movl %r14d, %esi
xorl %eax, %eax
callq 0x2090
jmp 0x29ae
movq %r12, %rdi
xorl %eax, %eax
callq 0x2090
cmpb $0x0, 0x1f68(%rbx,%rbp)
je 0x29f0
leaq 0x1816(%rip), %rdi      # 0x41d5
xorl %eax, %eax
callq 0x2090
addq %r15, %rbp
movzbl (%rbp), %eax
testl %eax, %eax
je 0x29e6
cmpl $0xa, %eax
je 0x29e6
movsbl %al, %edi
callq 0x2030
incl %r13d
incq %rbp
jmp 0x29c9
xorl %ecx, %ecx
cmpb $0xa, %al
sete %cl
addl %ecx, %r13d
pushq $0xa
popq %rdi
callq 0x2030
incq %r14
jmp 0x28a8
movl (%rbx,%r14,4), %edx
cmpl $-0x1, %edx
je 0x2a1c
leaq 0x17a6(%rip), %rdi      # 0x41b6
movl %r14d, %esi
xorl %eax, %eax
callq 0x2090
jmp 0x2a2d
leaq 0x179d(%rip), %rdi      # 0x41c0
movl %r14d, %esi
xorl %eax, %eax
callq 0x2090
movl 0x1f58(%rbx), %eax
cmpq %rax, %r14
jne 0x297e
cmpl $0x0, 0x1f60(%rbx)
leaq 0x1766(%rip), %rdi      # 0x41b0
jne 0x297e
jmp 0x2977
leaq 0x181f(%rip), %rdi      # 0x427b
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2060