// File: /workspace/github_c_makefile_star2_O3/ejunjsh[P]mycc/decl.c
// Function: declaration_list
int declaration_list(struct symtable **ctype, int class, int et1, int et2,
		     struct ASTnode **gluetree) {
  int inittype, type;
  struct symtable *sym;
  struct ASTnode *tree;
  *gluetree = NULL; // TODO：有问题？

  // 获取初始的类型， 如果是-1，代表是个复合类型声明，直接返回
  if ((inittype = parse_type(ctype, &class)) == -1)
    return (inittype);

  // 现在解析一列表符号
  while (1) {
    // 看看这个符号是否是个指针
    type = parse_stars(inittype);

    // 解析符号
    sym = symbol_declaration(type, *ctype, class, &tree);

    // 解析到函数，直接返回
    if (sym->stype == S_FUNCTION) {
      if (class != C_GLOBAL && class != C_STATIC)
	      fatal("Function definition not at global level");
      return (type);
    }

    // 把tree粘起来（Glue）
    // 这只在本地变量声明并有赋值操作的时候，
    // 这样就能把一系列赋值操作连起来
    if (*gluetree == NULL)
      *gluetree = tree;
    else
      *gluetree =
	      mkastnode(A_GLUE, P_NONE, NULL, *gluetree, NULL, tree, NULL, 0);

    // 遇到结束token，返回
    if (Token.token == et1 || Token.token == et2)
      return (type);

    // 否则，匹配逗号，继续
    comma();
  }

  return(0);	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %r8, %rbx
movl %ecx, %r15d
movl %edx, -0x60(%rbp)
leaq -0x5c(%rbp), %rax
movl %esi, (%rax)
movq $0x0, (%r8)
movq %rdi, -0x78(%rbp)
movq %rax, %rsi
callq 0x3c7c
movl %eax, -0x64(%rbp)
cmpl $-0x1, %eax
je 0x4a8a
movq %rbx, -0x58(%rbp)
movl %r15d, -0x2c(%rbp)
movl -0x64(%rbp), %edi
callq 0x41f9
movl %eax, %r14d
movq -0x78(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movl -0x5c(%rbp), %r12d
leaq 0xb056(%rip), %rdi      # 0xf3d0
callq 0x2180
movq %rax, %r13
callq 0x690b
leaq 0xb012(%rip), %rax      # 0xf3a0
movl (%rax), %eax
cmpl $0x39, %eax
jne 0x43d1
leaq 0xafcc(%rip), %rax      # 0xf368
movl (%rax), %eax
movl %eax, -0x44(%rbp)
movq %r13, %rdi
callq 0x8288
testq %rax, %rax
je 0x43f9
cmpl $0x1, 0x20(%rax)
jne 0x43f9
movq %rax, %rbx
callq 0x68df
movq %rbx, %rdi
callq 0x4b1b
callq 0x68f5
movq %rbx, %r8
jmp 0x45ca
leal -0x1(%r12), %ebx
cmpl $0x5, %ebx
jae 0x445a
movq %r13, %rdi
callq 0x8217
testq %rax, %rax
je 0x4460
leaq 0x676b(%rip), %rdi      # 0xab5a
movq %r13, %rsi
callq 0x683f
jmp 0x4460
callq 0x5828
movq %r12, %r8
movl %eax, %r12d
movl %eax, (%rsp)
movq %r13, %rdi
movl %r14d, %esi
xorl %edx, %edx
movl $0x1, %ecx
xorl %r9d, %r9d
callq 0x7ddd
movq %rax, %r13
callq 0x68df
xorl %edi, %edi
callq 0x4b1b
movl %eax, %ebx
callq 0x68f5
testq %r13, %r13
je 0x45c7
movq %r13, %r8
movl %ebx, 0x2c(%r13)
leaq 0xb1b7(%rip), %rcx      # 0xf600
movq (%rcx), %rax
movq %rax, 0x40(%r13)
movq %rcx, %rax
xorl %ecx, %ecx
jmp 0x45d3
cmpl $0x8, %r12d
jne 0x4485
movq %r13, %rdi
callq 0x8323
testq %rax, %rax
je 0x447c
leaq 0x670b(%rip), %rdi      # 0xab7f
movq %r13, %rsi
callq 0x683f
leaq 0xaf1d(%rip), %rax      # 0xf3a0
movl (%rax), %eax
cmpl $0x3b, %eax
jne 0x4558
leaq 0xaf0b(%rip), %rbx      # 0xf3a0
movq %rbx, %rdi
callq 0x6b20
movl $0xffffffff, -0x40(%rbp) # imm = 0xFFFFFFFF
cmpl $0x3c, (%rbx)
je 0x44c8
movl $0x30, %edi
callq 0x426b
testl %eax, %eax
movl %eax, -0x40(%rbp)
jg 0x44c8
leaq 0x67ab(%rip), %rdi      # 0xac6c
movl %eax, %esi
callq 0x6991
movl $0x3c, %edi
leaq 0x7714(%rip), %rsi      # 0xbbe8
callq 0x6818
leal -0x4(%r12), %eax
cmpl $0x2, %eax
jb 0x44f7
cmpl $0x2, %r12d
je 0x46f9
cmpl $0x1, %r12d
jne 0x471c
movq %r13, %rdi
callq 0x8185
movq %rax, %rbx
movl %r14d, %edi
callq 0x8e52
movq %rbx, %rdi
movl %r12d, %esi
movl %eax, %edx
movq %r12, %r15
movq -0x50(%rbp), %r12
movq %r12, %rcx
callq 0x4c19
testl %eax, %eax
je 0x46ed
movl %r14d, %edi
callq 0x8e52
movl $0x0, (%rsp)
movq %r13, %rdi
movl %eax, %esi
movq %r12, %rdx
movl $0x2, %ecx
movl %r15d, %r8d
xorl %r9d, %r9d
callq 0x7ddd
movq %rax, %rcx
jmp 0x46f0
xorl %r8d, %r8d
cmpl $0x7, %ebx
ja 0x496a
leaq 0x6389(%rip), %rcx      # 0xa8f4
movslq (%rcx,%rbx,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r13, %rdi
callq 0x8185
movq %rax, %rbx
movq %rax, %rdi
movl %r12d, %esi
movl %r14d, %edx
movq %r12, %r15
movq -0x50(%rbp), %r12
movq %r12, %rcx
callq 0x4c19
testl %eax, %eax
je 0x4918
movl $0x0, (%rsp)
movq %r13, %rdi
movl %r14d, %esi
movq %r12, %rdx
xorl %ecx, %ecx
movl %r15d, %r8d
movl $0x1, %r9d
callq 0x7ddd
movq %rax, %r8
jmp 0x491b
xorl %r8d, %r8d
xorl %ecx, %ecx
leaq 0xb02d(%rip), %rax      # 0xf600
leaq 0xb02e(%rip), %rdx      # 0xf608
movq %rcx, (%rdx)
movq %rcx, (%rax)
leaq 0xadb9(%rip), %rax      # 0xf3a0
cmpl $0x35, (%rax)
jne 0x45f5
movq -0x58(%rbp), %rbx
jmp 0x46e4
leaq 0xad7c(%rip), %rax      # 0xf378
movq %r8, %r13
movq %r8, (%rax)
leaq 0xafcb(%rip), %rax      # 0xf5d4
movl %ecx, (%rax)
leaq 0xafc6(%rip), %rax      # 0xf5d8
movl %ecx, (%rax)
callq 0x68b3
xorl %edi, %edi
callq 0x7690
movq %rax, %rbx
callq 0x68c9
cmpl $0x10, %r14d
je 0x4664
testq %rbx, %rbx
jne 0x463f
leaq 0x656f(%rip), %rdi      # 0xaba9
callq 0x6937
movl 0x4(%rbx), %eax
cmpl $0x1d, %eax
jne 0x4653
movq 0x30(%rbx), %rax
testq %rax, %rax
je 0x4658
movl 0x4(%rax), %eax
cmpl $0x22, %eax
je 0x4664
leaq 0x6577(%rip), %rdi      # 0xabd6
callq 0x6937
movl $0x20, %edi
movl %r14d, %esi
movq -0x50(%rbp), %rdx
movq %rbx, %rcx
movq %r13, %r8
movl %r12d, %r9d
callq 0x88d3
movl -0x44(%rbp), %ecx
movl %ecx, 0x40(%rax)
movq %rax, %rdi
callq 0x6a4c
movq %rax, %rbx
leaq 0xacbe(%rip), %rax      # 0xf354
cmpl $0x0, (%rax)
je 0x46c7
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x88f1
movq 0xa922(%rip), %rax      # 0xefd0
movq (%rax), %rcx
movl $0x2, %esi
movl $0x1, %edx
leaq 0x5b86(%rip), %rdi      # 0xa248
callq 0x2170
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x583d
callq 0x8501
movq -0x58(%rbp), %rbx
movq %r13, %r8
movq -0x40(%rbp), %r12
jmp 0x48b2
movq %rbx, %rcx
movq %r15, %r12
movl -0x2c(%rbp), %r15d
jmp 0x4728
movl %r14d, %edi
callq 0x8e52
movq %r13, %rdi
movl %eax, %esi
movq -0x50(%rbp), %rdx
movl $0x2, %ecx
xorl %r8d, %r8d
callq 0x7e5c
movq %rax, %rcx
jmp 0x4728
leaq 0x655f(%rip), %rdi      # 0xac82
callq 0x6937
leaq 0xac71(%rip), %rax      # 0xf3a0
cmpl $0x1, (%rax)
movq %rcx, -0x38(%rbp)
jne 0x4805
movl %r14d, -0x44(%rbp)
movq %r12, -0x70(%rbp)
movl %r12d, %eax
andl $-0x5, %eax
cmpl $0x1, %eax
je 0x475e
leaq 0x655f(%rip), %rdi      # 0xacb5
movq %r13, %rsi
callq 0x683f
leaq 0xac3b(%rip), %rdi      # 0xf3a0
callq 0x6b20
movl $0x37, %edi
leaq 0x655f(%rip), %rsi      # 0xacd5
callq 0x6818
movl -0x40(%rbp), %r14d
cmpl $-0x1, %r14d
movl $0xa, %eax
cmovel %eax, %r14d
movslq %r14d, %rdi
shlq $0x2, %rdi
callq 0x2120
movq %rax, %r13
xorl %r12d, %r12d
movl %r14d, %ebx
cmpl $-0x1, -0x40(%rbp)
je 0x47b8
cmpq %rbx, %r12
jne 0x47b8
leaq 0x6524(%rip), %rdi      # 0xacd7
callq 0x6937
movl -0x44(%rbp), %edi
callq 0x426b
leaq 0x1(%r12), %r15
movl %eax, (%r13,%r12,4)
cmpl $-0x1, -0x40(%rbp)
jne 0x47ef
cmpq %rbx, %r15
jne 0x47ef
movslq %r14d, %rax
addl $0xa, %r14d
leaq 0x28(,%rax,4), %rsi
movq %r13, %rdi
callq 0x2130
movq %rax, %r13
leaq 0xabaa(%rip), %rax      # 0xf3a0
cmpl $0x38, (%rax)
je 0x480b
callq 0x6921
movq %r15, %r12
jmp 0x479e
movl -0x40(%rbp), %r13d
jmp 0x4857
leaq 0x1(%r12), %r14
leaq 0xab89(%rip), %rdi      # 0xf3a0
callq 0x6b20
movq %r14, %rax
movq -0x38(%rbp), %rcx
cmpl %r14d, 0x2c(%rcx)
jle 0x483a
movl $0x0, (%r13,%rax,4)
incq %rax
cmpl %eax, 0x2c(%rcx)
jg 0x4829
movl -0x40(%rbp), %eax
cmpl %r12d, %eax
cmovgl %eax, %r14d
movq %r13, 0x30(%rcx)
movl %r14d, %r13d
movl -0x2c(%rbp), %r15d
movl -0x44(%rbp), %r14d
movq -0x70(%rbp), %r12
cmpl $0x4, %r12d
movq -0x50(%rbp), %rbx
je 0x487a
testl %r13d, %r13d
jg 0x487a
movq 0x8(%rcx), %rsi
leaq 0x648d(%rip), %rdi      # 0xacfe
callq 0x683f
movq -0x38(%rbp), %rcx
movl %r13d, 0x2c(%rcx)
movl %r14d, %edi
movq %rbx, %rsi
callq 0x8ea1
movq -0x38(%rbp), %r8
imull %r13d, %eax
movl %eax, 0x28(%r8)
andl $-0x5, %r12d
cmpl $0x1, %r12d
jne 0x48ab
movq %r8, %rdi
callq 0x61f3
movq -0x38(%rbp), %r8
xorl %r12d, %r12d
movq -0x58(%rbp), %rbx
cmpl $0x1, 0x20(%r8)
je 0x4a92
movq (%rbx), %rcx
movq %r12, %rax
testq %rcx, %rcx
je 0x48ec
movl $0x0, 0x8(%rsp)
movq $0x0, (%rsp)
movl $0x1d, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %r8d, %r8d
movq %r12, %r9
callq 0x8828
movq %rax, (%rbx)
leaq 0xaaaa(%rip), %rax      # 0xf3a0
movl (%rax), %eax
cmpl -0x60(%rbp), %eax
je 0x4aa9
cmpl %r15d, %eax
je 0x4aa9
movq %r12, -0x40(%rbp)
callq 0x6921
jmp 0x4359
movq %rbx, %r8
movq %r15, %r12
movl -0x2c(%rbp), %r15d
jmp 0x496a
movq %r13, %rdi
movl %r14d, %esi
movq -0x50(%rbp), %rdx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x7f4e
jmp 0x4967
movq %r13, %rdi
movl %r14d, %esi
movq -0x50(%rbp), %rdx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x7e5c
jmp 0x4967
movq %r13, %rdi
movl %r14d, %esi
movq -0x50(%rbp), %rdx
xorl %ecx, %ecx
callq 0x7ee5
movq %rax, %r8
leaq 0xaa2f(%rip), %rax      # 0xf3a0
cmpl $0x1, (%rax)
movq %r8, -0x38(%rbp)
jne 0x4a75
cmpl $0x5, %r12d
ja 0x498f
movl $0x26, %eax
btl %r12d, %eax
jb 0x499e
leaq 0x631f(%rip), %rdi      # 0xacb5
movq %r13, %rsi
callq 0x683f
leaq 0xa9fb(%rip), %rdi      # 0xf3a0
callq 0x6b20
movl %r12d, %ebx
andl $-0x5, %ebx
cmpl $0x1, %ebx
jne 0x49d5
movl $0x4, %edi
callq 0x2120
movq -0x38(%rbp), %r13
movq %rax, 0x30(%r13)
movl %r14d, %edi
callq 0x426b
movq 0x30(%r13), %rcx
movl %eax, (%rcx)
cmpl $0x2, %r12d
movq -0x38(%rbp), %r8
jne 0x4a7c
movq -0x58(%rbp), %r13
movl %r14d, %r12d
movl 0x10(%r8), %esi
movq 0x18(%r8), %rdx
movl $0x1c, %edi
movq %r8, %rcx
xorl %r8d, %r8d
callq 0x88b3
movq %rax, %rbx
xorl %edi, %edi
callq 0x4d39
movl $0x1, 0x18(%rax)
movl 0x8(%rbx), %esi
movq 0x10(%rbx), %rdx
movq %rax, %rdi
xorl %ecx, %ecx
callq 0x8eba
movq %rax, %r14
testq %rax, %rax
jne 0x4a38
leaq 0x6337(%rip), %rdi      # 0xad6a
callq 0x6937
movl 0x8(%r14), %esi
movq 0x10(%r14), %rdx
movl $0x0, 0x8(%rsp)
movq $0x0, (%rsp)
movl $0x1, %edi
movq %r14, %rcx
xorl %r8d, %r8d
movq %rbx, %r9
callq 0x8828
movl %r12d, %r14d
movq %rax, %r12
movq %r13, %rbx
movq -0x38(%rbp), %r8
jmp 0x48b2
andl $-0x5, %r12d
movl %r12d, %ebx
cmpl $0x1, %ebx
je 0x489f
jmp 0x48ab
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jmp 0x4aa9
movl -0x5c(%rbp), %eax
andl $-0x5, %eax
cmpl $0x1, %eax
je 0x4aa9
leaq 0x5f6e(%rip), %rdi      # 0xaa12
callq 0x6937
movl %r14d, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq