// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/arch/arm32/arm_reg_alloc.c
// Function: prv_insert_spill_code
static void prv_insert_spill_code(subtilis_arm_reg_ud_t *ud,
				  subtilis_arm_reg_class_t *regs,
				  int32_t offset, int32_t arg_offset,
				  subtilis_error_t *err)
{
	size_t i;
	subtilis_spill_point_t *sp;
	subtilis_arm_op_t *current;
	int32_t basic_offset;
	subtilis_arm_section_t *arm_s = ud->arm_s;

	for (i = 0; i < regs->spill_points_count; i++) {
		sp = &regs->spill_points[i];
		current = &arm_s->op_pool->ops[sp->pos];
		if (sp->offset < regs->spilt_args * regs->reg_size)
			basic_offset = arg_offset;
		else
			basic_offset = offset;
		basic_offset += sp->offset;
		if (sp->type == SUBTILIS_SPILL_POINT_LOAD) {
			prv_insert_spill_code_load(arm_s, sp->phys, current,
						   regs, basic_offset, err);
		} else {
			prv_insert_spill_code_store(arm_s, sp->phys, current,
						    ud->int_regs, regs,
						    basic_offset, err);
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r8, 0x10(%rsp)
movl %ecx, 0x1c(%rsp)
movl %edx, 0x18(%rsp)
movq %rdi, 0x20(%rsp)
cmpq $0x0, 0x80(%rsi)
je 0x5493a
movq %rsi, %r15
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x8(%rsp)
xorl %r14d, %r14d
movq 0x40(%r15), %rax
movq 0x78(%r15), %rcx
movq %r14, %rdx
shlq $0x5, %rdx
imulq $0x68, 0x8(%rcx,%rdx), %r8
movq 0x8(%rsp), %rsi
movq 0x38(%rsi), %rsi
movslq 0x10(%rcx,%rdx), %rdi
imulq 0x50(%r15), %rax
movq 0x18(%rcx,%rdx), %r10
addq (%rsi), %r8
cmpq %rdi, %rax
movl 0x18(%rsp), %eax
movl %eax, %ebx
cmoval 0x1c(%rsp), %ebx
addl %edi, %ebx
cmpl $0x0, (%rcx,%rdx)
je 0x5481c
movl 0x48(%r15), %eax
cmpl %ebx, %eax
setl %cl
negl %eax
cmpl %eax, %ebx
setl %al
orb %cl, %al
cmpb $0x1, %al
jne 0x54864
movq 0x20(%rsp), %rax
movq 0x8(%rax), %r13
movq (%r13), %rbp
testq %rbp, %rbp
movq %r8, 0x28(%rsp)
je 0x54890
movq 0x8(%r13), %rax
xorl %r12d, %r12d
movq %r13, %rcx
xorq %r15, %rcx
movq %r10, %rdx
xorq %r12, %rdx
orq %rcx, %rdx
sete %cl
cmpq $0x7fffffff, (%rax,%r12,8) # imm = 0x7FFFFFFF
jne 0x54812
testb %cl, %cl
je 0x54893
incq %r12
cmpq %r12, %rbp
jne 0x547ee
jmp 0x5489b
movl 0x48(%r15), %eax
movl 0x6c(%r15), %edx
cmpl %ebx, %eax
setl %cl
negl %eax
cmpl %eax, %ebx
setl %al
orb %cl, %al
cmpb $0x1, %al
jne 0x54868
subq $0x8, %rsp
movl $0xb, %r9d
movq 0x10(%rsp), %rdi
movq %r8, %rsi
movl $0xe, %ecx
movq %r10, %r8
pushq 0x18(%rsp)
pushq %rbx
pushq %r10
callq *0x58(%r15)
addq $0x20, %rsp
jmp 0x5492a
movl 0x68(%r15), %edx
movl $0xb, %r9d
movq 0x8(%rsp), %rdi
movq %r8, %rsi
movl $0xe, %ecx
movq %r10, %r8
pushq 0x10(%rsp)
pushq %rbx
callq *0x60(%r15)
addq $0x10, %rsp
jmp 0x5492a
xorl %r12d, %r12d
movq %r12, %rax
cmpq %rbp, %r12
jne 0x548d5
movq 0x8(%rsp), %rdi
movq %r8, %rsi
movl $0xe, %edx
xorl %ecx, %ecx
movq 0x10(%rsp), %r12
movq %r12, %r8
movq %r10, 0x30(%rsp)
callq 0x506ca
movq 0x30(%rsp), %r10
movq 0x28(%rsp), %r8
cmpl $0x0, (%r12)
movq %rbp, %r12
movl $0x0, %eax
jne 0x5492a
movl 0x68(%r15), %edx
subq $0x8, %rsp
movl $0xb, %r9d
movq 0x10(%rsp), %rdi
movq %r8, %rsi
movl $0xe, %ecx
movq %r10, %r8
movq 0x18(%rsp), %rbp
pushq %rbp
pushq %rbx
pushq %rax
callq *0x58(%r15)
movq 0x48(%rsp), %rsi
addq $0x20, %rsp
cmpl $0x0, (%rbp)
jne 0x5492a
cmpq (%r13), %r12
jne 0x5492a
movq 0x8(%rsp), %rdi
movl $0xe, %edx
xorl %ecx, %ecx
movq 0x10(%rsp), %r8
callq 0x50724
incq %r14
cmpq 0x80(%r15), %r14
jb 0x5476c
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq