// File: /workspace/github_c_makefile_star2_O2/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 $0xd8, %rsp
movl %edx, %ebx
movl %esi, %r15d
leaq 0x110(%rsp), %rbp
movl 0x8(%rbp), %r12d
movq %rdi, 0x58(%rsp)
movl %r12d, %ecx
callq 0xb45a
movl 0x4(%rbp), %r13d
leaq 0xc0(%rsp), %r14
movq %r14, %rdi
movl %r15d, %esi
movl %r13d, %edx
movl %r12d, %ecx
callq 0xb45a
movl (%rbp), %eax
movq %rax, 0x60(%rsp)
decl %eax
movl %eax, 0x40(%rsp)
cvtsi2ss %eax, %xmm1
leal -0x1(%r15), %eax
movq %rax, 0x28(%rsp)
cvtsi2ss %eax, %xmm0
divss %xmm0, %xmm1
movss %xmm1, 0x38(%rsp)
movq %rbx, 0x30(%rsp)
leal -0x1(%rbx), %eax
movl %eax, 0x70(%rsp)
cvtsi2ss %eax, %xmm0
movss %xmm0, 0x6c(%rsp)
leal -0x1(%r13), %eax
movl %eax, 0x68(%rsp)
movslq (%r14), %rcx
movslq 0x4(%r14), %rdx
movq 0x10(%r14), %rax
movq %rax, 0x78(%rsp)
xorl %eax, %eax
testl %r15d, %r15d
cmovlel %eax, %r15d
testl %r13d, %r13d
movl $0x0, %esi
movq %r13, 0xa8(%rsp)
cmovgl %r13d, %esi
movq %rsi, 0xb0(%rsp)
movq %rcx, %r13
movl 0x8(%r14), %ecx
movl %ecx, 0x1c(%rsp)
testl %r12d, %r12d
cmovlel %eax, %r12d
movl %r12d, 0x24(%rsp)
xorl %eax, %eax
movq %rdx, 0x50(%rsp)
movl %edx, %ecx
imull %r13d, %ecx
movl %ecx, 0x74(%rsp)
xorl %ebp, %ebp
movq %r15, 0xb8(%rsp)
cmpl 0x24(%rsp), %ebp
je 0xc667
movq %rax, 0xa0(%rsp)
xorl %r14d, %r14d
cmpq 0xb0(%rsp), %r14
je 0xc654
movl %eax, 0x18(%rsp)
movl %eax, %eax
movq 0x78(%rsp), %rcx
leaq (%rcx,%rax,4), %rax
movq %rax, 0x48(%rsp)
xorl %ebx, %ebx
cmpq %rbx, %r15
je 0xc645
cmpl $0x1, 0x60(%rsp)
sete %al
cmpq %rbx, 0x28(%rsp)
sete %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0xc56c
leaq 0x110(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0x10(%rsp)
movups (%rcx), %xmm0
movups %xmm0, (%rsp)
movl 0x40(%rsp), %edi
movl %r14d, %esi
movl %ebp, %edx
callq 0xb589
jmp 0xc621
cvtsi2ss %ebx, %xmm1
mulss 0x38(%rsp), %xmm1
movq %r13, %r15
cvttss2si %xmm1, %r13d
cvttps2dq %xmm1, %xmm0
cvtdq2ps %xmm0, %xmm0
subss %xmm0, %xmm1
movaps %xmm1, 0x80(%rsp)
movss 0x3fa6f(%rip), %xmm0    # 0x4c008
subss %xmm1, %xmm0
movss %xmm0, 0x90(%rsp)
leaq 0x110(%rsp), %r12
movq 0x10(%r12), %rax
movq %rax, 0x10(%rsp)
movups (%r12), %xmm0
movups %xmm0, (%rsp)
movl %r13d, %edi
movl %r14d, %esi
movl %ebp, %edx
callq 0xb589
movss %xmm0, 0x20(%rsp)
incl %r13d
movq 0x10(%r12), %rax
movq %rax, 0x10(%rsp)
movups (%r12), %xmm0
movups %xmm0, (%rsp)
movl %r13d, %edi
movq %r15, %r13
movq 0xb8(%rsp), %r15
movl %r14d, %esi
movl %ebp, %edx
callq 0xb589
mulss 0x80(%rsp), %xmm0
movss 0x20(%rsp), %xmm1
mulss 0x90(%rsp), %xmm1
addss %xmm0, %xmm1
movaps %xmm1, %xmm0
cmpq %r13, %rbx
jge 0xc63d
cmpq 0x50(%rsp), %r14
jge 0xc63d
cmpl %ebp, 0x1c(%rsp)
jle 0xc63d
movq 0x48(%rsp), %rax
movss %xmm0, (%rax,%rbx,4)
incq %rbx
jmp 0xc521
incq %r14
movl 0x18(%rsp), %eax
addl %r13d, %eax
jmp 0xc4fd
incl %ebp
movq 0xa0(%rsp), %rax
addl 0x74(%rsp), %eax
jmp 0xc4e8
cvtsi2ssl 0x68(%rsp), %xmm0
divss 0x6c(%rsp), %xmm0
movss %xmm0, 0x1c(%rsp)
movq 0x58(%rsp), %rax
movslq (%rax), %rcx
movslq 0x4(%rax), %rdx
movq 0x10(%rax), %rsi
movq %rsi, 0x48(%rsp)
movl 0x8(%rax), %eax
movl %eax, 0x20(%rsp)
xorl %esi, %esi
movq 0x30(%rsp), %rax
testl %eax, %eax
cmovlel %esi, %eax
movq %rax, 0x30(%rsp)
movl 0x70(%rsp), %eax
movq %rax, 0x40(%rsp)
movq %rdx, 0x80(%rsp)
movl %edx, %eax
movq %rcx, 0x28(%rsp)
imull %ecx, %eax
movl %eax, 0x18(%rsp)
xorl %ebp, %ebp
cmpl 0x24(%rsp), %ebp
je 0xc81e
movq %rsi, 0x38(%rsp)
movl %esi, %eax
xorl %r14d, %r14d
cmpq 0x30(%rsp), %r14
je 0xc80e
movl %eax, 0x50(%rsp)
cltq
movq 0x48(%rsp), %rcx
leaq (%rcx,%rax,4), %rbx
cvtsi2ss %r14d, %xmm1
mulss 0x1c(%rsp), %xmm1
cvttss2si %xmm1, %r12d
cvttps2dq %xmm1, %xmm0
cvtdq2ps %xmm0, %xmm0
subss %xmm0, %xmm1
movss 0x3f8f0(%rip), %xmm0    # 0x4c008
movaps %xmm1, 0x90(%rsp)
subss %xmm1, %xmm0
movss %xmm0, 0x60(%rsp)
xorl %r13d, %r13d
cmpl %r13d, %r15d
je 0xc785
movq 0xd0(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0xc0(%rsp), %xmm0
movups %xmm0, (%rsp)
movl %r13d, %edi
movl %r12d, %esi
movl %ebp, %edx
callq 0xb589
mulss 0x60(%rsp), %xmm0
movq 0x58(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0x10(%rsp)
movups (%rcx), %xmm1
movups %xmm1, (%rsp)
movl %r13d, %edi
movl %r14d, %esi
movl %ebp, %edx
callq 0xb5fe
incl %r13d
jmp 0xc72d
cmpl $0x1, 0xa8(%rsp)
sete %al
cmpq 0x40(%rsp), %r14
sete %cl
orb %al, %cl
je 0xc7ac
incq %r14
movl 0x50(%rsp), %eax
addl 0x28(%rsp), %eax
jmp 0xc6db
incl %r12d
xorl %r13d, %r13d
cmpq %r13, %r15
je 0xc79c
movq 0xd0(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0xc0(%rsp), %xmm0
movups %xmm0, (%rsp)
movl %r13d, %edi
movl %r12d, %esi
movl %ebp, %edx
callq 0xb589
cmpq 0x28(%rsp), %r13
jge 0xc83f
cmpq 0x80(%rsp), %r14
jge 0xc83f
cmpl %ebp, 0x20(%rsp)
jle 0xc83f
mulss 0x90(%rsp), %xmm0
addss (%rbx,%r13,4), %xmm0
movss %xmm0, (%rbx,%r13,4)
incq %r13
jmp 0xc7b2
incl %ebp
movq 0x38(%rsp), %rsi
addl 0x18(%rsp), %esi
jmp 0xc6c7
movq 0x78(%rsp), %rdi
callq 0x3040
movq 0x58(%rsp), %rax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x42c6b(%rip), %rdi     # 0x4f4b1
leaq 0x41e6f(%rip), %rsi     # 0x4e6bc
leaq 0x42ca1(%rip), %rcx     # 0x4f4f5
pushq $0x48
popq %rdx
callq 0x31b0