// File: /workspace/github_c_makefile_star2_O1/ejunjsh[P]mycc/tree.c
// Function: dumpAST
void dumpAST(struct ASTnode *n, int label, int level) {
  int Lfalse, Lstart, Lend;
  int i;

  switch (n->op) {
    case A_IF:
      Lfalse = gendumplabel();
      for (i = 0; i < level; i++)
	      fprintf(stdout, " ");
      fprintf(stdout, "A_IF");
      if (n->right) {
	      Lend = gendumplabel();
	      fprintf(stdout, ", end L%d", Lend);
      }
      fprintf(stdout, "\n");
      dumpAST(n->left, Lfalse, level + 2);
      dumpAST(n->mid, NOLABEL, level + 2);
      if (n->right)
	      dumpAST(n->right, NOLABEL, level + 2);
      return;
    case A_WHILE:
      Lstart = gendumplabel();
      for (i = 0; i < level; i++)
	      fprintf(stdout, " ");
      fprintf(stdout, "A_WHILE, start L%d\n", Lstart);
      Lend = gendumplabel();
      dumpAST(n->left, Lend, level + 2);
      dumpAST(n->right, NOLABEL, level + 2);
      return;
  }

  // 为A_GLUE重设层级为-2
  if (n->op == A_GLUE)
    level = -2;

  // 通用语法树节点处理
  if (n->left)
    dumpAST(n->left, NOLABEL, level + 2);
  if (n->right)
    dumpAST(n->right, NOLABEL, level + 2);


  for (i = 0; i < level; i++)
    fprintf(stdout, " ");
  switch (n->op) {
    case A_GLUE:
      fprintf(stdout, "\n\n");
      return;
    case A_FUNCTION:
      fprintf(stdout, "A_FUNCTION %s\n", n->sym->name);
      return;
    case A_ADD:
      fprintf(stdout, "A_ADD\n");
      return;
    case A_SUBTRACT:
      fprintf(stdout, "A_SUBTRACT\n");
      return;
    case A_MULTIPLY:
      fprintf(stdout, "A_MULTIPLY\n");
      return;
    case A_DIVIDE:
      fprintf(stdout, "A_DIVIDE\n");
      return;
    case A_EQ:
      fprintf(stdout, "A_EQ\n");
      return;
    case A_NE:
      fprintf(stdout, "A_NE\n");
      return;
    case A_LT:
      fprintf(stdout, "A_LE\n");
      return;
    case A_GT:
      fprintf(stdout, "A_GT\n");
      return;
    case A_LE:
      fprintf(stdout, "A_LE\n");
      return;
    case A_GE:
      fprintf(stdout, "A_GE\n");
      return;
    case A_INTLIT:
      fprintf(stdout, "A_INTLIT %d\n", n->atu.a_intvalue);
      return;
    case A_STRLIT:
      fprintf(stdout, "A_STRLIT rval label L%d\n", n->atu.a_intvalue);
      return;
    case A_IDENT:
      if (n->rvalue)
	      fprintf(stdout, "A_IDENT rval %s\n", n->sym->name);
      else
	      fprintf(stdout, "A_IDENT %s\n", n->sym->name);
      return;
    case A_ASSIGN:
      fprintf(stdout, "A_ASSIGN\n");
      return;
    case A_WIDEN:
      fprintf(stdout, "A_WIDEN\n");
      return;
    case A_RETURN:
      fprintf(stdout, "A_RETURN\n");
      return;
    case A_FUNCCALL:
      fprintf(stdout, "A_FUNCCALL %s\n", n->sym->name);
      return;
    case A_ADDR:
      fprintf(stdout, "A_ADDR %s\n", n->sym->name);
      return;
    case A_DEREF:
      if (n->rvalue)
	      fprintf(stdout, "A_DEREF rval\n");
      else
	      fprintf(stdout, "A_DEREF\n");
      return;
    case A_SCALE:
      fprintf(stdout, "A_SCALE %d\n", n->atu.a_size);
      return;
    case A_PREINC:
      fprintf(stdout, "A_PREINC %s\n", n->sym->name);
      return;
    case A_PREDEC:
      fprintf(stdout, "A_PREDEC %s\n", n->sym->name);
      return;
    case A_POSTINC:
      fprintf(stdout, "A_POSTINC\n");
      return;
    case A_POSTDEC:
      fprintf(stdout, "A_POSTDEC\n");
      return;
    case A_NEGATE:
      fprintf(stdout, "A_NEGATE\n");
      return;
    case A_BREAK:
      fprintf(stdout, "A_BREAK\n");
      return;
    case A_CONTINUE:
      fprintf(stdout, "A_CONTINUE\n");
      return;
    case A_CASE:
      fprintf(stdout, "A_CASE %d\n", n->atu.a_intvalue);
      return;
    case A_DEFAULT:
      fprintf(stdout, "A_DEFAULT\n");
      return;
    case A_SWITCH:
      fprintf(stdout, "A_SWITCH\n");
      return;
    case A_CAST:
      fprintf(stdout, "A_CAST %d\n", n->type);
      return;
    case A_ASPLUS:
      fprintf(stdout, "A_ASPLUS\n");
      return;
    case A_ASMINUS:
      fprintf(stdout, "A_ASMINUS\n");
      return;
    case A_ASSTAR:
      fprintf(stdout, "A_ASSTAR\n");
      return;
    case A_ASSLASH:
      fprintf(stdout, "A_ASSLASH\n");
      return;
    case A_TOBOOL:
      fprintf(stdout, "A_TOBOOL\n");
      return;
    case A_LOGOR:
      fprintf(stdout, "A_LOGOR\n");
      return;
    case A_LOGAND:
      fprintf(stdout, "A_LOGAND\n");
      return;
    case A_AND:
      fprintf(stdout, "A_AND\n");
      return;
    case A_ASMOD:
      fprintf(stdout, "A_ASMOD\n");
      return;
    case A_INVERT:
      fprintf(stdout, "A_INVERT\n");
      return;
    case A_LOGNOT:
      fprintf(stdout, "A_LOGNOT\n");
      return;
    case A_LSHIFT:
      fprintf(stdout, "A_LSHIFT\n");
      return;
    case A_MOD:
      fprintf(stdout, "A_MOD\n");
      return;
    case A_OR:
      fprintf(stdout, "A_OR\n");
      return;
    case A_RSHIFT:
      fprintf(stdout, "A_RSHIFT\n");
      return;
    case A_TERNARY:
      fprintf(stdout, "A_TERNARY\n");
      return;
    case A_XOR:
      fprintf(stdout, "A_XOR\n");
      return;
    default:
      fatald("Unknown dumpAST operator", n->op);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r14d
movq %rdi, %rbx
movq 0x673c(%rip), %r15      # 0xefd0
movl 0x4(%rbx), %eax
cmpl $0x1e, %eax
je 0x8901
cmpl $0x1f, %eax
jne 0x89a6
movl 0x6a5c(%rip), %r12d     # 0xf308
leal 0x1(%r12), %eax
movl %eax, 0x6a51(%rip)      # 0xf308
testl %r14d, %r14d
jle 0x88d1
movl %r14d, %r13d
movq (%r15), %rsi
movl $0x20, %edi
callq 0x20e0
decl %r13d
jne 0x88bf
movq (%r15), %rdi
leaq 0x34c0(%rip), %rsi      # 0xbd9b
movl %r12d, %edx
xorl %eax, %eax
callq 0x2100
incl 0x6a1d(%rip)            # 0xf308
movq 0x20(%rbx), %rdi
addl $0x2, %r14d
movl %r14d, %edx
callq 0x8879
movq 0x30(%rbx), %rbx
jmp 0x8894
incl 0x6a01(%rip)            # 0xf308
testl %r14d, %r14d
jle 0x8921
movl %r14d, %r12d
movq (%r15), %rsi
movl $0x20, %edi
callq 0x20e0
decl %r12d
jne 0x890f
movq (%r15), %rcx
movl $0x4, %esi
movl $0x1, %edx
leaq 0x3457(%rip), %rdi      # 0xbd8c
callq 0x2170
cmpq $0x0, 0x30(%rbx)
je 0x8961
movl 0x69c1(%rip), %edx      # 0xf308
leal 0x1(%rdx), %eax
movl %eax, 0x69b8(%rip)      # 0xf308
movq (%r15), %rdi
leaq 0x3437(%rip), %rsi      # 0xbd91
xorl %eax, %eax
callq 0x2100
movq (%r15), %rsi
movl $0xa, %edi
callq 0x20e0
movq 0x20(%rbx), %rdi
addl $0x2, %r14d
movl %r14d, %edx
callq 0x8879
movq 0x28(%rbx), %rdi
movl %r14d, %edx
callq 0x8879
movq 0x30(%rbx), %rbx
testq %rbx, %rbx
jne 0x8894
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x1d, %eax
jne 0x89b1
movl $0xfffffffe, %r14d      # imm = 0xFFFFFFFE
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x89c3
leal 0x2(%r14), %edx
callq 0x8879
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x89d5
leal 0x2(%r14), %edx
callq 0x8879
testl %r14d, %r14d
jle 0x89ec
movq (%r15), %rsi
movl $0x20, %edi
callq 0x20e0
decl %r14d
jne 0x89da
movl 0x4(%rbx), %esi
leal -0x1(%rsi), %eax
cmpl $0x33, %eax
ja 0x8d53
leaq 0x329a(%rip), %rcx      # 0xbc9c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq (%r15), %rcx
leaq 0x33de(%rip), %rdi      # 0xbdf3
jmp 0x8cdb
movq (%r15), %rcx
leaq 0x3522(%rip), %rdi      # 0xbf46
jmp 0x8cef
movq (%r15), %rdi
movl 0x8(%rbx), %edx
leaq 0x34db(%rip), %rsi      # 0xbf11
jmp 0x8d3e
movq (%r15), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rdx
leaq 0x3418(%rip), %rsi      # 0xbe65
jmp 0x8d98
movq (%r15), %rcx
leaq 0x346b(%rip), %rdi      # 0xbec7
jmp 0x8c36
movq (%r15), %rcx
leaq 0x3451(%rip), %rdi      # 0xbebc
jmp 0x8c36
movq (%r15), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rdx
leaq 0x3420(%rip), %rsi      # 0xbea2
jmp 0x8d98
movq (%r15), %rdi
movl (%rbx), %edx
leaq 0x337f(%rip), %rsi      # 0xbe12
jmp 0x8d3e
movq (%r15), %rcx
leaq 0x343a(%rip), %rdi      # 0xbedc
jmp 0x8d74
movq (%r15), %rcx
leaq 0x34d6(%rip), %rdi      # 0xbf87
jmp 0x8cef
cmpl $0x0, 0x18(%rbx)
movq (%r15), %rcx
je 0x8d6d
leaq 0x33b5(%rip), %rdi      # 0xbe7f
movl $0xd, %esi
jmp 0x8d79
movq (%r15), %rcx
leaq 0x32e7(%rip), %rdi      # 0xbdc5
jmp 0x8c07
movq (%r15), %rcx
leaq 0x3300(%rip), %rdi      # 0xbded
jmp 0x8cdb
movq (%r15), %rdi
movl (%rbx), %edx
leaq 0x3307(%rip), %rsi      # 0xbe05
jmp 0x8d3e
movq (%r15), %rcx
leaq 0x344c(%rip), %rdi      # 0xbf59
jmp 0x8cef
movq (%r15), %rcx
leaq 0x348c(%rip), %rdi      # 0xbfa8
jmp 0x8c36
movq (%r15), %rcx
leaq 0x32b2(%rip), %rdi      # 0xbddd
jmp 0x8cef
movq (%r15), %rcx
leaq 0x3398(%rip), %rdi      # 0xbed2
jmp 0x8cef
movq (%r15), %rcx
leaq 0x346a(%rip), %rdi      # 0xbfb3
jmp 0x8d03
movq (%r15), %rcx
leaq 0x16f0(%rip), %rdi      # 0xa248
movl $0x2, %esi
jmp 0x8d79
movq (%r15), %rcx
leaq 0x33c5(%rip), %rdi      # 0xbf31
jmp 0x8cef
movq (%r15), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rdx
leaq 0x322c(%rip), %rsi      # 0xbdaf
jmp 0x8d98
movq (%r15), %rcx
leaq 0x32c9(%rip), %rdi      # 0xbe5b
jmp 0x8cef
movq (%r15), %rcx
leaq 0x3385(%rip), %rdi      # 0xbf26
jmp 0x8c36
movq (%r15), %rcx
leaq 0x3221(%rip), %rdi      # 0xbdd1
jmp 0x8c07
movq (%r15), %rcx
leaq 0x322b(%rip), %rdi      # 0xbde7
jmp 0x8cdb
movq (%r15), %rcx
leaq 0x33d3(%rip), %rdi      # 0xbf9e
jmp 0x8cef
movq (%r15), %rcx
leaq 0x326e(%rip), %rdi      # 0xbe48
jmp 0x8cef
movq (%r15), %rcx
leaq 0x337a(%rip), %rdi      # 0xbf63
jmp 0x8d03
movq (%r15), %rcx
leaq 0x337b(%rip), %rdi      # 0xbf73
jmp 0x8cef
movq (%r15), %rcx
leaq 0x32de(%rip), %rdi      # 0xbee5
movl $0xb, %esi
jmp 0x8d79
movq (%r15), %rcx
leaq 0x3320(%rip), %rdi      # 0xbf3b
jmp 0x8c36
movq (%r15), %rcx
leaq 0x32f5(%rip), %rdi      # 0xbf1c
jmp 0x8cef
movq (%r15), %rcx
leaq 0x32c6(%rip), %rdi      # 0xbefc
movl $0xa, %esi
jmp 0x8d79
movq (%r15), %rcx
leaq 0x3347(%rip), %rdi      # 0xbf91
jmp 0x8d03
movq (%r15), %rcx
leaq 0x32ae(%rip), %rdi      # 0xbf07
jmp 0x8cef
movq (%r15), %rcx
leaq 0x3302(%rip), %rdi      # 0xbf6a
jmp 0x8d74
movq (%r15), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rdx
leaq 0x3230(%rip), %rsi      # 0xbeaf
jmp 0x8d98
movq (%r15), %rcx
leaq 0x31c4(%rip), %rdi      # 0xbe52
jmp 0x8d74
movq (%r15), %rcx
leaq 0x32b3(%rip), %rdi      # 0xbf50
jmp 0x8d74
movq (%r15), %rcx
leaq 0x32ec(%rip), %rdi      # 0xbf98
jmp 0x8cdb
movq (%r15), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rdx
leaq 0x31b4(%rip), %rsi      # 0xbe74
jmp 0x8d98
movq (%r15), %rcx
leaq 0x3130(%rip), %rdi      # 0xbdff
jmp 0x8cdb
movq (%r15), %rcx
leaq 0x311e(%rip), %rdi      # 0xbdf9
movl $0x5, %esi
jmp 0x8d79
movq (%r15), %rcx
leaq 0x328e(%rip), %rdi      # 0xbf7d
movl $0x9, %esi
jmp 0x8d79
movq (%r15), %rcx
leaq 0x30bb(%rip), %rdi      # 0xbdbe
movl $0x6, %esi
jmp 0x8d79
cmpl $0x0, 0x18(%rbx)
movq (%r15), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rdx
je 0x8d91
leaq 0x3109(%rip), %rsi      # 0xbe2b
jmp 0x8d98
movq (%r15), %rdi
movl (%rbx), %edx
leaq 0x3166(%rip), %rsi      # 0xbe96
jmp 0x8d3e
movq (%r15), %rdi
movl (%rbx), %edx
leaq 0x31b3(%rip), %rsi      # 0xbef1
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2100
leaq 0x3260(%rip), %rdi      # 0xbfba
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x68e9
leaq 0x3119(%rip), %rdi      # 0xbe8d
movl $0x8, %esi
movl $0x1, %edx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2170
leaq 0x30a4(%rip), %rsi      # 0xbe3c
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2100
nopl (%rax)