// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/frontend/float64_type.c
// Function: prv_sgn
static subtilis_exp_t *prv_sgn(subtilis_parser_t *p, subtilis_exp_t *e,
			       subtilis_error_t *err)
{
	subtilis_ir_operand_t less_zero;
	subtilis_ir_operand_t gte_zero;
	size_t reg;
	size_t reg2;
	subtilis_ir_operand_t op1;
	subtilis_ir_operand_t op2;

	less_zero.label = subtilis_ir_section_new_label(p->current);
	gte_zero.label = subtilis_ir_section_new_label(p->current);

	op2.real = 0.0;
	reg = subtilis_ir_section_add_instr(
	    p->current, SUBTILIS_OP_INSTR_LTI_REAL, e->exp.ir_op, op2, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

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

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

	reg2 = subtilis_ir_section_add_instr(
	    p->current, SUBTILIS_OP_INSTR_GTI_REAL, e->exp.ir_op, op2, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	e->exp.ir_op.reg = reg2;
	e->type.type = SUBTILIS_TYPE_INTEGER;

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

	subtilis_type_if_assign_to_reg(p, reg, e, err);
	e = NULL;
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

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

	return subtilis_exp_new_int32_var(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 -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)
xorps %xmm0, %xmm0
movsd %xmm0, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %r8
movq 0x148(%rax), %rdx
movq -0x50(%rbp), %rcx
movl $0x3e, %esi
callq 0x38230
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x4cf15
jmp 0x4d03d
movq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x20(%rbp), %r9
movq -0x48(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %r8
movl $0x43, %esi
callq 0x38360
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x4cf4d
jmp 0x4d03d
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 0x4cf70
jmp 0x4d03d
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %r8
movq 0x148(%rax), %rdx
movq -0x50(%rbp), %rcx
movl $0x36, %esi
callq 0x38230
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x4cfa7
jmp 0x4d03d
movq -0x40(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x148(%rax)
movq -0x18(%rbp), %rax
movl $0x5, (%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x49bb0
movq %rax, -0x18(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x4cfe0
jmp 0x4d03d
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x47ea0
movq $0x0, -0x18(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x4d008
jmp 0x4d03d
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 0x4d028
jmp 0x4d03d
movq -0x38(%rbp), %rax
movl %eax, %edi
movq -0x20(%rbp), %rsi
callq 0x37770
movq %rax, -0x8(%rbp)
jmp 0x4d04e
movq -0x18(%rbp), %rdi
callq 0x36ee0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)