// File: /workspace/github_c_makefile_star2_O1/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 0x2e62b
movl $0x95, %ebx
cmpl $0x0, (%r14)
jne 0x15270
incq 0x78(%r15)
movq (%r15), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x12eda
cmpl $0x0, (%r14)
je 0x15281
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r15), %rax
movl 0x38(%rax), %eax
movl %eax, 0x4(%rsp)
movl $0x95, %ebx
cmpl $0x0, (%r12)
je 0x15351
movq %r12, %rdi
callq 0x12ad0
movq %rax, %rbp
movl (%r12), %r13d
cmpl $0x2, %r13d
je 0x152d7
cmpl $0x6, %r13d
jne 0x15303
movq 0x48(%r15), %rax
cmpb $0x1, 0x88(%rax)
je 0x1541a
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x184e9
jmp 0x152f8
movq %rbp, %rdi
leaq 0x5e1c8(%rip), %rsi     # 0x734a9
callq 0x12160
testl %eax, %eax
jne 0x15303
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x1c9e2
cmpl $0x0, (%r14)
je 0x15290
jmp 0x15270
cmpl $0x1, %r13d
jne 0x153e2
movl 0x8(%r12), %ebx
movl %ebx, %eax
andl $-0x5, %eax
cmpl $0x23, %eax
je 0x15351
movq 0x48(%r15), %rax
cmpb $0x1, 0x88(%rax)
je 0x15443
movslq %ebx, %rax
leaq 0x87429(%rip), %rcx     # 0x9c760
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x15464
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq *%rax
jmp 0x152f8
cmpl $0x0, (%r12)
jne 0x1537d
movq (%r15), %rax
movq 0x30(%rax), %rdx
leaq 0x5e123(%rip), %r8      # 0x73489
movq %r14, %rdi
movl $0x1e, %esi
movl 0x4(%rsp), %ecx
movl $0x11c, %r9d            # imm = 0x11C
callq 0x14618
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 0x4e94e
cmpl $0x0, (%r14)
jne 0x15270
decq 0x78(%r15)
movq 0x68(%r15), %rdi
movq %r14, %rsi
callq 0x2e667
cmpl $0x0, (%r14)
jne 0x15270
movq 0x48(%r15), %rax
movq 0x78(%r15), %rsi
movq 0x78(%rax), %rdi
callq 0x2be75
movq 0x48(%r15), %rcx
movq %rax, 0x78(%rcx)
jmp 0x15270
movq (%r15), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0x5e095(%rip), %rax     # 0x73489
leaq 0x5e9fa(%rip), %rcx     # 0x73df5
movq %r14, %rdi
movl $0x10, %esi
movq %rbp, %rdx
pushq $0xff
pushq %rax
callq 0x1442a
addq $0x10, %rsp
jmp 0x15270
movq (%r15), %rax
movq 0x30(%rax), %rdx
movl 0x38(%rax), %ecx
leaq 0x5e05e(%rip), %r8      # 0x73489
movq %r14, %rdi
movl $0x2e, %esi
movl $0xf0, %r9d
callq 0x14618
jmp 0x15270
movq (%r15), %rax
movq 0x30(%rax), %rdx
movl 0x38(%rax), %ecx
leaq 0x5e035(%rip), %r8      # 0x73489
movq %r14, %rdi
movl $0x2e, %esi
movl $0x10a, %r9d            # imm = 0x10A
jmp 0x15439
movq %r12, %rdi
callq 0x12ad0
movq (%r15), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0x5e00b(%rip), %r10     # 0x73489
leaq 0x5e970(%rip), %rcx     # 0x73df5
movq %r14, %rdi
movl $0x13, %esi
movq %rax, %rdx
pushq $0x112                  # imm = 0x112
pushq %r10
jmp 0x1540c