// File: /workspace/github_c_makefile_star2_O2/pocari[P]compilerbook-9cc/parser.c
// Function: program
Program *program() {
  Function head = {};
  Function *cur = &head;
  while (!at_eof()) {
    switch(next_decl()) {
      case NEXT_DECL_FUNCTION_DEF:
        {
          Function *f = function_def_or_decl();
          if (f) {
            cur->next = f;
            cur = cur->next;
          }
        }
        break;
      case NEXT_DECL_GLOBAL_VAR_OR_TYPEDEF:
        global_var_decl();
        break;
      default:
        // ここには来ないはず
        assert(false);
    }
  }
  Program *program = calloc(1, sizeof(Program));
  program->global_var = globals;
  program->functions = head.next;

  return program;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
andq $0x0, (%rax)
leaq 0xaa54(%rip), %r13      # 0xf480
leaq 0x8(%rsp), %rbx
leaq 0x5c82(%rip), %r14      # 0xa6ba
movq (%r13), %r12
cmpl $0x1e, (%r12)
je 0x4e13
andl $0x0, 0x8(%rsp)
movq %rbx, %rdi
callq 0x4ee4
cmpl $0x1, 0x8(%rsp)
je 0x4a6b
movq %rax, %r15
movq %r14, %rdi
callq 0x498f
testq %rax, %rax
je 0x4ac8
movq %r12, (%r13)
andl $0x0, 0x8(%rsp)
movq %rbx, %rdi
callq 0x4ee4
movq %rax, %r15
movq %r14, %rdi
callq 0x498f
testq %rax, %rax
jne 0x4a38
movq (%r13), %rbp
movq %r15, %rdi
leaq 0x40(%rsp), %rsi
callq 0x5443
movq %rax, %r15
movl 0x8(%rsp), %eax
cmpl $0x1, %eax
jne 0x4b7c
movq %r14, %rdi
callq 0x5644
movq 0x40(%rsp), %rdi
callq 0x6abd
movq %r15, 0x18(%rax)
jmp 0x4a38
movq %r14, %rbx
movq %r15, %rdi
leaq 0x40(%rsp), %rsi
callq 0x5443
leaq 0x5a97(%rip), %r14      # 0xa576
movq %r14, %rdi
callq 0x498f
testq %rax, %rax
je 0x4bce
movq %r12, (%r13)
andq $0x0, 0xa954(%rip)      # 0xf450
leaq 0x1c(%rsp), %rdi
callq 0x4ee4
movq %rax, %rdi
leaq 0x38(%rsp), %rsi
callq 0x5443
movq %rax, %r15
pushq $0x1
popq %rdi
pushq $0x38
popq %rsi
callq 0x2100
movq %r15, 0x8(%rax)
movq 0x38(%rsp), %r12
movq %rax, 0x10(%rsp)
movq %r12, 0x10(%rax)
movq %r15, %rdi
callq 0x89f8
xorl %ebp, %ebp
movq %r12, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x6a7a
movb $0x0, 0x20(%rax)
callq 0x7600
movq %rax, %r15
movq %r14, %rdi
callq 0x5644
leaq 0x5a24(%rip), %rdi      # 0xa589
callq 0x498f
testq %rax, %rax
je 0x4bdb
movq %rbx, %r14
leaq 0x8(%rsp), %rbx
jmp 0x4d11
movq 0x40(%rsp), %rdi
xorl %edx, %edx
cmpl $0x4, %eax
setne %dl
xorl %ecx, %ecx
cmpl $0x2, %eax
sete %cl
movq %r15, %rsi
callq 0x6991
cmpl $0x4, 0x8(%rsp)
je 0x4cd9
movq %rax, %r12
leaq 0x5d53(%rip), %rdi      # 0xa901
callq 0x498f
testq %rax, %rax
je 0x4cce
movq %r15, %rdi
callq 0x69d5
movq %rax, 0x18(%r12)
jmp 0x4cd9
movq %rbx, %r14
leaq 0x8(%rsp), %rbx
jmp 0x4a6b
movq (%r13), %r12
cmpl $0xa, (%r12)
movq %rbx, %r14
leaq 0x8(%rsp), %rbx
jne 0x4c0c
movq 0x8(%r12), %rax
movq %rax, (%r13)
leaq 0x598b(%rip), %rdi      # 0xa589
callq 0x498f
testq %rax, %rax
jne 0x4d11
movq %r12, (%r13)
xorl %edi, %edi
callq 0x4ee4
movq %rax, %rdi
leaq 0x40(%rsp), %rsi
callq 0x5443
cmpl $0x8, (%rax)
jne 0x4c32
movq 0x10(%rax), %rdi
callq 0x8990
movq 0x40(%rsp), %rdi
movq %rax, %rsi
callq 0x69f3
movq %rax, %rbp
pushq $0x1
popq %rdi
pushq $0x10
popq %rsi
callq 0x2100
movq %rax, %r12
movq %rbp, 0x8(%rax)
movq %r15, 0x28(%rsp)
leaq 0x5929(%rip), %rdi      # 0xa589
callq 0x498f
testq %rax, %rax
jne 0x4ce6
leaq 0x5a3e(%rip), %rdi      # 0xa6af
callq 0x5644
leaq 0x5f07(%rip), %rdi      # 0xab84
callq 0x498f
testq %rax, %rax
jne 0x4cef
xorl %edi, %edi
callq 0x4ee4
movq %rax, %rdi
movq %rbx, %rsi
callq 0x5443
cmpl $0x8, (%rax)
jne 0x4ca7
movq 0x10(%rax), %rdi
callq 0x8990
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x69f3
movq %rax, %rbp
pushq $0x1
popq %rdi
pushq $0x10
popq %rsi
callq 0x2100
movq %rbp, 0x8(%rax)
movq %r12, (%rax)
movq %rax, %r12
jmp 0x4c59
cmpb $0x1, 0xc(%r15)
je 0x4e43
movq %r14, %rdi
callq 0x5644
jmp 0x4a38
xorl %ebp, %ebp
movq 0x10(%rsp), %r15
jmp 0x4d08
movq 0x10(%rsp), %r15
movb $0x1, 0x35(%r15)
leaq 0x5889(%rip), %rdi      # 0xa589
callq 0x5644
pushq $0x38
popq %rbp
movq %r12, 0x28(%r15)
movq 0x28(%rsp), %r15
movq %r14, %rdi
callq 0x498f
testq %rax, %rax
je 0x4d3e
movq (%r15), %rax
movq %rax, 0xa718(%rip)      # 0xf440
movq 0x8(%r15), %rax
movq %rax, 0xa705(%rip)      # 0xf438
decl 0xa6f7(%rip)            # 0xf430
jmp 0x4a38
leaq 0x55d1(%rip), %rdi      # 0xa316
callq 0x5644
movl $0xc8, %edx
leaq 0x40(%rsp), %r12
movq %r12, %rdi
xorl %esi, %esi
callq 0x20e0
leaq 0x5948(%rip), %rdi      # 0xa6ad
callq 0x498f
testq %rax, %rax
jne 0x4d7e
callq 0x7629
movq %rax, 0x30(%r12)
movq %rax, %r12
jmp 0x4d5e
movq 0x70(%rsp), %rax
movq 0x10(%rsp), %r9
movq %rax, 0x18(%r9)
movq 0xa6bd(%rip), %rcx      # 0xf450
cmpl $0x2, 0x1c(%rsp)
movq %rcx, 0x20(%r9)
sete 0x34(%r9)
testq %rcx, %rcx
je 0x4dce
movq 0x8(%rcx), %rsi
movq (%rsi), %rdi
movl 0x8(%rdi), %r8d
movl %ebp, %eax
cltd
idivl %r8d
cmpl $0x1, %edx
movl %eax, %ebp
sbbl $-0x1, %ebp
imull %r8d, %ebp
addl 0x4(%rdi), %ebp
movl %ebp, 0x10(%rsi)
movq (%rcx), %rcx
jmp 0x4da1
movl %ebp, %eax
cltd
pushq $0x8
popq %rcx
idivl %ecx
andl $0x7, %ebp
cmpl $0x1, %ebp
sbbl $-0x1, %eax
shll $0x3, %eax
movl %eax, 0x30(%r9)
movq (%r15), %rax
movq %rax, 0xa650(%rip)      # 0xf440
decl 0xa63a(%rip)            # 0xf430
movq 0x8(%r15), %rax
movq %rax, 0xa637(%rip)      # 0xf438
movq 0x20(%rsp), %rax
movq %r9, (%rax)
movq %r9, 0x20(%rsp)
jmp 0x4a38
pushq $0x1
popq %rdi
pushq $0x10
popq %rsi
callq 0x2100
movq 0xa603(%rip), %rcx      # 0xf428
movq %rcx, (%rax)
movq 0x30(%rsp), %rcx
movq %rcx, 0x8(%rax)
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x18(%rbp), %rdi
leaq 0x5d18(%rip), %rsi      # 0xab66
xorl %eax, %eax
callq 0x46f0