// File: /workspace/github_c_makefile_star2_O3/hsjoihs[P]c-compiler/parse_type.c
// Function: parse_dcl_postfixes
static void parse_dcl_postfixes(const struct Token **ptr_tokvec,
                                struct Vector /*<struct TypeNode>*/ *ptr_vec)
{
	const struct Token *tokvec = *ptr_tokvec;

	struct Vector vec = *ptr_vec;

	// The parser must handle cases like `int test()[3];` (which tries to define
	// an array of functions) or `int test()()` (which tries to define a
	// function returning a function). While these declarations are semantically
	// forbidden, they are syntactically legal.
	while (1) {
		if (tokvec[0].kind == LEFT_BRACKET) {
			++tokvec;
			expect_and_consume(&tokvec, LIT_DEC_INTEGER,
			                   "an integer while parsing a declaration");
			int length = tokvec[-1].int_value;
			expect_and_consume(&tokvec, RIGHT_BRACKET,
			                   "closing ] while parsing a declaration");

			struct TypeNode a;
			a.type_category = ARRAY;
			a.array_length = length;
			struct TypeNode *ptr = calloc(1, sizeof(struct TypeNode));
			*ptr = a;
			push_vector(&vec, ptr);
			continue;
		} else if (tokvec[0].kind == LEFT_PAREN &&
		           (can_start_a_type(&tokvec[1]) ||
		            tokvec[1].kind == RIGHT_PAREN)) {
			++tokvec;
			parse_parameter_type_list(&tokvec, &vec);
			expect_and_consume(&tokvec, RIGHT_PAREN,
			                   "closing ) while parsing functional type");
			continue;
		} else {
			break;
		}
	}

	*ptr_tokvec = tokvec;
	*ptr_vec = vec;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdi, -0x68(%rbp)
movq (%rdi), %rax
movq %rsi, -0x70(%rbp)
movups (%rsi), %xmm0
leaq -0x50(%rbp), %r15
movaps %xmm0, (%r15)
leaq -0xa8(%rbp), %r12
leaq -0x38(%rbp), %r14
leaq -0x30(%rbp), %r13
movl (%rax), %ecx
cmpl $0x6, %ecx
je 0xa0b6
cmpl $0x36, %ecx
jne 0xa276
addq $0x20, %rax
movq %rax, -0x38(%rbp)
movq %r14, %rdi
movl $0x4, %esi
leaq 0x65eb(%rip), %rdx      # 0x10659
callq 0x9563
movq -0x38(%rbp), %rax
movl -0x1c(%rax), %ebx
movq %r14, %rdi
movl $0x37, %esi
leaq 0x65f7(%rip), %rdx      # 0x10680
callq 0x9563
movl $0x1, %edi
movl $0x50, %esi
callq 0x10d0
movl $0x2, (%rax)
movl %ebx, 0x10(%rax)
movq %r15, %rdi
movq %rax, %rsi
callq 0x5d9b
jmp 0xa1c7
movl 0x20(%rax), %ecx
leal -0x35(%rcx), %edx
cmpl $0x15, %edx
ja 0xa1d0
movl $0x21c229, %esi         # imm = 0x21C229
btl %edx, %esi
jae 0xa1d0
addq $0x20, %rax
movq %rax, -0x38(%rbp)
movl $0x1, %edi
xorl %eax, %eax
callq 0x243c
movq -0x38(%rbp), %rdi
movq %rdi, -0x30(%rbp)
movaps -0x50(%rbp), %xmm0
movaps %xmm0, -0x60(%rbp)
movl (%rdi), %eax
leal -0x35(%rax), %ecx
cmpl $0x15, %ecx
ja 0xa22d
movl $0x21c029, %edx         # imm = 0x21C029
btl %ecx, %edx
jae 0xa1de
movl $0x3, -0xc0(%rbp)
movl $0x1, -0x98(%rbp)
callq 0x5cf8
movq %rax, -0xa8(%rbp)
movq %rdx, -0xa0(%rbp)
movq %r13, %rdi
callq 0x9778
movq %r12, %rdi
movq %rax, %rsi
callq 0x5d9b
movq -0x30(%rbp), %rax
cmpl $0xa, (%rax)
jne 0xa176
leaq 0x20(%rax), %rcx
movq %rcx, -0x30(%rbp)
cmpl $0x48, 0x20(%rax)
jne 0xa13a
movl $0x2, -0x98(%rbp)
addq $0x40, %rax
movq %rax, -0x30(%rbp)
movl $0x1, %edi
movl $0x50, %esi
callq 0x10d0
movl $0xa, %ecx
movq %rax, %rdi
leaq -0xc0(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq -0x60(%rbp), %rdi
movq %rax, %rsi
callq 0x5d9b
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movaps -0x60(%rbp), %xmm0
movaps %xmm0, -0x50(%rbp)
movq %r14, %rdi
movl $0x7, %esi
leaq 0x64e4(%rip), %rdx      # 0x106a6
callq 0x9563
movq -0x38(%rbp), %rax
jmp 0xa047
cmpl $0x7, %ecx
je 0xa0d3
jmp 0xa276
cmpl $0x9, %ecx
jne 0xa22d
cmpl $0x7, 0x20(%rdi)
jne 0xa113
addq $0x20, %rdi
movq %rdi, -0x30(%rbp)
callq 0x5cf8
movq %rax, %rbx
movq %rdx, %r15
movl $0x1, %edi
movl $0x50, %esi
callq 0x10d0
movl $0x3, (%rax)
movq %rbx, 0x18(%rax)
movq %r15, 0x20(%rax)
leaq -0x50(%rbp), %r15
movl $0x1, 0x28(%rax)
jmp 0xa197
cmpl $0x7, %eax
jne 0xa29a
callq 0x5cf8
movq %rax, %rbx
movq %rdx, %r15
movl $0x1, %edi
movl $0x50, %esi
callq 0x10d0
movl $0x3, (%rax)
movq %rbx, 0x18(%rax)
movq %r15, 0x20(%rax)
movl $0x0, 0x28(%rax)
leaq -0x60(%rbp), %rdi
movq %rax, %rsi
callq 0x5d9b
leaq -0x50(%rbp), %r15
jmp 0xa1a3
movq -0x68(%rbp), %rcx
movq %rax, (%rcx)
movaps -0x50(%rbp), %xmm0
movq -0x70(%rbp), %rax
movups %xmm0, (%rax)
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x642d(%rip), %rsi      # 0x106ce
callq 0x9478