// File: rfotino[P]consolite-compiler/src/syntax.cpp
// Function: TypeToken::parse(Tokenizer*, std::vector<std::shared_ptr<FunctionToken>, std::allocator<std::shared_ptr<FunctionToken>>> const&, std::vector<std::shared_ptr<GlobalVarToken>, std::allocator<std::shared_ptr<GlobalVarToken>>> const&, std::vector<std::shared_ptr<ParamToken>, std::allocator<std::shared_ptr<ParamToken>>> const&, std::vector<std::shared_ptr<LocalVarToken>, std::allocator<std::shared_ptr<LocalVarToken>>> const&)
bool TypeToken::parse(
      Tokenizer *tokenizer,
      const std::vector<std::shared_ptr<FunctionToken>>& functions,
      const std::vector<std::shared_ptr<GlobalVarToken>>& globals,
      const std::vector<std::shared_ptr<ParamToken>>& parameters,
      const std::vector<std::shared_ptr<LocalVarToken>>& localVars) {
  AtomToken typeName = tokenizer->getNext();
  if (!isType(typeName.str())) {
    _error("Invalid type '" + typeName.str() + "'.", typeName.line());
    return false;
  }
  _lineNum = typeName.line();
  _name = typeName.str();
  if ("[" == tokenizer->peekNext().str()) {
    tokenizer->getNext();
    _isArray = true;
    ExprToken expr;
    if (!expr.parse(tokenizer, functions, globals, parameters, localVars)) {
      return false;
    }
    if (!expr.isConst()) {
      _error("Array size must be known at compile time.", expr.line());
      return false;
    }
    _arraySize = expr.val();
    if (!_expect(tokenizer, "]")) {
      return false;
    }
  }
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x270, %rsp            # imm = 0x270
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x228(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x68(%rbp), %rdi
movq %rdi, -0x220(%rbp)
callq 0x6ae20
movq -0x220(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0xd5c0
jmp 0x1d437
leaq -0x88(%rbp), %rdi
callq 0x6d910
movb %al, -0x229(%rbp)
jmp 0x1d44b
movb -0x229(%rbp), %al
xorb $-0x1, %al
movb %al, -0x22a(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x8848
movb -0x22a(%rbp), %al
testb $0x1, %al
jne 0x1d474
jmp 0x1d5b7
leaq -0xf8(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0xd5c0
jmp 0x1d486
leaq 0x5246c(%rip), %rsi     # 0x6f8f9
leaq -0xd8(%rbp), %rdi
leaq -0xf8(%rbp), %rdx
callq 0x325f0
jmp 0x1d4a2
leaq 0x52929(%rip), %rdx     # 0x6fdd2
leaq -0xb8(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0xe020
jmp 0x1d4be
leaq -0x68(%rbp), %rdi
callq 0x32270
movl %eax, -0x230(%rbp)
jmp 0x1d4cf
movl -0x230(%rbp), %esi
leaq -0xb8(%rbp), %rdi
callq 0x6d960
jmp 0x1d4e3
leaq -0xb8(%rbp), %rdi
callq 0x8848
leaq -0xd8(%rbp), %rdi
callq 0x8848
leaq -0xf8(%rbp), %rdi
callq 0x8848
movb $0x0, -0x1(%rbp)
movl $0x1, -0xfc(%rbp)
jmp 0x1d981
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x1d998
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x8848
jmp 0x1d998
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x1d5a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x1d59a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x8848
leaq -0xd8(%rbp), %rdi
callq 0x8848
leaq -0xf8(%rbp), %rdi
callq 0x8848
jmp 0x1d998
leaq -0x68(%rbp), %rdi
callq 0x32270
movl %eax, -0x234(%rbp)
jmp 0x1d5c8
movq -0x228(%rbp), %rax
movl -0x234(%rbp), %ecx
movl %ecx, 0x8(%rax)
leaq -0x120(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0xd5c0
jmp 0x1d5ea
movq -0x228(%rbp), %rdi
addq $0x10, %rdi
leaq -0x120(%rbp), %rsi
movq %rsi, -0x240(%rbp)
callq 0x84e0
movq -0x240(%rbp), %rdi
callq 0x8848
movq -0x18(%rbp), %rsi
leaq -0x170(%rbp), %rdi
callq 0x6bae0
jmp 0x1d626
leaq -0x140(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0xd5c0
jmp 0x1d63b
leaq 0x52042(%rip), %rdi     # 0x6f684
leaq -0x140(%rbp), %rsi
callq 0xd590
movb %al, -0x241(%rbp)
jmp 0x1d656
leaq -0x140(%rbp), %rdi
callq 0x8848
leaq -0x170(%rbp), %rdi
callq 0x99b0
movb -0x241(%rbp), %al
testb $0x1, %al
jne 0x1d67d
jmp 0x1d973
movq -0x18(%rbp), %rsi
leaq -0x1a0(%rbp), %rdi
callq 0x6ae20
jmp 0x1d68f
leaq -0x1a0(%rbp), %rdi
callq 0x99b0
movq -0x228(%rbp), %rax
movb $0x1, 0x30(%rax)
leaq -0x1c8(%rbp), %rdi
callq 0x32670
jmp 0x1d6b4
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %r8
movq -0x38(%rbp), %r9
leaq -0x1c8(%rbp), %rdi
callq 0x1d9b0
movb %al, -0x242(%rbp)
jmp 0x1d6dc
movb -0x242(%rbp), %al
testb $0x1, %al
jne 0x1d755
jmp 0x1d6e8
movb $0x0, -0x1(%rbp)
movl $0x1, -0xfc(%rbp)
jmp 0x1d94b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x1d72d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x8848
leaq -0x170(%rbp), %rdi
callq 0x99b0
jmp 0x1d998
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x1d965
leaq -0x1c8(%rbp), %rdi
callq 0x326c0
movb %al, -0x243(%rbp)
jmp 0x1d769
movb -0x243(%rbp), %al
testb $0x1, %al
jne 0x1d83e
jmp 0x1d779
leaq -0x1e9(%rbp), %rdi
movq %rdi, -0x250(%rbp)
callq 0x8760
movq -0x250(%rbp), %rdx
leaq 0x5216e(%rip), %rsi     # 0x6f908
leaq -0x1e8(%rbp), %rdi
callq 0xced0
jmp 0x1d7a8
leaq -0x1c8(%rbp), %rdi
callq 0x32270
movl %eax, -0x254(%rbp)
jmp 0x1d7bc
movl -0x254(%rbp), %esi
leaq -0x1e8(%rbp), %rdi
callq 0x6d960
jmp 0x1d7d0
leaq -0x1e8(%rbp), %rdi
callq 0x8848
leaq -0x1e9(%rbp), %rdi
callq 0x8460
movb $0x0, -0x1(%rbp)
movl $0x1, -0xfc(%rbp)
jmp 0x1d94b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x1d82d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x1e8(%rbp), %rdi
callq 0x8848
leaq -0x1e9(%rbp), %rdi
callq 0x8460
jmp 0x1d965
leaq -0x1c8(%rbp), %rdi
callq 0x326e0
movw %ax, -0x256(%rbp)
jmp 0x1d853
movq -0x228(%rbp), %rax
movw -0x256(%rbp), %cx
movw %cx, 0x32(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x268(%rbp)
leaq -0x211(%rbp), %rdi
movq %rdi, -0x260(%rbp)
callq 0x8760
movq -0x260(%rbp), %rdx
leaq 0x520a1(%rip), %rsi     # 0x6f932
leaq -0x210(%rbp), %rdi
callq 0xced0
jmp 0x1d89f
movq -0x268(%rbp), %rdi
leaq -0x210(%rbp), %rsi
movl $0x1, %edx
callq 0x6da60
movb %al, -0x269(%rbp)
jmp 0x1d8bf
movb -0x269(%rbp), %al
xorb $-0x1, %al
movb %al, -0x26a(%rbp)
leaq -0x210(%rbp), %rdi
callq 0x8848
leaq -0x211(%rbp), %rdi
callq 0x8460
movb -0x26a(%rbp), %al
testb $0x1, %al
jne 0x1d8f1
jmp 0x1d941
movb $0x0, -0x1(%rbp)
movl $0x1, -0xfc(%rbp)
jmp 0x1d94b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x1d933
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x210(%rbp), %rdi
callq 0x8848
leaq -0x211(%rbp), %rdi
callq 0x8460
jmp 0x1d965
movl $0x0, -0xfc(%rbp)
leaq -0x1c8(%rbp), %rdi
callq 0x32700
movl -0xfc(%rbp), %eax
testl %eax, %eax
jne 0x1d981
jmp 0x1d963
jmp 0x1d973
leaq -0x1c8(%rbp), %rdi
callq 0x32700
jmp 0x1d998
movb $0x1, -0x1(%rbp)
movl $0x1, -0xfc(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x99b0
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x270, %rsp            # imm = 0x270
popq %rbp
retq
leaq -0x68(%rbp), %rdi
callq 0x99b0
movq -0x90(%rbp), %rdi
callq 0x8750
nopl (%rax)