// File: /workspace/github_c_makefile_star2_O1/sisshiki1969[P]monocc/src/parse.c
// Function: parse_postfix_expr
Node *parse_postfix_expr() {
  Node *node = parse_prim_expr();
  while (true) {
    Token *op_token = token;
    if (consume_if(TK_OP_PAREN)) {
      /*
      if (node->kind != ND_IDENT)
        error_at_node(node, "Currently, callee must be an identifier.");*/
      Function *fn = find_func(node->token);
      if (!fn) error_at_node(node, "Undefined identifier.");
      node->type = fn->type->ptr_to;
      Vector *vec = vec_new();
      Token *op_token = token;
      MemberInfo *param = fn->type->params;
      while (!peek(TK_CL_PAREN)) {
        if (!param && !fn->type->variadic)
          error_at_token(token, "Too many arguments in func call.");
        Node *arg = parse_assign_expr();
        if (is_array(type(arg)))
          arg = new_node_expr(ND_ADDR, arg, NULL, arg->token);
        if (param && !is_compatible_type(param->type, type(arg))) {
          error_types(param->type, type(arg));
          error_at_node(arg, "The type of an argument is mismatch %s",
                        "with func parameter.");
        }
        if (param) {
          Type *ty_from = type(arg);
          Type *ty_to = param->type;
          arg = new_node_cast(arg, ty_to, arg->token);
        }

        vec_push(vec, arg);
        if (param) param = param->next;
        if (!consume_if(TK_COMMA)) break;
      }
      if (param) error_at_token(token, "Too few arguments in func call.");
      expect(TK_CL_PAREN);
      node = new_node_call(node, vec, node->token);
    } else if (consume_if(TK_OP_BRACKET)) {
      // ary[index] -> *(ary + index * sizeof(ary))
      if (!is_array(type(node)) && !is_ptr(type(node)))
        error_at_node(node, "Subscripted value is neither array nor pointer.");
      Node *offset = parse_expr();
      node = pointer_add(node, offset, token);
      /*int size = sizeof_type(type(node)->ptr_to);
      offset =
          new_node_binary(ND_MUL, offset, new_node_num(size, token), token);
      node = new_node_binary(ND_ADD, node, offset, token);*/
      node = new_node_expr(ND_DEREF, node, NULL, token);
      expect(TK_CL_BRACKET);
    } else if (consume_if(TK_INC)) {
      Node *rhs =
          new_node_binary(ND_ADD, node, new_node_num(1, op_token), op_token);
      node = new_node_expr(ND_ASSIGN, node, rhs, op_token);
      node = new_node_binary(ND_SUB, node, new_node_num(1, op_token), op_token);
    } else if (consume_if(TK_DEC)) {
      Node *rhs =
          new_node_binary(ND_SUB, node, new_node_num(1, op_token), op_token);
      node = new_node_expr(ND_ASSIGN, node, rhs, op_token);
      node = new_node_binary(ND_ADD, node, new_node_num(1, op_token), op_token);
    } else if (consume_if(TK_DOT)) {
      if (!is_struct(type(node)))
        error_at_node(
            node,
            "Request for member 'a' in something not a structure or union.");
      node = new_node_member(node, consume_ident());
    } else if (consume_if(TK_ARROW)) {
      if (!is_ptr(type(node)) || !is_struct(type(node)->ptr_to))
        error_at_node(node, "Invalid type argument of '->'.");
      node = new_node_binary(ND_DEREF, node, NULL, op_token);
      node = new_node_member(node, consume_ident());
    } else
      return node;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
callq 0x6581
movq %rax, %rbx
leaq 0xc8bd(%rip), %rbp      # 0x13228
movq (%rbp), %r15
cmpl $0x1d, (%r15)
jne 0x6b05
movq 0x8(%r15), %rax
movq %rax, (%rbp)
movq 0x50(%rbx), %rdi
callq 0x643f
movq %rax, %r14
testq %rax, %rax
jne 0x69a3
movq %rbx, %rdi
leaq 0x6aa0(%rip), %rsi      # 0xd43c
xorl %eax, %eax
callq 0x552e
movq 0x10(%r14), %rax
movq 0x8(%rax), %rax
movq %rbx, 0x8(%rsp)
movq %rax, 0x58(%rbx)
xorl %eax, %eax
callq 0x3f34
movq %rax, %r15
movq %r14, 0x10(%rsp)
movq 0x10(%r14), %rax
movq 0x18(%rax), %rbx
movq (%rbp), %rdi
cmpl $0x1e, (%rdi)
je 0x6bbe
testq %rbx, %rbx
jne 0x69fa
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rax
cmpb $0x0, 0x38(%rax)
jne 0x69fa
leaq 0x6a5f(%rip), %rsi      # 0xd452
xorl %eax, %eax
callq 0x52f9
callq 0x77a4
movq %rax, %r12
movq %rax, %rdi
callq 0xb354
movq %rax, %rdi
callq 0xaea7
testb %al, %al
je 0x6a43
movq 0x50(%r12), %r13
movl $0x1, %edi
movl $0x68, %esi
callq 0x10d0
movl $0x16, (%rax)
movq %r12, 0x8(%rax)
movq $0x0, 0x10(%rax)
movq %r13, 0x50(%rax)
movq %rax, %r12
testq %rbx, %rbx
je 0x6ade
movq %rbp, %r14
movq 0x10(%rbx), %r13
movq %r12, %rdi
callq 0xb354
movq %r13, %rdi
movq %rax, %rsi
callq 0xb1e5
testb %al, %al
jne 0x6a99
movq 0x10(%rbx), %r13
movq %r12, %rdi
callq 0xb354
movq %r13, %rdi
movq %rax, %rsi
callq 0x17d8
movq %r12, %rdi
leaq 0x69e8(%rip), %rsi      # 0xd473
leaq 0x6a08(%rip), %rdx      # 0xd49a
xorl %eax, %eax
callq 0x552e
movq %r12, %rdi
callq 0xb354
movq 0x10(%rbx), %r13
movq 0x50(%r12), %rbp
movl $0x1, %edi
movl $0x68, %esi
callq 0x10d0
movl $0x1c, (%rax)
movq %rbp, 0x50(%rax)
movq %r13, 0x58(%rax)
movq %r12, 0x8(%rax)
movq %r15, %rdi
movq %rax, %rsi
callq 0x3f66
movq (%rbx), %rbx
movq %r14, %rbp
jmp 0x6aeb
movq %r15, %rdi
movq %r12, %rsi
callq 0x3f66
xorl %ebx, %ebx
movq (%rbp), %rax
cmpl $0x23, (%rax)
jne 0x6bbe
movq 0x8(%rax), %rdi
movq %rdi, (%rbp)
jmp 0x69cf
movq (%rbp), %rax
cmpl $0x21, (%rax)
jne 0x6c37
movq 0x8(%rax), %rax
movq %rax, (%rbp)
movq %rbx, %rdi
callq 0xb354
movq %rax, %rdi
callq 0xaea7
testb %al, %al
jne 0x6b53
movq %rbx, %rdi
callq 0xb354
movq %rax, %rdi
callq 0xaea0
testb %al, %al
jne 0x6b53
movq %rbx, %rdi
leaq 0x6983(%rip), %rsi      # 0xd4cf
xorl %eax, %eax
callq 0x552e
callq 0x77a4
movq (%rbp), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6852
movq %rax, %r15
movq (%rbp), %r14
movl $0x1, %edi
movl $0x68, %esi
callq 0x10d0
movq %rax, %rbx
movl $0x17, (%rax)
movq %r15, 0x8(%rax)
movq $0x0, 0x10(%rax)
movq %r14, 0x50(%rax)
cmpl $0x22, (%r14)
je 0x6bad
movq %r14, %rdi
leaq 0x6884(%rip), %rsi      # 0xd42a
xorl %eax, %eax
callq 0x52f9
movq (%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, (%rbp)
jmp 0x6db3
testq %rbx, %rbx
je 0x6bd5
movq (%rbp), %rdi
leaq 0x68e1(%rip), %rsi      # 0xd4af
xorl %eax, %eax
callq 0x52f9
movq (%rbp), %rdi
cmpl $0x1e, (%rdi)
movq 0x8(%rsp), %rbx
je 0x6bf1
leaq 0x6840(%rip), %rsi      # 0xd42a
xorl %eax, %eax
callq 0x52f9
movq (%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, (%rbp)
movq %rbx, %r14
movq 0x50(%rbx), %rbx
movl $0x1, %edi
movl $0x68, %esi
callq 0x10d0
movl $0x1a, (%rax)
movq %r14, 0x8(%rax)
movq %r15, 0x48(%rax)
movq %rbx, 0x50(%rax)
movq 0x58(%r14), %rcx
movq %rcx, 0x58(%rax)
movb $0x1, %cl
movq %rax, %rbx
jmp 0x6db5
movq (%rbp), %rax
cmpl $0x12, (%rax)
jne 0x6cef
movq 0x8(%rax), %rax
movq %rax, (%rbp)
movl $0x1, %edi
movl $0x68, %esi
callq 0x10d0
movq %rax, %r14
movl $0x1, %eax
movl %eax, (%r14)
movl $0x1, %r13d
movq %r13, 0x20(%r14)
movq %r15, 0x50(%r14)
xorl %eax, %eax
callq 0xad70
movq %rax, 0x58(%r14)
movl $0x4, %edi
movq %rbx, %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x5b07
movq %rax, %r14
movl $0x1, %edi
movl $0x68, %esi
callq 0x10d0
movq %rax, %r12
movl $0x15, (%rax)
movq %rbx, 0x8(%rax)
movq %r14, 0x10(%rax)
movq %r15, 0x50(%rax)
movl $0x1, %edi
movl $0x68, %esi
callq 0x10d0
movq %rax, %rbx
movl $0x1, %eax
movl %eax, (%rbx)
movq %r13, 0x20(%rbx)
movq %r15, 0x50(%rbx)
xorl %eax, %eax
callq 0xad70
movq %rax, 0x58(%rbx)
movl $0x5, %edi
jmp 0x6da2
movq (%rbp), %rax
cmpl $0x13, (%rax)
jne 0x6dc2
movq 0x8(%rax), %rax
movq %rax, (%rbp)
movl $0x1, %edi
movl $0x68, %esi
callq 0x10d0
movq %rax, %r14
movl $0x1, %eax
movl %eax, (%r14)
movl $0x1, %r13d
movq %r13, 0x20(%r14)
movq %r15, 0x50(%r14)
xorl %eax, %eax
callq 0xad70
movq %rax, 0x58(%r14)
movl $0x5, %edi
movq %rbx, %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x5b07
movq %rax, %r14
movl $0x1, %edi
movl $0x68, %esi
callq 0x10d0
movq %rax, %r12
movl $0x15, (%rax)
movq %rbx, 0x8(%rax)
movq %r14, 0x10(%rax)
movq %r15, 0x50(%rax)
movl $0x1, %edi
movl $0x68, %esi
callq 0x10d0
movq %rax, %rbx
movl $0x1, %eax
movl %eax, (%rbx)
movq %r13, 0x20(%rbx)
movq %r15, 0x50(%rbx)
xorl %eax, %eax
callq 0xad70
movq %rax, 0x58(%rbx)
movl $0x4, %edi
movq %r12, %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x5b07
movq %rax, %rbx
movb $0x1, %cl
testb %cl, %cl
jne 0x696b
jmp 0x6e99
movq (%rbp), %rax
cmpl $0x25, (%rax)
jne 0x6dfa
movq 0x8(%rax), %rax
movq %rax, (%rbp)
movq %rbx, %rdi
callq 0xb354
movq %rax, %rdi
callq 0xaeb5
testb %al, %al
jne 0x6e5e
movq %rbx, %rdi
leaq 0x670e(%rip), %rsi      # 0xd4ff
xorl %eax, %eax
callq 0x552e
jmp 0x6e5e
movq (%rbp), %rax
cmpl $0x26, (%rax)
jne 0x6e8e
movq 0x8(%rax), %rax
movq %rax, (%rbp)
movq %rbx, %rdi
callq 0xb354
movq %rax, %rdi
callq 0xaea0
testb %al, %al
je 0x6e38
movq %rbx, %rdi
callq 0xb354
movq 0x8(%rax), %rdi
callq 0xaeb5
testb %al, %al
jne 0x6e49
movq %rbx, %rdi
leaq 0x66fb(%rip), %rsi      # 0xd53d
xorl %eax, %eax
callq 0x552e
movl $0x17, %edi
movq %rbx, %rsi
xorl %edx, %edx
movq %r15, %rcx
callq 0x5b07
movq %rax, %rbx
movq (%rbp), %rdi
cmpl $0x0, (%rdi)
je 0x6e75
leaq 0x64d7(%rip), %rsi      # 0xd345
xorl %eax, %eax
callq 0x52f9
movq (%rbp), %rsi
movq 0x8(%rsi), %rax
movq %rax, (%rbp)
movq %rbx, %rdi
callq 0x5c27
jmp 0x6db0
xorl %ecx, %ecx
movq %rbx, (%rsp)
jmp 0x6db5
movq (%rsp), %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq