// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/frontend/parser_call.c
// Function: prv_complete_array_type
static bool prv_complete_array_type(subtilis_parser_t *p, subtilis_token_t *t,
				    subtilis_type_t *fn_type,
				    subtilis_error_t *err)
{
	subtilis_type_t id_type;
	size_t i;
	const char *tbuf;

	id_type.type = SUBTILIS_TYPE_VOID;

	subtilis_lexer_get(p->l, t, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return false;

	if ((t->type == SUBTILIS_TOKEN_INTEGER) &&
	    (fn_type->type != SUBTILIS_TYPE_VOID) &&
	    (!subtilis_type_if_is_vector(fn_type))) {
		/*
		 * We have a function returning an array.
		 */

		if ((t->tok.integer < 1) ||
		    (t->tok.integer > SUBTILIS_MAX_DIMENSIONS)) {
			subtilis_error_bad_dim(err, "return type",
					       p->l->stream->name, p->l->line);
			return false;
		}
		subtilis_type_init_copy(&id_type, fn_type, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return false;
		subtilis_type_if_array_of(&id_type, fn_type, err);
		subtilis_type_free(&id_type);
		if (err->type != SUBTILIS_ERROR_OK)
			return false;
		fn_type->params.array.num_dims = t->tok.integer;
		for (i = 0; i < fn_type->params.array.num_dims; i++)
			fn_type->params.array.dims[i] =
			    SUBTILIS_DYNAMIC_DIMENSION;

		subtilis_lexer_get(p->l, t, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return false;
		tbuf = subtilis_token_get_text(t);

		if ((t->type != SUBTILIS_TOKEN_OPERATOR) || strcmp(tbuf, ")")) {
			subtilis_error_set_right_bkt_expected(
			    err, tbuf, p->l->stream->name, p->l->line);
			return false;
		}

		subtilis_lexer_get(p->l, t, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return false;
		tbuf = subtilis_token_get_text(t);
		if ((t->type != SUBTILIS_TOKEN_OPERATOR) || strcmp(tbuf, "("))
			return false;
		subtilis_lexer_get(p->l, t, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return false;
	}

	return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x150, %rsp            # imm = 0x150
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %r15
movl $0x8, 0x8(%rsp)
movq (%rdi), %rdi
movq %rcx, %rdx
callq 0x12e0e
cmpl $0x0, (%rbx)
je 0x1c1b5
xorl %eax, %eax
jmp 0x1c1d0
cmpl $0x4, (%r14)
jne 0x1c1ce
cmpl $0x8, (%r12)
je 0x1c1ce
movq %r12, %rdi
callq 0x357ea
testb %al, %al
je 0x1c1e1
movb $0x1, %al
addq $0x150, %rsp            # imm = 0x150
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movl 0x8(%r14), %eax
addl $-0xb, %eax
cmpl $-0xb, %eax
ja 0x1c222
movq (%r15), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0x51411(%rip), %rax     # 0x6d610
leaq 0x51421(%rip), %rdx     # 0x6d627
leaq 0x51bb8(%rip), %rcx     # 0x6ddc5
pushq $0x38
popq %rsi
movq %rbx, %rdi
pushq $0x2dc                  # imm = 0x2DC
pushq %rax
callq 0x140cd
popq %rax
popq %rcx
jmp 0x1c1b1
leaq 0x8(%rsp), %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x2db73
cmpl $0x0, (%rbx)
jne 0x1c1b1
leaq 0x8(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x34015
movq %r13, %rdi
callq 0x2dc7c
cmpl $0x0, (%rbx)
jne 0x1c1b1
movl 0x8(%r14), %ecx
movl %ecx, 0x8(%r12)
xorl %eax, %eax
movslq %ecx, %rcx
cmpq %rcx, %rax
jae 0x1c282
orl $-0x1, 0xc(%r12,%rax,4)
incq %rax
movl 0x8(%r12), %ecx
jmp 0x1c26a
movq (%r15), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x12e0e
cmpl $0x0, (%rbx)
jne 0x1c1b1
movq %r14, %rdi
callq 0x12a25
cmpl $0x2, (%r14)
jne 0x1c2b2
cmpb $0x29, (%rax)
jne 0x1c2b2
cmpb $0x0, 0x1(%rax)
je 0x1c2e0
movq (%r15), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0x5134c(%rip), %r10     # 0x6d610
leaq 0x51afa(%rip), %rcx     # 0x6ddc5
pushq $0x16
popq %rsi
movq %rbx, %rdi
movq %rax, %rdx
pushq $0x2f2                  # imm = 0x2F2
pushq %r10
jmp 0x1c219
movq (%r15), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x12e0e
cmpl $0x0, (%rbx)
jne 0x1c1b1
movq %r14, %rdi
callq 0x12a25
cmpl $0x2, (%r14)
jne 0x1c1b1
cmpb $0x28, (%rax)
jne 0x1c1b1
cmpb $0x0, 0x1(%rax)
jne 0x1c1b1
movq (%r15), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x12e0e
cmpl $0x0, (%rbx)
jne 0x1c1b1
jmp 0x1c1ce