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

	tbuf = subtilis_token_get_text(t);
	subtilis_type_init_rec(type, tbuf, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return NULL;

	name = malloc(strlen(tbuf) + 1);
	if (!name) {
		subtilis_error_set_oom(err);
		return NULL;
	}
	strcpy(name, tbuf);

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

	tbuf = subtilis_token_get_text(t);
	if ((t->type != SUBTILIS_TOKEN_OPERATOR) || strcmp(tbuf, "(")) {
		subtilis_error_set_expected(err, "(", tbuf, p->l->stream->name,
					    p->l->line);
		goto cleanup;
	}

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

	prv_parse_fields(p, t, type, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	if (type->params.rec.num_fields == 0) {
		subtilis_error_set_empty_rec(err, name, p->l->stream->name,
					     p->l->line);
		goto cleanup;
	}

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

	return name;

cleanup:

	free(name);

	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x18(%rbp), %rdi
callq 0x12d70
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x3ebc0
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x341c4
movq $0x0, -0x8(%rbp)
jmp 0x34377
movq -0x30(%rbp), %rdi
callq 0x120d0
movq %rax, %rdi
addq $0x1, %rdi
callq 0x121b0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x3420b
movq -0x28(%rbp), %rdi
movl $0x1, %esi
leaq 0x76942(%rip), %rdx     # 0xaab36
movl $0xdf, %ecx
callq 0x158e0
movq $0x0, -0x8(%rbp)
jmp 0x34377
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x12060
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x133f0
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x3423a
jmp 0x34366
movq -0x18(%rbp), %rdi
callq 0x12d70
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x34265
movq -0x30(%rbp), %rdi
leaq 0x77041(%rip), %rsi     # 0xab29c
callq 0x12140
cmpl $0x0, %eax
je 0x342ac
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %r8
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl 0x38(%rax), %r9d
movl $0x1d, %esi
leaq 0x7700d(%rip), %rdx     # 0xab29c
leaq 0x768a0(%rip), %rax     # 0xaab36
movq %rax, (%rsp)
movl $0xeb, 0x8(%rsp)
callq 0x156d0
jmp 0x34366
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x133f0
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x342ce
jmp 0x34366
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x34390
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x342ee
jmp 0x34366
movq -0x20(%rbp), %rax
cmpq $0x0, 0x28(%rax)
jne 0x3433d
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rdx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %r8
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl 0x38(%rax), %r9d
movl $0x6b, %esi
leaq 0x76f53(%rip), %rcx     # 0xab276
leaq 0x7680c(%rip), %rax     # 0xaab36
movq %rax, (%rsp)
movl $0xf9, 0x8(%rsp)
callq 0x156d0
jmp 0x34366
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x133f0
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x3435c
jmp 0x34366
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x34377
movq -0x38(%rbp), %rdi
callq 0x12290
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)