// File: /workspace/github_c_makefile_star2_O1/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 $0x78, %rsp
movq %r8, %rbx
movl %ecx, -0x6c(%rbp)
movl %edx, -0x70(%rbp)
leaq -0x5c(%rbp), %rax
movl %esi, (%rax)
movq $0x0, (%r8)
movq %rdi, -0x80(%rbp)
movq %rax, %rsi
callq 0x3c44
movl %eax, -0x74(%rbp)
cmpl $-0x1, %eax
je 0x4b15
xorl %r12d, %r12d
movq %rbx, -0x58(%rbp)
movl -0x74(%rbp), %edi
callq 0x41a4
movl %eax, %ebx
movq -0x80(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movl -0x5c(%rbp), %r15d
leaq 0xb0af(%rip), %rdi      # 0xf3d0
callq 0x2180
movq %rax, %r13
callq 0x6863
leaq 0xb06b(%rip), %rax      # 0xf3a0
cmpl $0x39, (%rax)
movl %ebx, -0x34(%rbp)
jne 0x4360
leaq 0xb024(%rip), %rax      # 0xf368
movl (%rax), %eax
movl %eax, -0x68(%rbp)
movq %r13, %rdi
callq 0x820b
testq %rax, %rax
je 0x4392
cmpl $0x1, 0x20(%rax)
cmovneq %r12, %rax
jmp 0x4394
leal -0x1(%r15), %ebx
cmpl $0x5, %ebx
jae 0x448e
movq %r13, %rdi
callq 0x8191
testq %rax, %rax
je 0x4494
leaq 0x67d5(%rip), %rdi      # 0xab5a
movq %r13, %rsi
callq 0x6797
jmp 0x4494
xorl %eax, %eax
movq %rax, -0x30(%rbp)
testq %rax, %rax
je 0x43a2
xorl %r15d, %r15d
jmp 0x43c7
callq 0x5780
movl %eax, -0x4c(%rbp)
movl %eax, (%rsp)
movq %r13, %rdi
movl %ebx, %esi
xorl %edx, %edx
movl $0x1, %ecx
movl %r15d, %r8d
xorl %r9d, %r9d
callq 0x7d5d
movq %rax, %r15
leaq 0xafd2(%rip), %r13      # 0xf3a0
callq 0x6837
movq -0x30(%rbp), %rax
testq %rax, %rax
je 0x43e2
movq 0x40(%rax), %r14
jmp 0x43e5
xorl %r14d, %r14d
xorl %ebx, %ebx
movl (%r13), %eax
cmpl $0x1e, %eax
je 0x43fa
cmpl $0x3a, %eax
jne 0x4414
jmp 0x4611
leaq 0xafb7(%rip), %r12      # 0xf3b8
movq %r12, %rdi
callq 0x6a78
cmpl $0x3a, (%r12)
je 0x4607
leaq -0x90(%rbp), %rdi
movl $0x3, %esi
movl $0x3d, %edx
movl $0x3a, %ecx
leaq -0x88(%rbp), %r8
callq 0x42bb
movl %eax, %r13d
cmpl $-0x1, %eax
jne 0x444a
leaq 0x67bb(%rip), %rdi      # 0xac00
callq 0x688f
testq %r14, %r14
je 0x446a
cmpl 0x10(%r14), %r13d
je 0x4464
leal 0x1(%rbx), %esi
leaq 0x67bc(%rip), %rdi      # 0xac1b
callq 0x68e9
movq 0x38(%r14), %r14
jmp 0x446d
xorl %r14d, %r14d
leaq 0xaf2c(%rip), %r13      # 0xf3a0
cmpl $0x3a, (%r13)
je 0x4487
callq 0x6879
incl %ebx
jmp 0x43e7
incl %ebx
jmp 0x4611
cmpl $0x8, %r15d
jne 0x44b0
movq %r13, %rdi
callq 0x82b7
testq %rax, %rax
je 0x44b0
leaq 0x66d7(%rip), %rdi      # 0xab7f
movq %r13, %rsi
callq 0x6797
leaq 0xaee9(%rip), %r14      # 0xf3a0
cmpl $0x3b, (%r14)
jne 0x458e
movq %r14, %rdi
callq 0x6a78
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0x3c, (%r14)
movl -0x34(%rbp), %ebx
je 0x44f9
movl $0x30, %edi
callq 0x4216
testl %eax, %eax
jg 0x44f9
leaq 0x6780(%rip), %rdi      # 0xac6c
movl %eax, %esi
movl %eax, %r14d
callq 0x68e9
movl %r14d, %eax
movl %eax, -0x48(%rbp)
movl $0x3c, %edi
leaq 0x76e0(%rip), %rsi      # 0xbbe8
callq 0x6770
leal -0x4(%r15), %eax
cmpl $0x2, %eax
jb 0x452a
cmpl $0x2, %r15d
je 0x477c
cmpl $0x1, %r15d
jne 0x479f
movq %r13, %rdi
callq 0x80ff
movq %rax, %r12
movl %ebx, %edi
callq 0x8dda
movq %r12, %rdi
movl %r15d, %esi
movl %eax, %edx
movl %ebx, %r14d
movq %r15, %rbx
movq -0x40(%rbp), %r15
movq %r15, %rcx
callq 0x4ba3
testl %eax, %eax
je 0x4770
movl %r14d, %edi
callq 0x8dda
movl $0x0, (%rsp)
movq %r13, %rdi
movl %eax, %esi
movq %r15, %rdx
movl $0x2, %ecx
movl %ebx, %r8d
xorl %r9d, %r9d
callq 0x7d5d
movq %rax, -0x30(%rbp)
jmp 0x4774
movq $0x0, -0x30(%rbp)
cmpl $0x7, %ebx
ja 0x4b0c
leaq 0x634e(%rip), %rcx      # 0xa8f4
movslq (%rcx,%rbx,4), %rax
addq %rcx, %rax
movl -0x34(%rbp), %r14d
jmpq *%rax
movq %r13, %rdi
callq 0x80ff
movq %rax, %r12
movq %rax, %rdi
movl %r15d, %esi
movl %r14d, %edx
movq %r15, %rbx
movq -0x40(%rbp), %r15
movq %r15, %rcx
callq 0x4ba3
testl %eax, %eax
je 0x4935
movl $0x0, (%rsp)
movq %r13, %rdi
movl %r14d, %esi
movq %r15, %rdx
xorl %ecx, %ecx
movl %ebx, %r8d
movl $0x1, %r9d
callq 0x7d5d
movq %rax, -0x30(%rbp)
jmp 0x4939
movq %r13, %rdi
callq 0x6a78
xorl %ebx, %ebx
movq -0x30(%rbp), %rax
testq %rax, %rax
je 0x462f
cmpl 0x2c(%rax), %ebx
je 0x462f
movq 0x8(%rax), %rsi
leaq 0x661c(%rip), %rdi      # 0xac46
callq 0x6797
callq 0x684d
testq %r15, %r15
leaq 0xafc2(%rip), %rcx      # 0xf600
je 0x464f
movl %ebx, 0x2c(%r15)
movq (%rcx), %rax
movq %rax, 0x40(%r15)
movq %r15, -0x30(%rbp)
xorl %r12d, %r12d
leaq 0xafaf(%rip), %rax      # 0xf608
movq %r12, (%rax)
movq %r12, (%rcx)
cmpl $0x35, (%r13)
je 0x4763
leaq 0xad07(%rip), %rax      # 0xf378
movq -0x30(%rbp), %rcx
movq %rcx, (%rax)
leaq 0xaf55(%rip), %rax      # 0xf5d4
movl %r12d, (%rax)
leaq 0xaf4f(%rip), %rax      # 0xf5d8
movl %r12d, (%rax)
callq 0x680b
xorl %edi, %edi
callq 0x75f0
movq %rax, %r15
callq 0x6821
movl -0x34(%rbp), %ebx
cmpl $0x10, %ebx
movl -0x4c(%rbp), %r9d
je 0x46ea
testq %r15, %r15
jne 0x46c1
leaq 0x64f1(%rip), %rdi      # 0xaba9
callq 0x688f
movl -0x4c(%rbp), %r9d
cmpl $0x1d, 0x4(%r15)
movq %r15, %rax
jne 0x46cf
movq 0x30(%r15), %rax
testq %rax, %rax
je 0x46da
cmpl $0x22, 0x4(%rax)
je 0x46ea
leaq 0x64f5(%rip), %rdi      # 0xabd6
callq 0x688f
movl -0x4c(%rbp), %r9d
movl $0x20, %edi
movl %ebx, %esi
movq -0x40(%rbp), %rdx
movq %r15, %rcx
movq -0x30(%rbp), %r8
callq 0x885b
movl -0x68(%rbp), %ecx
movl %ecx, 0x40(%rax)
movq %rax, %rdi
callq 0x69a4
movq %rax, %rbx
leaq 0xac3b(%rip), %rax      # 0xf354
cmpl $0x0, (%rax)
je 0x474a
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x8879
movq 0xa89f(%rip), %rax      # 0xefd0
movq (%rax), %rcx
movl $0x2, %esi
movl $0x1, %edx
leaq 0x5b03(%rip), %rdi      # 0xa248
callq 0x2170
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5795
callq 0x8495
xorl %r12d, %r12d
movl -0x34(%rbp), %r14d
movq -0x48(%rbp), %rbx
jmp 0x4ab0
movq %r12, -0x30(%rbp)
movq %rbx, %r15
movl %r14d, %ebx
jmp 0x47ab
movl %ebx, %edi
callq 0x8dda
movq %r13, %rdi
movl %eax, %esi
movq -0x40(%rbp), %rdx
movl $0x2, %ecx
xorl %r8d, %r8d
callq 0x7dda
movq %rax, -0x30(%rbp)
jmp 0x47ab
leaq 0x64dc(%rip), %rdi      # 0xac82
callq 0x688f
leaq 0xabee(%rip), %rax      # 0xf3a0
cmpl $0x1, (%rax)
jne 0x487c
movq %r15, -0x68(%rbp)
movl %r15d, %eax
andl $-0x5, %eax
cmpl $0x1, %eax
je 0x47d9
leaq 0x64e4(%rip), %rdi      # 0xacb5
movq %r13, %rsi
callq 0x6797
leaq 0xabc0(%rip), %rdi      # 0xf3a0
callq 0x6a78
movl $0x37, %edi
leaq 0x64e4(%rip), %rsi      # 0xacd5
callq 0x6770
movl -0x48(%rbp), %ebx
cmpl $-0x1, %ebx
movl $0xa, %eax
cmovel %eax, %ebx
movslq %ebx, %rdi
shlq $0x2, %rdi
callq 0x2120
movq %rax, %r13
xorl %r12d, %r12d
movl %ebx, %r14d
cmpl $-0x1, -0x48(%rbp)
je 0x4830
cmpq %r14, %r12
jne 0x4830
leaq 0x64ac(%rip), %rdi      # 0xacd7
callq 0x688f
movl -0x34(%rbp), %edi
callq 0x4216
leaq 0x1(%r12), %r15
movl %eax, (%r13,%r12,4)
cmpl $-0x1, -0x48(%rbp)
jne 0x4866
cmpq %r14, %r15
jne 0x4866
movslq %ebx, %rax
addl $0xa, %ebx
leaq 0x28(,%rax,4), %rsi
movq %r13, %rdi
callq 0x2130
movq %rax, %r13
leaq 0xab33(%rip), %rax      # 0xf3a0
cmpl $0x38, (%rax)
je 0x4885
callq 0x6879
movq %r15, %r12
jmp 0x4816
movq -0x40(%rbp), %rsi
movl -0x48(%rbp), %eax
jmp 0x48cd
leaq 0x1(%r12), %rbx
leaq 0xab0f(%rip), %rdi      # 0xf3a0
callq 0x6a78
movq %rbx, %rax
movq -0x30(%rbp), %rcx
cmpl %ebx, 0x2c(%rcx)
movq -0x68(%rbp), %r15
jle 0x48b7
movl $0x0, (%r13,%rax,4)
incq %rax
cmpl %eax, 0x2c(%rcx)
jg 0x48a6
movl -0x48(%rbp), %eax
cmpl %r12d, %eax
cmovgl %eax, %ebx
movq %r13, 0x30(%rcx)
movl %ebx, %eax
movl -0x34(%rbp), %ebx
movq -0x40(%rbp), %rsi
cmpl $0x4, %r15d
leaq 0xaac8(%rip), %r13      # 0xf3a0
je 0x48fc
testl %eax, %eax
jg 0x48fc
movl %eax, %r14d
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0x640e(%rip), %rdi      # 0xacfe
callq 0x6797
movl %r14d, %eax
movq -0x40(%rbp), %rsi
movq -0x30(%rbp), %r12
movl %eax, 0x2c(%r12)
movl %ebx, %r14d
movl %ebx, %edi
movl %eax, %ebx
callq 0x8e29
imull %ebx, %eax
movl %eax, 0x28(%r12)
andl $-0x5, %r15d
cmpl $0x1, %r15d
jne 0x492b
movq %r12, %rdi
callq 0x612e
xorl %ebx, %ebx
xorl %r12d, %r12d
jmp 0x4ab0
movq %r12, -0x30(%rbp)
movq %rbx, %r15
jmp 0x4985
movq %r13, %rdi
movl %r14d, %esi
movq -0x40(%rbp), %rdx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x7eca
jmp 0x4981
movq %r13, %rdi
movl %r14d, %esi
movq -0x40(%rbp), %rdx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x7dda
jmp 0x4981
movq %r13, %rdi
movl %r14d, %esi
movq -0x40(%rbp), %rdx
xorl %ecx, %ecx
callq 0x7e61
movq %rax, -0x30(%rbp)
leaq 0xaa14(%rip), %rax      # 0xf3a0
cmpl $0x1, (%rax)
jne 0x4a8d
cmpl $0x5, %r15d
movl $0x0, %r12d
ja 0x49ac
movl $0x26, %eax
btl %r15d, %eax
jb 0x49bb
leaq 0x6302(%rip), %rdi      # 0xacb5
movq %r13, %rsi
callq 0x6797
leaq 0xa9de(%rip), %r13      # 0xf3a0
movq %r13, %rdi
callq 0x6a78
movl %r15d, %eax
andl $-0x5, %eax
cmpl $0x1, %eax
jne 0x49fa
movl $0x4, %edi
callq 0x2120
movq -0x30(%rbp), %r12
movq %rax, 0x30(%r12)
movl %r14d, %edi
callq 0x4216
movq 0x30(%r12), %rcx
xorl %r12d, %r12d
movl %eax, (%rcx)
cmpl $0x2, %r15d
jne 0x4a9b
movq -0x30(%rbp), %rcx
movl 0x10(%rcx), %esi
movq 0x18(%rcx), %rdx
movl $0x1c, %edi
xorl %r8d, %r8d
callq 0x883b
movq %rax, %rbx
xorl %edi, %edi
callq 0x4cc5
movl $0x1, 0x18(%rax)
movl 0x8(%rbx), %esi
movq 0x10(%rbx), %rdx
movq %rax, %rdi
xorl %ecx, %ecx
callq 0x8e42
movq %rax, %r13
testq %rax, %rax
jne 0x4a52
leaq 0x631d(%rip), %rdi      # 0xad6a
callq 0x688f
movl 0x8(%r13), %esi
movq 0x10(%r13), %rdx
movl $0x0, 0x8(%rsp)
movq $0x0, (%rsp)
movl $0x1, %edi
movq %r13, %rcx
xorl %r8d, %r8d
movq %rbx, %r9
callq 0x87b0
movq %rax, %rbx
leaq 0xa919(%rip), %r13      # 0xf3a0
movl -0x34(%rbp), %r14d
jmp 0x4a9d
xorl %ebx, %ebx
leaq 0xa90a(%rip), %r13      # 0xf3a0
xorl %r12d, %r12d
jmp 0x4a9d
xorl %ebx, %ebx
andl $-0x5, %r15d
cmpl $0x1, %r15d
jne 0x4ab0
movq -0x30(%rbp), %rdi
callq 0x612e
movq -0x58(%rbp), %r15
movq -0x30(%rbp), %rax
cmpl $0x1, 0x20(%rax)
je 0x4b1d
movq (%r15), %rcx
movq %rbx, %rax
testq %rcx, %rcx
je 0x4aed
movl $0x0, 0x8(%rsp)
movq $0x0, (%rsp)
movl $0x1d, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %r8d, %r8d
movq %rbx, %r9
callq 0x87b0
movq %rax, (%r15)
movl (%r13), %eax
cmpl -0x70(%rbp), %eax
je 0x4b34
cmpl -0x6c(%rbp), %eax
je 0x4b34
movq %rbx, -0x48(%rbp)
callq 0x6879
jmp 0x4301
movl -0x34(%rbp), %r14d
jmp 0x4985
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jmp 0x4b34
movl -0x5c(%rbp), %eax
andl $-0x5, %eax
cmpl $0x1, %eax
je 0x4b34
leaq 0x5ee3(%rip), %rdi      # 0xaa12
callq 0x688f
movl %r14d, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq