// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_reg_alloc.c
// Function: subtilis_arm_save_regs
void subtilis_arm_save_regs(subtilis_arm_section_t *arm_s,
			    subtilis_error_t *err)
{
	size_t i;
	size_t start;
	size_t end;
	size_t int_regs_used;
	size_t real_regs_used;
	subtilis_arm_call_site_t *call_site;
	subtilis_regs_used_t regs_used_before;
	subtilis_regs_used_t regs_used_after;
	subtilis_arm_mtran_instr_t *mtran;
	subtilis_arm_op_t *op;

	for (i = 0; i < arm_s->call_site_count; i++) {
		call_site = &arm_s->call_sites[i];
		start = arm_s->op_pool->ops[call_site->ldm_site].next;
		end = arm_s->op_pool->ops[call_site->stm_site].prev;

		if (start == SIZE_MAX || end == SIZE_MAX) {
			op = &arm_s->op_pool->ops[call_site->stm_site];
			mtran = &op->op.instr.operands.mtran;
			prv_update_arg_offsets(arm_s, call_site,
					       mtran->reg_list, 0, err);
			if (err->type != SUBTILIS_ERROR_OK)
				return;
			continue;
		}

		subtilis_arm_regs_used_before(
		    arm_s, &arm_s->op_pool->ops[end], call_site->int_args,
		    call_site->real_args, &regs_used_before, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;

		subtilis_arm_regs_used_after(
		    arm_s, &arm_s->op_pool->ops[start], call_site->int_args,
		    call_site->real_args, &regs_used_after, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;

		prv_compute_regs_used(arm_s, call_site, regs_used_before,
				      regs_used_after, &int_regs_used,
				      &real_regs_used, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;

		prv_update_arg_offsets(arm_s, call_site, int_regs_used,
				       real_regs_used, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, %r14
xorl %r15d, %r15d
xorl %eax, %eax
movq %rax, 0x10(%rsp)
cmpq 0x40(%r14), %rax
jae 0x51b16
movq 0x38(%r14), %rax
movq 0x50(%r14), %r13
leaq (%r15,%r13), %r8
movq (%rax), %rsi
imulq $0x68, (%r13,%r15), %rax
movq 0x58(%rsi,%rax), %r12
imulq $0x68, 0x8(%r13,%r15), %rax
cmpq $-0x1, %r12
je 0x51a85
movq 0x60(%rsi,%rax), %rcx
cmpq $-0x1, %rcx
je 0x51a85
movq %r8, 0x8(%rsp)
imulq $0x68, %rcx, %rax
addq %rax, %rsi
movq 0x20(%r13,%r15), %rdx
movq 0x28(%r13,%r15), %rcx
movq %r14, %rdi
leaq 0x28(%rsp), %r8
movq %rbx, %r9
callq 0x51568
cmpl $0x0, (%rbx)
jne 0x51b16
movq 0x38(%r14), %rax
imulq $0x68, %r12, %rsi
addq (%rax), %rsi
movq 0x20(%r13,%r15), %rdx
movq 0x28(%r13,%r15), %rcx
movq %r14, %rdi
leaq 0x18(%rsp), %r8
movq %rbx, %r9
callq 0x51851
cmpl $0x0, (%rbx)
jne 0x51b16
movq 0x30(%rsp), %rax
movq 0x18(%rsp), %rdx
movq 0x38(%r14), %rcx
movq (%rcx), %rsi
andq 0x28(%rsp), %rdx
imulq $0x68, 0x8(%r13,%r15), %rdi
orq 0x20(%rsi,%rdi), %rdx
imulq $0x68, 0x30(%r13,%r15), %rcx
movl 0x18(%rsi,%rcx), %ecx
movq %rdx, %rbp
andq $-0x2, %rbp
cmpl $0x1, %ecx
cmovneq %rdx, %rbp
movq 0x20(%rsp), %rdx
movq %rbp, 0x20(%rsi,%rdi)
imulq $0x68, (%r13,%r15), %rdi
orq %rbp, 0x20(%rsi,%rdi)
cmpq $0x7fffffff, 0x10(%r13,%r15) # imm = 0x7FFFFFFF
jne 0x51a96
xorl %r12d, %r12d
jmp 0x51ae2
addq %rax, %rsi
movq 0x20(%rsi), %rdx
movq %r14, %rdi
movq %r8, %rsi
xorl %ecx, %ecx
jmp 0x51af5
andq %rax, %rdx
movq %rdx, %r12
andq $-0x2, %r12
cmpl $0x2, %ecx
cmovneq %rdx, %r12
movq 0xc0(%r14), %rax
testq %rax, %rax
je 0x51acb
movq 0x28(%r13,%r15), %rdx
movq %r14, %rdi
movq 0x8(%rsp), %rsi
movq %r12, %rcx
movq %rbx, %r8
callq *0x38(%rax)
jmp 0x51ae2
movq %rbx, %rdi
pushq $0xf
popq %rsi
leaq 0x1e0d3(%rip), %rdx     # 0x6fbab
movl $0x8ff, %ecx            # imm = 0x8FF
callq 0x1429e
cmpl $0x0, (%rbx)
jne 0x51b16
movq %r14, %rdi
movq 0x8(%rsp), %rsi
movq %rbp, %rdx
movq %r12, %rcx
movq %rbx, %r8
callq 0x51b25
cmpl $0x0, (%rbx)
jne 0x51b16
movq 0x10(%rsp), %rax
incq %rax
addq $0xf8, %r15
jmp 0x51982
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq