// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/frontend/parser.c
// Function: prv_parser_type
static void prv_parser_type(subtilis_parser_t *p, subtilis_token_t *t,
			    subtilis_error_t *err)
{
	const char *tbuf;
	char *name;
	subtilis_type_t type;

	type.type = SUBTILIS_TYPE_VOID;

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

	tbuf = subtilis_token_get_text(t);
	if ((t->type != SUBTILIS_TOKEN_KEYWORD) ||
	    ((t->tok.keyword.type != SUBTILIS_KEYWORD_PROC) &&
	     (t->tok.keyword.type != SUBTILIS_KEYWORD_FN) &&
	     (t->tok.keyword.type != SUBTILIS_KEYWORD_REC))) {
		subtilis_error_set_expected(err, "REC, PROC or FN", tbuf,
					    p->l->stream->name, p->l->line);
		return;
	}

	if (t->tok.keyword.type == SUBTILIS_KEYWORD_REC)
		name = subtilis_parser_parse_rec_type(p, t, &type, err);
	else
		name = subtilis_parser_parse_call_type(p, t, &type, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto on_error;

	if ((p->current != p->main) || (p->level > 0)) {
		subtilis_error_set_type_not_at_top_level(
		    err, name, p->l->stream->name, p->l->line);
		goto on_error;
	}

	subtilis_symbol_table_insert_type(p->st, name, &type, err);
	if (err->type == SUBTILIS_ERROR_TYPE_ALREADY_DEFINED) {
		subtilis_error_set_already_defined(
		    err, name, p->l->stream->name, p->l->line);
	}

on_error:
	subtilis_type_free(&type);
	free(name);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x8, -0x170(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x133f0
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x178b3
jmp 0x17a5f
movq -0x10(%rbp), %rdi
callq 0x12d70
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x178e7
movq -0x10(%rbp), %rax
cmpl $0x1, 0x8(%rax)
je 0x1792e
movq -0x10(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0x1792e
movq -0x10(%rbp), %rax
cmpl $0x2, 0x8(%rax)
je 0x1792e
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %r8
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl 0x38(%rax), %r9d
movl $0x1d, %esi
leaq 0x92bdc(%rip), %rdx     # 0xaa4ed
leaq 0x92ba3(%rip), %rax     # 0xaa4bb
movq %rax, (%rsp)
movl $0x1b6, 0x8(%rsp)       # imm = 0x1B6
callq 0x156d0
jmp 0x17a5f
movq -0x10(%rbp), %rax
cmpl $0x2, 0x8(%rax)
jne 0x17956
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rcx
leaq -0x170(%rbp), %rdx
callq 0x34170
movq %rax, -0x28(%rbp)
jmp 0x17972
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rcx
leaq -0x170(%rbp), %rdx
callq 0x20130
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x17980
jmp 0x17a4a
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x50(%rcx), %rax
jne 0x1799d
movq -0x8(%rbp), %rax
cmpq $0x0, 0x78(%rax)
jbe 0x179e1
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rdx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %r8
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl 0x38(%rax), %r9d
movl $0x57, %esi
leaq 0x938af(%rip), %rcx     # 0xab276
leaq 0x92aed(%rip), %rax     # 0xaa4bb
movq %rax, (%rsp)
movl $0x1c3, 0x8(%rsp)       # imm = 0x1C3
callq 0x156d0
jmp 0x17a4a
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rdi
movq -0x28(%rbp), %rsi
movq -0x18(%rbp), %rcx
leaq -0x170(%rbp), %rdx
callq 0x3ca30
movq -0x18(%rbp), %rax
cmpl $0x68, (%rax)
jne 0x17a48
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rdx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %r8
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl 0x38(%rax), %r9d
movl $0x20, %esi
leaq 0x93846(%rip), %rcx     # 0xab276
leaq 0x92a84(%rip), %rax     # 0xaa4bb
movq %rax, (%rsp)
movl $0x1ca, 0x8(%rsp)       # imm = 0x1CA
callq 0x156d0
jmp 0x17a4a
leaq -0x170(%rbp), %rdi
callq 0x3e100
movq -0x28(%rbp), %rdi
callq 0x12290
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
nopl (%rax,%rax)