// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/parser_error.c
// Function: subtilis_parser_try_exp
subtilis_exp_t *subtilis_parser_try_exp(subtilis_parser_t *p,
					subtilis_token_t *t,
					subtilis_error_t *err)
{
	subtilis_ir_operand_t handler_label;
	subtilis_ir_operand_t skip_label;
	subtilis_ir_operand_t retval;
	subtilis_ir_operand_t zero;
	subtilis_exp_t *e = NULL;

	retval.reg = p->current->reg_counter++;
	zero.integer = 0;

	handler_label.label = subtilis_ir_section_new_label(p->current);
	skip_label.label = subtilis_ir_section_new_label(p->current);

	p->level++;
	p->current->try_depth++;

	subtilis_lexer_get(p->l, t, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	p->current->handler_list = subtilis_handler_list_update(
	    p->current->handler_list, p->level, handler_label.label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_parser_compound_at_level(p, t, SUBTILIS_KEYWORD_ENDTRY, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_ir_section_add_instr_no_reg2(
	    p->current, SUBTILIS_OP_INSTR_MOVI_I32, retval, zero, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_ir_section_add_instr_no_reg(p->current, SUBTILIS_OP_INSTR_JMP,
					     skip_label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_ir_section_add_label(p->current, handler_label.label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	e = subtilis_var_lookup_var(p, subtilis_err_hidden_var, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_ir_section_add_instr_no_reg2(p->current, SUBTILIS_OP_INSTR_MOV,
					      retval, e->exp.ir_op, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_var_set_eflag(p, false, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_ir_section_add_label(p->current, skip_label.label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_exp_delete(e);

	p->current->try_depth--;

	return subtilis_exp_new_int32_var(retval.reg, err);

cleanup:
	subtilis_exp_delete(e);

	return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r13
movq %rdi, %r15
movq 0x48(%rdi), %rdi
movq 0x18(%rdi), %r14
leaq 0x1(%r14), %rax
movq %rax, 0x18(%rdi)
callq 0x2cc99
movq %rax, %rbp
movq 0x48(%r15), %rdi
callq 0x2cc99
movq %rax, %r12
incq 0x78(%r15)
movq 0x48(%r15), %rax
incq 0x68(%rax)
movq (%r15), %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x12edc
cmpl $0x0, (%rbx)
jne 0x24953
movq 0x48(%r15), %rax
movq 0x78(%r15), %rsi
movq 0x78(%rax), %rdi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x2bb24
movq 0x48(%r15), %rcx
movq %rax, 0x78(%rcx)
cmpl $0x0, (%rbx)
jne 0x24953
movq %r15, %rdi
movq %r13, %rsi
movl $0x2a, %edx
movq %rbx, %rcx
callq 0x1e2fc
cmpl $0x0, (%rbx)
je 0x2496f
xorl %r13d, %r13d
movq %r13, %rdi
callq 0x2b166
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x48(%r15), %rdi
xorl %r13d, %r13d
movl $0x1b, %esi
movq %r14, %rdx
xorl %ecx, %ecx
movq %rbx, %r8
callq 0x2be2c
cmpl $0x0, (%rbx)
jne 0x24956
movq 0x48(%r15), %rdi
movl $0x45, %esi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x2be1f
cmpl $0x0, (%rbx)
jne 0x24953
movq 0x48(%r15), %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x2cca6
cmpl $0x0, (%rbx)
jne 0x24953
leaq 0x817bf(%rip), %rax     # 0xa6180
movq (%rax), %rsi
movq %r15, %rdi
movq %rbx, %rdx
callq 0x35c45
movq %rax, %r13
cmpl $0x0, (%rbx)
jne 0x24956
movq 0x48(%r15), %rdi
movq 0x148(%r13), %rcx
movl $0x1d, %esi
movq %r14, %rdx
movq %rbx, %r8
callq 0x2be2c
cmpl $0x0, (%rbx)
jne 0x24956
movq %r15, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x35d3d
cmpl $0x0, (%rbx)
jne 0x24956
movq 0x48(%r15), %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x2cca6
cmpl $0x0, (%rbx)
jne 0x24956
movq %r13, %rdi
callq 0x2b166
movq 0x48(%r15), %rax
decq 0x68(%rax)
movl %r14d, %edi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2b71f