// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: rotate_crop_image
image rotate_crop_image(image im, float rad, float s, int w, int h, float dx, float dy, float aspect)
{
    int x, y, c;
    float cx = im.w/2.;
    float cy = im.h/2.;
    image rot = make_image(w, h, im.c);
    for(c = 0; c < im.c; ++c){
        for(y = 0; y < h; ++y){
            for(x = 0; x < w; ++x){
                float rx = cos(rad)*((x - w/2.)/s*aspect + dx/s*aspect) - sin(rad)*((y - h/2.)/s + dy/s) + cx;
                float ry = sin(rad)*((x - w/2.)/s*aspect + dx/s*aspect) + cos(rad)*((y - h/2.)/s + dy/s) + cy;
                float val = bilinear_interpolate(im, rx, ry, c);
                set_pixel(rot, x, y, c, val);
            }
        }
    }
    return rot;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movss %xmm4, 0x20(%rsp)
movss %xmm3, 0x38(%rsp)
movss %xmm2, 0x48(%rsp)
movl %esi, %r15d
movss %xmm1, 0x30(%rsp)
movss %xmm0, 0x18(%rsp)
movq %rdi, %r14
movl 0xf0(%rsp), %ebx
movl 0xf4(%rsp), %ebp
movslq 0xf8(%rsp), %r12
movl %edx, 0x4(%rdi)
movl %esi, (%rdi)
movl %r12d, 0x8(%rdi)
movl %edx, 0x28(%rsp)
movl %edx, %eax
imull %esi, %eax
movl %eax, 0x50(%rsp)
imull %r12d, %eax
movslq %eax, %rdi
movl $0x4, %esi
callq 0x3250
movq %r14, 0x60(%rsp)
movq %rax, 0x80(%rsp)
movq %rax, 0x10(%r14)
movq %r12, 0x68(%rsp)
testq %r12, %r12
jle 0x18f21
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
movsd 0x3c487(%rip), %xmm1    # 0x55148
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
xorps %xmm2, %xmm2
cvtsi2sd %ebx, %xmm2
leaq 0xf0(%rsp), %r14
mulsd %xmm1, %xmm2
cvtsd2ss %xmm2, %xmm2
xorps %xmm3, %xmm3
cvtss2sd 0x18(%rsp), %xmm3
xorps %xmm4, %xmm4
cvtsi2sd %r15d, %xmm4
mulsd %xmm1, %xmm4
movsd %xmm4, 0xb0(%rsp)
movss 0x30(%rsp), %xmm5
xorps %xmm4, %xmm4
cvtss2sd %xmm5, %xmm4
movsd %xmm4, 0x58(%rsp)
movss 0x20(%rsp), %xmm6
xorps %xmm4, %xmm4
cvtss2sd %xmm6, %xmm4
movsd %xmm4, 0xa8(%rsp)
movss 0x48(%rsp), %xmm4
divss %xmm5, %xmm4
mulss %xmm6, %xmm4
cvtss2sd %xmm4, %xmm4
movsd %xmm4, 0xa0(%rsp)
movl 0x28(%rsp), %eax
xorps %xmm4, %xmm4
cvtsi2sd %eax, %xmm4
mulsd %xmm1, %xmm4
movsd %xmm4, 0x78(%rsp)
movss 0x38(%rsp), %xmm1
divss %xmm5, %xmm1
cvtss2sd %xmm1, %xmm1
movsd %xmm1, 0x70(%rsp)
xorps %xmm1, %xmm1
cvtss2sd %xmm2, %xmm1
movsd %xmm1, 0x98(%rsp)
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x90(%rsp)
movl %eax, %eax
movq %rax, 0x88(%rsp)
movl %r15d, %ebx
movq $0x0, 0x40(%rsp)
xorl %r12d, %r12d
movl %r15d, 0x54(%rsp)
movsd %xmm3, 0x18(%rsp)
cmpl $0x0, 0x28(%rsp)
jle 0x18f05
movq 0x40(%rsp), %rax
movl %eax, 0x2c(%rsp)
xorl %r13d, %r13d
testl %r15d, %r15d
jle 0x18eea
movl 0x2c(%rsp), %eax
movq 0x80(%rsp), %rcx
leaq (%rcx,%rax,4), %rbp
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
subsd 0x78(%rsp), %xmm0
divsd 0x58(%rsp), %xmm0
addsd 0x70(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
xorl %r15d, %r15d
movaps %xmm3, %xmm0
callq 0x31e0
movsd %xmm0, 0x20(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
subsd 0xb0(%rsp), %xmm0
divsd 0x58(%rsp), %xmm0
mulsd 0xa8(%rsp), %xmm0
addsd 0xa0(%rsp), %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x33d0
mulsd 0x30(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
mulsd 0x38(%rsp), %xmm1
subsd %xmm0, %xmm1
addsd 0x98(%rsp), %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
movss %xmm0, 0x20(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x33d0
movsd %xmm0, 0x48(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x31e0
mulsd 0x30(%rsp), %xmm0
movsd 0x48(%rsp), %xmm1
mulsd 0x38(%rsp), %xmm1
addsd %xmm0, %xmm1
addsd 0x90(%rsp), %xmm1
cvtsd2ss %xmm1, %xmm1
movq 0x10(%r14), %rax
movq %rax, 0x10(%rsp)
movups (%r14), %xmm0
movups %xmm0, (%rsp)
movss 0x20(%rsp), %xmm0
movl %r12d, %edi
callq 0x1884d
movsd 0x18(%rsp), %xmm3
movss %xmm0, (%rbp,%r15,4)
incq %r15
cmpq %r15, %rbx
jne 0x18dff
incq %r13
movl 0x54(%rsp), %r15d
addl %r15d, 0x2c(%rsp)
cmpq 0x88(%rsp), %r13
jne 0x18dc3
incq %r12
movq 0x40(%rsp), %rax
addl 0x50(%rsp), %eax
movq %rax, 0x40(%rsp)
cmpq 0x68(%rsp), %r12
jne 0x18dac
movq 0x60(%rsp), %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq