// File: /workspace/github_c_makefile_star2_O1/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 %rdi, 0x18(%rsp)
cmpq $0x0, 0x80(%rsi)
je 0x54a4b
movq %rsi, %r15
movq 0x18(%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), %r11
movq 0x8(%rsp), %rsi
movq 0x38(%rsi), %rsi
movslq 0x10(%rcx,%rdx), %rdi
imulq 0x50(%r15), %rax
movq 0x18(%rcx,%rdx), %rbp
addq (%rsi), %r11
cmpq %rdi, %rax
movl 0x10(%rsp), %eax
movl %eax, %ebx
cmoval 0x14(%rsp), %ebx
addl %edi, %ebx
cmpl $0x0, (%rcx,%rdx)
je 0x54932
movl 0x48(%r15), %eax
cmpl %ebx, %eax
setl %cl
negl %eax
cmpl %eax, %ebx
setl %al
orb %cl, %al
cmpb $0x1, %al
jne 0x54979
movq 0x18(%rsp), %rax
movq 0x8(%rax), %r13
movq (%r13), %rax
testq %rax, %rax
je 0x549aa
movq 0x8(%r13), %rcx
xorl %r12d, %r12d
movq %r13, %rdx
xorq %r15, %rdx
movq %rbp, %rsi
xorq %r12, %rsi
orq %rdx, %rsi
sete %dl
cmpq $0x7fffffff, (%rcx,%r12,8) # imm = 0x7FFFFFFF
jne 0x54925
testb %dl, %dl
je 0x549ad
incq %r12
cmpq %r12, %rax
jne 0x54901
movq %rax, %r12
jmp 0x549ad
movl 0x48(%r15), %eax
cmpl %ebx, %eax
setl %cl
negl %eax
cmpl %eax, %ebx
setl %al
orb %cl, %al
cmpb $0x1, %al
jne 0x5497f
movl 0x6c(%r15), %edx
subq $0x8, %rsp
movl $0xb, %r9d
movq 0x10(%rsp), %rdi
movq %r11, %rsi
movl $0xe, %ecx
movq %rbp, %r8
pushq 0x8(%rsp)
pushq %rbx
pushq %rbp
callq *0x58(%r15)
addq $0x20, %rsp
jmp 0x54a3b
movl 0x68(%r15), %edx
jmp 0x54983
movl 0x6c(%r15), %edx
movl $0xb, %r9d
movq 0x8(%rsp), %rdi
movq %r11, %rsi
movl $0xe, %ecx
movq %rbp, %r8
pushq (%rsp)
pushq %rbx
callq *0x60(%r15)
addq $0x10, %rsp
jmp 0x54a3b
xorl %r12d, %r12d
movq %r12, %r10
cmpq %rax, %r12
movq %r11, 0x20(%rsp)
jne 0x549e6
movq 0x8(%rsp), %rdi
movq %r11, %rsi
movl $0xe, %edx
xorl %ecx, %ecx
movq (%rsp), %r8
callq 0x50866
movq 0x20(%rsp), %r11
movq (%rsp), %rax
cmpl $0x0, (%rax)
movl $0x0, %r10d
jne 0x54a3b
movl 0x68(%r15), %edx
subq $0x8, %rsp
movl $0xb, %r9d
movq 0x10(%rsp), %rdi
movq %r11, %rsi
movl $0xe, %ecx
movq %rbp, %r8
movq 0x8(%rsp), %rbp
pushq %rbp
pushq %rbx
pushq %r10
callq *0x58(%r15)
movq 0x40(%rsp), %rsi
addq $0x20, %rsp
cmpl $0x0, (%rbp)
jne 0x54a3b
cmpq (%r13), %r12
jne 0x54a3b
movq 0x8(%rsp), %rdi
movl $0xe, %edx
xorl %ecx, %ecx
movq (%rsp), %r8
callq 0x508c7
incq %r14
cmpq 0x80(%r15), %r14
jb 0x54884
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq