// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/arch/arm32/arm_reg_alloc.c
// Function: prv_insert_spill_code_store
static void prv_insert_spill_code_store(subtilis_arm_section_t *arm_s,
					subtilis_arm_reg_t reg,
					subtilis_arm_op_t *current,
					subtilis_arm_reg_class_t *int_regs,
					subtilis_arm_reg_class_t *regs,
					int32_t offset, subtilis_error_t *err)
{
	size_t i;
	subtilis_arm_reg_t spill_reg;

	if (offset > regs->max_offset || offset < -regs->max_offset) {
		/*
		 * We need to find an integer register to act as our base
		 * when spilling the contents of reg_num.  So if we're
		 * currently spilling the contents of a floating point
		 * register we still need to use the int_regs structure
		 * to use as our base.
		 */

		for (i = 0; i < int_regs->max_regs; i++)
			if ((int_regs->phys_to_virt[i] == INT_MAX) &&
			    (int_regs != regs || i != reg))
				break;

		if (i == int_regs->max_regs) {
			/*
			 * TODO: Don't think this code has ever been tested.
			 */

			subtilis_arm_insert_push(arm_s, current,
						 SUBTILIS_ARM_CCODE_AL, 0, err);
			if (err->type != SUBTILIS_ERROR_OK)
				return;
			spill_reg = 0;
		} else {
			spill_reg = i;
		}
		regs->spill_imm(arm_s, current, regs->store_type,
				SUBTILIS_ARM_CCODE_AL, reg, 11, spill_reg,
				offset, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;

		if (i == int_regs->max_regs) {
			subtilis_arm_insert_pop(arm_s, current,
						SUBTILIS_ARM_CCODE_AL, 0, err);
			if (err->type != SUBTILIS_ERROR_OK)
				return;
		}
	} else {
		regs->stran_imm(arm_s, current, regs->store_type,
				SUBTILIS_ARM_CCODE_AL, reg, 11, offset, err);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x58, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movl %r9d, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl 0x48(%rcx), %eax
jg 0x7bb45
movl -0x34(%rbp), %eax
movq -0x30(%rbp), %rdx
xorl %ecx, %ecx
subl 0x48(%rdx), %ecx
cmpl %ecx, %eax
jge 0x7bc60
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x7bb96
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x40(%rbp), %rcx
cmpq $0x7fffffff, (%rax,%rcx,8) # imm = 0x7FFFFFFF
jne 0x7bb86
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
jne 0x7bb84
movq -0x40(%rbp), %rax
cmpq -0x18(%rbp), %rax
je 0x7bb86
jmp 0x7bb96
jmp 0x7bb88
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x7bb4d
movq -0x40(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq (%rcx), %rax
jne 0x7bbd5
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq 0x10(%rbp), %r8
movl $0xe, %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x722c0
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x7bbcb
jmp 0x7bc99
movq $0x0, -0x48(%rbp)
jmp 0x7bbdd
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rcx
movl 0x68(%rcx), %edx
movq -0x18(%rbp), %r8
movq -0x48(%rbp), %rbx
movl -0x34(%rbp), %r11d
movq 0x10(%rbp), %r10
movl $0xe, %ecx
movl $0xb, %r9d
movq %rbx, (%rsp)
movl %r11d, 0x8(%rsp)
movq %r10, 0x10(%rsp)
callq *%rax
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x7bc2a
jmp 0x7bc99
movq -0x40(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq (%rcx), %rax
jne 0x7bc5e
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq 0x10(%rbp), %r8
movl $0xe, %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x72370
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x7bc5c
jmp 0x7bc99
jmp 0x7bc5e
jmp 0x7bc99
movq -0x30(%rbp), %rax
movq 0x60(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rcx
movl 0x68(%rcx), %edx
movq -0x18(%rbp), %r8
movl -0x34(%rbp), %r11d
movq 0x10(%rbp), %r10
movl $0xe, %ecx
movl $0xb, %r9d
movl %r11d, (%rsp)
movq %r10, 0x8(%rsp)
callq *%rax
addq $0x58, %rsp
popq %rbx
popq %rbp
retq