// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/frontend/parser.c
// Function: subtilis_parser_new
subtilis_parser_t *subtilis_parser_new(subtilis_lexer_t *l,
				       const subtilis_backend_t *backend,
				       const subtilis_settings_t *settings,
				       subtilis_error_t *err)
{
	const subtilis_symbol_t *s;
	subtilis_parser_t *p = calloc(1, sizeof(*p));
	subtilis_type_section_t *stype = NULL;

	if (!p) {
		subtilis_error_set_oom(err);
		goto on_error;
	}

	p->settings = *settings;

	p->st = subtilis_symbol_table_new(err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto on_error;

	p->main_st = subtilis_symbol_table_new(err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto on_error;
	p->local_st = p->main_st;

	p->prog = subtilis_ir_prog_new(&p->settings, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto on_error;

	stype =
	    subtilis_type_section_new(&subtilis_type_void, 0, NULL, NULL, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto on_error;

	/*
	 * We pre-seed the symbol table here to ensure that these variables
	 * have offsets 0 and 0 + sizeof(INT).
	 */

	s = subtilis_symbol_table_insert(p->st, subtilis_eflag_hidden_var,
					 &subtilis_type_integer, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto on_error;

	p->eflag_offset = (int32_t)s->loc;
	p->error_offset = s->size;
	s = subtilis_symbol_table_insert(p->st, subtilis_err_hidden_var,
					 &subtilis_type_integer, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto on_error;

	p->current = subtilis_ir_prog_section_new(
	    p->prog, SUBTILIS_MAIN_FN, 0, stype, SUBTILIS_BUILTINS_MAX,
	    l->stream->name, l->line, p->eflag_offset, p->error_offset, NULL,
	    err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto on_error;
	stype = NULL;
	p->main = p->current;

	p->l = l;
	p->backend = *backend;
	p->level = 0;

	return p;

on_error:

	subtilis_type_section_delete(stype);
	subtilis_parser_delete(p);

	return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %r12
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, %r15
movl $0x1, %edi
movl $0xc0, %esi
callq 0x12150
movq %rax, %rbx
testq %rax, %rax
je 0x14ff5
movb 0x2(%r13), %al
movb %al, 0xba(%rbx)
movzwl (%r13), %eax
movw %ax, 0xb8(%rbx)
movq %r12, %rdi
callq 0x2e528
movq %rax, 0x60(%rbx)
cmpl $0x0, (%r12)
jne 0x1500e
movq %r12, %rdi
callq 0x2e528
movq %rax, 0x70(%rbx)
cmpl $0x0, (%r12)
jne 0x1500e
movq %rbx, %rdi
addq $0xb8, %rdi
movq %rax, 0x68(%rbx)
movq %r12, %rsi
callq 0x2c453
movq %rax, 0x58(%rbx)
cmpl $0x0, (%r12)
jne 0x1500e
leaq 0x5fddc(%rip), %rdi     # 0x74cd0
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movq %r12, %r8
callq 0x2f57c
movq %rax, %r13
cmpl $0x0, (%r12)
jne 0x15011
movq 0x60(%rbx), %rdi
leaq 0x9125d(%rip), %rax     # 0xa6178
movq (%rax), %rsi
leaq 0x5f9d3(%rip), %rdx     # 0x748f8
movq %r12, %rcx
callq 0x2e6e8
cmpl $0x0, (%r12)
jne 0x15011
movl (%rax), %ecx
movl %ecx, 0xb0(%rbx)
movl 0x2a0(%rax), %eax
movl %eax, 0xb4(%rbx)
movq 0x60(%rbx), %rdi
leaq 0x91229(%rip), %rax     # 0xa6180
movq (%rax), %rsi
leaq 0x5f997(%rip), %rdx     # 0x748f8
movq %r12, %rcx
callq 0x2e6e8
cmpl $0x0, (%r12)
jne 0x15011
movq 0x58(%rbx), %rdi
movq 0x30(%r15), %r9
movl 0x38(%r15), %eax
movl 0xb0(%rbx), %r10d
movl 0xb4(%rbx), %r11d
subq $0x8, %rsp
leaq 0x5e502(%rip), %rsi     # 0x7349b
xorl %edx, %edx
movq %r13, %rcx
movl $0x9, %r8d
pushq %r12
pushq $0x0
pushq %r11
pushq %r10
pushq %rax
callq 0x2c522
addq $0x30, %rsp
movq %rax, 0x48(%rbx)
cmpl $0x0, (%r12)
jne 0x15011
movq %rax, 0x50(%rbx)
movq %r15, (%rbx)
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
movups 0x30(%r14), %xmm3
movups %xmm0, 0x8(%rbx)
movups %xmm1, 0x18(%rbx)
movups %xmm2, 0x28(%rbx)
movups %xmm3, 0x38(%rbx)
movq $0x0, 0x78(%rbx)
jmp 0x15023
leaq 0x5e48d(%rip), %rdx     # 0x73489
movq %r12, %rdi
movl $0x1, %esi
movl $0x36, %ecx
callq 0x145f4
xorl %r13d, %r13d
movq %r13, %rdi
callq 0x2f7d2
movq %rbx, %rdi
callq 0x15030
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq