// File: /workspace/github_c_makefile_star2_O3/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 0x31f0
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
xorl %ebp, %ebp
movq %rbp, 0x40(%rax)
movl $0xffffffff, 0x24(%rax) # imm = 0xFFFFFFFF
leaq 0x38(%rax), %rcx
movq %rcx, 0x28(%rax)
movb %bpl, 0x38(%rax)
leaq 0x48(%rax), %rcx
movq %rcx, 0xc0(%rsp)
movups %xmm0, 0x48(%rax)
movq %rbp, 0x58(%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), %r14
leaq 0x108(%rsp), %r15
movq %rsp, %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0x7862
movl (%rsp), %eax
movl %eax, 0x58(%rsp)
leaq 0x60(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x3260
movq 0x28(%rsp), %rax
movq %rax, 0x80(%rsp)
leaq 0x88(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x3260
movl 0x50(%rsp), %eax
movl %eax, 0xa8(%rsp)
movl 0x58(%rsp), %r12d
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x4f46
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3200
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4f62
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3200
cmpl $0x7, %r12d
jne 0x50ec
movq %r14, 0xc8(%rsp)
movq %rbp, 0xd0(%rsp)
movb %bpl, 0xd8(%rsp)
movq %rbp, 0xe8(%rsp)
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
movq %rax, 0xf0(%rsp)
movq %r15, 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 0x58f8
movl $0x1, %r12d
testb %al, %al
je 0x509f
movq 0xb0(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x628c
movq %r13, %rdi
movq %rbx, %rsi
callq 0x7862
movl (%rsp), %eax
movl %eax, 0x58(%rsp)
leaq 0x60(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x3260
movq 0x28(%rsp), %rax
movq %rax, 0x80(%rsp)
leaq 0x88(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x3260
movl 0x50(%rsp), %eax
movl %eax, 0xa8(%rsp)
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x505d
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3200
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x5079
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3200
leaq 0x58(%rsp), %rdi
leaq 0x50ae(%rip), %rsi      # 0xa133
callq 0x7b32
testb %al, %al
je 0x509f
xorl %eax, %eax
cmpb $0x29, 0x80(%rsp)
sete %al
leal (%rax,%rax,2), %r12d
movq 0xf8(%rsp), %rdi
cmpq %r15, %rdi
je 0x50bc
movq 0x108(%rsp), %rsi
incq %rsi
callq 0x3200
movq 0xc8(%rsp), %rdi
cmpq %r14, %rdi
je 0x50d9
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x3200
testl %r12d, %r12d
je 0x4eda
cmpl $0x3, %r12d
jne 0x5423
leaq 0x58(%rsp), %rdi
movl $0x29, %esi
callq 0x7afc
movq 0xb0(%rsp), %r14
testb %al, %al
je 0x5423
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x7862
leaq 0x8(%rsp), %r15
movl -0x8(%r15), %eax
movl %eax, 0x58(%rsp)
leaq 0x60(%rsp), %rdi
movq %r15, %rsi
callq 0x3260
movq 0x20(%r15), %rax
movq %rax, 0x80(%rsp)
leaq 0x30(%rsp), %r15
leaq 0x88(%rsp), %rdi
movq %r15, %rsi
callq 0x3260
movl 0x20(%r15), %eax
movl %eax, 0xa8(%rsp)
movq (%r15), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x5176
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3200
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x5192
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3200
leaq 0x4f9d(%rip), %rsi      # 0xa136
leaq 0x58(%rsp), %rdi
callq 0x7b32
testb %al, %al
je 0x5423
movq $0x0, 0x18(%r14)
movb 0x80(%rsp), %al
cmpb $0x3a, %al
jne 0x5288
movq %r14, %rsi
addq $0x18, %rsi
movq 0xb8(%rsp), %rdi
movq %rbx, %rdx
callq 0x59ac
testb %al, %al
je 0x5423
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x7862
leaq 0x8(%rsp), %r15
movl -0x8(%r15), %eax
movl %eax, 0x58(%rsp)
leaq 0x60(%rsp), %rdi
movq %r15, %rsi
callq 0x3260
movq 0x20(%r15), %rax
movq %rax, 0x80(%rsp)
leaq 0x30(%rsp), %r15
leaq 0x88(%rsp), %rdi
movq %r15, %rsi
callq 0x3260
movl 0x20(%r15), %eax
movl %eax, 0xa8(%rsp)
movq (%r15), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x524c
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3200
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x5268
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3200
leaq 0x4ec8(%rip), %rsi      # 0xa137
leaq 0x58(%rsp), %rdi
callq 0x7b32
testb %al, %al
je 0x5423
movb 0x80(%rsp), %al
cmpb $0x7b, %al
jne 0x541f
leaq 0x8(%rsp), %r15
leaq 0x30(%rsp), %r12
movq %rsp, %r13
leaq 0x58(%rsp), %rbp
movq %r13, %rdi
movq %rbx, %rsi
callq 0x7862
movl (%rsp), %eax
movl %eax, 0x58(%rsp)
leaq 0x60(%rsp), %rdi
movq %r15, %rsi
callq 0x3260
movq 0x28(%rsp), %rax
movq %rax, 0x80(%rsp)
leaq 0x88(%rsp), %rdi
movq %r12, %rsi
callq 0x3260
movl 0x50(%rsp), %eax
movl %eax, 0xa8(%rsp)
movl 0x58(%rsp), %r14d
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x530a
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3200
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x5326
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3200
cmpl $0x2, %r14d
movq 0xb0(%rsp), %rcx
jne 0x540c
movl 0x84(%rsp), %eax
movl %eax, (%rsp)
movq 0x50(%rcx), %rsi
cmpq 0x58(%rcx), %rsi
je 0x5358
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x50(%rcx)
jmp 0x5368
movq 0xc0(%rsp), %rdi
movq %r13, %rdx
callq 0x6f24
movq %r13, %rdi
movq %rbx, %rsi
callq 0x7862
movl (%rsp), %eax
movl %eax, 0x58(%rsp)
leaq 0x60(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x3260
movq 0x28(%rsp), %rax
movq %rax, 0x80(%rsp)
leaq 0x88(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x3260
movl 0x50(%rsp), %eax
movl %eax, 0xa8(%rsp)
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x53cf
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3200
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x53eb
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3200
movq %rbp, %rdi
leaq 0x4d3b(%rip), %rsi      # 0xa130
callq 0x7b32
testb %al, %al
je 0x5423
cmpb $0x7d, 0x80(%rsp)
jne 0x52a2
leaq 0x58(%rsp), %rdi
movl $0x7d, %esi
callq 0x7afc
testb %al, %al
je 0x5423
movb $0x1, %bl
jmp 0x5425
xorl %ebx, %ebx
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x544a
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x3200
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x5466
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3200
movl %ebx, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x548a
jmp 0x548a
jmp 0x548a
jmp 0x548a
jmp 0x548a
jmp 0x548a
jmp 0x548a
jmp 0x548f
movq %rax, %rbx
jmp 0x549f
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0x62b6
leaq 0x58(%rsp), %rdi
callq 0x6014
movq %rbx, %rdi
callq 0x33d0
nop