// File: /workspace/github_c_makefile_star2_O3/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 0x66c4(%rip), %r15      # 0xefd0
movl 0x4(%rbx), %eax
cmpl $0x1e, %eax
je 0x8979
cmpl $0x1f, %eax
jne 0x8a1e
movl 0x69e4(%rip), %r12d     # 0xf308
leal 0x1(%r12), %eax
movl %eax, 0x69d9(%rip)      # 0xf308
testl %r14d, %r14d
jle 0x8949
movl %r14d, %r13d
movq (%r15), %rsi
movl $0x20, %edi
callq 0x20e0
decl %r13d
jne 0x8937
movq (%r15), %rdi
leaq 0x3448(%rip), %rsi      # 0xbd9b
movl %r12d, %edx
xorl %eax, %eax
callq 0x2100
incl 0x69a5(%rip)            # 0xf308
movq 0x20(%rbx), %rdi
addl $0x2, %r14d
movl %r14d, %edx
callq 0x88f1
movq 0x30(%rbx), %rbx
jmp 0x890c
incl 0x6989(%rip)            # 0xf308
testl %r14d, %r14d
jle 0x8999
movl %r14d, %r12d
movq (%r15), %rsi
movl $0x20, %edi
callq 0x20e0
decl %r12d
jne 0x8987
movq (%r15), %rcx
movl $0x4, %esi
movl $0x1, %edx
leaq 0x33df(%rip), %rdi      # 0xbd8c
callq 0x2170
cmpq $0x0, 0x30(%rbx)
je 0x89d9
movl 0x6949(%rip), %edx      # 0xf308
leal 0x1(%rdx), %eax
movl %eax, 0x6940(%rip)      # 0xf308
movq (%r15), %rdi
leaq 0x33bf(%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 0x88f1
movq 0x28(%rbx), %rdi
movl %r14d, %edx
callq 0x88f1
movq 0x30(%rbx), %rbx
testq %rbx, %rbx
jne 0x890c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x1d, %eax
jne 0x8a29
movl $0xfffffffe, %r14d      # imm = 0xFFFFFFFE
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x8a3b
leal 0x2(%r14), %edx
callq 0x88f1
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x8a4d
leal 0x2(%r14), %edx
callq 0x88f1
testl %r14d, %r14d
jle 0x8a64
movq (%r15), %rsi
movl $0x20, %edi
callq 0x20e0
decl %r14d
jne 0x8a52
movl 0x4(%rbx), %esi
leal -0x1(%rsi), %eax
cmpl $0x33, %eax
ja 0x8dcb
leaq 0x3222(%rip), %rcx      # 0xbc9c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq (%r15), %rcx
leaq 0x3366(%rip), %rdi      # 0xbdf3
jmp 0x8d53
movq (%r15), %rcx
leaq 0x34aa(%rip), %rdi      # 0xbf46
jmp 0x8d67
movq (%r15), %rdi
movl 0x8(%rbx), %edx
leaq 0x3463(%rip), %rsi      # 0xbf11
jmp 0x8db6
movq (%r15), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rdx
leaq 0x33a0(%rip), %rsi      # 0xbe65
jmp 0x8e10
movq (%r15), %rcx
leaq 0x33f3(%rip), %rdi      # 0xbec7
jmp 0x8cae
movq (%r15), %rcx
leaq 0x33d9(%rip), %rdi      # 0xbebc
jmp 0x8cae
movq (%r15), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rdx
leaq 0x33a8(%rip), %rsi      # 0xbea2
jmp 0x8e10
movq (%r15), %rdi
movl (%rbx), %edx
leaq 0x3307(%rip), %rsi      # 0xbe12
jmp 0x8db6
movq (%r15), %rcx
leaq 0x33c2(%rip), %rdi      # 0xbedc
jmp 0x8dec
movq (%r15), %rcx
leaq 0x345e(%rip), %rdi      # 0xbf87
jmp 0x8d67
cmpl $0x0, 0x18(%rbx)
movq (%r15), %rcx
je 0x8de5
leaq 0x333d(%rip), %rdi      # 0xbe7f
movl $0xd, %esi
jmp 0x8df1
movq (%r15), %rcx
leaq 0x326f(%rip), %rdi      # 0xbdc5
jmp 0x8c7f
movq (%r15), %rcx
leaq 0x3288(%rip), %rdi      # 0xbded
jmp 0x8d53
movq (%r15), %rdi
movl (%rbx), %edx
leaq 0x328f(%rip), %rsi      # 0xbe05
jmp 0x8db6
movq (%r15), %rcx
leaq 0x33d4(%rip), %rdi      # 0xbf59
jmp 0x8d67
movq (%r15), %rcx
leaq 0x3414(%rip), %rdi      # 0xbfa8
jmp 0x8cae
movq (%r15), %rcx
leaq 0x323a(%rip), %rdi      # 0xbddd
jmp 0x8d67
movq (%r15), %rcx
leaq 0x3320(%rip), %rdi      # 0xbed2
jmp 0x8d67
movq (%r15), %rcx
leaq 0x33f2(%rip), %rdi      # 0xbfb3
jmp 0x8d7b
movq (%r15), %rcx
leaq 0x1678(%rip), %rdi      # 0xa248
movl $0x2, %esi
jmp 0x8df1
movq (%r15), %rcx
leaq 0x334d(%rip), %rdi      # 0xbf31
jmp 0x8d67
movq (%r15), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rdx
leaq 0x31b4(%rip), %rsi      # 0xbdaf
jmp 0x8e10
movq (%r15), %rcx
leaq 0x3251(%rip), %rdi      # 0xbe5b
jmp 0x8d67
movq (%r15), %rcx
leaq 0x330d(%rip), %rdi      # 0xbf26
jmp 0x8cae
movq (%r15), %rcx
leaq 0x31a9(%rip), %rdi      # 0xbdd1
jmp 0x8c7f
movq (%r15), %rcx
leaq 0x31b3(%rip), %rdi      # 0xbde7
jmp 0x8d53
movq (%r15), %rcx
leaq 0x335b(%rip), %rdi      # 0xbf9e
jmp 0x8d67
movq (%r15), %rcx
leaq 0x31f6(%rip), %rdi      # 0xbe48
jmp 0x8d67
movq (%r15), %rcx
leaq 0x3302(%rip), %rdi      # 0xbf63
jmp 0x8d7b
movq (%r15), %rcx
leaq 0x3303(%rip), %rdi      # 0xbf73
jmp 0x8d67
movq (%r15), %rcx
leaq 0x3266(%rip), %rdi      # 0xbee5
movl $0xb, %esi
jmp 0x8df1
movq (%r15), %rcx
leaq 0x32a8(%rip), %rdi      # 0xbf3b
jmp 0x8cae
movq (%r15), %rcx
leaq 0x327d(%rip), %rdi      # 0xbf1c
jmp 0x8d67
movq (%r15), %rcx
leaq 0x324e(%rip), %rdi      # 0xbefc
movl $0xa, %esi
jmp 0x8df1
movq (%r15), %rcx
leaq 0x32cf(%rip), %rdi      # 0xbf91
jmp 0x8d7b
movq (%r15), %rcx
leaq 0x3236(%rip), %rdi      # 0xbf07
jmp 0x8d67
movq (%r15), %rcx
leaq 0x328a(%rip), %rdi      # 0xbf6a
jmp 0x8dec
movq (%r15), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rdx
leaq 0x31b8(%rip), %rsi      # 0xbeaf
jmp 0x8e10
movq (%r15), %rcx
leaq 0x314c(%rip), %rdi      # 0xbe52
jmp 0x8dec
movq (%r15), %rcx
leaq 0x323b(%rip), %rdi      # 0xbf50
jmp 0x8dec
movq (%r15), %rcx
leaq 0x3274(%rip), %rdi      # 0xbf98
jmp 0x8d53
movq (%r15), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rdx
leaq 0x313c(%rip), %rsi      # 0xbe74
jmp 0x8e10
movq (%r15), %rcx
leaq 0x30b8(%rip), %rdi      # 0xbdff
jmp 0x8d53
movq (%r15), %rcx
leaq 0x30a6(%rip), %rdi      # 0xbdf9
movl $0x5, %esi
jmp 0x8df1
movq (%r15), %rcx
leaq 0x3216(%rip), %rdi      # 0xbf7d
movl $0x9, %esi
jmp 0x8df1
movq (%r15), %rcx
leaq 0x3043(%rip), %rdi      # 0xbdbe
movl $0x6, %esi
jmp 0x8df1
cmpl $0x0, 0x18(%rbx)
movq (%r15), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rdx
je 0x8e09
leaq 0x3091(%rip), %rsi      # 0xbe2b
jmp 0x8e10
movq (%r15), %rdi
movl (%rbx), %edx
leaq 0x30ee(%rip), %rsi      # 0xbe96
jmp 0x8db6
movq (%r15), %rdi
movl (%rbx), %edx
leaq 0x313b(%rip), %rsi      # 0xbef1
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2100
leaq 0x31e8(%rip), %rdi      # 0xbfba
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6991
leaq 0x30a1(%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 0x302c(%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)