// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rcx
movq 0x18(%rcx), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x18(%rcx)
movq %rax, -0x38(%rbp)
movl $0x0, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x78(%rax)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x68(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x68(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x133f0
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2d906
jmp 0x2daa4
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x78(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rsi
movq -0x28(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x37fd0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq %rcx, 0x78(%rax)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2d944
jmp 0x2daa4
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rcx
movl $0x2a, %edx
callq 0x23b50
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2d968
jmp 0x2daa4
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x20(%rbp), %r8
movq -0x38(%rbp), %rdx
movq -0x40(%rbp), %rcx
movl $0x1b, %esi
callq 0x385a0
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2d994
jmp 0x2daa4
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x20(%rbp), %rcx
movq -0x30(%rbp), %rdx
movl $0x45, %esi
callq 0x38540
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2d9bc
jmp 0x2daa4
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x39960
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2d9df
jmp 0x2daa4
movq -0x10(%rbp), %rdi
leaq 0xa6e56(%rip), %rax     # 0xd4840
movq (%rax), %rsi
movq -0x20(%rbp), %rdx
callq 0x47240
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2da08
jmp 0x2daa4
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x48(%rbp), %rax
movq -0x20(%rbp), %r8
movq -0x38(%rbp), %rdx
movq 0x148(%rax), %rcx
movl $0x1d, %esi
callq 0x385a0
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2da38
jmp 0x2daa4
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rdx
xorl %esi, %esi
callq 0x473b0
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2da52
jmp 0x2daa4
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x30(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x39960
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2da72
jmp 0x2daa4
movq -0x48(%rbp), %rdi
callq 0x36ee0
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x68(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x68(%rax)
movq -0x38(%rbp), %rax
movl %eax, %edi
movq -0x20(%rbp), %rsi
callq 0x37770
movq %rax, -0x8(%rbp)
jmp 0x2dab5
movq -0x48(%rbp), %rdi
callq 0x36ee0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nop