// File: /workspace/github_c_makefile_star2_O1/mrkite[P]regs/docmaker/parser.cc
// Function: Parser::parseFunc(Symbol*, File*)
bool Parser::parseFunc(Symbol *s, File *f) {
  Function *func = new Function();
  s->kind = isFunction;
  s->asFunction = func;

  Token token;
  while ((token = f->token()).type == VAR) {
    Argument arg;
    if (!parseArgument(&arg, token, f)) {
      return false;
    }
    func->arguments.push_back(arg);
    token = f->token();
    if (!token.expect(",)")) {
      return false;
    }
    if (token.asSym == ')') {
      break;
    }
  }
  if (!token.expect(')')) {
    return false;
  }
  token = f->token();
  if (!token.expect(":;{")) {
    return false;
  }
  func->retType.symbol = nullptr;
  if (token.asSym == ':') {
    if (!parseRef(&func->retType, f)) {
      return false;
    }
    token = f->token();
    if (!token.expect(";{")) {
      return false;
    }
  }
  if (token.asSym == '{') {
    while ((token = f->token()).type == NUMBER) {
      func->signature.push_back(token.asNum);
      token = f->token();
      if (!token.expect(",}")) {
        return false;
      }
      if (token.asSym == '}') {
        break;
      }
    }
    if (!token.expect('}')) {
      return false;
    }
  }
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, 0xb8(%rsp)
movl $0x60, %edi
callq 0x3200
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x50(%rax)
movups %xmm0, 0x40(%rax)
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movl $0xffffffff, 0x24(%rax) # imm = 0xFFFFFFFF
leaq 0x38(%rax), %rcx
movq %rcx, 0x28(%rax)
xorl %ebp, %ebp
movq %rbp, 0x30(%rax)
movb %bpl, 0x38(%rax)
leaq 0x48(%rax), %rcx
movq %rcx, 0xc0(%rsp)
movq %rbp, 0x58(%rax)
movups %xmm0, 0x48(%rax)
movl $0x6, 0x78(%r15)
movq %rax, 0xb0(%rsp)
movq %rax, 0x80(%r15)
leaq 0x70(%rsp), %rax
movq %rax, -0x10(%rax)
movq %rbp, -0x8(%rax)
movb %bpl, (%rax)
movb %bpl, 0x10(%rax)
movl $0x0, 0x14(%rax)
leaq 0x98(%rsp), %rax
movq %rax, -0x10(%rax)
movq %rbp, -0x8(%rax)
movb %bpl, (%rax)
leaq 0xd8(%rsp), %r15
leaq 0x108(%rsp), %r12
movq %rsp, %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0x78ce
movl (%rsp), %eax
movl %eax, 0x58(%rsp)
leaq 0x60(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x3270
movq 0x28(%rsp), %rax
movq %rax, 0x80(%rsp)
leaq 0x88(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x3270
movl 0x50(%rsp), %eax
movl %eax, 0xa8(%rsp)
movl 0x58(%rsp), %r14d
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x4f5e
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3210
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4f7a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3210
cmpl $0x7, %r14d
jne 0x5104
movq %r15, 0xc8(%rsp)
movq %rbp, 0xd0(%rsp)
movb %bpl, 0xd8(%rsp)
movq %rbp, 0xe8(%rsp)
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
movq %rax, 0xf0(%rsp)
movq %r12, 0xf8(%rsp)
movq %rbp, 0x100(%rsp)
movb %bpl, 0x108(%rsp)
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
leaq 0x58(%rsp), %rdx
movq %rbx, %rcx
callq 0x5916
movl $0x1, %r14d
testb %al, %al
je 0x50b7
movq 0xb0(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x62b2
movq %r13, %rdi
movq %rbx, %rsi
callq 0x78ce
movl (%rsp), %eax
movl %eax, 0x58(%rsp)
leaq 0x60(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x3270
movq 0x28(%rsp), %rax
movq %rax, 0x80(%rsp)
leaq 0x88(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x3270
movl 0x50(%rsp), %eax
movl %eax, 0xa8(%rsp)
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x5075
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3210
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x5091
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3210
leaq 0x58(%rsp), %rdi
leaq 0x5096(%rip), %rsi      # 0xa133
callq 0x7b94
testb %al, %al
je 0x50b7
xorl %eax, %eax
cmpb $0x29, 0x80(%rsp)
sete %al
leal (%rax,%rax,2), %r14d
movq 0xf8(%rsp), %rdi
cmpq %r12, %rdi
je 0x50d4
movq 0x108(%rsp), %rsi
incq %rsi
callq 0x3210
movq 0xc8(%rsp), %rdi
cmpq %r15, %rdi
je 0x50f1
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x3210
testl %r14d, %r14d
je 0x4ef2
cmpl $0x3, %r14d
jne 0x5439
leaq 0x58(%rsp), %rdi
movl $0x29, %esi
callq 0x7b5e
movq 0xb0(%rsp), %r14
testb %al, %al
je 0x5439
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x78ce
leaq 0x8(%rsp), %r15
movl -0x8(%r15), %eax
movl %eax, 0x58(%rsp)
leaq 0x60(%rsp), %rdi
movq %r15, %rsi
callq 0x3270
movq 0x20(%r15), %rax
movq %rax, 0x80(%rsp)
leaq 0x30(%rsp), %r15
leaq 0x88(%rsp), %rdi
movq %r15, %rsi
callq 0x3270
movl 0x20(%r15), %eax
movl %eax, 0xa8(%rsp)
movq (%r15), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x518e
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3210
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x51aa
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3210
leaq 0x4f85(%rip), %rsi      # 0xa136
leaq 0x58(%rsp), %rdi
callq 0x7b94
testb %al, %al
je 0x5439
movq $0x0, 0x18(%r14)
cmpb $0x3a, 0x80(%rsp)
jne 0x5298
movq %r14, %rsi
addq $0x18, %rsi
movq 0xb8(%rsp), %rdi
movq %rbx, %rdx
callq 0x59ca
testb %al, %al
je 0x5439
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x78ce
leaq 0x8(%rsp), %r15
movl -0x8(%r15), %eax
movl %eax, 0x58(%rsp)
leaq 0x60(%rsp), %rdi
movq %r15, %rsi
callq 0x3270
movq 0x20(%r15), %rax
movq %rax, 0x80(%rsp)
leaq 0x30(%rsp), %r15
leaq 0x88(%rsp), %rdi
movq %r15, %rsi
callq 0x3270
movl 0x20(%r15), %eax
movl %eax, 0xa8(%rsp)
movq (%r15), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x5263
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3210
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x527f
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3210
leaq 0x4eb1(%rip), %rsi      # 0xa137
leaq 0x58(%rsp), %rdi
callq 0x7b94
testb %al, %al
je 0x5439
cmpb $0x7b, 0x80(%rsp)
jne 0x5435
leaq 0x8(%rsp), %r15
leaq 0x30(%rsp), %r12
movq %rsp, %r13
leaq 0x58(%rsp), %rbp
movq %r13, %rdi
movq %rbx, %rsi
callq 0x78ce
movl (%rsp), %eax
movl %eax, 0x58(%rsp)
leaq 0x60(%rsp), %rdi
movq %r15, %rsi
callq 0x3270
movq 0x28(%rsp), %rax
movq %rax, 0x80(%rsp)
leaq 0x88(%rsp), %rdi
movq %r12, %rsi
callq 0x3270
movl 0x50(%rsp), %eax
movl %eax, 0xa8(%rsp)
movl 0x58(%rsp), %r14d
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x5320
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3210
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x533c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3210
cmpl $0x2, %r14d
movq 0xb0(%rsp), %rcx
jne 0x5422
movl 0x84(%rsp), %eax
movl %eax, (%rsp)
movq 0x50(%rcx), %rsi
cmpq 0x58(%rcx), %rsi
je 0x536e
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x50(%rcx)
jmp 0x537e
movq 0xc0(%rsp), %rdi
movq %r13, %rdx
callq 0x6f64
movq %r13, %rdi
movq %rbx, %rsi
callq 0x78ce
movl (%rsp), %eax
movl %eax, 0x58(%rsp)
leaq 0x60(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x3270
movq 0x28(%rsp), %rax
movq %rax, 0x80(%rsp)
leaq 0x88(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x3270
movl 0x50(%rsp), %eax
movl %eax, 0xa8(%rsp)
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x53e5
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3210
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x5401
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3210
movq %rbp, %rdi
leaq 0x4d25(%rip), %rsi      # 0xa130
callq 0x7b94
testb %al, %al
je 0x5439
cmpb $0x7d, 0x80(%rsp)
jne 0x52b8
leaq 0x58(%rsp), %rdi
movl $0x7d, %esi
callq 0x7b5e
testb %al, %al
je 0x5439
movb $0x1, %bl
jmp 0x543b
xorl %ebx, %ebx
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x5460
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x3210
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x547c
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3210
movl %ebx, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x54a0
jmp 0x54a0
jmp 0x54a0
jmp 0x54a0
jmp 0x54a0
jmp 0x54a0
jmp 0x54a0
jmp 0x54a5
movq %rax, %rbx
jmp 0x54b5
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0x62dc
leaq 0x58(%rsp), %rdi
callq 0x603a
movq %rbx, %rdi
callq 0x33e0
nop