// File: rfotino[P]consolite-compiler/src/syntax.cpp
// Function: ArrayExprToken::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 ArrayExprToken::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) {
  _lineNum = tokenizer->peekNext().line();
  // Make sure the first token is a '{' symbol
  if (!_expect(tokenizer, "{")) {
    return false;
  }
  // Check if the next token is a closing brace, in which
  // case we don't need to check for expressions.
  if ("}" == tokenizer->peekNext().str()) {
    tokenizer->getNext();
    return true;
  }
  // Get any expressions we find, separated by commas
  while (true) {
    std::shared_ptr<ExprToken> expr(new ExprToken());
    if (!expr->parse(tokenizer, functions, globals, parameters, localVars)) {
      return false;
    }
    _exprs.push_back(expr);
    AtomToken next = tokenizer->getNext();
    if ("}" == next.str()) {
      break;
    } else if (next.empty()) {
      _error("Unexpected EOF.", next.line());
      return false;
    } else if ("," != next.str()) {
      _error("Unexpected token '" + next.str() + "'.", next.line());
      return false;
    }
  }
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2b0, %rsp            # imm = 0x2B0
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, -0x248(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x68(%rbp), %rdi
movq %rdi, -0x240(%rbp)
callq 0x6bae0
movq -0x240(%rbp), %rdi
callq 0x32270
movl %eax, -0x234(%rbp)
jmp 0x24616
movq -0x248(%rbp), %rax
movl -0x234(%rbp), %ecx
movl %ecx, 0x8(%rax)
leaq -0x68(%rbp), %rdi
callq 0x99b0
movq -0x18(%rbp), %rax
movq %rax, -0x258(%rbp)
leaq -0x99(%rbp), %rdi
movq %rdi, -0x250(%rbp)
callq 0x8760
movq -0x250(%rbp), %rdx
leaq 0x4b408(%rip), %rsi     # 0x6fa63
leaq -0x98(%rbp), %rdi
callq 0xced0
jmp 0x24669
movq -0x258(%rbp), %rdi
leaq -0x98(%rbp), %rsi
movl $0x1, %edx
callq 0x6da60
movb %al, -0x259(%rbp)
jmp 0x24689
movb -0x259(%rbp), %al
xorb $-0x1, %al
movb %al, -0x25a(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x8848
leaq -0x99(%rbp), %rdi
callq 0x8460
movb -0x25a(%rbp), %al
testb $0x1, %al
jne 0x246bb
jmp 0x24715
movb $0x0, -0x1(%rbp)
jmp 0x24bed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x99b0
jmp 0x24bfb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x24704
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x8848
leaq -0x99(%rbp), %rdi
callq 0x8460
jmp 0x24bfb
movq -0x18(%rbp), %rsi
leaq -0xf0(%rbp), %rdi
movq %rdi, -0x268(%rbp)
callq 0x6bae0
movq -0x268(%rbp), %rsi
leaq -0xc0(%rbp), %rdi
callq 0xd5c0
jmp 0x24741
leaq 0x4b31d(%rip), %rdi     # 0x6fa65
leaq -0xc0(%rbp), %rsi
callq 0xd590
movb %al, -0x269(%rbp)
jmp 0x2475c
leaq -0xc0(%rbp), %rdi
callq 0x8848
leaq -0xf0(%rbp), %rdi
callq 0x99b0
movb -0x269(%rbp), %al
testb $0x1, %al
jne 0x24780
jmp 0x247dc
movq -0x18(%rbp), %rsi
leaq -0x120(%rbp), %rdi
callq 0x6ae20
leaq -0x120(%rbp), %rdi
callq 0x99b0
movb $0x1, -0x1(%rbp)
jmp 0x24bed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x247cb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x8848
leaq -0xf0(%rbp), %rdi
callq 0x99b0
jmp 0x24bfb
jmp 0x247de
movl $0x28, %edi
callq 0x83e0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x278(%rbp)
callq 0x32670
jmp 0x247fc
movq -0x278(%rbp), %rsi
leaq -0x130(%rbp), %rdi
movq %rdi, -0x288(%rbp)
callq 0x33ab0
movq -0x288(%rbp), %rdi
callq 0x33ae0
movq %rax, %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %r8
movq -0x38(%rbp), %r9
callq 0x1d9b0
movb %al, -0x279(%rbp)
jmp 0x24846
movb -0x279(%rbp), %al
testb $0x1, %al
jne 0x24898
jmp 0x24852
movb $0x0, -0x1(%rbp)
movl $0x1, -0x134(%rbp)
jmp 0x24b9d
movq -0x278(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
movl $0x28, %esi
callq 0x83f0
jmp 0x24bfb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x24bdb
movq -0x248(%rbp), %rdi
addq $0x10, %rdi
leaq -0x130(%rbp), %rsi
callq 0x33b00
jmp 0x248b1
movq -0x18(%rbp), %rsi
leaq -0x168(%rbp), %rdi
callq 0x6ae20
jmp 0x248c3
leaq -0x188(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0xd5c0
jmp 0x248d8
leaq 0x4b186(%rip), %rdi     # 0x6fa65
leaq -0x188(%rbp), %rsi
callq 0xd590
movb %al, -0x289(%rbp)
jmp 0x248f3
leaq -0x188(%rbp), %rdi
callq 0x8848
movb -0x289(%rbp), %al
testb $0x1, %al
jne 0x2490b
jmp 0x24948
movl $0x3, -0x134(%rbp)
jmp 0x24b91
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x24bcf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x8848
jmp 0x24bcf
leaq -0x168(%rbp), %rdi
callq 0xd490
movb %al, -0x28a(%rbp)
jmp 0x2495c
movb -0x28a(%rbp), %al
testb $0x1, %al
jne 0x2496b
jmp 0x24a24
leaq -0x1a9(%rbp), %rdi
movq %rdi, -0x298(%rbp)
callq 0x8760
movq -0x298(%rbp), %rdx
leaq 0x4b0db(%rip), %rsi     # 0x6fa67
leaq -0x1a8(%rbp), %rdi
callq 0xced0
jmp 0x2499a
leaq -0x168(%rbp), %rdi
callq 0x32270
movl %eax, -0x29c(%rbp)
jmp 0x249ae
movl -0x29c(%rbp), %esi
leaq -0x1a8(%rbp), %rdi
callq 0x6d960
jmp 0x249c2
leaq -0x1a8(%rbp), %rdi
callq 0x8848
leaq -0x1a9(%rbp), %rdi
callq 0x8460
movb $0x0, -0x1(%rbp)
movl $0x1, -0x134(%rbp)
jmp 0x24b91
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x24a13
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x1a8(%rbp), %rdi
callq 0x8848
leaq -0x1a9(%rbp), %rdi
callq 0x8460
jmp 0x24bcf
leaq -0x1d0(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0xd5c0
jmp 0x24a39
leaq 0x4b037(%rip), %rdi     # 0x6fa77
leaq -0x1d0(%rbp), %rsi
callq 0xd8e0
movb %al, -0x29d(%rbp)
jmp 0x24a54
leaq -0x1d0(%rbp), %rdi
callq 0x8848
movb -0x29d(%rbp), %al
testb $0x1, %al
jne 0x24a6f
jmp 0x24b83
leaq -0x230(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0xd5c0
jmp 0x24a84
leaq 0x4aeac(%rip), %rsi     # 0x6f937
leaq -0x210(%rbp), %rdi
leaq -0x230(%rbp), %rdx
callq 0x325f0
jmp 0x24aa0
leaq 0x4b32b(%rip), %rdx     # 0x6fdd2
leaq -0x1f0(%rbp), %rdi
leaq -0x210(%rbp), %rsi
callq 0xe020
jmp 0x24abc
leaq -0x168(%rbp), %rdi
callq 0x32270
movl %eax, -0x2a4(%rbp)
jmp 0x24ad0
movl -0x2a4(%rbp), %esi
leaq -0x1f0(%rbp), %rdi
callq 0x6d960
jmp 0x24ae4
leaq -0x1f0(%rbp), %rdi
callq 0x8848
leaq -0x210(%rbp), %rdi
callq 0x8848
leaq -0x230(%rbp), %rdi
callq 0x8848
movb $0x0, -0x1(%rbp)
movl $0x1, -0x134(%rbp)
jmp 0x24b91
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0x8848
jmp 0x24bcf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x24b75
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x24b69
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x1f0(%rbp), %rdi
callq 0x8848
leaq -0x210(%rbp), %rdi
callq 0x8848
leaq -0x230(%rbp), %rdi
callq 0x8848
jmp 0x24bcf
jmp 0x24b85
jmp 0x24b87
movl $0x0, -0x134(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x99b0
leaq -0x130(%rbp), %rdi
callq 0x33b70
movl -0x134(%rbp), %eax
movl %eax, -0x2a8(%rbp)
testl %eax, %eax
je 0x24bca
jmp 0x24bbb
movl -0x2a8(%rbp), %eax
subl $0x1, %eax
je 0x24bed
jmp 0x24bc8
jmp 0x24be9
jmp 0x247de
leaq -0x168(%rbp), %rdi
callq 0x99b0
leaq -0x130(%rbp), %rdi
callq 0x33b70
jmp 0x24bfb
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x2b0, %rsp            # imm = 0x2B0
popq %rbp
retq
movq -0x70(%rbp), %rdi
callq 0x8750
nopw %cs:(%rax,%rax)