// File: /workspace/github_c_makefile_star2_O2/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), %r14
movaps %xmm0, (%r14)
leaq -0xa8(%rbp), %r12
leaq -0x30(%rbp), %r13
leaq -0x38(%rbp), %r15
movl (%rax), %ecx
cmpl $0x6, %ecx
je 0x8fda
cmpl $0x36, %ecx
jne 0x9185
addq $0x20, %rax
movq %rax, -0x30(%rbp)
movq %r13, %rdi
pushq $0x4
popq %rsi
leaq 0x66e1(%rip), %rdx      # 0xf679
callq 0x8168
movq -0x30(%rbp), %rax
movl -0x1c(%rax), %ebx
movq %r13, %rdi
pushq $0x37
popq %rsi
leaq 0x66ef(%rip), %rdx      # 0xf6a0
callq 0x8168
pushq $0x1
popq %rdi
pushq $0x50
popq %rsi
callq 0x10d0
movl $0x2, (%rax)
movl %ebx, 0x10(%rax)
movq %r14, %rdi
movq %rax, %rsi
callq 0x4a57
jmp 0x90e1
movl 0x20(%rax), %ecx
leal -0x35(%rcx), %edx
cmpl $0x15, %edx
ja 0x90ea
movl $0x21c229, %esi         # imm = 0x21C229
btl %edx, %esi
jae 0x90ea
addq $0x20, %rax
movq %rax, -0x30(%rbp)
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x128c
movq -0x30(%rbp), %rdi
movq %rdi, -0x38(%rbp)
movaps -0x50(%rbp), %xmm0
movaps %xmm0, -0x60(%rbp)
movl (%rdi), %eax
leal -0x35(%rax), %ecx
cmpl $0x15, %ecx
ja 0x9143
movl $0x21c029, %edx         # imm = 0x21C029
btl %ecx, %edx
jae 0x90f8
movl $0x3, -0xc0(%rbp)
movl $0x1, -0x98(%rbp)
callq 0x49e0
movq %rax, -0xa8(%rbp)
movq %rdx, -0xa0(%rbp)
movq %r15, %rdi
callq 0x86ac
movq %r12, %rdi
movq %rax, %rsi
callq 0x4a57
movq -0x38(%rbp), %rax
cmpl $0xa, (%rax)
jne 0x9098
leaq 0x20(%rax), %rcx
movq %rcx, -0x38(%rbp)
cmpl $0x48, 0x20(%rax)
jne 0x905c
movl $0x2, -0x98(%rbp)
addq $0x40, %rax
movq %rax, -0x38(%rbp)
pushq $0x1
popq %rdi
pushq $0x50
popq %rsi
callq 0x10d0
pushq $0xa
popq %rcx
movq %rax, %rdi
leaq -0xc0(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq -0x60(%rbp), %rdi
movq %rax, %rsi
callq 0x4a57
movq -0x38(%rbp), %rax
movq %rax, -0x30(%rbp)
movaps -0x60(%rbp), %xmm0
movaps %xmm0, -0x50(%rbp)
movq %r13, %rdi
pushq $0x7
popq %rsi
leaq 0x65ea(%rip), %rdx      # 0xf6c6
callq 0x8168
movq -0x30(%rbp), %rax
jmp 0x8f73
cmpl $0x7, %ecx
je 0x8ff7
jmp 0x9185
cmpl $0x9, %ecx
jne 0x9143
cmpl $0x7, 0x20(%rdi)
jne 0x9035
addq $0x20, %rdi
movq %rdi, -0x38(%rbp)
callq 0x49e0
movq %rax, %rbx
movq %rdx, %r14
pushq $0x1
popq %rdi
pushq $0x50
popq %rsi
callq 0x10d0
movl $0x3, (%rax)
movq %rbx, 0x18(%rax)
movq %r14, 0x20(%rax)
leaq -0x50(%rbp), %r14
movl $0x1, 0x28(%rax)
jmp 0x90b3
cmpl $0x7, %eax
jne 0x91a9
callq 0x49e0
movq %rax, %rbx
movq %rdx, %r14
pushq $0x1
popq %rdi
pushq $0x50
popq %rsi
callq 0x10d0
movl $0x3, (%rax)
movq %rbx, 0x18(%rax)
movq %r14, 0x20(%rax)
andl $0x0, 0x28(%rax)
leaq -0x60(%rbp), %rdi
movq %rax, %rsi
callq 0x4a57
leaq -0x50(%rbp), %r14
jmp 0x90bf
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 0x653e(%rip), %rsi      # 0xf6ee
callq 0x8084