// File: /workspace/github_c_makefile_star2_O2/sisshiki1969[P]monocc/src/debug.c
// Function: print_node
void print_node(Node *node) {
  if (node == NULL) {
    fprintf(output, "NULL ");
    return;
  }
  if (is_binary_op(node->kind)) {
    switch (node->kind) {
      case ND_ADD:
      case ND_SUB:
      case ND_MUL:
      case ND_DIV:
      case ND_EQ:
      case ND_NEQ:
      case ND_GE:
      case ND_GT:
      case ND_LAND:
      case ND_LOR:
      case ND_AND:
      case ND_OR:
      case ND_XOR:
      case ND_SHR:
      case ND_SHL:
        fprintf(output, "(%.*s ", node->token->len, node->token->str);
        break;
      default:
        error("Unknown binary node.");
    }
    print_node(node->lhs);
    fprintf(output, " ");
    print_node(node->rhs);
    fprintf(output, ")");
    return;
  }
  switch (node->kind) {
    case ND_NOT:
      fprintf(output, "(! ");
      print_node(node->lhs);
      fprintf(output, ")");
      return;
    case ND_CMP:
      fprintf(output, "(~ ");
      print_node(node->lhs);
      fprintf(output, ")");
      return;
    case ND_ADDR:
      fprintf(output, "(ADDR ");
      print_node(node->lhs);
      fprintf(output, ")");
      return;
    case ND_DEREF:
      fprintf(output, "(DEREF ");
      print_node(node->lhs);
      fprintf(output, ")");
      return;
    case ND_CAST:
      fprintf(output, "(CAST ");
      print_type(output, node->type);
      fprintf(output, " ");
      print_node(node->lhs);
      fprintf(output, ")");
      return;
    case ND_MEMBER:
      fprintf(output, "(MEMBER ");
      print_node(node->lhs);
      fprintf(output, " %.*s %d)", node->token->len, node->token->str,
              node->offset);
      return;
    case ND_BREAK:
      fprintf(output, "BREAK ");
      return;
    case ND_CONTINUE:
      fprintf(output, "CONTINUE ");
      return;
  }
  if (node->kind == ND_CALL) {
    Token *name = node->lhs->token;
    fprintf(output, "(CALL %.*s (", name->len, name->str);
    Vector *vec = node->nodes;
    int len = vec_len(vec);
    for (int i = 0; i < len; i++) {
      print_node(vec->data[i]);
      fprintf(output, ":");
    }
    fprintf(output, ") )");
    return;
  }
  if (node->kind == ND_NUM) {
    fprintf(output, " %ld ", node->num_val);
    return;
  }
  if (node->kind == ND_STR) {
    fprintf(output, " \"%.*s\" ", node->token->len, node->token->str);
    return;
  }
  if (node->kind == ND_INIT) {
    Vector *vec = node->nodes;
    bool first = true;
    fprintf(output, "{");
    for (int i = 0; i < vec_len(vec); i++) {
      if (!first) fprintf(output, ",");
      first = false;
      print_node(vec->data[i]);
      // fprintf(output, " ");
    }
    fprintf(output, "}");
    return;
  }
  if (node->kind == ND_ASSIGN) {
    fprintf(output, "(= ");
    print_node(node->lhs);
    fprintf(output, " ");
    print_node(node->rhs);
    fprintf(output, ")");
    return;
  }
  if (node->kind == ND_IF) {
    fprintf(output, "(IF ");
    print_node(node->lhs);
    fprintf(output, " ");
    print_node(node->rhs);
    fprintf(output, " ");
    print_node(node->xhs);
    fprintf(output, ")");
    return;
  }
  if (node->kind == ND_SWITCH) {
    fprintf(output, "(SWITCH cond: ");
    print_node(node->lhs);
    fprintf(output, " body: ");
    print_node(node->rhs);
    fprintf(output, ")");
    return;
  }

  if (node->kind == ND_CASE) {
    fprintf(output, "(CASE cond:");
    print_node(node->lhs);
    fprintf(output, " body:");
    print_node(node->rhs);
    fprintf(output, ")");
    return;
  }

  if (node->kind == ND_DEFAULT) {
    fprintf(output, "(DEFAULT body:");
    print_node(node->lhs);
    fprintf(output, ")");
    return;
  }

  if (node->kind == ND_WHILE) {
    fprintf(output, "(WHILE cond:");
    print_node(node->lhs);
    fprintf(output, "body: ");
    print_node(node->rhs);
    fprintf(output, ")");
    return;
  }
  if (node->kind == ND_FOR) {
    fprintf(output, "(FOR init: ");
    print_node(node->lhs);
    fprintf(output, "cond: ");
    print_node(node->rhs);
    fprintf(output, " post: ");
    print_node(node->xhs);
    fprintf(output, " body ");
    print_node(node->nodes->data[0]);
    fprintf(output, ")");
    return;
  }
  if (node->kind == ND_BLOCK) {
    fprintf(output, "(BLOCK");
    if (node->nodes) {
      Vector *vec = node->nodes;
      int len = vec_len(vec);
      for (int i = 0; i < len; i++) {
        print_node(vec->data[i]);
        fprintf(output, ":");
      }
    }
    fprintf(output, ")");
    return;
  }
  if (node->kind == ND_LVAR) {
    fprintf(output, "(LVAR %d)", node->lvar->offset);
    return;
  }
  if (node->kind == ND_GVAR) {
    fprintf(output, "(GVAR %.*s)", node->token->len, node->token->str);
    return;
  }
  if (node->kind == ND_RETURN) {
    fprintf(output, "(RETURN ");
    print_node(node->lhs);
    fprintf(output, ")");
    return;
  }
  if (node->kind == ND_FDECL) {
    fprintf(output, "FDECL %.*s ", node->token->len, node->token->str);
    print_type(output, node->type);
    fprintf(output, " max_offset:%d\n//    ", node->offset);
    if (node->nodes) {
      Vector *params = node->nodes;
      int len = vec_len(params);
      for (int i = 0; i < len; i++) {
        print_node(params->data[i]);
        fprintf(output, " ");
      }
    }
    fprintf(output, "\n//    ");
    print_node(node->lhs);
    fprintf(output, ")");
    return;
  }
  error("print_node(): Unknown node.");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x3762
movq %rdi, %rbx
movl (%rdi), %edi
callq 0x12cc
movl (%rbx), %ecx
testb %al, %al
je 0x378c
cmpl $0x13, %ecx
ja 0x37d1
movl $0xfbff0, %eax          # imm = 0xFBFF0
btl %ecx, %eax
jae 0x37d1
leaq 0xdafe(%rip), %rax      # 0x11220
movq (%rax), %rdi
movq 0x50(%rbx), %rax
movl 0x28(%rax), %edx
movq 0x20(%rax), %rcx
leaq 0x75ea(%rip), %rsi      # 0xad21
xorl %eax, %eax
callq 0x10f0
movq 0x8(%rbx), %rdi
callq 0x36e0
leaq 0xdad2(%rip), %r14      # 0x11220
movq (%r14), %rsi
pushq $0x20
popq %rdi
callq 0x10c0
movq 0x10(%rbx), %rdi
jmp 0x3c5b
leaq 0xdab7(%rip), %rax      # 0x11220
movq (%rax), %rcx
leaq 0x75a8(%rip), %rdi      # 0xad1b
pushq $0x5
popq %rsi
pushq $0x1
popq %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1190
decl %ecx
cmpl $0x26, %ecx
ja 0x3d75
leaq 0x745e(%rip), %rax      # 0xabfc
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0xda72(%rip), %rax      # 0x11220
movq (%rax), %rdi
movq 0x20(%rbx), %rdx
leaq 0x75d4(%rip), %rsi      # 0xad90
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10f0
leaq 0x7550(%rip), %rdi      # 0xad28
xorl %eax, %eax
callq 0x462f
jmp 0x373e
leaq 0xda35(%rip), %r14      # 0x11220
movq (%r14), %rcx
leaq 0x75d6(%rip), %rdi      # 0xadcb
pushq $0xe
jmp 0x3c4e
leaq 0xda1d(%rip), %rax      # 0x11220
movq (%rax), %rcx
leaq 0x7568(%rip), %rdi      # 0xad75
pushq $0x9
jmp 0x3775
leaq 0xda05(%rip), %r14      # 0x11220
movq (%r14), %rcx
leaq 0x757e(%rip), %rdi      # 0xada3
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
callq 0x1190
movq 0x8(%rbx), %rdi
callq 0x36e0
movq (%r14), %rsi
pushq $0x20
popq %rbp
movl %ebp, %edi
callq 0x10c0
movq 0x10(%rbx), %rdi
callq 0x36e0
movq (%r14), %rsi
movl %ebp, %edi
callq 0x10c0
movq 0x18(%rbx), %rdi
jmp 0x3c5b
leaq 0xd9b7(%rip), %r12      # 0x11220
movq (%r12), %rdi
movq 0x50(%rbx), %rax
movl 0x28(%rax), %edx
movq 0x20(%rax), %rcx
leaq 0x75a9(%rip), %rsi      # 0xae28
xorl %r13d, %r13d
xorl %eax, %eax
callq 0x10f0
movq (%r12), %rdi
movq 0x58(%rbx), %rsi
callq 0x3d91
movq (%r12), %rdi
movl 0x38(%rbx), %edx
leaq 0x7590(%rip), %rsi      # 0xae34
xorl %eax, %eax
callq 0x10f0
movq 0x48(%rbx), %r14
testq %r14, %r14
je 0x38e9
movq %r14, %rdi
callq 0x34f2
movl %eax, %r15d
testl %eax, %eax
cmovlel %r13d, %r15d
pushq $0x20
popq %rbp
cmpq %r13, %r15
je 0x38e9
movq (%r14), %rax
movq (%rax,%r13,8), %rdi
callq 0x36e0
movq (%r12), %rsi
movl %ebp, %edi
callq 0x10c0
incq %r13
jmp 0x38c8
movq (%r12), %rcx
leaq 0x754e(%rip), %rdi      # 0xae42
pushq $0x7
popq %rsi
pushq $0x1
popq %rdx
callq 0x1190
movq 0x8(%rbx), %rdi
jmp 0x3c1d
movq 0x8(%rbx), %rax
movq 0x50(%rax), %rax
leaq 0xd909(%rip), %r15      # 0x11220
movq (%r15), %rdi
movl 0x28(%rax), %edx
movq 0x20(%rax), %rcx
leaq 0x7457(%rip), %rsi      # 0xad7f
xorl %r12d, %r12d
xorl %eax, %eax
callq 0x10f0
movq 0x48(%rbx), %rbx
movq %rbx, %rdi
callq 0x34f2
movl %eax, %r14d
testl %eax, %eax
cmovlel %r12d, %r14d
pushq $0x3a
popq %rbp
cmpq %r12, %r14
je 0x396a
movq (%rbx), %rax
movq (%rax,%r12,8), %rdi
callq 0x36e0
movq (%r15), %rsi
movl %ebp, %edi
callq 0x10c0
incq %r12
jmp 0x394a
movq (%r15), %rcx
leaq 0x7418(%rip), %rdi      # 0xad8c
pushq $0x3
jmp 0x3775
leaq 0xd89e(%rip), %r15      # 0x11220
movq (%r15), %rcx
leaq 0x7476(%rip), %rdi      # 0xae02
pushq $0x6
popq %rsi
pushq $0x1
popq %rdx
callq 0x1190
movq 0x48(%rbx), %rbx
testq %rbx, %rbx
je 0x3d55
movq %rbx, %rdi
callq 0x34f2
movl %eax, %r14d
xorl %r12d, %r12d
testl %eax, %eax
cmovlel %r12d, %r14d
pushq $0x3a
popq %rbp
cmpq %r12, %r14
je 0x3d55
movq (%rbx), %rax
movq (%rax,%r12,8), %rdi
callq 0x36e0
movq (%r15), %rsi
movl %ebp, %edi
callq 0x10c0
incq %r12
jmp 0x39bb
leaq 0xd83a(%rip), %r14      # 0x11220
movq (%r14), %rcx
leaq 0x7364(%rip), %rdi      # 0xad54
pushq $0x6
popq %rsi
pushq $0x1
popq %rdx
callq 0x1190
movq (%r14), %rdi
movq 0x58(%rbx), %rsi
callq 0x3d91
movq (%r14), %rsi
pushq $0x20
popq %rdi
callq 0x10c0
jmp 0x3c57
leaq 0xd802(%rip), %r14      # 0x11220
movq (%r14), %rcx
leaq 0x73f7(%rip), %rdi      # 0xae1f
pushq $0x8
jmp 0x3c4e
movq 0x48(%rbx), %rbx
leaq 0xd7e6(%rip), %r14      # 0x11220
movq (%r14), %rsi
pushq $0x7b
popq %rdi
callq 0x10c0
movb $0x1, %r12b
xorl %r15d, %r15d
pushq $0x2c
popq %rbp
movq %rbx, %rdi
callq 0x34f2
cltq
cmpq %rax, %r15
jge 0x3a81
testb $0x1, %r12b
jne 0x3a6d
movq (%r14), %rsi
movl %ebp, %edi
callq 0x10c0
movq (%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x36e0
incq %r15
xorl %r12d, %r12d
jmp 0x3a4e
movq (%r14), %rsi
pushq $0x7d
jmp 0x3c65
leaq 0xd78e(%rip), %r14      # 0x11220
movq (%r14), %rcx
leaq 0x7303(%rip), %rdi      # 0xad9f
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
callq 0x1190
movq 0x8(%rbx), %rdi
callq 0x36e0
jmp 0x374e
leaq 0xd764(%rip), %r14      # 0x11220
movq (%r14), %rcx
leaq 0x7295(%rip), %rdi      # 0xad5b
pushq $0x8
popq %rsi
pushq $0x1
popq %rdx
callq 0x1190
movq 0x8(%rbx), %rdi
callq 0x36e0
movq (%r14), %rdi
movq 0x50(%rbx), %rax
movl 0x28(%rax), %edx
movq 0x20(%rax), %rcx
movl 0x38(%rbx), %r8d
leaq 0x7271(%rip), %rsi      # 0xad64
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10f0
leaq 0xd711(%rip), %rax      # 0x11220
movq (%rax), %rdi
movq 0x50(%rbx), %rax
movl 0x28(%rax), %edx
movq 0x20(%rax), %rcx
leaq 0x7272(%rip), %rsi      # 0xad96
jmp 0x3c95
leaq 0xd6f0(%rip), %r14      # 0x11220
movq (%r14), %rcx
leaq 0x720b(%rip), %rdi      # 0xad45
pushq $0x6
jmp 0x3c4e
leaq 0xd6d8(%rip), %r14      # 0x11220
movq (%r14), %rcx
leaq 0x71fa(%rip), %rdi      # 0xad4c
pushq $0x7
jmp 0x3c4e
leaq 0xd6c0(%rip), %r15      # 0x11220
movq (%r15), %rcx
leaq 0x7270(%rip), %rdi      # 0xadda
pushq $0xc
popq %rsi
pushq $0x1
popq %r14
movq %r14, %rdx
callq 0x1190
movq 0x8(%rbx), %rdi
callq 0x36e0
movq (%r15), %rcx
leaq 0x722c(%rip), %rdi      # 0xadb8
jmp 0x3d0a
leaq 0xd688(%rip), %r12      # 0x11220
movq (%r12), %rcx
leaq 0x7244(%rip), %rdi      # 0xade7
pushq $0xb
popq %rsi
pushq $0x1
popq %r14
movq %r14, %rdx
callq 0x1190
movq 0x8(%rbx), %rdi
callq 0x36e0
movq (%r12), %rcx
leaq 0x71ea(%rip), %rdi      # 0xadb0
pushq $0x6
popq %r15
movq %r15, %rsi
movq %r14, %rdx
callq 0x1190
movq 0x10(%rbx), %rdi
callq 0x36e0
movq (%r12), %rcx
leaq 0x720a(%rip), %rdi      # 0xadf3
pushq $0x7
popq %rsi
movq %r14, %rdx
callq 0x1190
movq 0x18(%rbx), %rdi
callq 0x36e0
movq (%r12), %rcx
leaq 0x71f3(%rip), %rdi      # 0xadfb
movq %r15, %rsi
movq %r14, %rdx
callq 0x1190
movq 0x48(%rbx), %rax
movq (%rax), %rax
movq (%rax), %rdi
callq 0x36e0
movq (%r12), %rsi
jmp 0x3c63
leaq 0xd5f1(%rip), %r14      # 0x11220
movq (%r14), %rcx
leaq 0x7104(%rip), %rdi      # 0xad3d
jmp 0x3c4c
leaq 0xd5de(%rip), %r14      # 0x11220
movq (%r14), %rcx
leaq 0x70f5(%rip), %rdi      # 0xad41
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
callq 0x1190
movq 0x8(%rbx), %rdi
callq 0x36e0
movq (%r14), %rsi
pushq $0x29
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10c0
leaq 0xd5a0(%rip), %rax      # 0x11220
movq (%rax), %rdi
movq 0x50(%rbx), %rax
movl 0x28(%rax), %edx
movq 0x20(%rax), %rcx
leaq 0x717e(%rip), %rsi      # 0xae13
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10f0
leaq 0xd56f(%rip), %rax      # 0x11220
movq (%rax), %rdi
movq 0x30(%rbx), %rax
movl 0x18(%rax), %edx
leaq 0x7147(%rip), %rsi      # 0xae09
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10f0
leaq 0xd542(%rip), %r15      # 0x11220
movq (%r15), %rcx
leaq 0x70d7(%rip), %rdi      # 0xadbf
pushq $0xb
popq %rsi
pushq $0x1
popq %r14
movq %r14, %rdx
callq 0x1190
movq 0x8(%rbx), %rdi
callq 0x36e0
movq (%r15), %rcx
leaq 0x70c9(%rip), %rdi      # 0xadd3
pushq $0x6
jmp 0x3d43
leaq 0xd50b(%rip), %r15      # 0x11220
movq (%r15), %rcx
leaq 0x7089(%rip), %rdi      # 0xada8
pushq $0xe
popq %rsi
pushq $0x1
popq %r14
movq %r14, %rdx
callq 0x1190
movq 0x8(%rbx), %rdi
callq 0x36e0
movq (%r15), %rcx
leaq 0x7076(%rip), %rdi      # 0xadb7
pushq $0x7
popq %rsi
movq %r14, %rdx
callq 0x1190
movq 0x10(%rbx), %rdi
callq 0x36e0
movq (%r15), %rsi
jmp 0x3c63
leaq 0xd4bc(%rip), %rax      # 0x11220
movq (%rax), %rcx
leaq 0x7000(%rip), %rdi      # 0xad6e
pushq $0x6
jmp 0x3775
leaq 0x70ce(%rip), %rdi      # 0xae4a
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x462f