// File: /workspace/github_c_makefile_star2_O3/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 0x7862
movl 0x10(%rsp), %eax
movl %eax, 0x68(%rsp)
leaq 0x70(%rsp), %rdi
movq %rbp, %rsi
callq 0x3260
movq 0x38(%rsp), %rax
movq %rax, 0x90(%rsp)
leaq 0x98(%rsp), %rdi
movq %r13, %rsi
callq 0x3260
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 0x5a93
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3200
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x5aaf
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3200
andb %r14b, %r12b
je 0x5ac1
movq 0x8(%rsp), %rax
incl 0x8(%rax)
jmp 0x5a1a
cmpl $0x7, 0x68(%rsp)
jne 0x5e96
leaq 0x68(%rsp), %rsi
movq 0xc0(%rsp), %rdi
callq 0x3f92
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x7862
leaq 0x18(%rsp), %r15
movl -0x8(%r15), %eax
movl %eax, 0x68(%rsp)
leaq 0x70(%rsp), %rdi
movq %r15, %rsi
callq 0x3260
movq 0x20(%r15), %rax
movq %rax, 0x90(%rsp)
leaq 0x40(%rsp), %r15
leaq 0x98(%rsp), %rdi
movq %r15, %rsi
callq 0x3260
movl 0x20(%r15), %eax
movl %eax, 0xb8(%rsp)
movq (%r15), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x5b53
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3200
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x5b6f
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3200
cmpl $0x3, 0x68(%rsp)
jne 0x5cda
cmpb $0x5b, 0x90(%rsp)
jne 0x5cda
movq 0x8(%rsp), %rax
movl $0x0, 0xc(%rax)
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x7862
leaq 0x18(%rsp), %r15
movl -0x8(%r15), %eax
movl %eax, 0x68(%rsp)
leaq 0x70(%rsp), %rdi
movq %r15, %rsi
callq 0x3260
movq 0x20(%r15), %rax
movq %rax, 0x90(%rsp)
leaq 0x40(%rsp), %r15
leaq 0x98(%rsp), %rdi
movq %r15, %rsi
callq 0x3260
movl 0x20(%r15), %eax
movl %eax, 0xb8(%rsp)
movq (%r15), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x5c01
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3200
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x5c1d
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3200
cmpl $0x2, 0x68(%rsp)
jne 0x5cc0
movl 0x94(%rsp), %eax
movq 0x8(%rsp), %rcx
movl %eax, 0xc(%rcx)
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x7862
leaq 0x18(%rsp), %r15
movl -0x8(%r15), %eax
movl %eax, 0x68(%rsp)
leaq 0x70(%rsp), %rdi
movq %r15, %rsi
callq 0x3260
movq 0x20(%r15), %rax
movq %rax, 0x90(%rsp)
leaq 0x40(%rsp), %r15
leaq 0x98(%rsp), %rdi
movq %r15, %rsi
callq 0x3260
movl 0x20(%r15), %eax
movl %eax, 0xb8(%rsp)
movq (%r15), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x5ca4
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3200
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x5cc0
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3200
leaq 0x68(%rsp), %rdi
movl $0x5d, %esi
callq 0x7afc
testb %al, %al
jne 0x5ce2
xorl %ebp, %ebp
jmp 0x5e3b
movq %rbx, %rdi
callq 0x7af4
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x7862
leaq 0x18(%rsp), %r15
movl -0x8(%r15), %eax
movl %eax, 0x68(%rsp)
leaq 0x70(%rsp), %rdi
movq %r15, %rsi
callq 0x3260
movq 0x20(%r15), %rax
movq %rax, 0x90(%rsp)
leaq 0x40(%rsp), %r15
leaq 0x98(%rsp), %rdi
movq %r15, %rsi
callq 0x3260
movl 0x20(%r15), %eax
movl %eax, 0xb8(%rsp)
movq (%r15), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x5d4f
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3200
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x5d6b
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3200
cmpl $0x3, 0x68(%rsp)
jne 0x5e30
cmpb $0x7c, 0x90(%rsp)
jne 0x5e30
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x7862
leaq 0x18(%rsp), %r15
movl -0x8(%r15), %eax
movl %eax, 0x68(%rsp)
leaq 0x70(%rsp), %rdi
movq %r15, %rsi
callq 0x3260
movq 0x20(%r15), %rax
movq %rax, 0x90(%rsp)
leaq 0x40(%rsp), %r15
leaq 0x98(%rsp), %rdi
movq %r15, %rsi
callq 0x3260
movl 0x20(%r15), %eax
movl %eax, 0xb8(%rsp)
movq (%r15), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x5df1
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3200
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x5e0d
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3200
cmpl $0x7, 0x68(%rsp)
jne 0x5e9f
movq 0x8(%rsp), %rdi
addq $0x10, %rdi
movb $0x1, %bpl
leaq 0x70(%rsp), %rsi
callq 0x3140
jmp 0x5e3b
movb $0x1, %bpl
movq %rbx, %rdi
callq 0x7af4
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0x5e60
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x3200
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x5e82
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x3200
movl %ebp, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x42a0(%rip), %rdx      # 0xa13d
jmp 0x5ea6
leaq 0x42b6(%rip), %rdx      # 0xa15c
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3430
jmp 0x5e3b
jmp 0x5ec0
jmp 0x5ec0
jmp 0x5ec0
jmp 0x5ec0
jmp 0x5ec0
jmp 0x5ec0
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x6014
movq %rbx, %rdi
callq 0x33d0
nop