// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/parser.c
// Function: subtilis_parser_if_compound
int subtilis_parser_if_compound(subtilis_parser_t *p, subtilis_token_t *t,
				subtilis_error_t *err)
{
	const char *tbuf;
	subtilis_keyword_fn fn;
	subtilis_ir_operand_t var_reg;
	int key_type = SUBTILIS_KEYWORD_MAX;
	unsigned int start;

	subtilis_symbol_table_level_up(p->local_st, p->l, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return key_type;
	p->level++;
	subtilis_lexer_get(p->l, t, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return key_type;
	start = p->l->line;
	while (t->type != SUBTILIS_TOKEN_EOF) {
		tbuf = subtilis_token_get_text(t);
		if (t->type == SUBTILIS_TOKEN_IDENTIFIER) {
			if (p->current->endproc) {
				subtilis_error_set_useless_statement(
				    err, p->l->stream->name, p->l->line);
				return key_type;
			}
			subtilis_parser_assignment(p, t, err);
			if (err->type != SUBTILIS_ERROR_OK)
				return key_type;
			continue;
		} else if ((t->type == SUBTILIS_TOKEN_OPERATOR) &&
			   !strcmp(tbuf, "<-")) {
			subtilis_parser_return(p, t, err);
			if (err->type != SUBTILIS_ERROR_OK)
				return key_type;
			continue;
		} else if (t->type != SUBTILIS_TOKEN_KEYWORD) {
			subtilis_error_set_keyword_expected(
			    err, tbuf, p->l->stream->name, p->l->line);
			return key_type;
		}

		key_type = t->tok.keyword.type;
		if ((key_type == SUBTILIS_KEYWORD_ELSE) ||
		    (key_type == SUBTILIS_KEYWORD_ENDIF))
			break;

		if (p->current->endproc) {
			subtilis_error_set_useless_statement(
			    err, p->l->stream->name, p->l->line);
			return key_type;
		}

		fn = keyword_fns[key_type];
		if (!fn) {
			tbuf = subtilis_token_get_text(t);
			subtilis_error_set_not_supported(
			    err, tbuf, p->l->stream->name, p->l->line);
			return key_type;
		}
		fn(p, t, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return key_type;
	}

	if (t->type == SUBTILIS_TOKEN_EOF)
		subtilis_error_set_compund_not_term(err, p->l->stream->name,
						    start);

	p->current->endproc = false;

	var_reg.reg = SUBTILIS_IR_REG_LOCAL;
	subtilis_reference_deallocate_refs(p, var_reg, p->local_st, p->level,
					   err);
	if (err->type != SUBTILIS_ERROR_OK)
		return key_type;

	p->level--;
	subtilis_symbol_table_level_down(p->local_st, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return key_type;
	p->current->handler_list =
	    subtilis_handler_list_truncate(p->current->handler_list, p->level);
	return key_type;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %r15
movq (%rdi), %rsi
movq 0x68(%rdi), %rdi
callq 0x2e306
movl $0x95, %ebx
cmpl $0x0, (%r14)
jne 0x153ae
incq 0x78(%r15)
movq (%r15), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x12edc
cmpl $0x0, (%r14)
jne 0x153ae
movq (%r15), %rax
movl 0x38(%rax), %ebp
movl $0x95, %ebx
leaq 0x8753f(%rip), %r13     # 0x9c760
cmpl $0x0, (%r12)
je 0x1530d
movq %r12, %rdi
callq 0x12ad0
movl (%r12), %ecx
cmpl $0x2, %ecx
je 0x15263
cmpl $0x6, %ecx
jne 0x1528d
movq 0x48(%r15), %rax
cmpb $0x1, 0x88(%rax)
je 0x1538a
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x183e9
jmp 0x15282
cmpb $0x3c, (%rax)
jne 0x152d4
cmpb $0x2d, 0x1(%rax)
jne 0x152d4
cmpb $0x0, 0x2(%rax)
jne 0x152d4
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x1cb13
cmpl $0x0, (%r14)
je 0x15221
jmp 0x153ae
cmpl $0x1, %ecx
jne 0x152d4
movl 0x8(%r12), %ebx
movl %ebx, %eax
andl $-0x5, %eax
cmpl $0x23, %eax
je 0x15330
movq 0x48(%r15), %rax
cmpb $0x1, 0x88(%rax)
je 0x153bf
movslq %ebx, %rax
movq (%r13,%rax,8), %rax
testq %rax, %rax
je 0x153e0
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq *%rax
jmp 0x15282
movq (%r15), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0x5e1a3(%rip), %r10     # 0x73489
leaq 0x5eb28(%rip), %rcx     # 0x73e15
movq %r14, %rdi
movl $0x10, %esi
movq %rax, %rdx
pushq $0xff
pushq %r10
callq 0x143da
addq $0x10, %rsp
jmp 0x153ae
movq (%r15), %rax
movq 0x30(%rax), %rdx
leaq 0x5e16e(%rip), %r8      # 0x73489
movq %r14, %rdi
movl $0x1e, %esi
movl %ebp, %ecx
movl $0x11c, %r9d            # imm = 0x11C
callq 0x145c8
movq 0x48(%r15), %rax
movb $0x0, 0x88(%rax)
movq 0x68(%r15), %rdx
movq 0x78(%r15), %rcx
movl $0x2, %esi
movq %r15, %rdi
movq %r14, %r8
callq 0x4e90a
cmpl $0x0, (%r14)
jne 0x153ae
decq 0x78(%r15)
movq 0x68(%r15), %rdi
movq %r14, %rsi
callq 0x2e342
cmpl $0x0, (%r14)
jne 0x153ae
movq 0x48(%r15), %rax
movq 0x78(%r15), %rsi
movq 0x78(%rax), %rdi
callq 0x2baf1
movq 0x48(%r15), %rcx
movq %rax, 0x78(%rcx)
jmp 0x153ae
movq (%r15), %rax
movq 0x30(%rax), %rdx
movl 0x38(%rax), %ecx
leaq 0x5e0ee(%rip), %r8      # 0x73489
movq %r14, %rdi
movl $0x2e, %esi
movl $0xf0, %r9d
callq 0x145c8
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r15), %rax
movq 0x30(%rax), %rdx
movl 0x38(%rax), %ecx
leaq 0x5e0b9(%rip), %r8      # 0x73489
movq %r14, %rdi
movl $0x2e, %esi
movl $0x10a, %r9d            # imm = 0x10A
jmp 0x153a9
movq %r12, %rdi
callq 0x12ad0
movq (%r15), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0x5e08f(%rip), %r10     # 0x73489
leaq 0x5ea14(%rip), %rcx     # 0x73e15
movq %r14, %rdi
movl $0x13, %esi
movq %rax, %rdx
pushq $0x112                  # imm = 0x112
jmp 0x152fd