// File: /workspace/github_c_makefile_star2_O0/ender672[P]liboil/oil_resample.c
// Function: xscale_calc_coeffs
static void xscale_calc_coeffs(int in_width, int out_width, float *coeff_buf,
	int *border_buf, float *tmp_coeffs)
{
	int smp_i, i, j, taps, offset, pos, ltrim, rtrim, smp_end, smp_start,
		ends[4];
	float tx;

	taps = calc_taps(in_width, out_width);
	for (i=0; i<4; i++) {
		ends[i] = -1;
	}

	for (i=0; i<out_width; i++) {
		smp_i = split_map(in_width, out_width, i, &tx);

		smp_start = smp_i - (taps/2 - 1);
		smp_end = smp_i + taps/2;
		if (smp_end >= in_width) {
			smp_end = in_width - 1;
		}
		ends[i%4] = smp_end;
		border_buf[i] = smp_end - ends[(i+3)%4];

		ltrim = 0;
		if (smp_start < 0) {
			ltrim = -1 * smp_start;
		}
		rtrim = smp_start + (taps - 1) - smp_end;
		calc_coeffs(tmp_coeffs, tx, taps, ltrim, rtrim);

		for (j=ltrim; j<taps - rtrim; j++) {
			pos = smp_start + j;

			offset = 3;
			if (pos > ends[(i+3)%4]) {
				offset = 0;
			} else if (pos > ends[(i+2)%4]) {
				offset = 1;
			} else if (pos > ends[(i+1)%4]) {
				offset = 2;
			}

			coeff_buf[pos * 4 + offset] = tmp_coeffs[j];
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
callq 0x1770
movl %eax, -0x30(%rbp)
movl $0x0, -0x28(%rbp)
cmpl $0x4, -0x28(%rbp)
jge 0x22af
movslq -0x28(%rbp), %rax
movl $0xffffffff, -0x60(%rbp,%rax,4) # imm = 0xFFFFFFFF
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x2292
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x2483
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
movl -0x28(%rbp), %edx
leaq -0x64(%rbp), %rcx
callq 0x2580
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl -0x30(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x6c(%rbp), %eax
subl $0x1, %ecx
subl %ecx, %eax
movl %eax, -0x48(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x68(%rbp)
movl -0x30(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x68(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x4(%rbp), %eax
jl 0x2321
movl -0x4(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %ecx
movl -0x28(%rbp), %eax
movl $0x4, %esi
cltd
idivl %esi
movslq %edx, %rax
movl %ecx, -0x60(%rbp,%rax,4)
movl -0x44(%rbp), %eax
movl %eax, -0x70(%rbp)
movl -0x28(%rbp), %eax
addl $0x3, %eax
movl $0x4, %ecx
cltd
idivl %ecx
movl %edx, %eax
movl -0x70(%rbp), %edx
cltq
subl -0x60(%rbp,%rax,4), %edx
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl $0x0, -0x3c(%rbp)
cmpl $0x0, -0x48(%rbp)
jge 0x2377
imull $0xffffffff, -0x48(%rbp), %eax # imm = 0xFFFFFFFF
movl %eax, -0x3c(%rbp)
movl -0x48(%rbp), %eax
movl -0x30(%rbp), %ecx
subl $0x1, %ecx
addl %ecx, %eax
subl -0x44(%rbp), %eax
movl %eax, -0x40(%rbp)
movq -0x20(%rbp), %rdi
movss -0x64(%rbp), %xmm0
movl -0x30(%rbp), %esi
movl -0x3c(%rbp), %edx
movl -0x40(%rbp), %ecx
callq 0x2600
movl -0x3c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movl -0x30(%rbp), %ecx
subl -0x40(%rbp), %ecx
cmpl %ecx, %eax
jge 0x2473
movl -0x48(%rbp), %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x38(%rbp)
movl $0x3, -0x34(%rbp)
movl -0x38(%rbp), %eax
movl %eax, -0x74(%rbp)
movl -0x28(%rbp), %eax
addl $0x3, %eax
movl $0x4, %ecx
cltd
idivl %ecx
movl -0x74(%rbp), %eax
movslq %edx, %rcx
cmpl -0x60(%rbp,%rcx,4), %eax
jle 0x23ef
movl $0x0, -0x34(%rbp)
jmp 0x2443
movl -0x38(%rbp), %eax
movl %eax, -0x78(%rbp)
movl -0x28(%rbp), %eax
addl $0x2, %eax
movl $0x4, %ecx
cltd
idivl %ecx
movl -0x78(%rbp), %eax
movslq %edx, %rcx
cmpl -0x60(%rbp,%rcx,4), %eax
jle 0x2418
movl $0x1, -0x34(%rbp)
jmp 0x2441
movl -0x38(%rbp), %eax
movl %eax, -0x7c(%rbp)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl $0x4, %ecx
cltd
idivl %ecx
movl -0x7c(%rbp), %eax
movslq %edx, %rcx
cmpl -0x60(%rbp,%rcx,4), %eax
jle 0x243f
movl $0x2, -0x34(%rbp)
jmp 0x2441
jmp 0x2443
movq -0x20(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
movq -0x10(%rbp), %rax
movl -0x38(%rbp), %ecx
shll $0x2, %ecx
addl -0x34(%rbp), %ecx
movslq %ecx, %rcx
movss %xmm0, (%rax,%rcx,4)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x23a5
jmp 0x2475
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x22b6
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)