// File: /workspace/github_c_makefile_star2_O0/ender672[P]liboil/test.c
// Function: ref_xscale
static void ref_xscale(long double *in, long in_width, long double *out,
	long out_width, long cmp)
{
	long i, j, k, stride, taps, smp_i, start, ltrim, rtrim, start_safe,
		taps_safe, max_pos, in_pos;
	long double *tmp, *coeffs, in_val, tx;

	stride = cmp * in_width;
	tmp = malloc(stride * sizeof(long double));

	taps = calc_taps_check(in_width, out_width);
	coeffs = malloc(taps * sizeof(long double));
	max_pos = in_width - 1;
	for (i=0; i<out_width; i++) {
		smp_i = split_map_check(in_width, out_width, i, &tx);
		start = smp_i - (taps/2 - 1);

		start_safe = start;
		if (start_safe < 0) {
			start_safe = 0;
		}
		ltrim = start_safe - start;

		taps_safe = taps - ltrim;
		if (start_safe + taps_safe > max_pos) {
			taps_safe = max_pos - start_safe + 1;
		}
		rtrim = (start + taps) - (start_safe + taps_safe);

		ref_calc_coeffs(coeffs, tx, taps, ltrim, rtrim);

		for (j=0; j<cmp; j++) {
			out[i * cmp + j] = 0;
			for(k=0; k<taps_safe; k++) {
				in_pos = start_safe + k;
				in_val = in[in_pos * cmp + j];
				out[i * cmp + j] += coeffs[ltrim + k] * in_val;
			}
		}
	}

	free(tmp);
	free(coeffs);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x28(%rbp), %rax
imulq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
shlq $0x4, %rdi
callq 0x10e0
movq %rax, -0x98(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x51e0
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
shlq $0x4, %rdi
callq 0x10e0
movq %rax, -0xa0(%rbp)
movq -0x10(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x88(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0x4ddf
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rdx
leaq -0xc0(%rbp), %rcx
callq 0x5240
fld %st(0)
fstp %st(0)
fnstcw -0xca(%rbp)
movzwl -0xca(%rbp), %eax
orl $0xc00, %eax            # imm = 0xC00
movw %ax, -0xcc(%rbp)
fldcw -0xcc(%rbp)
fistpll -0xc8(%rbp)
fldcw -0xca(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x50(%rbp), %rax
movl $0x2, %ecx
cqto
idivq %rcx
movq %rax, %rcx
movq -0xd8(%rbp), %rax
subq $0x1, %rcx
subq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x78(%rbp)
jge 0x4c61
movq $0x0, -0x78(%rbp)
movq -0x78(%rbp), %rax
subq -0x60(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x50(%rbp), %rax
subq -0x68(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x78(%rbp), %rax
addq -0x80(%rbp), %rax
cmpq -0x88(%rbp), %rax
jle 0x4c9d
movq -0x88(%rbp), %rax
subq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x80(%rbp)
movq -0x60(%rbp), %rax
movq -0x50(%rbp), %rcx
addq %rcx, %rax
movq -0x78(%rbp), %rcx
movq -0x80(%rbp), %rdx
addq %rdx, %rcx
subq %rcx, %rax
movq %rax, -0x70(%rbp)
movq -0xa0(%rbp), %rdi
fldt -0xc0(%rbp)
movq -0x50(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq -0x70(%rbp), %rcx
movq %rsp, %rax
fstpt (%rax)
callq 0x52d0
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x28(%rbp), %rax
jge 0x4dcc
movq -0x18(%rbp), %rax
movq -0x30(%rbp), %rcx
movq -0x28(%rbp), %rdx
imulq %rdx, %rcx
movq -0x38(%rbp), %rdx
addq %rdx, %rcx
shlq $0x4, %rcx
fldz
fstpt (%rax,%rcx)
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x80(%rbp), %rax
jge 0x4db9
movq -0x78(%rbp), %rax
movq -0x40(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movq -0x8(%rbp), %rax
movq -0x90(%rbp), %rcx
movq -0x28(%rbp), %rdx
imulq %rdx, %rcx
movq -0x38(%rbp), %rdx
addq %rdx, %rcx
shlq $0x4, %rcx
fldt (%rax,%rcx)
fstpt -0xb0(%rbp)
movq -0xa0(%rbp), %rax
movq -0x68(%rbp), %rcx
movq -0x40(%rbp), %rdx
addq %rdx, %rcx
shlq $0x4, %rcx
fldt (%rax,%rcx)
fldt -0xb0(%rbp)
movq -0x18(%rbp), %rax
movq -0x30(%rbp), %rcx
movq -0x28(%rbp), %rdx
imulq %rdx, %rcx
movq -0x38(%rbp), %rdx
addq %rdx, %rcx
shlq $0x4, %rcx
fldt (%rax,%rcx)
fxch %st(2)
fmulp %st, %st(1)
faddp %st, %st(1)
fstpt (%rax,%rcx)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x4d1b
jmp 0x4dbb
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x4ce5
jmp 0x4dce
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x4bbc
movq -0x98(%rbp), %rdi
callq 0x1030
movq -0xa0(%rbp), %rdi
callq 0x1030
addq $0xf0, %rsp
popq %rbp
retq