// File: /workspace/github_c_makefile_star2_O0/ender672[P]liboil/oil_resample.c
// Function: oil_scale_init
int oil_scale_init(struct oil_scale *os, int in_height, int out_height,
	int in_width, int out_width, enum oil_colorspace cs)
{
	int taps_x, taps_y, coeffs_x_len, coeffs_y_len, borders_x_len,
		borders_y_len, rb_len, sums_len, tmp_len;

	if (!os || in_height > MAX_DIMENSION || out_height > MAX_DIMENSION ||
		in_height < 1 || out_height < 1 ||
		in_width > MAX_DIMENSION || out_width > MAX_DIMENSION ||
		in_width < 1 || out_width < 1) {
		return -1;
	}

	// Lazy perform global init, in case oil_global_ini() hasn't been
	// called yet.
	if (!s2l_map[128]) {
		oil_global_init();
	}

	taps_x = calc_taps(in_width, out_width);
	taps_y = calc_taps(in_height, out_height);

	coeffs_x_len = calc_coeffs_len(in_width, out_width);
	borders_x_len = calc_borders_len(in_width, out_width);
	coeffs_y_len = calc_coeffs_len(in_height, out_height);
	borders_y_len = calc_borders_len(in_height, out_height);
	rb_len = out_width * OIL_CMP(cs) * taps_y * sizeof(float);
	tmp_len = max(taps_x, taps_y) * sizeof(float);
	sums_len = 0;
	if (out_height <= in_height) {
		sums_len = out_width * OIL_CMP(cs) * 4 * sizeof(float);
		rb_len = out_width * OIL_CMP(cs) * sizeof(float);
	}

	memset(os, 0, sizeof(struct oil_scale));
	os->in_height = in_height;
	os->out_height = out_height;
	os->in_width = in_width;
	os->out_width = out_width;
	os->cs = cs;
	os->coeffs_x = calloc(1, coeffs_x_len);
	os->borders_x = calloc(1, borders_x_len);
	os->coeffs_y = calloc(1, coeffs_y_len);
	os->borders_y = calloc(1, borders_y_len);
	os->rb = calloc(1, rb_len);
	os->sums_y = calloc(1, sums_len);
	os->tmp_coeffs = malloc(tmp_len);

	if (!os->coeffs_x || !os->borders_x || !os->coeffs_y ||
		!os->borders_y || !os->rb || !os->tmp_coeffs ||
		(sums_len && !os->sums_y)) {
		oil_scale_free(os);
		return -2;
	}

	set_coeffs(in_width, out_width, os->coeffs_x, os->borders_x, os->tmp_coeffs);
	set_coeffs(in_height, out_height, os->coeffs_y, os->borders_y, os->tmp_coeffs);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl %r9d, -0x24(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x14e0
cmpl $0xf4240, -0x14(%rbp)   # imm = 0xF4240
jg 0x14e0
cmpl $0xf4240, -0x18(%rbp)   # imm = 0xF4240
jg 0x14e0
cmpl $0x1, -0x14(%rbp)
jl 0x14e0
cmpl $0x1, -0x18(%rbp)
jl 0x14e0
cmpl $0xf4240, -0x1c(%rbp)   # imm = 0xF4240
jg 0x14e0
cmpl $0xf4240, -0x20(%rbp)   # imm = 0xF4240
jg 0x14e0
cmpl $0x1, -0x1c(%rbp)
jl 0x14e0
cmpl $0x1, -0x20(%rbp)
jge 0x14ec
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1766
movss 0x7dbc(%rip), %xmm0     # 0x92b0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x1503
jp 0x1503
callq 0x1210
movl -0x1c(%rbp), %edi
movl -0x20(%rbp), %esi
callq 0x1770
movl %eax, -0x28(%rbp)
movl -0x14(%rbp), %edi
movl -0x18(%rbp), %esi
callq 0x1770
movl %eax, -0x2c(%rbp)
movl -0x1c(%rbp), %edi
movl -0x20(%rbp), %esi
callq 0x17b0
movl %eax, -0x30(%rbp)
movl -0x1c(%rbp), %edi
movl -0x20(%rbp), %esi
callq 0x17e0
movl %eax, -0x38(%rbp)
movl -0x14(%rbp), %edi
movl -0x18(%rbp), %esi
callq 0x17b0
movl %eax, -0x34(%rbp)
movl -0x14(%rbp), %edi
movl -0x18(%rbp), %esi
callq 0x17e0
movl %eax, -0x3c(%rbp)
movl -0x20(%rbp), %eax
movl -0x24(%rbp), %ecx
andl $0xff, %ecx
imull %ecx, %eax
imull -0x2c(%rbp), %eax
movl %eax, %eax
shlq $0x2, %rax
movl %eax, -0x40(%rbp)
movl -0x28(%rbp), %edi
movl -0x2c(%rbp), %esi
callq 0x1810
cltq
shlq $0x2, %rax
movl %eax, -0x48(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jg 0x15c9
movl -0x20(%rbp), %eax
movl -0x24(%rbp), %ecx
andl $0xff, %ecx
imull %ecx, %eax
shll $0x2, %eax
movl %eax, %eax
shlq $0x2, %rax
movl %eax, -0x44(%rbp)
movl -0x20(%rbp), %eax
movl -0x24(%rbp), %ecx
andl $0xff, %ecx
imull %ecx, %eax
movl %eax, %eax
shlq $0x2, %rax
movl %eax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
xorl %esi, %esi
movl $0x58, %edx
callq 0x1090
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movl -0x18(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0x20(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xc(%rax)
movl -0x24(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x10(%rax)
movslq -0x30(%rbp), %rsi
movl $0x1, %edi
callq 0x10b0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
movslq -0x38(%rbp), %rsi
movl $0x1, %edi
callq 0x10b0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x30(%rax)
movslq -0x34(%rbp), %rsi
movl $0x1, %edi
callq 0x10b0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movslq -0x3c(%rbp), %rsi
movl $0x1, %edi
callq 0x10b0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x38(%rax)
movslq -0x40(%rbp), %rsi
movl $0x1, %edi
callq 0x10b0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x48(%rax)
movslq -0x44(%rbp), %rsi
movl $0x1, %edi
callq 0x10b0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x40(%rax)
movslq -0x48(%rbp), %rdi
callq 0x10e0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x1707
movq -0x10(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x1707
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x1707
movq -0x10(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x1707
movq -0x10(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x1707
movq -0x10(%rbp), %rax
cmpq $0x0, 0x50(%rax)
je 0x1707
cmpl $0x0, -0x44(%rbp)
je 0x1719
movq -0x10(%rbp), %rax
cmpq $0x0, 0x40(%rax)
jne 0x1719
movq -0x10(%rbp), %rdi
callq 0x1840
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x1766
movl -0x1c(%rbp), %edi
movl -0x20(%rbp), %esi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x50(%rax), %r8
callq 0x1910
movl -0x14(%rbp), %edi
movl -0x18(%rbp), %esi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x50(%rax), %r8
callq 0x1910
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nop