// File: /workspace/github_c_makefile_star2_O2/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 $0x28, %rsp
movq %r8, (%rsp)
movl %ecx, 0x14(%rsp)
movl %edx, 0x10(%rsp)
movq %rsi, %r15
movq %rdi, 0x18(%rsp)
movq 0x18(%rdi), %rax
movq %rax, 0x8(%rsp)
xorl %r8d, %r8d
cmpq 0x80(%r15), %r8
jae 0x513bd
movq 0x40(%r15), %rax
movq 0x78(%r15), %rcx
movq %r8, %rdx
shlq $0x5, %rdx
imulq $0x68, 0x8(%rcx,%rdx), %r12
movq 0x8(%rsp), %rsi
movq 0x38(%rsi), %rsi
movslq 0x10(%rcx,%rdx), %rdi
imulq 0x50(%r15), %rax
movq 0x18(%rcx,%rdx), %rbp
addq (%rsi), %r12
cmpq %rdi, %rax
movl 0x10(%rsp), %eax
movl %eax, %ebx
cmoval 0x14(%rsp), %ebx
addl %edi, %ebx
cmpl $0x0, (%rcx,%rdx)
movq %r8, 0x20(%rsp)
je 0x512d4
movl 0x48(%r15), %eax
cmpl %ebx, %eax
setl %cl
negl %eax
cmpl %eax, %ebx
setl %al
orb %cl, %al
cmpb $0x1, %al
jne 0x51317
movq 0x18(%rsp), %rax
movq 0x8(%rax), %r13
movq (%r13), %r14
xorl %eax, %eax
cmpq %rax, %r14
je 0x5133b
movq %r13, %rcx
xorq %r15, %rcx
movq %rbp, %rdx
xorq %rax, %rdx
orq %rcx, %rdx
je 0x512cf
movq 0x8(%r13), %rcx
cmpq $0x7fffffff, (%rcx,%rax,8) # imm = 0x7FFFFFFF
je 0x51361
incq %rax
jmp 0x512a3
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 0x5131b
subq $0x8, %rsp
movq 0x10(%rsp), %rdi
movq %r12, %rsi
pushq $0xe
popq %rcx
movq %rbp, %r8
pushq $0xb
popq %r9
pushq 0x8(%rsp)
pushq %rbx
pushq %rbp
callq *0x58(%r15)
addq $0x20, %rsp
jmp 0x513b0
movl 0x68(%r15), %edx
movq 0x8(%rsp), %rdi
movq %r12, %rsi
pushq $0xe
popq %rcx
movq %rbp, %r8
pushq $0xb
popq %r9
pushq (%rsp)
pushq %rbx
callq *0x60(%r15)
addq $0x10, %rsp
jmp 0x513b0
movq 0x8(%rsp), %rdi
movq %r12, %rsi
pushq $0xe
popq %rdx
xorl %ecx, %ecx
movq (%rsp), %r8
callq 0x4d6d1
movq (%rsp), %rax
cmpl $0x0, (%rax)
movl $0x0, %eax
jne 0x513b0
jmp 0x51364
movq %rax, %r14
movl 0x68(%r15), %edx
subq $0x8, %rsp
movq 0x10(%rsp), %rdi
movq %r12, %rsi
pushq $0xe
popq %rcx
movq %rbp, %r8
pushq $0xb
popq %r9
movq 0x8(%rsp), %rbp
pushq %rbp
pushq %rbx
pushq %rax
callq *0x58(%r15)
addq $0x20, %rsp
cmpl $0x0, (%rbp)
jne 0x513b0
cmpq (%r13), %r14
jne 0x513b0
movq 0x8(%rsp), %rdi
movq %r12, %rsi
pushq $0xe
popq %rdx
xorl %ecx, %ecx
movq (%rsp), %r8
callq 0x4d717
movq 0x20(%rsp), %r8
incq %r8
jmp 0x51222
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq