// File: /workspace/github_c_makefile_star2_O2/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 0x2cb0c
movl $0x95, %ebx
cmpl $0x0, (%r14)
jne 0x15016
incq 0x78(%r15)
movq (%r15), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x12e0e
cmpl $0x0, (%r14)
jne 0x15016
movq (%r15), %rax
movl 0x38(%rax), %ebp
movl $0x95, %ebx
leaq 0x878cd(%rip), %r13     # 0x9c760
cmpl $0x0, (%r12)
je 0x14f7b
movq %r12, %rdi
callq 0x12a25
movl (%r12), %ecx
cmpl $0x2, %ecx
je 0x14ed5
cmpl $0x6, %ecx
jne 0x14eff
movq 0x48(%r15), %rax
cmpb $0x1, 0x88(%rax)
je 0x14ff4
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x17e60
jmp 0x14ef4
cmpb $0x3c, (%rax)
jne 0x14f46
cmpb $0x2d, 0x1(%rax)
jne 0x14f46
cmpb $0x0, 0x2(%rax)
jne 0x14f46
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x1c41a
cmpl $0x0, (%r14)
je 0x14e93
jmp 0x15016
cmpl $0x1, %ecx
jne 0x14f46
movl 0x8(%r12), %ebx
movl %ebx, %eax
andl $-0x5, %eax
cmpl $0x23, %eax
je 0x14f9c
movq 0x48(%r15), %rax
cmpb $0x1, 0x88(%rax)
je 0x15027
movslq %ebx, %rax
movq (%r13,%rax,8), %rax
testq %rax, %rax
je 0x15046
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq *%rax
jmp 0x14ef4
movq (%r15), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0x58531(%rip), %r10     # 0x6d489
leaq 0x58e66(%rip), %rcx     # 0x6ddc5
pushq $0x10
popq %rsi
movq %r14, %rdi
movq %rax, %rdx
pushq $0xff
pushq %r10
callq 0x140cd
popq %rax
popq %rcx
jmp 0x15016
movq (%r15), %rax
movq 0x30(%rax), %rdx
leaq 0x58500(%rip), %r8      # 0x6d489
pushq $0x1e
popq %rsi
movq %r14, %rdi
movl %ebp, %ecx
movl $0x11c, %r9d            # imm = 0x11C
callq 0x142c0
movq 0x48(%r15), %rax
movb $0x0, 0x88(%rax)
movq 0x68(%r15), %rdx
movq 0x78(%r15), %rcx
pushq $0x2
popq %rsi
movq %r15, %rdi
movq %r14, %r8
callq 0x4bbc0
cmpl $0x0, (%r14)
jne 0x15016
decq 0x78(%r15)
movq 0x68(%r15), %rdi
movq %r14, %rsi
callq 0x2cb44
cmpl $0x0, (%r14)
jne 0x15016
movq 0x48(%r15), %rax
movq 0x78(%r15), %rsi
movq 0x78(%rax), %rdi
callq 0x2a68e
movq 0x48(%r15), %rcx
movq %rax, 0x78(%rcx)
jmp 0x15016
movq (%r15), %rax
movq 0x30(%rax), %rdx
movl 0x38(%rax), %ecx
leaq 0x58484(%rip), %r8      # 0x6d489
pushq $0x2e
popq %rsi
movq %r14, %rdi
movl $0xf0, %r9d
callq 0x142c0
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 0x58451(%rip), %r8      # 0x6d489
pushq $0x2e
popq %rsi
movq %r14, %rdi
movl $0x10a, %r9d            # imm = 0x10A
jmp 0x15011
movq %r12, %rdi
callq 0x12a25
movq (%r15), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0x58429(%rip), %r10     # 0x6d489
leaq 0x58d5e(%rip), %rcx     # 0x6ddc5
pushq $0x13
popq %rsi
movq %r14, %rdi
movq %rax, %rdx
pushq $0x112                  # imm = 0x112
jmp 0x14f6d