// File: /workspace/github_c_makefile_star2_O2/sisshiki1969[P]monocc/src/parse.c
// Function: parse_prim_expr
Node *parse_prim_expr() {
  Token *cur_token = token;
  if (at_eof()) {
    error_at_token(token, "Unexpected EOF.");
  }
  if (peek(TK_NUM)) {
    Token *t = consume();
    Node *node = new_node_num(t->num_val, cur_token);
    node->type = t->num_ty;
    return node;
  }
  if (peek(TK_STR)) {
    Token *tok = consume();
    Token *t = tok;
    while (peek(TK_STR)) {
      t->next = consume();
      t = t->next;
    }
    t->next = NULL;
    Node *node = new_node_str(tok);

    return node;
  }
  if (consume_if(TK_OP_PAREN)) {
    Node *node = parse_expr();
    expect(TK_CL_PAREN);
    return node;
  }
  if (consume_if(TK_IDENT)) {
    LVar *lvar = find_lvar(cur_token);
    if (lvar) return new_node_lvar(lvar, cur_token);
    Global *gvar = find_gvar(cur_token);
    if (gvar) return new_node_gvar(gvar, cur_token);
    TagName *tag = find_tag(cur_token);
    if (tag && is_enum_el(tag->type)) {
      return new_node_num(tag->type->offset, cur_token);
    }
    if (peek(TK_OP_PAREN)) {
      if (find_func(cur_token)) return new_node_ident(cur_token);
    }
    error_at_token(cur_token, "Identifier is not defined.");
  }
  if (consume_if(TK_MACRO)) {
    if (strncmp(cur_token->str, "__LINE__", 8) == 0) {
      int line_no = get_line(cur_token->str, source_text);
      return new_node_num(line_no, cur_token);
    }
  }
  if (is_type_specifier(token))
    error_at_token(token, "Can not use declaration here.");
  error_at_token(token, "parse_prim_expr(): Unexpected token.");
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
leaq 0xb4b4(%rip), %r12      # 0x11228
movq (%r12), %rbx
movl (%rbx), %eax
movq %rbx, %r14
cmpl $0x41, %eax
jne 0x5d9a
leaq 0x5660(%rip), %rsi      # 0xb3e9
movq %rbx, %rdi
xorl %eax, %eax
callq 0x48b3
movq (%r12), %r14
movl (%r14), %eax
testl %eax, %eax
je 0x5e32
cmpl $0x1d, %eax
je 0x5dd6
cmpl $0x2, %eax
je 0x5df6
cmpl $0x1, %eax
jne 0x5eec
movq 0x8(%r14), %rax
movq %rax, (%r12)
movq 0x10(%r14), %rdi
movq %rbx, %rsi
callq 0x5200
movq 0x18(%r14), %rcx
movq %rcx, 0x58(%rax)
jmp 0x5f45
movq 0x8(%r14), %rax
movq %rax, (%r12)
callq 0x6ac5
movq %rax, %rbx
pushq $0x1e
popq %rdi
callq 0x5a46
movq %rbx, %rax
jmp 0x5f45
movq 0x8(%r14), %rcx
movq %rcx, (%r12)
movq %r14, %rax
cmpl $0x2, (%rcx)
jne 0x5e1a
movq %rcx, %rdx
movq 0x8(%rcx), %rcx
movq %rcx, (%r12)
movq %rdx, 0x8(%rax)
movq %rdx, %rax
jmp 0x5e01
andq $0x0, 0x8(%rax)
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x523b
movq 0x8(%r14), %r15
movq %r15, (%r12)
movq %rbx, %rdi
callq 0x5b3a
testq %rax, %rax
je 0x5e5d
movq %rax, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x53c0
movq %rbx, %rdi
callq 0x5bed
testq %rax, %rax
je 0x5e80
movq %rax, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x53f3
movq %rbx, %rdi
callq 0x5cca
testq %rax, %rax
je 0x5eae
movq %rax, %r14
movq 0x10(%rax), %rdi
callq 0x91bb
testb %al, %al
je 0x5eaa
movq 0x10(%r14), %rax
movslq 0x28(%rax), %rdi
jmp 0x5f66
movq (%r12), %r15
cmpl $0x1d, (%r15)
jne 0x5ed4
movq %rbx, %rdi
callq 0x5c59
testq %rax, %rax
je 0x5ed4
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x53ab
leaq 0x551e(%rip), %rsi      # 0xb3f9
movq %rbx, %rdi
xorl %eax, %eax
callq 0x48b3
movq (%r12), %r14
movl (%r14), %eax
cmpl $0x42, %eax
jne 0x5f13
movq 0x8(%r14), %r14
movq %r14, (%r12)
movq 0x20(%rbx), %r15
leaq 0x5510(%rip), %rsi      # 0xb414
pushq $0x8
popq %rdx
movq %r15, %rdi
callq 0x1050
testl %eax, %eax
je 0x5f51
movq %r14, %rdi
callq 0x5ad3
testb %al, %al
je 0x5f34
leaq 0x54f7(%rip), %rsi      # 0xb41d
movq %r14, %rdi
xorl %eax, %eax
callq 0x48b3
movq (%r12), %r14
leaq 0x5500(%rip), %rsi      # 0xb43b
movq %r14, %rdi
xorl %eax, %eax
callq 0x48b3
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0xb2b8(%rip), %rax      # 0x11210
movq (%rax), %rsi
movq %r15, %rdi
callq 0x45e8
movslq %eax, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x5200