// File: /workspace/github_c_makefile_star2_O0/ejunjsh[P]mycc/stmt.c
// Function: single_statement
static struct ASTnode *single_statement(void) {
  struct ASTnode *stmt;
  struct symtable *ctype;
  int linenum= Line;

  switch (Token.token) {
    case T_SEMI:
      // 空语句
      semi();
      break;
    case T_LBRACE:
      // 有 '{', 所以这个是个组合语句
      lbrace();
      stmt = compound_statement(0);
      stmt->linenum= linenum;
      rbrace();
      return (stmt);
    case T_IDENT:
      // 如果标识符不是个typedef,当它为表达式处理
      // 如果是,那就由下面的情况来处理
      if (findtypedef(Text) == NULL) {
        stmt = binexpr(0);
        stmt->linenum= linenum;
        semi();
        return (stmt);
      }
    case T_CHAR:
    case T_INT:
    case T_LONG:
    case T_STRUCT:
    case T_UNION:
    case T_ENUM:
    case T_TYPEDEF:
      // 变量声明
      declaration_list(&ctype, C_LOCAL, T_SEMI, T_EOF, &stmt);
      semi();
      return (stmt);		// 变量声明也可能有赋值
    case T_IF:
      stmt= if_statement(); stmt->linenum= linenum; return(stmt);
    case T_WHILE:
      stmt= while_statement(); stmt->linenum= linenum; return(stmt);
    case T_FOR:
      stmt= for_statement(); stmt->linenum= linenum; return(stmt);
    case T_RETURN:
      stmt= return_statement(); stmt->linenum= linenum; return(stmt);
    case T_BREAK:
      stmt= break_statement(); stmt->linenum= linenum; return(stmt);
    case T_CONTINUE:
      stmt= continue_statement(); stmt->linenum= linenum; return(stmt);
    case T_SWITCH:
      stmt= switch_statement(); stmt->linenum= linenum; return(stmt);
    default:
      // 到这里,剩下的应该就是赋值的语句了
      stmt = binexpr(0);
      stmt->linenum= linenum;
      semi();
      return (stmt);
  }
  return (NULL);		
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
leaq 0x9009(%rip), %rax      # 0x124f8
movl (%rax), %eax
movl %eax, -0x1c(%rbp)
leaq 0x9035(%rip), %rax      # 0x12530
movl (%rax), %eax
addl $-0x1f, %eax
movl %eax, %ecx
movq %rcx, -0x28(%rbp)
subl $0x18, %eax
ja 0x9696
movq -0x28(%rbp), %rax
leaq 0x4816(%rip), %rcx      # 0xdd30
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0x8030
jmp 0x96ba
callq 0x8050
xorl %edi, %edi
callq 0x9420
movq %rax, -0x10(%rbp)
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x40(%rax)
callq 0x8070
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x96c2
leaq 0x9000(%rip), %rdi      # 0x12560
callq 0xa5a0
cmpq $0x0, %rax
jne 0x9592
xorl %edi, %edi
callq 0x58c0
movq %rax, -0x10(%rbp)
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x40(%rax)
callq 0x8030
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x96c2
jmp 0x9594
leaq -0x18(%rbp), %rdi
movl $0x2, %esi
movl $0x35, %edx
xorl %ecx, %ecx
leaq -0x10(%rbp), %r8
callq 0x4bf0
callq 0x8030
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x96c2
callq 0x96d0
movq %rax, -0x10(%rbp)
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x40(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x96c2
callq 0x97a0
movq %rax, -0x10(%rbp)
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x40(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x96c2
callq 0x9870
movq %rax, -0x10(%rbp)
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x40(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x96c2
callq 0x99d0
movq %rax, -0x10(%rbp)
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x40(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x96c2
callq 0x9aa0
movq %rax, -0x10(%rbp)
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x40(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x96c2
callq 0x9b00
movq %rax, -0x10(%rbp)
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x40(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x96c2
callq 0x9b50
movq %rax, -0x10(%rbp)
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x40(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x96c2
xorl %edi, %edi
callq 0x58c0
movq %rax, -0x10(%rbp)
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x40(%rax)
callq 0x8030
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x96c2
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)