// File: /workspace/github_c_makefile_star2_O1/mrkite[P]regs/docmaker/parser.cc
// Function: Parser::parseRef(Ref*, File*)
bool Parser::parseRef(Ref *ref, File *f) {
  ref->pointer = 0;
  ref->array = -1;

  Token token;
  while ((token = f->token()).type == SYMBOL && token.asSym == '^') {
    ref->pointer++;
  }
  if (token.type != VAR) {
    error(f, "Expected a type or a pointer.\n");
    return false;
  }
  ref->symbol = find(token);
  token = f->token();
  if (token.type == SYMBOL && token.asSym == '[') {
    ref->array = 0;  // empty bracket
    token = f->token();
    if (token.type == NUMBER) {
      ref->array = token.asNum;
      token = f->token();
    }
    if (!token.expect(']')) {
      return false;
    }
  } else {
    f->reset();
  }
  token = f->token();
  if (token.type == SYMBOL && token.asSym == '|') {
    token = f->token();
    if (token.type != VAR) {
      error(f, "Expected a register\n");
      return false;
    } else {
      ref->reg = token.asStr;
    }
  } else {
    f->reset();
  }
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdx, %rbx
movq %rdi, 0xc0(%rsp)
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
movq %rsi, 0x8(%rsp)
movq %rax, 0x8(%rsi)
leaq 0x80(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
movb %al, 0x10(%rcx)
movl $0x0, 0x14(%rcx)
leaq 0xa8(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x18(%rsp), %rbp
leaq 0x40(%rsp), %r13
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x78ce
movl 0x10(%rsp), %eax
movl %eax, 0x68(%rsp)
leaq 0x70(%rsp), %rdi
movq %rbp, %rsi
callq 0x3270
movq 0x38(%rsp), %rax
movq %rax, 0x90(%rsp)
leaq 0x98(%rsp), %rdi
movq %r13, %rsi
callq 0x3270
movl 0x60(%rsp), %eax
movl %eax, 0xb8(%rsp)
cmpl $0x3, 0x68(%rsp)
sete %r12b
cmpb $0x5e, 0x90(%rsp)
sete %r14b
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x5ab1
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3210
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x5acd
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3210
andb %r14b, %r12b
je 0x5adf
movq 0x8(%rsp), %rax
incl 0x8(%rax)
jmp 0x5a38
cmpl $0x7, 0x68(%rsp)
jne 0x5eb4
leaq 0x68(%rsp), %rsi
movq 0xc0(%rsp), %rdi
callq 0x3f9e
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x78ce
leaq 0x18(%rsp), %r15
movl -0x8(%r15), %eax
movl %eax, 0x68(%rsp)
leaq 0x70(%rsp), %rdi
movq %r15, %rsi
callq 0x3270
movq 0x20(%r15), %rax
movq %rax, 0x90(%rsp)
leaq 0x40(%rsp), %r15
leaq 0x98(%rsp), %rdi
movq %r15, %rsi
callq 0x3270
movl 0x20(%r15), %eax
movl %eax, 0xb8(%rsp)
movq (%r15), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x5b71
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3210
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x5b8d
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3210
cmpl $0x3, 0x68(%rsp)
jne 0x5cf8
cmpb $0x5b, 0x90(%rsp)
jne 0x5cf8
movq 0x8(%rsp), %rax
movl $0x0, 0xc(%rax)
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x78ce
leaq 0x18(%rsp), %r15
movl -0x8(%r15), %eax
movl %eax, 0x68(%rsp)
leaq 0x70(%rsp), %rdi
movq %r15, %rsi
callq 0x3270
movq 0x20(%r15), %rax
movq %rax, 0x90(%rsp)
leaq 0x40(%rsp), %r15
leaq 0x98(%rsp), %rdi
movq %r15, %rsi
callq 0x3270
movl 0x20(%r15), %eax
movl %eax, 0xb8(%rsp)
movq (%r15), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x5c1f
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3210
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x5c3b
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3210
cmpl $0x2, 0x68(%rsp)
jne 0x5cde
movl 0x94(%rsp), %eax
movq 0x8(%rsp), %rcx
movl %eax, 0xc(%rcx)
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x78ce
leaq 0x18(%rsp), %r15
movl -0x8(%r15), %eax
movl %eax, 0x68(%rsp)
leaq 0x70(%rsp), %rdi
movq %r15, %rsi
callq 0x3270
movq 0x20(%r15), %rax
movq %rax, 0x90(%rsp)
leaq 0x40(%rsp), %r15
leaq 0x98(%rsp), %rdi
movq %r15, %rsi
callq 0x3270
movl 0x20(%r15), %eax
movl %eax, 0xb8(%rsp)
movq (%r15), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x5cc2
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3210
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x5cde
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3210
leaq 0x68(%rsp), %rdi
movl $0x5d, %esi
callq 0x7b5e
testb %al, %al
jne 0x5d00
xorl %ebp, %ebp
jmp 0x5e59
movq %rbx, %rdi
callq 0x7b56
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x78ce
leaq 0x18(%rsp), %r15
movl -0x8(%r15), %eax
movl %eax, 0x68(%rsp)
leaq 0x70(%rsp), %rdi
movq %r15, %rsi
callq 0x3270
movq 0x20(%r15), %rax
movq %rax, 0x90(%rsp)
leaq 0x40(%rsp), %r15
leaq 0x98(%rsp), %rdi
movq %r15, %rsi
callq 0x3270
movl 0x20(%r15), %eax
movl %eax, 0xb8(%rsp)
movq (%r15), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x5d6d
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3210
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x5d89
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3210
cmpl $0x3, 0x68(%rsp)
jne 0x5e4e
cmpb $0x7c, 0x90(%rsp)
jne 0x5e4e
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x78ce
leaq 0x18(%rsp), %r15
movl -0x8(%r15), %eax
movl %eax, 0x68(%rsp)
leaq 0x70(%rsp), %rdi
movq %r15, %rsi
callq 0x3270
movq 0x20(%r15), %rax
movq %rax, 0x90(%rsp)
leaq 0x40(%rsp), %r15
leaq 0x98(%rsp), %rdi
movq %r15, %rsi
callq 0x3270
movl 0x20(%r15), %eax
movl %eax, 0xb8(%rsp)
movq (%r15), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x5e0f
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3210
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x5e2b
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3210
cmpl $0x7, 0x68(%rsp)
jne 0x5ebd
movq 0x8(%rsp), %rdi
addq $0x10, %rdi
movb $0x1, %bpl
leaq 0x70(%rsp), %rsi
callq 0x3140
jmp 0x5e59
movb $0x1, %bpl
movq %rbx, %rdi
callq 0x7b56
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0x5e7e
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x3210
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x5ea0
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x3210
movl %ebp, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4282(%rip), %rdx      # 0xa13d
jmp 0x5ec4
leaq 0x4298(%rip), %rdx      # 0xa15c
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3440
jmp 0x5e59
jmp 0x5ede
jmp 0x5ede
jmp 0x5ede
jmp 0x5ede
jmp 0x5ede
jmp 0x5ede
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x603a
movq %rbx, %rdi
callq 0x33e0
nop