// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x458, %rsp            # imm = 0x458
movq %rcx, %r14
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, %r12
movq %rsi, %rdi
callq 0x12a25
movq %rax, %rbp
movq %r13, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x2e26b
cmpl $0x0, (%r14)
jne 0x27ea4
movq %rbp, %rdi
callq 0x120f0
leaq 0x1(%rax), %rdi
callq 0x121d0
testq %rax, %rax
je 0x27e8d
movq %rax, %rbx
movq %rax, %rdi
movq %rbp, %rsi
callq 0x12070
movq (%r12), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x12e0e
cmpl $0x0, (%r14)
jne 0x27e83
movq %r15, %rdi
callq 0x12a25
cmpl $0x2, (%r15)
jne 0x27e52
cmpb $0x28, (%rax)
jne 0x27e52
cmpb $0x0, 0x1(%rax)
je 0x27ebb
movq (%r12), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0x45c3d(%rip), %r10     # 0x6daa2
leaq 0x46376(%rip), %rdx     # 0x6e1e2
pushq $0x1d
popq %rsi
movq %r14, %rdi
movq %rax, %rcx
pushq $0xeb
pushq %r10
callq 0x140cd
popq %rax
popq %rcx
movq %rbx, %rdi
callq 0x122c0
jmp 0x27ea4
leaq 0x45c0e(%rip), %rdx     # 0x6daa2
pushq $0x1
popq %rsi
movq %r14, %rdi
movl $0xdf, %ecx
callq 0x1429e
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x458, %rsp            # imm = 0x458
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r12), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x12e0e
cmpl $0x0, (%r14)
jne 0x27e83
movq %r15, %rdi
callq 0x12a25
movq %rax, %rcx
leaq 0x1c8(%rsp), %rbp
movl (%r15), %eax
cmpl $0x1, %eax
je 0x27faf
movq %rcx, 0x10(%rsp)
cmpl $0x2, %eax
jne 0x27f12
movq 0x10(%rsp), %rax
cmpb $0x29, (%rax)
jne 0x27f12
movq 0x10(%rsp), %rax
cmpb $0x0, 0x1(%rax)
je 0x282d7
movq %r12, %rdi
movq %r15, %rsi
movq %rbp, %rdx
movq %r14, %rcx
callq 0x2969b
cmpl $0x0, (%r14)
jne 0x27e83
movq %rbp, %rdi
movq %r14, %rsi
callq 0x33df0
movq %rax, 0x18(%rsp)
cmpl $0x0, (%r14)
jne 0x28271
movq %rbp, %rdi
movq %r14, %rsi
callq 0x33e26
cmpl $0x0, (%r14)
jne 0x28271
subq $0x8, %rsp
movq %r13, %rdi
movq 0x18(%rsp), %rsi
movq %rbp, %rdx
movl %eax, %ecx
movq 0x20(%rsp), %r8
xorl %r9d, %r9d
pushq %r14
callq 0x2e32b
popq %rax
popq %rcx
movq %rbp, %rdi
callq 0x2dc7c
movl (%r14), %eax
testl %eax, %eax
jne 0x28280
movq (%r12), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x12e0e
cmpl $0x0, (%r14)
je 0x28168
jmp 0x27e83
cmpl $0x1f, 0x8(%r15)
jne 0x282aa
movb $0x0, 0xf(%rsp)
movq (%r12), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x12e0e
cmpl $0x0, (%r14)
jne 0x282d7
movq %r12, %rdi
movq %r15, %rsi
leaq 0x80(%rsp), %rdx
movq %r14, %rcx
callq 0x2969b
cmpl $0x0, (%r14)
jne 0x282d7
movq %r15, %rdi
callq 0x12a25
movq %rax, %rbp
movq %rax, %rdi
callq 0x120f0
leaq 0x1(%rax), %rdi
callq 0x121d0
testq %rax, %rax
movq %rax, 0x18(%rsp)
je 0x2808d
movq %rax, %rdi
movq %rbp, %rsi
callq 0x12070
movq %r12, %rdi
movq %r15, %rsi
leaq 0x30(%rsp), %rdx
pushq $0xa
popq %rcx
leaq 0xf(%rsp), %r8
movq %r14, %r9
callq 0x160ec
movq %rax, 0x10(%rsp)
movl (%r14), %eax
testl %eax, %eax
je 0x280a4
cmpl $0x16, %eax
jne 0x28127
movq (%r12), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
movq %r14, %rdi
pushq $0x36
popq %rsi
movq 0x18(%rsp), %rdx
leaq 0x45d4e(%rip), %rcx     # 0x6ddc5
pushq $0x5a
leaq 0x45a22(%rip), %rax     # 0x6daa2
pushq %rax
callq 0x140cd
popq %rax
popq %rcx
jmp 0x28127
movq %r14, %rdi
pushq $0x1
popq %rsi
leaq 0x45a08(%rip), %rdx     # 0x6daa2
pushq $0x51
popq %rcx
callq 0x1429e
jmp 0x2811e
movb 0xf(%rsp), %al
cmpq $0x0, 0x10(%rsp)
setne %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x280fd
xorl %ecx, %ecx
leaq 0x310(%rsp), %rbp
cmpq %rcx, 0x10(%rsp)
je 0x28178
movq 0x30(%rsp,%rcx,8), %rdx
incq %rcx
cmpl $0x1, (%rdx)
je 0x280c2
movq (%r12), %rax
movq 0x30(%rax), %rdx
movl 0x38(%rax), %ecx
movq %r14, %rdi
pushq $0x43
popq %rsi
leaq 0x459b0(%rip), %r8      # 0x6daa2
pushq $0x6c
popq %r9
callq 0x142c0
jmp 0x28127
movq (%r12), %rax
movq 0x30(%rax), %rdx
movl 0x38(%rax), %ecx
movq %r14, %rdi
pushq $0x43
popq %rsi
leaq 0x4598d(%rip), %r8      # 0x6daa2
pushq $0x63
popq %r9
callq 0x142c0
movq $0x0, 0x10(%rsp)
xorl %ebp, %ebp
cmpq %rbp, 0x10(%rsp)
je 0x2813f
movq 0x30(%rsp,%rbp,8), %rdi
callq 0x29d88
incq %rbp
jmp 0x28129
leaq 0x80(%rsp), %rdi
callq 0x2dc7c
movq 0x18(%rsp), %rdi
callq 0x122c0
cmpl $0x0, (%r14)
leaq 0x1c8(%rsp), %rbp
jne 0x282d7
movq %r15, %rdi
callq 0x12a25
movq %rax, %rcx
jmp 0x27ee3
testb %al, %al
je 0x281a7
leaq 0x80(%rsp), %rdi
movq %rbp, %rsi
movq %r14, %rdx
callq 0x3f3e3
pushq $-0x1
popq %rax
cmpq $0x0, 0x10(%rsp)
je 0x281d3
movq 0x30(%rsp), %rax
movl 0x148(%rax), %eax
jmp 0x281d3
subq $0x8, %rsp
movq %r12, %rdi
movq 0x20(%rsp), %rsi
leaq 0x88(%rsp), %rdx
movq %rbp, %rcx
leaq 0x38(%rsp), %r8
movq 0x18(%rsp), %r9
pushq %r14
callq 0x3f30f
popq %rax
popq %rcx
xorl %eax, %eax
cmpl $0x0, (%r14)
jne 0x28127
movl %eax, 0x24(%rsp)
movq %rbp, %rdi
movq %r14, %rsi
callq 0x33df0
movq %rax, 0x28(%rsp)
cmpl $0x0, (%r14)
je 0x281fc
movq %rbp, %rdi
jmp 0x28215
movq %rbp, %rdi
movq %r14, %rsi
callq 0x33e26
cmpl $0x0, (%r14)
je 0x2821f
leaq 0x310(%rsp), %rdi
callq 0x2dc7c
jmp 0x28127
subq $0x8, %rsp
movq %r13, %rdi
movq 0x20(%rsp), %rsi
leaq 0x318(%rsp), %rbp
movq %rbp, %rdx
movl %eax, %ecx
movq 0x30(%rsp), %r8
movl 0x2c(%rsp), %r9d
pushq %r14
callq 0x2e32b
popq %rax
popq %rcx
movq %rbp, %rdi
callq 0x2dc7c
cmpl $0x0, (%r14)
jne 0x28127
movq (%r12), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x12e0e
jmp 0x28127
leaq 0x1c8(%rsp), %rdi
callq 0x2dc7c
jmp 0x282d7
cmpl $0x68, %eax
jne 0x282da
movq (%r12), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0x45b2d(%rip), %rcx     # 0x6ddc5
pushq $0x20
popq %rsi
movq %r14, %rdi
movq 0x10(%rsp), %rdx
pushq $0xc1
jmp 0x282c8
movq (%r12), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0x45800(%rip), %rdx     # 0x6dabd
pushq $0x1d
popq %rsi
movq %r14, %rdi
pushq $0xa4
leaq 0x457d3(%rip), %rax     # 0x6daa2
pushq %rax
callq 0x140cd
popq %rax
popq %rcx
movl (%r14), %eax
testl %eax, %eax
jne 0x27e83
cmpq $0x0, 0x28(%r13)
movq (%r12), %rdi
je 0x28307
movq %r15, %rsi
movq %r14, %rdx
callq 0x12e0e
cmpl $0x0, (%r14)
jne 0x27e83
jmp 0x27ea6
movq 0x30(%rdi), %r8
movl 0x38(%rdi), %r9d
leaq 0x45aaf(%rip), %rcx     # 0x6ddc5
pushq $0x6b
popq %rsi
movq %r14, %rdi
movq %rbx, %rdx
pushq $0xf9
leaq 0x45777(%rip), %rax     # 0x6daa2
pushq %rax
jmp 0x27e7c