// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/builtins_ir.c
// Function: prv_compute_whole_part
static void
prv_compute_whole_part(subtilis_parser_t *p, subtilis_ir_operand_t str_data,
		       subtilis_ir_operand_t ptr, subtilis_ir_operand_t ret_val,
		       subtilis_ir_operand_t factor, subtilis_error_t *err)
{
	subtilis_ir_operand_t op1;
	subtilis_ir_operand_t condee;
	subtilis_ir_operand_t byte;
	subtilis_ir_operand_t bytef;
	subtilis_ir_operand_t product;
	subtilis_ir_operand_t new_ptr;
	subtilis_ir_operand_t whole_start_label;
	subtilis_ir_operand_t process_whole_label;
	subtilis_ir_operand_t skip_whole_label;

	whole_start_label.label = subtilis_ir_section_new_label(p->current);
	process_whole_label.label = subtilis_ir_section_new_label(p->current);
	skip_whole_label.label = subtilis_ir_section_new_label(p->current);

	factor.reg = subtilis_ir_section_add_instr2(
	    p->current, SUBTILIS_OP_INSTR_MOVFP, factor, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	new_ptr.reg = subtilis_ir_section_add_instr2(
	    p->current, SUBTILIS_OP_INSTR_MOV, ptr, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_ir_section_add_label(p->current, whole_start_label.label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	op1.integer = 1;
	subtilis_ir_section_add_instr_reg(
	    p->current, SUBTILIS_OP_INSTR_SUBI_I32, new_ptr, new_ptr, op1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	condee.reg = subtilis_ir_section_add_instr(
	    p->current, SUBTILIS_OP_INSTR_GTE_I32, new_ptr, str_data, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_ir_section_add_instr_reg(p->current, SUBTILIS_OP_INSTR_JMPC,
					  condee, process_whole_label,
					  skip_whole_label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_ir_section_add_label(p->current, process_whole_label.label,
				      err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	op1.integer = 0;
	byte.reg = subtilis_ir_section_add_instr(
	    p->current, SUBTILIS_OP_INSTR_LOADO_I8, new_ptr, op1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	op1.integer = '0';
	subtilis_ir_section_add_instr_reg(
	    p->current, SUBTILIS_OP_INSTR_SUBI_I32, byte, byte, op1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	bytef.reg = subtilis_ir_section_add_instr2(
	    p->current, SUBTILIS_OP_INSTR_MOV_I32_FP, byte, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	product.reg = subtilis_ir_section_add_instr(
	    p->current, SUBTILIS_OP_INSTR_MUL_REAL, bytef, factor, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	op1.real = 10.0;
	subtilis_ir_section_add_instr_reg(
	    p->current, SUBTILIS_OP_INSTR_MULI_REAL, factor, factor, op1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_ir_section_add_instr_reg(p->current,
					  SUBTILIS_OP_INSTR_ADD_REAL, ret_val,
					  ret_val, product, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_ir_section_add_instr_no_reg(p->current, SUBTILIS_OP_INSTR_JMP,
					     whole_start_label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_ir_section_add_label(p->current, skip_whole_label.label, err);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %rbx
movq %r8, %rbp
movq %rcx, 0x10(%rsp)
movq %rdx, %r15
movq %rsi, %r13
movq %rdi, %r14
movq 0x48(%rdi), %rdi
callq 0x2cc99
movq %rax, 0x8(%rsp)
movq 0x48(%r14), %rdi
callq 0x2cc99
movq %rax, %r12
movq 0x48(%r14), %rdi
callq 0x2cc99
movq %rax, (%rsp)
movq 0x48(%r14), %rdi
movl $0x1e, %esi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x2be09
cmpl $0x0, (%rbx)
jne 0x32a25
movq %rax, %rbp
movq 0x48(%r14), %rdi
movl $0x1d, %esi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x2be09
cmpl $0x0, (%rbx)
jne 0x32a25
movq %rax, %r15
movq 0x48(%r14), %rdi
movq 0x8(%rsp), %rsi
movq %rbx, %rdx
callq 0x2cca6
cmpl $0x0, (%rbx)
jne 0x32a25
movq 0x48(%r14), %rdi
movl $0x1, %r8d
movl $0xb, %esi
movq %r15, %rdx
movq %r15, %rcx
movq %rbx, %r9
callq 0x2bd42
cmpl $0x0, (%rbx)
jne 0x32a25
movq 0x48(%r14), %rdi
movl $0x3f, %esi
movq %r15, %rdx
movq %r13, %rcx
movq %rbx, %r8
callq 0x2bc8f
cmpl $0x0, (%rbx)
jne 0x32a25
movq 0x48(%r14), %rdi
movl $0x43, %esi
movq %rax, %rdx
movq %r12, %rcx
movq (%rsp), %r8
movq %rbx, %r9
callq 0x2bd42
cmpl $0x0, (%rbx)
jne 0x32a25
movq 0x48(%r14), %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x2cca6
cmpl $0x0, (%rbx)
jne 0x32a25
movq 0x48(%r14), %rdi
movl $0x11, %esi
movq %r15, %rdx
xorl %ecx, %ecx
movq %rbx, %r8
callq 0x2bc8f
cmpl $0x0, (%rbx)
jne 0x32a25
movq %rax, %r15
movq 0x48(%r14), %rdi
movl $0x30, %r8d
movl $0xb, %esi
movq %rax, %rdx
movq %rax, %rcx
movq %rbx, %r9
callq 0x2bd42
cmpl $0x0, (%rbx)
jne 0x32a25
movq 0x48(%r14), %rdi
movl $0x51, %esi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x2be09
cmpl $0x0, (%rbx)
jne 0x32a25
movq 0x48(%r14), %rdi
movl $0x5, %esi
movq %rax, %rdx
movq %rbp, %rcx
movq %rbx, %r8
callq 0x2bc8f
cmpl $0x0, (%rbx)
jne 0x32a25
movq %rax, %r15
movq 0x48(%r14), %rdi
movabsq $0x4024000000000000, %r8 # imm = 0x4024000000000000
movl $0xe, %esi
movq %rbp, %rdx
movq %rbp, %rcx
movq %rbx, %r9
callq 0x2bd42
cmpl $0x0, (%rbx)
jne 0x32a25
movq 0x48(%r14), %rdi
movl $0x1, %esi
movq 0x10(%rsp), %rcx
movq %rcx, %rdx
movq %r15, %r8
movq %rbx, %r9
callq 0x2bd42
cmpl $0x0, (%rbx)
jne 0x32a25
movq 0x48(%r14), %rdi
movl $0x45, %esi
movq 0x8(%rsp), %rdx
movq %rbx, %rcx
callq 0x2be1f
cmpl $0x0, (%rbx)
je 0x32a34
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x48(%r14), %rdi
movq (%rsp), %rsi
movq %rbx, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2cca6