// File: /workspace/github_c_makefile_star2_O1/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 0x2821(%rip), %rdi      # 0x51a5
xorl %eax, %eax
callq 0x2090
leaq 0x290d(%rip), %rdi      # 0x529f
callq 0x2060
leaq 0x28e0(%rip), %rdi      # 0x527e
callq 0x2060
leaq 0x1f68(%rbx), %rbp
leaq 0x2826(%rip), %r12      # 0x51d7
xorl %r13d, %r13d
xorl %r14d, %r14d
movslq 0x571a(%rip), %rax      # 0x80d8
movslq %r14d, %r15
cmpq %rax, %r13
jl 0x29fe
cmpq $0x7cf, %r13            # imm = 0x7CF
ja 0x29d6
cmpl $-0x1, (%rbx,%r13,4)
jne 0x29f6
cmpq $0x4, %r13
ja 0x29e7
cmpl $-0x1, 0x1f40(%rbx,%r13,4)
jne 0x29f6
cmpb $0x0, 0x1f68(%rbx,%r15)
je 0x2b69
movq %r12, %rdi
cmpq %rax, %r13
jge 0x2a62
movl 0x2168(%rbx), %eax
cmpq %rax, %r13
movl $0x20, %esi
movl $0x2a, %eax
cmovel %eax, %esi
leaq 0x27af(%rip), %rdi      # 0x51ca
movl %r13d, %edx
xorl %eax, %eax
callq 0x2090
movq 0x5594(%rip), %rax      # 0x7fc0
movq (%rax), %rdi
movl %r13d, %esi
xorl %edx, %edx
callq 0x24db
leaq 0x2791(%rip), %rdi      # 0x51d1
xorl %eax, %eax
callq 0x2090
movl 0x1f54(%rbx), %eax
cmpq %rax, %r13
jne 0x2a69
cmpl $0x0, 0x1f60(%rbx)
leaq 0x2774(%rip), %rdi      # 0x51d4
jne 0x2a69
xorl %eax, %eax
callq 0x2090
movq %r12, %rdi
cmpq $0x7cf, %r13            # imm = 0x7CF
ja 0x2a88
movslq 0x1f5c(%rbx), %rax
movq %r12, %rdi
cmpq %rax, %r13
jle 0x2b14
xorl %eax, %eax
callq 0x2090
cmpq $0x4, %r13
ja 0x2ab5
movl 0x1f40(%rbx,%r13,4), %edx
cmpl $-0x1, %edx
je 0x2ab5
leaq 0x2746(%rip), %rdi      # 0x51ef
movl %r13d, %esi
xorl %eax, %eax
callq 0x2090
jmp 0x2abf
movq %r12, %rdi
xorl %eax, %eax
callq 0x2090
cmpb $0x0, 0x1f68(%rbx,%r15)
je 0x2b02
leaq 0x2728(%rip), %rdi      # 0x51f9
xorl %eax, %eax
callq 0x2090
addq %rbp, %r15
movzbl (%r15), %eax
testl %eax, %eax
je 0x2af8
cmpl $0xa, %eax
je 0x2af8
movsbl %al, %edi
callq 0x2030
incl %r14d
incq %r15
jmp 0x2adb
xorl %ecx, %ecx
cmpb $0xa, %al
sete %cl
addl %ecx, %r14d
movl $0xa, %edi
callq 0x2030
incq %r13
jmp 0x29b7
movl (%rbx,%r13,4), %edx
cmpl $-0x1, %edx
je 0x2b30
leaq 0x26b6(%rip), %rdi      # 0x51da
movl %r13d, %esi
xorl %eax, %eax
callq 0x2090
jmp 0x2b41
leaq 0x26ad(%rip), %rdi      # 0x51e4
movl %r13d, %esi
xorl %eax, %eax
callq 0x2090
movl 0x1f58(%rbx), %eax
cmpq %rax, %r13
jne 0x2a8f
cmpl $0x0, 0x1f60(%rbx)
leaq 0x2676(%rip), %rdi      # 0x51d4
jne 0x2a8f
jmp 0x2a88
leaq 0x272f(%rip), %rdi      # 0x529f
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2060