// File: /workspace/github_c_makefile_star2_O3/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
pushq %rax
callq 0x6539
movq %rax, %r15
leaq 0xc917(%rip), %r13      # 0x13228
movq (%r13), %r14
movl (%r14), %eax
leal -0x1d(%rax), %ecx
cmpl $0x9, %ecx
ja 0x6b34
leaq 0x68a5(%rip), %rdx      # 0xd1d0
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movq 0x8(%r14), %rax
movq %rax, (%r13)
movq 0x50(%r15), %rdi
callq 0x63ef
movq %rax, %rbx
testq %rax, %rax
jne 0x695e
movq %r15, %rdi
leaq 0x6b21(%rip), %rsi      # 0xd478
xorl %eax, %eax
callq 0x5502
movq 0x10(%rbx), %rax
movq 0x8(%rax), %rax
movq %rax, 0x58(%r15)
xorl %eax, %eax
callq 0x3f0c
movq %rax, %r14
movq %rbx, (%rsp)
movq 0x10(%rbx), %rax
movq 0x18(%rax), %rbp
movq (%r13), %rdi
movl $0x1e, %eax
cmpl $0x1e, (%rdi)
je 0x6ace
testq %rbp, %rbp
jne 0x69b3
movq (%rsp), %rax
movq 0x10(%rax), %rax
cmpb $0x0, 0x38(%rax)
jne 0x69b3
leaq 0x6ae2(%rip), %rsi      # 0xd48e
xorl %eax, %eax
callq 0x52cd
callq 0x76ae
movq %rax, %r12
movq %rax, %rdi
callq 0xb225
movq %rax, %rdi
callq 0xad7b
testb %al, %al
je 0x6a03
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)
leaq 0xc828(%rip), %r13      # 0x13228
movq %rax, %r12
testq %rbp, %rbp
je 0x6aa0
movq 0x10(%rbp), %r13
movq %r12, %rdi
callq 0xb225
movq %r13, %rdi
movq %rax, %rsi
callq 0xb0c5
testb %al, %al
jne 0x6a56
movq 0x10(%rbp), %r13
movq %r12, %rdi
callq 0xb225
movq %r13, %rdi
movq %rax, %rsi
callq 0x17d5
movq %r12, %rdi
leaq 0x6a67(%rip), %rsi      # 0xd4af
leaq 0x6a87(%rip), %rdx      # 0xd4d6
xorl %eax, %eax
callq 0x5502
movq %r12, %rdi
callq 0xb225
movq 0x10(%rbp), %r13
movq 0x50(%r12), %rbx
movl $0x1, %edi
movl $0x68, %esi
callq 0x10d0
movl $0x1c, (%rax)
movq %rbx, 0x50(%rax)
movq %r13, 0x58(%rax)
movq %r12, 0x8(%rax)
movq %r14, %rdi
movq %rax, %rsi
callq 0x3f3e
movq (%rbp), %rbp
leaq 0xc78a(%rip), %r13      # 0x13228
jmp 0x6aad
movq %r14, %rdi
movq %r12, %rsi
callq 0x3f3e
xorl %ebp, %ebp
movq (%r13), %rdi
movl (%rdi), %eax
cmpl $0x23, %eax
jne 0x6ace
movq 0x8(%rdi), %rdi
movq %rdi, (%r13)
cmpl $0x1e, (%rdi)
jne 0x6992
movl $0x1e, %eax
testq %rbp, %rbp
je 0x6ae7
leaq 0x6a11(%rip), %rsi      # 0xd4eb
xorl %eax, %eax
callq 0x52cd
movq (%r13), %rdi
movl (%rdi), %eax
cmpl $0x1e, %eax
je 0x6afe
leaq 0x6973(%rip), %rsi      # 0xd466
xorl %eax, %eax
callq 0x52cd
movq (%r13), %rdi
movq 0x8(%rdi), %rax
movq %rax, (%r13)
movl $0x1, %edi
movl $0x68, %esi
callq 0x10d0
movl $0x1a, (%rax)
movq %r15, 0x8(%rax)
movq %r14, 0x48(%rax)
movups 0x50(%r15), %xmm0
movups %xmm0, 0x50(%rax)
movq %rax, %r15
jmp 0x6911
cmpl $0x12, %eax
je 0x6d82
cmpl $0x13, %eax
jne 0x6e3c
movq 0x8(%r14), %rax
movq %rax, (%r13)
movl $0x1, %edi
movl $0x68, %esi
callq 0x10d0
movq %rax, %rbx
movl $0x1, %ebp
movl %ebp, (%rax)
movl $0x1, %eax
movq %rax, 0x20(%rbx)
movq %r14, 0x50(%rbx)
xorl %eax, %eax
callq 0xac48
movq %rax, 0x58(%rbx)
movl $0x5, %edi
movq %r15, %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x5ab9
movq %rax, %rbx
movl $0x1, %edi
movl $0x68, %esi
callq 0x10d0
movq %rax, %r12
movl $0x15, (%rax)
movq %r15, 0x8(%rax)
movq %rbx, 0x10(%rax)
movq %r14, 0x50(%rax)
movl $0x1, %edi
movl $0x68, %esi
callq 0x10d0
movq %rax, %rbx
movl %ebp, (%rax)
movl $0x1, %eax
movq %rax, 0x20(%rbx)
movq %r14, 0x50(%rbx)
xorl %eax, %eax
callq 0xac48
movq %rax, 0x58(%rbx)
movl $0x4, %edi
jmp 0x6e26
movq 0x8(%r14), %rax
movq %rax, (%r13)
movq %r15, %rdi
callq 0xb225
movq %rax, %rdi
callq 0xad89
testb %al, %al
jne 0x6c1c
movq %r15, %rdi
leaq 0x6926(%rip), %rsi      # 0xd53b
xorl %eax, %eax
callq 0x5502
movq (%r13), %rsi
cmpl $0x0, (%rsi)
je 0x6c3a
movq %rsi, %rdi
leaq 0x6752(%rip), %rsi      # 0xd381
xorl %eax, %eax
callq 0x52cd
movq (%r13), %rsi
movq 0x8(%rsi), %rax
movq %rax, (%r13)
movq %r15, %rdi
jmp 0x6cca
movq 0x8(%r14), %rax
movq %rax, (%r13)
movq %r15, %rdi
callq 0xb225
movq %rax, %rdi
callq 0xad74
testb %al, %al
je 0x6c7b
movq %r15, %rdi
callq 0xb225
movq 0x8(%rax), %rdi
callq 0xad89
testb %al, %al
jne 0x6c8c
movq %r15, %rdi
leaq 0x68f4(%rip), %rsi      # 0xd579
xorl %eax, %eax
callq 0x5502
movl $0x17, %edi
movq %r15, %rsi
xorl %edx, %edx
movq %r14, %rcx
callq 0x5ab9
movq %rax, %rbx
movq (%r13), %rsi
cmpl $0x0, (%rsi)
je 0x6cbf
movq %rsi, %rdi
leaq 0x66cd(%rip), %rsi      # 0xd381
xorl %eax, %eax
callq 0x52cd
movq (%r13), %rsi
movq 0x8(%rsi), %rax
movq %rax, (%r13)
movq %rbx, %rdi
callq 0x5bd1
movq %rax, %r15
jmp 0x6911
movq 0x8(%r14), %rax
movq %rax, (%r13)
movq %r15, %rdi
callq 0xb225
movq %rax, %rdi
callq 0xad7b
testb %al, %al
jne 0x6d18
movq %r15, %rdi
callq 0xb225
movq %rax, %rdi
callq 0xad74
testb %al, %al
jne 0x6d18
movq %r15, %rdi
leaq 0x67fa(%rip), %rsi      # 0xd50b
xorl %eax, %eax
callq 0x5502
callq 0x76ae
movq (%r13), %rdx
movq %r15, %rdi
movq %rax, %rsi
callq 0x67fb
movq %rax, %r14
movq (%r13), %rbx
movl $0x1, %edi
movl $0x68, %esi
callq 0x10d0
movq %rax, %r15
movl $0x17, (%rax)
movq %r14, 0x8(%rax)
movq $0x0, 0x10(%rax)
movq %rbx, 0x50(%rax)
cmpl $0x22, (%rbx)
je 0x6d75
movq %rbx, %rdi
leaq 0x66fc(%rip), %rsi      # 0xd466
xorl %eax, %eax
callq 0x52cd
movq (%r13), %rbx
movq 0x8(%rbx), %rax
movq %rax, (%r13)
jmp 0x6911
movq 0x8(%r14), %rax
movq %rax, (%r13)
movl $0x1, %edi
movl $0x68, %esi
callq 0x10d0
movq %rax, %rbx
movl $0x1, %ebp
movl %ebp, (%rax)
movl $0x1, %eax
movq %rax, 0x20(%rbx)
movq %r14, 0x50(%rbx)
xorl %eax, %eax
callq 0xac48
movq %rax, 0x58(%rbx)
movl $0x4, %edi
movq %r15, %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x5ab9
movq %rax, %rbx
movl $0x1, %edi
movl $0x68, %esi
callq 0x10d0
movq %rax, %r12
movl $0x15, (%rax)
movq %r15, 0x8(%rax)
movq %rbx, 0x10(%rax)
movq %r14, 0x50(%rax)
movl $0x1, %edi
movl $0x68, %esi
callq 0x10d0
movq %rax, %rbx
movl %ebp, (%rax)
movl $0x1, %eax
movq %rax, 0x20(%rbx)
movq %r14, 0x50(%rbx)
xorl %eax, %eax
callq 0xac48
movq %rax, 0x58(%rbx)
movl $0x5, %edi
movq %r12, %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x5ab9
movq %rax, %r15
jmp 0x6911
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq