// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/frontend/parser_rnd.c
// Function: prv_rnd_var
static subtilis_exp_t *prv_rnd_var(subtilis_parser_t *p, subtilis_exp_t *e,
				   subtilis_error_t *err)
{
	size_t reg;
	subtilis_ir_section_t *fn;
	size_t zero;
	size_t one;
	size_t cond;
	subtilis_ir_operand_t op1;
	subtilis_ir_operand_t op2;
	subtilis_ir_operand_t else_label;
	subtilis_ir_operand_t zero_one_label;
	subtilis_ir_operand_t end_label;
	subtilis_ir_operand_t result;

	zero_one_label.label = subtilis_ir_section_new_label(p->current);
	else_label.label = subtilis_ir_section_new_label(p->current);
	end_label.label = subtilis_ir_section_new_label(p->current);

	result.reg = p->current->freg_counter++;
	reg = e->exp.ir_op.reg;
	subtilis_exp_delete(e);
	e = NULL;

	fn = subtilis_builtins_ir_add_1_arg_int(p, "_rnd_int",
						&subtilis_type_integer, err);
	if (err->type != SUBTILIS_ERROR_OK) {
		if (err->type != SUBTILIS_ERROR_ALREADY_DEFINED)
			goto cleanup;
		subtilis_error_init(err);
	} else {
		subtilis_builtins_ir_rnd_int(p, fn, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;
	}

	fn = subtilis_builtins_ir_add_1_arg_int(p, "_rnd_real",
						&subtilis_type_real, err);
	if (err->type != SUBTILIS_ERROR_OK) {
		if (err->type != SUBTILIS_ERROR_ALREADY_DEFINED)
			goto cleanup;
		subtilis_error_init(err);
	} else {
		subtilis_builtins_ir_rnd_real(p, fn, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;
	}

	op1.reg = reg;
	op2.integer = 0;
	zero = subtilis_ir_section_add_instr(
	    p->current, SUBTILIS_OP_INSTR_EQI_I32, op1, op2, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	op2.integer = 1;
	one = subtilis_ir_section_add_instr(
	    p->current, SUBTILIS_OP_INSTR_EQI_I32, op1, op2, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	op1.reg = zero;
	op2.reg = one;
	cond = subtilis_ir_section_add_instr(
	    p->current, SUBTILIS_OP_INSTR_OR_I32, op1, op2, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	op1.reg = cond;
	subtilis_ir_section_add_instr_reg(p->current, SUBTILIS_OP_INSTR_JMPC,
					  op1, zero_one_label, else_label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

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

	e = subtilis_parser_call_1_arg_fn(
	    p, "_rnd_real", reg, SUBTILIS_BUILTINS_MAX,
	    SUBTILIS_IR_REG_TYPE_INTEGER, &subtilis_type_real, false, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

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

	subtilis_exp_delete(e);
	e = NULL;

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

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

	e = subtilis_parser_call_1_arg_fn(
	    p, "_rnd_int", reg, SUBTILIS_BUILTINS_MAX,
	    SUBTILIS_IR_REG_TYPE_INTEGER, &subtilis_type_integer, false, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

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

	subtilis_exp_delete(e);
	e = NULL;

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

	return subtilis_exp_new_real_var(result.reg, err);

cleanup:

	subtilis_exp_delete(e);

	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rcx
movq 0x20(%rcx), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x20(%rcx)
movq %rax, -0x78(%rbp)
movq -0x18(%rbp), %rax
movq 0x148(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
callq 0x36ee0
movq $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rcx
leaq 0x7437f(%rip), %rsi     # 0xaab53
leaq 0x750f5(%rip), %rdx     # 0xab8d0
callq 0x42fb0
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x36806
movq -0x20(%rbp), %rax
cmpl $0x20, (%rax)
je 0x367fb
jmp 0x36b26
movq -0x20(%rbp), %rdi
callq 0x15670
jmp 0x36827
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x409c0
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x36825
jmp 0x36b26
jmp 0x36827
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rcx
leaq 0x74326(%rip), %rsi     # 0xaab5c
leaq 0x74f4b(%rip), %rdx     # 0xab788
callq 0x42fb0
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x36868
movq -0x20(%rbp), %rax
cmpl $0x20, (%rax)
je 0x3685d
jmp 0x36b26
movq -0x20(%rbp), %rdi
callq 0x15670
jmp 0x36889
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x40d50
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x36887
jmp 0x36b26
jmp 0x36889
movq -0x28(%rbp), %rax
movq %rax, -0x50(%rbp)
movl $0x0, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x20(%rbp), %r8
movq -0x50(%rbp), %rdx
movq -0x58(%rbp), %rcx
movl $0x2d, %esi
callq 0x38230
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x368c8
jmp 0x36b26
movl $0x1, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x20(%rbp), %r8
movq -0x50(%rbp), %rdx
movq -0x58(%rbp), %rcx
movl $0x2d, %esi
callq 0x38230
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x368ff
jmp 0x36b26
movq -0x38(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x20(%rbp), %r8
movq -0x50(%rbp), %rdx
movq -0x58(%rbp), %rcx
movl $0x26, %esi
callq 0x38230
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x3693f
jmp 0x36b26
movq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x20(%rbp), %r9
movq -0x50(%rbp), %rdx
movq -0x68(%rbp), %rcx
movq -0x60(%rbp), %r8
movl $0x43, %esi
callq 0x38360
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x36977
jmp 0x36b26
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x68(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x39960
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x3699a
jmp 0x36b26
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rdx
movq -0x20(%rbp), %rax
leaq 0x741af(%rip), %rsi     # 0xaab5c
movl $0x9, %ecx
xorl %r8d, %r8d
leaq 0x74dcc(%rip), %r9      # 0xab788
movl $0x0, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x24790
movq %rax, -0x18(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x369df
jmp 0x36b26
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %r8
movq -0x78(%rbp), %rdx
movq 0x148(%rax), %rcx
movl $0x1e, %esi
callq 0x385a0
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x36a12
jmp 0x36b26
movq -0x18(%rbp), %rdi
callq 0x36ee0
movq $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x20(%rbp), %rcx
movq -0x70(%rbp), %rdx
movl $0x45, %esi
callq 0x38540
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x36a4b
jmp 0x36b26
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x60(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x39960
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x36a6e
jmp 0x36b26
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rdx
movq -0x20(%rbp), %rax
leaq 0x740d2(%rip), %rsi     # 0xaab53
movl $0x9, %ecx
xorl %r8d, %r8d
leaq 0x74e40(%rip), %r9      # 0xab8d0
movl $0x0, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x24790
movq %rax, -0x18(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x36ab0
jmp 0x36b26
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %r8
movq -0x78(%rbp), %rdx
movq 0x148(%rax), %rcx
movl $0x51, %esi
callq 0x385a0
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x36ae0
jmp 0x36b26
movq -0x18(%rbp), %rdi
callq 0x36ee0
movq $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x70(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x39960
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x36b11
jmp 0x36b26
movq -0x78(%rbp), %rax
movl %eax, %edi
movq -0x20(%rbp), %rsi
callq 0x377d0
movq %rax, -0x8(%rbp)
jmp 0x36b37
movq -0x18(%rbp), %rdi
callq 0x36ee0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop