// File: /workspace/github_c_makefile_star2_O1/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: resize_image
image resize_image(image im, int w, int h)
{
    image resized = make_image(w, h, im.c);   
    image part = make_image(w, im.h, im.c);
    int r, c, k;
    float w_scale = (float)(im.w - 1) / (w - 1);
    float h_scale = (float)(im.h - 1) / (h - 1);
    for(k = 0; k < im.c; ++k){
        for(r = 0; r < im.h; ++r){
            for(c = 0; c < w; ++c){
                float val = 0;
                if(c == w-1 || im.w == 1){
                    val = get_pixel(im, im.w-1, r, k);
                } else {
                    float sx = c*w_scale;
                    int ix = (int) sx;
                    float dx = sx - ix;
                    val = (1 - dx) * get_pixel(im, ix, r, k) + dx * get_pixel(im, ix+1, r, k);
                }
                set_pixel(part, c, r, k, val);
            }
        }
    }
    for(k = 0; k < im.c; ++k){
        for(r = 0; r < h; ++r){
            float sy = r*h_scale;
            int iy = (int) sy;
            float dy = sy - iy;
            for(c = 0; c < w; ++c){
                float val = (1-dy) * get_pixel(part, c, iy, k);
                set_pixel(resized, c, r, k, val);
            }
            if(r == h-1 || im.h == 1) continue;
            for(c = 0; c < w; ++c){
                float val = dy * get_pixel(part, c, iy+1, k);
                add_pixel(resized, c, r, k, val);
            }
        }
    }

    free_image(part);
    return resized;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movl %esi, %r13d
movq %rdi, %r14
movslq 0x108(%rsp), %r15
movq $0x0, 0x10(%rdi)
movl %edx, 0x4(%rdi)
movl %esi, (%rdi)
movl %r15d, 0x8(%rdi)
movl %r15d, %ebx
imull %esi, %ebx
movl %ebx, %eax
movq %rdx, 0x88(%rsp)
imull %edx, %eax
movslq %eax, %rdi
movl $0x4, %esi
callq 0x3260
movq %r14, 0x80(%rsp)
movq %rax, 0x90(%rsp)
movq %rax, 0x10(%r14)
movslq 0x104(%rsp), %rax
movq %rax, 0x20(%rsp)
imull %eax, %ebx
movslq %ebx, %rdi
movl $0x4, %esi
callq 0x3260
movq %rax, 0x38(%rsp)
movl %r13d, %eax
movq %rax, 0x60(%rsp)
movq %r15, 0x48(%rsp)
testq %r15, %r15
setg 0x1e(%rsp)
movq %r13, 0x58(%rsp)
jle 0x16a3b
leaq 0x100(%rsp), %rax
movl (%rax), %r12d
leal -0x1(%r12), %ecx
leal -0x1(%r13), %eax
movl %ecx, 0x74(%rsp)
cvtsi2ss %ecx, %xmm1
cvtsi2ss %eax, %xmm0
divss %xmm0, %xmm1
movss %xmm1, 0x70(%rsp)
movq 0x20(%rsp), %rcx
testl %ecx, %ecx
setg 0x1f(%rsp)
movl %eax, %ebp
movl %ecx, %eax
imull %r13d, %eax
movl %eax, 0x6c(%rsp)
movq $0x0, 0x50(%rsp)
movq $0x0, 0x40(%rsp)
movq %rbp, 0xa0(%rsp)
movq %r12, 0x98(%rsp)
cmpl $0x0, 0x20(%rsp)
jle 0x16a0a
movq 0x50(%rsp), %rax
movl %eax, 0x34(%rsp)
movq $0x0, 0x28(%rsp)
movb 0x1f(%rsp), %r15b
testl %r13d, %r13d
jle 0x169de
movl 0x34(%rsp), %eax
movq 0x38(%rsp), %rcx
leaq (%rcx,%rax,4), %rax
movq %rax, 0xa8(%rsp)
andb 0x1e(%rsp), %r15b
xorl %r13d, %r13d
cmpl $0x1, %r12d
sete %al
cmpq %r13, %rbp
sete %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x16901
leaq 0x100(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0x10(%rsp)
movups (%rcx), %xmm0
movups %xmm0, (%rsp)
movl 0x74(%rsp), %edi
movq 0x28(%rsp), %rsi
movq 0x40(%rsp), %rdx
callq 0x15476
jmp 0x169bc
xorps %xmm1, %xmm1
cvtsi2ss %r13d, %xmm1
mulss 0x70(%rsp), %xmm1
cvttss2si %xmm1, %r12d
cvttps2dq %xmm1, %xmm0
cvtdq2ps %xmm0, %xmm0
subss %xmm0, %xmm1
movaps %xmm1, 0xb0(%rsp)
movss 0x3c6d9(%rip), %xmm0    # 0x53008
subss %xmm1, %xmm0
movss %xmm0, 0x7c(%rsp)
leaq 0x100(%rsp), %rbp
movq 0x10(%rbp), %rax
movq %rax, 0x10(%rsp)
movups (%rbp), %xmm0
movups %xmm0, (%rsp)
movl %r12d, %edi
movq 0x28(%rsp), %rbx
movl %ebx, %esi
movq 0x40(%rsp), %r14
movl %r14d, %edx
callq 0x15476
movss %xmm0, 0x78(%rsp)
incl %r12d
movq 0x10(%rbp), %rax
movq %rax, 0x10(%rsp)
movups (%rbp), %xmm0
movups %xmm0, (%rsp)
movl %r12d, %edi
movq 0x98(%rsp), %r12
movq 0xa0(%rsp), %rbp
movl %ebx, %esi
movl %r14d, %edx
callq 0x15476
mulss 0xb0(%rsp), %xmm0
movss 0x78(%rsp), %xmm1
mulss 0x7c(%rsp), %xmm1
addss %xmm0, %xmm1
movaps %xmm1, %xmm0
testb $0x1, %r15b
je 0x169d0
movq 0xa8(%rsp), %rax
movss %xmm0, (%rax,%r13,4)
incq %r13
cmpq %r13, 0x60(%rsp)
jne 0x168bd
movq 0x28(%rsp), %rdx
incq %rdx
movq 0x20(%rsp), %rax
cmpq %rax, %rdx
setl %r15b
movq 0x58(%rsp), %r13
addl %r13d, 0x34(%rsp)
movq %rdx, 0x28(%rsp)
cmpq %rax, %rdx
jne 0x16897
movq 0x40(%rsp), %rdx
incq %rdx
movq 0x48(%rsp), %rax
cmpq %rax, %rdx
setb 0x1e(%rsp)
movq 0x50(%rsp), %rcx
addl 0x6c(%rsp), %ecx
movq %rcx, 0x50(%rsp)
movq %rdx, 0x40(%rsp)
cmpq %rax, %rdx
jne 0x16875
cmpl $0x0, 0x48(%rsp)
setg %al
jle 0x16bd3
movq 0x20(%rsp), %rcx
decl %ecx
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
movq 0x88(%rsp), %rsi
leal -0x1(%rsi), %ecx
xorps %xmm1, %xmm1
cvtsi2ss %ecx, %xmm1
divss %xmm1, %xmm0
movl %ecx, %ecx
movl %esi, %edx
imull %r13d, %esi
movl %esi, 0x28(%rsp)
xorl %edi, %edi
movl $0x1, %r8d
movss 0x3c57f(%rip), %xmm1    # 0x53008
xorl %r9d, %r9d
xorl %r10d, %r10d
cmpl $0x0, 0x88(%rsp)
jle 0x16bac
notb %al
movl %r9d, %r11d
xorl %ebx, %ebx
movslq %r11d, %r14
xorps %xmm2, %xmm2
cvtsi2ss %ebx, %xmm2
movq 0x90(%rsp), %rsi
leaq (%rsi,%r14,4), %r14
mulss %xmm0, %xmm2
cvttss2si %xmm2, %r15d
cvttps2dq %xmm2, %xmm3
cvtdq2ps %xmm3, %xmm3
subss %xmm3, %xmm2
testl %r13d, %r13d
jle 0x16b25
cmpl %r15d, 0x20(%rsp)
setle %bpl
orb %al, %bpl
testb $0x1, %bpl
jne 0x16bfc
movaps %xmm1, %xmm3
subss %xmm2, %xmm3
leal (%rdi,%r15), %ebp
imull 0x58(%rsp), %ebp
movslq %ebp, %r12
movq 0x38(%rsp), %rsi
leaq (%rsi,%r12,4), %r12
xorl %r13d, %r13d
movq 0x60(%rsp), %rsi
movss (%r12,%r13,4), %xmm4
mulss %xmm3, %xmm4
movss %xmm4, (%r14,%r13,4)
incq %r13
cmpq %r13, %rsi
jne 0x16b0d
movq 0x58(%rsp), %rsi
testl %esi, %esi
setle %bpl
cmpl $0x1, 0x20(%rsp)
sete %r12b
cmpq %rcx, %rbx
sete %r13b
orb %r12b, %r13b
orb %bpl, %r13b
movq %rsi, %r13
jne 0x16b9d
leal 0x1(%r15), %ebp
cmpl %ebp, 0x20(%rsp)
setle %bpl
orb %al, %bpl
testb $0x1, %bpl
jne 0x16bfc
addl %r8d, %r15d
imull %r13d, %r15d
movslq %r15d, %r15
movq 0x38(%rsp), %rsi
leaq (%rsi,%r15,4), %r15
xorl %r12d, %r12d
movq 0x60(%rsp), %rsi
movss (%r15,%r12,4), %xmm3
mulss %xmm2, %xmm3
addss (%r14,%r12,4), %xmm3
movss %xmm3, (%r14,%r12,4)
incq %r12
cmpq %r12, %rsi
jne 0x16b7f
incq %rbx
addl %r13d, %r11d
cmpq %rdx, %rbx
jne 0x16aa4
incq %r10
movq 0x48(%rsp), %rsi
cmpq %rsi, %r10
setb %al
addl 0x28(%rsp), %r9d
movq 0x20(%rsp), %r11
addl %r11d, %edi
addl %r11d, %r8d
cmpq %rsi, %r10
jne 0x16a8f
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x16be2
callq 0x3040
movq 0x80(%rsp), %rax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3f8ba(%rip), %rdi     # 0x564bd
leaq 0x3eaba(%rip), %rsi     # 0x556c4
leaq 0x3f8ca(%rip), %rcx     # 0x564db
movl $0x31, %edx
callq 0x31c0