LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: threshold_image
image threshold_image(image im, float thresh)
{
    int i;
    image t = make_image(im.w, im.h, im.c);
    for(i = 0; i < im.w*im.h*im.c; ++i){
        t.data[i] = im.data[i]>thresh ? 1 : 0;
    }
    return t;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movss %xmm0, 0x4(%rsp)
movq %rdi, %rbx
movl 0x30(%rsp), %ebp
movl 0x34(%rsp), %r14d
movl 0x38(%rsp), %r15d
movl %ebp, %esi
movl %r14d, %edx
movl %r15d, %ecx
callq 0xb45a
movss 0x4(%rsp), %xmm2
imull %ebp, %r14d
imull %r15d, %r14d
movq 0x40(%rsp), %rax
movq 0x10(%rbx), %rcx
xorl %edx, %edx
testl %r14d, %r14d
cmovlel %edx, %r14d
movss 0x3f759(%rip), %xmm0    # 0x4c008
cmpq %rdx, %r14
je 0xc8ca
movaps %xmm2, %xmm1
cmpltss (%rax,%rdx,4), %xmm1
andps %xmm0, %xmm1
movss %xmm1, (%rcx,%rdx,4)
incq %rdx
jmp 0xc8af
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: transpose_image
void transpose_image(image im)
{
    assert(im.w == im.h);
    int n, m;
    int c;
    for(c = 0; c < im.c; ++c){
        for(n = 0; n < im.w-1; ++n){
            for(m = n + 1; m < im.w; ++m){
                float swap = im.data[m + im.w*(n + im.h*c)];
                im.data[m + im.w*(n + im.h*c)] = im.data[n + im.w*(m + im.h*c)];
                im.data[n + im.w*(m + im.h*c)] = swap;
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movslq 0x40(%rsp), %rax
cmpl 0x44(%rsp), %eax
jne 0xc994
leaq 0x40(%rsp), %rdi
leal -0x1(%rax), %ecx
xorl %edx, %edx
testl %ecx, %ecx
cmovlel %edx, %ecx
movl 0x8(%rdi), %esi
testl %esi, %esi
cmovlel %edx, %esi
movq 0x10(%rdi), %rdi
movq %rax, %r8
imulq %rax, %r8
shlq $0x2, %r8
leaq (,%rax,4), %r9
movq %rdi, %r11
xorl %ebx, %ebx
cmpq %rsi, %rbx
je 0xc985
movq %rdi, %r14
movq %r11, %r15
xorl %r12d, %r12d
pushq $0x1
popq %rbp
cmpq %rcx, %r12
je 0xc97a
movslq %ebp, %r13
leaq (%rdx,%r13), %r10
imulq %r9, %r10
addq %r14, %r10
cmpq %rax, %r13
jge 0xc96c
movss (%r15,%r13,4), %xmm0
movss (%r10), %xmm1
movss %xmm1, (%r15,%r13,4)
movss %xmm0, (%r10)
incq %r13
addq %r9, %r10
jmp 0xc949
incq %r12
incl %ebp
addq %r9, %r15
addq $0x4, %r14
jmp 0xc936
incq %rbx
addq %r8, %r11
addq %rax, %rdx
jmp 0xc925
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x41d14(%rip), %rdi     # 0x4e6af
leaq 0x41d1a(%rip), %rsi     # 0x4e6bc
leaq 0x41d1b(%rip), %rcx     # 0x4e6c4
movl $0x13a, %edx            # imm = 0x13A
callq 0x31b0
// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: rotate_image_cw
void rotate_image_cw(image im, int times)
{
    assert(im.w == im.h);
    times = (times + 400) % 4;
    int i, x, y, c;
    int n = im.w;
    for(i = 0; i < times; ++i){
        for(c = 0; c < im.c; ++c){
            for(x = 0; x < n/2; ++x){
                for(y = 0; y < (n-1)/2 + 1; ++y){
                    float temp = im.data[y + im.w*(x + im.h*c)];
                    im.data[y + im.w*(x + im.h*c)] = im.data[n-1-x + im.w*(y + im.h*c)];
                    im.data[n-1-x + im.w*(y + im.h*c)] = im.data[n-1-y + im.w*(n-1-x + im.h*c)];
                    im.data[n-1-y + im.w*(n-1-x + im.h*c)] = im.data[x + im.w*(n-1-y + im.h*c)];
                    im.data[x + im.w*(n-1-y + im.h*c)] = temp;
                }
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %edi, %eax
movslq 0x90(%rsp), %rdi
cmpl 0x94(%rsp), %edi
jne 0xcb74
leaq 0x90(%rsp), %rcx
addl $0x190, %eax            # imm = 0x190
pushq $0x4
popq %rsi
cltd
idivl %esi
movl %edx, %r11d
movl 0x8(%rcx), %ebx
pushq $0x2
popq %r9
movl %edi, %eax
cltd
idivl %r9d
movl %eax, %esi
leal -0x1(%rdi), %r8d
movl %r8d, %eax
cltd
idivl %r9d
movq 0x10(%rcx), %rcx
testl %eax, %eax
pushq $-0x1
popq %r10
cmovnsl %eax, %r10d
incl %r10d
xorl %edx, %edx
testl %esi, %esi
cmovlel %edx, %esi
movslq %r8d, %rax
testl %ebx, %ebx
cmovlel %edx, %ebx
movq %rbx, 0x30(%rsp)
testl %r11d, %r11d
cmovlel %edx, %r11d
movl %r11d, 0x4(%rsp)
movq %rdi, %r8
imulq %rdi, %r8
shlq $0x2, %r8
leaq (,%rdi,4), %r11
negq %r10
leaq (%rcx,%rax,4), %rdx
movq %rdx, 0x18(%rsp)
leaq 0x4(,%rdi,4), %rdx
imulq %rax, %rdx
addq %rcx, %rdx
movq %rdx, 0x10(%rsp)
movq %r11, %r15
negq %r15
imulq %rax, %rdi
movq %rcx, 0x20(%rsp)
leaq (%rcx,%rdi,4), %rax
movq %rax, 0x8(%rsp)
xorl %eax, %eax
cmpl 0x4(%rsp), %eax
je 0xcb65
movq %rax, 0x28(%rsp)
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %r13
movq 0x18(%rsp), %rbx
movq 0x20(%rsp), %rax
xorl %ecx, %ecx
cmpq 0x30(%rsp), %rcx
je 0xcb59
movq %rdi, 0x50(%rsp)
movq %r13, 0x48(%rsp)
movq %rbx, 0x40(%rsp)
movq %rax, 0x38(%rsp)
xorl %r9d, %r9d
cmpq %rsi, %r9
je 0xcb31
movq %rdi, %r12
movq %rbx, %rbp
xorl %r14d, %r14d
movq %rax, %rdx
cmpq %r14, %r10
je 0xcb1e
movss (%rdx), %xmm0
movss (%rbp), %xmm1
movss %xmm1, (%rdx)
movss (%r13,%r14,4), %xmm1
movss %xmm1, (%rbp)
movss (%r12), %xmm1
movss %xmm1, (%r13,%r14,4)
movss %xmm0, (%r12)
addq $0x4, %rdx
decq %r14
addq %r11, %rbp
addq %r15, %r12
jmp 0xcade
incq %r9
addq %r11, %rax
addq $-0x4, %rbx
addq %r15, %r13
addq $0x4, %rdi
jmp 0xcacd
incq %rcx
movq 0x38(%rsp), %rax
addq %r8, %rax
movq 0x40(%rsp), %rbx
addq %r8, %rbx
movq 0x48(%rsp), %r13
addq %r8, %r13
movq 0x50(%rsp), %rdi
addq %r8, %rdi
jmp 0xcaab
movq 0x28(%rsp), %rax
incl %eax
jmp 0xca86
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x41b34(%rip), %rdi     # 0x4e6af
leaq 0x41b3a(%rip), %rsi     # 0x4e6bc
leaq 0x41b57(%rip), %rcx     # 0x4e6e0
movl $0x14a, %edx            # imm = 0x14A
callq 0x31b0
// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: flip_image
void flip_image(image a)
{
    int i,j,k;
    for(k = 0; k < a.c; ++k){
        for(i = 0; i < a.h; ++i){
            for(j = 0; j < a.w/2; ++j){
                int index = j + a.w*(i + a.h*(k));
                int flip = (a.w - j - 1) + a.w*(i + a.h*(k));
                float swap = a.data[flip];
                a.data[flip] = a.data[index];
                a.data[index] = swap;
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl 0x40(%rsp), %edi
movslq 0x3c(%rsp), %r10
movslq 0x38(%rsp), %rcx
movl $0x2, %esi
movl %ecx, %eax
cltd
idivl %esi
movq 0x48(%rsp), %rdx
xorl %r8d, %r8d
testl %eax, %eax
cmovlel %r8d, %eax
testl %r10d, %r10d
movl $0x0, %r9d
cmovgl %r10d, %r9d
testl %edi, %edi
cmovlel %r8d, %edi
movq %rdi, -0x8(%rsp)
movq %r10, -0x10(%rsp)
imulq %rcx, %r10
shlq $0x2, %r10
leaq (,%rcx,4), %r11
leal -0x1(%rcx), %ebx
movq %rdx, %r14
cmpq -0x8(%rsp), %r8
je 0xcc58
movq %r8, %r15
imulq -0x10(%rsp), %r15
movq %r14, %r12
xorl %r13d, %r13d
cmpq %r9, %r13
je 0xcc50
leaq (%r15,%r13), %rsi
imulq %rcx, %rsi
leaq (%rdx,%rsi,4), %rbp
movl %ebx, %edi
xorl %esi, %esi
cmpq %rsi, %rax
je 0xcc48
movslq %edi, %rdi
movss (%rbp,%rdi,4), %xmm0
movss (%r12,%rsi,4), %xmm1
movss %xmm1, (%rbp,%rdi,4)
movss %xmm0, (%r12,%rsi,4)
incq %rsi
decl %edi
jmp 0xcc21
incq %r13
addq %r11, %r12
jmp 0xcc0c
incq %r8
addq %r10, %r14
jmp 0xcbf6
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: image_distance
image image_distance(image a, image b)
{
    int i,j;
    image dist = make_image(a.w, a.h, 1);
    for(i = 0; i < a.c; ++i){
        for(j = 0; j < a.h*a.w; ++j){
            dist.data[j] += pow(a.data[i*a.h*a.w+j]-b.data[i*a.h*a.w+j],2);
        }
    }
    for(j = 0; j < a.h*a.w; ++j){
        dist.data[j] = sqrt(dist.data[j]);
    }
    return dist;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movl 0x30(%rsp), %r14d
movl 0x34(%rsp), %ebp
pushq $0x1
popq %rcx
movl %r14d, %esi
movl %ebp, %edx
callq 0xb45a
movl 0x38(%rsp), %eax
imull %r14d, %ebp
movq 0x40(%rsp), %rcx
movq 0x58(%rsp), %rdx
movq 0x10(%rbx), %r14
xorl %esi, %esi
testl %ebp, %ebp
movl $0x0, %r15d
cmovgl %ebp, %r15d
testl %eax, %eax
cmovlel %esi, %eax
xorl %edi, %edi
cmpq %rax, %rdi
je 0xccfb
movslq %esi, %r9
leaq (%rcx,%r9,4), %r8
leaq (%rdx,%r9,4), %r9
xorl %r10d, %r10d
cmpq %r10, %r15
je 0xccf4
movss (%r8,%r10,4), %xmm0
subss (%r9,%r10,4), %xmm0
cvtss2sd %xmm0, %xmm0
mulsd %xmm0, %xmm0
cvtss2sd (%r14,%r10,4), %xmm1
addsd %xmm0, %xmm1
cvtsd2ss %xmm1, %xmm0
movss %xmm0, (%r14,%r10,4)
incq %r10
jmp 0xccc2
incq %rdi
addl %ebp, %esi
jmp 0xccaf
xorl %r12d, %r12d
xorps %xmm1, %xmm1
cmpq %r12, %r15
je 0xcd2a
movss (%r14,%r12,4), %xmm0
ucomiss %xmm1, %xmm0
jb 0xcd17
sqrtss %xmm0, %xmm0
jmp 0xcd1f
callq 0x32e0
xorps %xmm1, %xmm1
movss %xmm0, (%r14,%r12,4)
incq %r12
jmp 0xcd01
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: blocky_image
void blocky_image(image im, int s)
{
    int i,j,k;
    for(k = 0; k < im.c; ++k){
        for(j = 0; j < im.h; ++j){
            for(i = 0; i < im.w; ++i){
                im.data[i + im.w*(j + im.h*k)] = im.data[i/s*s + im.w*(j/s*s + im.h*k)];
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movslq 0x3c(%rsp), %rax
movslq 0x38(%rsp), %r10
xorl %ecx, %ecx
testl %r10d, %r10d
movl $0x0, %ebx
cmovgl %r10d, %ebx
testl %eax, %eax
movl $0x0, %r14d
cmovgl %eax, %r14d
movl 0x40(%rsp), %edx
testl %edx, %edx
cmovlel %ecx, %edx
movq %rdx, -0x10(%rsp)
movq 0x48(%rsp), %r12
movq %rax, -0x18(%rsp)
imulq %r10, %rax
shlq $0x2, %rax
movq %rax, -0x20(%rsp)
movq %r10, %rbp
shlq $0x2, %rbp
movq %r12, %r11
xorl %r15d, %r15d
cmpq -0x10(%rsp), %r15
je 0xd017
movq %rcx, -0x8(%rsp)
movl %ecx, %r13d
movq %r11, %r9
xorl %ecx, %ecx
cmpq %r14, %rcx
je 0xd004
xorl %esi, %esi
cmpq %rsi, %rbx
je 0xcff9
movl %esi, %eax
cltd
idivl %edi
movl %edx, %r8d
movl %ecx, %eax
cltd
idivl %edi
movl %r13d, %eax
subl %edx, %eax
imull %r10d, %eax
subl %r8d, %eax
addl %esi, %eax
cltq
movss (%r12,%rax,4), %xmm0
movss %xmm0, (%r9,%rsi,4)
incq %rsi
jmp 0xcfc6
incq %rcx
addq %rbp, %r9
incl %r13d
jmp 0xcfbf
incq %r15
addq -0x20(%rsp), %r11
movq -0x8(%rsp), %rcx
addl -0x18(%rsp), %ecx
jmp 0xcfab
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: censor_image
void censor_image(image im, int dx, int dy, int w, int h)
{
    int i,j,k;
    int s = 32;
    if(dx < 0) dx = 0;
    if(dy < 0) dy = 0;

    for(k = 0; k < im.c; ++k){
        for(j = dy; j < dy + h && j < im.h; ++j){
            for(i = dx; i < dx + w && i < im.w; ++i){
                im.data[i + im.w*(j + im.h*k)] = im.data[i/s*s + im.w*(j/s*s + im.h*k)];
                //im.data[i + j*im.w + k*im.w*im.h] = 0;
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %edi, %r14d
xorl %eax, %eax
testl %edi, %edi
cmovlel %eax, %r14d
testl %esi, %esi
cmovlel %eax, %esi
movl 0x40(%rsp), %r8d
addl %esi, %ecx
movl 0x38(%rsp), %r9d
movl 0x3c(%rsp), %edi
cmpl %edi, %ecx
cmovgel %edi, %ecx
addl %r14d, %edx
cmpl %r9d, %edx
cmovgel %r9d, %edx
movq 0x48(%rsp), %r11
movslq %edx, %rdx
movslq %r9d, %rbx
movslq %ecx, %rcx
movl %edi, -0x14(%rsp)
movslq %edi, %r10
testl %r8d, %r8d
cmovlel %eax, %r8d
movq %r8, -0x8(%rsp)
movq %rbx, %rdi
movq %rsi, -0x10(%rsp)
imulq %rsi, %rdi
leaq (%r11,%rdi,4), %r15
imulq %rbx, %r10
shlq $0x2, %r10
movq %r10, %rsi
shlq $0x2, %rbx
cmpq -0x8(%rsp), %rax
je 0xd100
movl %eax, %ebp
imull -0x14(%rsp), %ebp
movq %r15, %r12
movq -0x10(%rsp), %r13
cmpq %rcx, %r13
jge 0xd0f8
movl %r13d, %r8d
andl $0x7fffffe0, %r8d       # imm = 0x7FFFFFE0
addl %ebp, %r8d
imull %r9d, %r8d
movq %r14, %rdi
cmpq %rdx, %rdi
jge 0xd0f0
movl %edi, %r10d
andl $0x7fffffe0, %r10d      # imm = 0x7FFFFFE0
addl %r8d, %r10d
movslq %r10d, %r10
movss (%r11,%r10,4), %xmm0
movss %xmm0, (%r12,%rdi,4)
incq %rdi
jmp 0xd0ca
incq %r13
addq %rbx, %r12
jmp 0xd0b1
incq %rax
addq %rsi, %r15
jmp 0xd09b
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: collapse_image_layers
image collapse_image_layers(image source, int border)
{
    int h = source.h;
    h = (h+border)*source.c - border;
    image dest = make_image(source.w, h, 1);
    int i;
    for(i = 0; i < source.c; ++i){
        image layer = get_image_layer(source, i);
        int h_offset = i*(source.h+border);
        embed_image(layer, dest, 0, h_offset);
        free_image(layer);
    }
    return dest;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
leaq 0x80(%rsp), %r12
movl 0x4(%r12), %r13d
addl %esi, %r13d
movl (%r12), %eax
movl 0x8(%r12), %r14d
movl %r13d, %edx
imull %r14d, %edx
subl %esi, %edx
pushq $0x1
popq %rcx
movl %eax, %esi
callq 0xb45a
xorl %ebp, %ebp
testl %r14d, %r14d
cmovlel %ebp, %r14d
xorl %r15d, %r15d
cmpl %r15d, %r14d
je 0xd1b8
movq 0x10(%r12), %rax
movq %rax, 0x10(%rsp)
movups (%r12), %xmm0
movups %xmm0, (%rsp)
leaq 0x30(%rsp), %rdi
movl %r15d, %esi
callq 0xd1ca
movq 0x10(%rbx), %rax
movq %rax, 0x28(%rsp)
movups (%rbx), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x30(%rsp), %xmm0
movups %xmm0, (%rsp)
xorl %edi, %edi
movl %ebp, %esi
callq 0xb8af
movq 0x40(%rsp), %rdi
callq 0x3040
incl %r15d
addl %r13d, %ebp
jmp 0xd154
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: get_image_layer
image get_image_layer(image m, int l)
{
    image out = make_image(m.w, m.h, 1);
    int i;
    for(i = 0; i < m.h*m.w; ++i){
        out.data[i] = m.data[i+l*m.h*m.w];
    }
    return out;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
movl 0x30(%rsp), %r15d
movl 0x34(%rsp), %r14d
pushq $0x1
popq %rcx
movl %r15d, %esi
movl %r14d, %edx
callq 0xb45a
imull %r15d, %r14d
imull %r14d, %ebp
movq 0x10(%rbx), %rax
xorl %ecx, %ecx
testl %r14d, %r14d
cmovlel %ecx, %r14d
movslq %ebp, %rdx
shlq $0x2, %rdx
addq 0x40(%rsp), %rdx
cmpq %rcx, %r14
je 0xd223
movss (%rdx,%rcx,4), %xmm0
movss %xmm0, (%rax,%rcx,4)
incq %rcx
jmp 0xd20f
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: constrain_image
void constrain_image(image im)
{
    int i;
    for(i = 0; i < im.w*im.h*im.c; ++i){
        if(im.data[i] < 0) im.data[i] = 0;
        if(im.data[i] > 1) im.data[i] = 1;
    }
}

// Assembly:
movslq 0x8(%rsp), %rax
movslq 0xc(%rsp), %rcx
imulq %rax, %rcx
movslq 0x10(%rsp), %rax
imulq %rcx, %rax
movq 0x18(%rsp), %rcx
xorl %edx, %edx
movss 0x3edb1(%rip), %xmm0    # 0x4c008
cmpq %rax, %rdx
jge 0xd27b
movss (%rcx,%rdx,4), %xmm2
xorps %xmm1, %xmm1
ucomiss %xmm2, %xmm1
ja 0xd271
ucomiss %xmm0, %xmm2
movaps %xmm0, %xmm1
jbe 0xd276
movss %xmm1, (%rcx,%rdx,4)
incq %rdx
jmp 0xd257
retq
// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: normalize_image
void normalize_image(image p)
{
    int i;
    float min = 9999999;
    float max = -999999;

    for(i = 0; i < p.h*p.w*p.c; ++i){
        float v = p.data[i];
        if(v < min) min = v;
        if(v > max) max = v;
    }
    if(max - min < .000000001){
        min = 0;
        max = 1;
    }
    for(i = 0; i < p.c*p.w*p.h; ++i){
        p.data[i] = (p.data[i] - min)/(max-min);
    }
}

// Assembly:
movl 0x8(%rsp), %eax
imull 0xc(%rsp), %eax
imull 0x10(%rsp), %eax
movq 0x18(%rsp), %rcx
xorl %edx, %edx
testl %eax, %eax
cmovlel %edx, %eax
movss 0x3efaa(%rip), %xmm0    # 0x4c248
movss 0x3efa6(%rip), %xmm2    # 0x4c24c
cmpq %rdx, %rax
je 0xd2c6
movss (%rcx,%rdx,4), %xmm1
movaps %xmm1, %xmm3
minss %xmm2, %xmm3
maxss %xmm0, %xmm1
incq %rdx
movaps %xmm3, %xmm2
movaps %xmm1, %xmm0
jmp 0xd2a6
movaps %xmm0, %xmm1
subss %xmm2, %xmm1
cvtss2sd %xmm1, %xmm1
movsd 0x41197(%rip), %xmm3    # 0x4e470
ucomisd %xmm1, %xmm3
xorps %xmm1, %xmm1
ja 0xd2e5
movaps %xmm2, %xmm1
jbe 0xd2ef
movss 0x3ed19(%rip), %xmm0    # 0x4c008
subss %xmm1, %xmm0
xorl %edx, %edx
cmpq %rdx, %rax
je 0xd311
movss (%rcx,%rdx,4), %xmm2
subss %xmm1, %xmm2
divss %xmm0, %xmm2
movss %xmm2, (%rcx,%rdx,4)
incq %rdx
jmp 0xd2f5
retq
// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: normalize_image2
void normalize_image2(image p)
{
    float *min = calloc(p.c, sizeof(float));
    float *max = calloc(p.c, sizeof(float));
    int i,j;
    for(i = 0; i < p.c; ++i) min[i] = max[i] = p.data[i*p.h*p.w];

    for(j = 0; j < p.c; ++j){
        for(i = 0; i < p.h*p.w; ++i){
            float v = p.data[i+j*p.h*p.w];
            if(v < min[j]) min[j] = v;
            if(v > max[j]) max[j] = v;
        }
    }
    for(i = 0; i < p.c; ++i){
        if(max[i] - min[i] < .000000001){
            min[i] = 0;
            max[i] = 1;
        }
    }
    for(j = 0; j < p.c; ++j){
        for(i = 0; i < p.w*p.h; ++i){
            p.data[i+j*p.h*p.w] = (p.data[i+j*p.h*p.w] - min[j])/(max[j]-min[j]);
        }
    }
    free(min);
    free(max);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movslq 0x28(%rsp), %r15
pushq $0x4
popq %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0x3250
movq %rax, %rbx
movq %r15, %rdi
movq %r14, %rsi
callq 0x3250
movq %rax, %r14
movq 0x30(%rsp), %rax
movl 0x24(%rsp), %ecx
imull 0x20(%rsp), %ecx
xorl %esi, %esi
testl %r15d, %r15d
movl $0x0, %edx
cmovgl %r15d, %edx
xorl %edi, %edi
cmpq %rdi, %rdx
je 0xd379
movslq %esi, %rsi
movss (%rax,%rsi,4), %xmm0
movss %xmm0, (%r14,%rdi,4)
movss %xmm0, (%rbx,%rdi,4)
incq %rdi
addl %ecx, %esi
jmp 0xd35a
xorl %edi, %edi
testl %ecx, %ecx
movl $0x0, %esi
cmovgl %ecx, %esi
xorl %r8d, %r8d
cmpq %rdx, %r8
je 0xd3cc
movslq %edi, %r9
leaq (%rax,%r9,4), %r9
xorl %r10d, %r10d
cmpq %r10, %rsi
je 0xd3c5
movss (%r9,%r10,4), %xmm0
movss (%rbx,%r8,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0xd3b3
movss %xmm0, (%rbx,%r8,4)
ucomiss (%r14,%r8,4), %xmm0
jbe 0xd3c0
movss %xmm0, (%r14,%r8,4)
incq %r10
jmp 0xd397
incq %r8
addl %ecx, %edi
jmp 0xd388
xorl %edi, %edi
movsd 0x4109a(%rip), %xmm0    # 0x4e470
cmpq %rdi, %rdx
je 0xd401
movss (%r14,%rdi,4), %xmm1
subss (%rbx,%rdi,4), %xmm1
cvtss2sd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0xd3fc
andl $0x0, (%rbx,%rdi,4)
movl $0x3f800000, (%r14,%rdi,4) # imm = 0x3F800000
incq %rdi
jmp 0xd3d6
xorl %edi, %edi
xorl %r8d, %r8d
cmpq %rdx, %r8
je 0xd44a
movslq %edi, %r9
leaq (%rax,%r9,4), %r9
xorl %r10d, %r10d
cmpq %r10, %rsi
je 0xd443
movss (%r9,%r10,4), %xmm0
movss (%rbx,%r8,4), %xmm1
subss %xmm1, %xmm0
movss (%r14,%r8,4), %xmm2
subss %xmm1, %xmm2
divss %xmm2, %xmm0
movss %xmm0, (%r9,%r10,4)
incq %r10
jmp 0xd415
incq %r8
addl %ecx, %edi
jmp 0xd406
movq %rbx, %rdi
callq 0x3040
movq %r14, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x3040
// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: rgbgr_image
void rgbgr_image(image im)
{
    int i;
    for(i = 0; i < im.w*im.h; ++i){
        float swap = im.data[i];
        im.data[i] = im.data[i+im.w*im.h*2];
        im.data[i+im.w*im.h*2] = swap;
    }
}

// Assembly:
movl 0xc(%rsp), %eax
imull 0x8(%rsp), %eax
movq 0x18(%rsp), %rcx
leal (%rax,%rax), %edx
movslq %edx, %rsi
xorl %edx, %edx
testl %eax, %eax
cmovlel %edx, %eax
leaq (%rcx,%rsi,4), %rsi
cmpq %rdx, %rax
je 0xd4c6
movss (%rcx,%rdx,4), %xmm0
movss (%rsi,%rdx,4), %xmm1
movss %xmm1, (%rcx,%rdx,4)
movss %xmm0, (%rsi,%rdx,4)
incq %rdx
jmp 0xd4a8
retq
// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: show_image_layers
void show_image_layers(image p, char *name)
{
    int i;
    char buff[256];
    for(i = 0; i < p.c; ++i){
        sprintf(buff, "%s - Layer %d", name, i);
        image layer = get_image_layer(p, i);
        show_image(layer, buff, 1);
        free_image(layer);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rdi, %rbx
leaq 0x170(%rsp), %r13
movl 0x8(%r13), %r14d
leaq 0x30(%rsp), %r15
leaq 0x18(%rsp), %r12
xorl %ebp, %ebp
cmpl %r14d, %ebp
jge 0xd762
movq %r15, %rdi
leaq 0x4105a(%rip), %rsi     # 0x4e76b
movq %rbx, %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x3420
movq 0x10(%r13), %rax
movq %rax, 0x10(%rsp)
movups (%r13), %xmm0
movups %xmm0, (%rsp)
movq %r12, %rdi
movl %ebp, %esi
callq 0xd1ca
movq 0x28(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x18(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r15, %rdi
callq 0xd4c7
movq 0x28(%rsp), %rdi
callq 0x3040
incl %ebp
jmp 0xd702
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: make_random_image
image make_random_image(int w, int h, int c)
{
    image out = make_empty_image(w,h,c);
    out.data = calloc(h*w*c, sizeof(float));
    int i;
    for(i = 0; i < w*h*c; ++i){
        out.data[i] = (rand_normal() * .25) + .5;
    }
    return out;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl %edx, 0x4(%rdi)
movl %esi, (%rdi)
movl %ecx, 0x8(%rdi)
imull %esi, %edx
imull %ecx, %edx
movslq %edx, %r14
pushq $0x4
popq %rsi
movq %r14, %rdi
callq 0x3250
movq %rax, %r15
xorl %eax, %eax
testl %r14d, %r14d
cmovlel %eax, %r14d
movq %r15, 0x10(%rbx)
xorl %r12d, %r12d
cmpq %r12, %r14
je 0xd833
xorl %eax, %eax
callq 0x4cf7
cvtss2sd %xmm0, %xmm0
mulsd 0x40c3c(%rip), %xmm0    # 0x4e458
addsd 0x3e8fc(%rip), %xmm0    # 0x4c120
cvtsd2ss %xmm0, %xmm0
movss %xmm0, (%r15,%r12,4)
incq %r12
jmp 0xd804
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: place_image
void place_image(image im, int w, int h, int dx, int dy, image canvas)
{
    int x, y, c;
    for(c = 0; c < im.c; ++c){
        for(y = 0; y < h; ++y){
            for(x = 0; x < w; ++x){
                float rx = ((float)x / w) * im.w;
                float ry = ((float)y / h) * im.h;
                float val = bilinear_interpolate(im, rx, ry, c);
                set_pixel(canvas, x + dx, y + dy, c, val);
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, 0x38(%rsp)
movl %edi, %ebp
cvtsi2ss %edi, %xmm0
movss %xmm0, 0x30(%rsp)
leaq 0x80(%rsp), %rax
cvtsi2ssl (%rax), %xmm0
movss %xmm0, 0x2c(%rsp)
cvtsi2ss %esi, %xmm0
movss %xmm0, 0x24(%rsp)
movl %edx, %r15d
cvtsi2ssl 0x4(%rax), %xmm0
movss %xmm0, 0x20(%rsp)
xorl %r12d, %r12d
testl %edi, %edi
cmovlel %r12d, %ebp
leaq 0x98(%rsp), %r14
testl %esi, %esi
cmovlel %r12d, %esi
movl %esi, 0x28(%rsp)
movl 0x8(%rax), %eax
testl %eax, %eax
cmovlel %r12d, %eax
movl %eax, 0x1c(%rsp)
cmpl 0x1c(%rsp), %r12d
je 0xd962
xorl %ecx, %ecx
cmpl 0x28(%rsp), %ecx
je 0xd95a
cvtsi2ss %ecx, %xmm0
divss 0x24(%rsp), %xmm0
mulss 0x20(%rsp), %xmm0
movss %xmm0, 0x34(%rsp)
movq 0x38(%rsp), %rax
movq %rcx, 0x40(%rsp)
leal (%rcx,%rax), %r13d
xorl %ebx, %ebx
cmpl %ebx, %ebp
je 0xd94e
cvtsi2ss %ebx, %xmm0
divss 0x30(%rsp), %xmm0
mulss 0x2c(%rsp), %xmm0
leaq 0x80(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0x10(%rsp)
movups (%rcx), %xmm1
movups %xmm1, (%rsp)
movss 0x34(%rsp), %xmm1
movl %r12d, %edi
callq 0xd971
leal (%r15,%rbx), %edi
movq 0x10(%r14), %rax
movq %rax, 0x10(%rsp)
movups (%r14), %xmm1
movups %xmm1, (%rsp)
movl %r13d, %esi
movl %r12d, %edx
callq 0xb5fe
incl %ebx
jmp 0xd8f0
movq 0x40(%rsp), %rcx
incl %ecx
jmp 0xd8c0
incl %r12d
jmp 0xd8b3
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: bilinear_interpolate
static float bilinear_interpolate(image im, float x, float y, int c)
{
    int ix = (int) floorf(x);
    int iy = (int) floorf(y);

    float dx = x - ix;
    float dy = y - iy;

    float val = (1-dy) * (1-dx) * get_pixel_extend(im, ix, iy, c) + 
        dy     * (1-dx) * get_pixel_extend(im, ix, iy+1, c) + 
        (1-dy) *   dx   * get_pixel_extend(im, ix+1, iy, c) +
        dy     *   dx   * get_pixel_extend(im, ix+1, iy+1, c);
    return val;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x88, %rsp
movl %edi, %ebx
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, %xmm2
unpcklps %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
movaps %xmm2, 0x60(%rsp)
movaps %xmm1, %xmm0
callq 0x33c0
movaps %xmm0, 0x50(%rsp)
movaps 0x20(%rsp), %xmm0
callq 0x33c0
unpcklps 0x50(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
cvttps2dq %xmm0, %xmm0
cvtdq2ps %xmm0, %xmm1
movaps 0x60(%rsp), %xmm2
subps %xmm1, %xmm2
movaps %xmm2, 0x60(%rsp)
movaps 0x3e8e9(%rip), %xmm3    # 0x4c2b0
subps %xmm2, %xmm3
movaps %xmm3, 0x40(%rsp)
movaps %xmm3, %xmm1
shufps $0x55, %xmm3, %xmm1     # xmm1 = xmm1[1,1],xmm3[1,1]
movaps %xmm1, 0x20(%rsp)
movaps %xmm3, %xmm2
mulss %xmm1, %xmm2
movaps %xmm2, 0x70(%rsp)
movd %xmm0, %ebp
pshufd $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movd %xmm0, %r15d
movq 0xc0(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0xb0(%rsp), %xmm0
movups %xmm0, (%rsp)
movl %ebp, %edi
movl %r15d, %esi
movl %ebx, %edx
callq 0xb5db
movss %xmm0, 0x3c(%rsp)
movaps 0x60(%rsp), %xmm0
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movaps %xmm0, 0x50(%rsp)
movaps 0x40(%rsp), %xmm1
mulss %xmm0, %xmm1
movaps %xmm1, 0x40(%rsp)
leal 0x1(%r15), %r14d
movq 0xc0(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0xb0(%rsp), %xmm0
movups %xmm0, (%rsp)
movl %ebp, %edi
movl %r14d, %esi
movl %ebx, %edx
callq 0xb5db
mulss 0x40(%rsp), %xmm0
movss 0x3c(%rsp), %xmm1
mulss 0x70(%rsp), %xmm1
addss %xmm1, %xmm0
movss %xmm0, 0x40(%rsp)
movaps 0x20(%rsp), %xmm0
mulss 0x60(%rsp), %xmm0
movaps %xmm0, 0x20(%rsp)
incl %ebp
movq 0xc0(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0xb0(%rsp), %xmm0
movups %xmm0, (%rsp)
movl %ebp, %edi
movl %r15d, %esi
movl %ebx, %edx
callq 0xb5db
mulss 0x20(%rsp), %xmm0
addss 0x40(%rsp), %xmm0
movss %xmm0, 0x20(%rsp)
movaps 0x50(%rsp), %xmm0
mulss 0x60(%rsp), %xmm0
movaps %xmm0, 0x50(%rsp)
movq 0xc0(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0xb0(%rsp), %xmm0
movups %xmm0, (%rsp)
movl %ebp, %edi
movl %r14d, %esi
movl %ebx, %edx
callq 0xb5db
mulss 0x50(%rsp), %xmm0
addss 0x20(%rsp), %xmm0
addq $0x88, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: center_crop_image
image center_crop_image(image im, int w, int h)
{
    int m = (im.w < im.h) ? im.w : im.h;   
    image c = crop_image(im, (im.w - m) / 2, (im.h - m)/2, m, m);
    image r = resize_image(c, w, h);
    free_image(c);
    return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x38, %rsp
movl %edx, %ebx
movl %esi, %ebp
movl 0x60(%rsp), %eax
movl 0x64(%rsp), %ecx
cmpl %ecx, %eax
movl %ecx, %r8d
cmovll %eax, %r8d
movq %rdi, %r14
subl %r8d, %eax
pushq $0x2
popq %rdi
cltd
idivl %edi
movl %eax, %esi
subl %r8d, %ecx
movl %ecx, %eax
cltd
idivl %edi
movq 0x70(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movaps 0x60(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movl %eax, %edx
movl %r8d, %ecx
callq 0xdba7
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
movl %ebp, %esi
movl %ebx, %edx
callq 0xc3ee
movq 0x10(%r15), %rdi
callq 0x3040
movq %r14, %rax
addq $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: crop_image
image crop_image(image im, int dx, int dy, int w, int h)
{
    image cropped = make_image(w, h, im.c);
    int i, j, k;
    for(k = 0; k < im.c; ++k){
        for(j = 0; j < h; ++j){
            for(i = 0; i < w; ++i){
                int r = j + dy;
                int c = i + dx;
                float val = 0;
                r = constrain_int(r, 0, im.h-1);
                c = constrain_int(c, 0, im.w-1);
                val = get_pixel(im, c, r, k);
                set_pixel(cropped, i, j, k, val);
            }
        }
    }
    return cropped;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r8d, %ebp
movl %ecx, %r14d
movq %rdx, 0x38(%rsp)
movq %rsi, 0x40(%rsp)
movq %rdi, %r15
leaq 0x80(%rsp), %rbx
movl 0x8(%rbx), %r12d
movl %ecx, %esi
movl %r8d, %edx
movl %r12d, %ecx
callq 0xb45a
movl (%rbx), %eax
movl 0x4(%rbx), %ecx
decl %ecx
movl %ecx, 0x28(%rsp)
decl %eax
movl %eax, 0x2c(%rsp)
xorl %ebx, %ebx
testl %r14d, %r14d
cmovlel %ebx, %r14d
movl %r14d, 0x34(%rsp)
testl %ebp, %ebp
cmovlel %ebx, %ebp
movl %ebp, 0x24(%rsp)
testl %r12d, %r12d
cmovlel %ebx, %r12d
movl %r12d, 0x20(%rsp)
cmpl 0x20(%rsp), %ebx
je 0xdcbd
xorl %ebp, %ebp
cmpl 0x24(%rsp), %ebp
je 0xdcb6
movq 0x38(%rsp), %rax
addl %ebp, %eax
movl %eax, 0x30(%rsp)
xorl %r13d, %r13d
cmpl %r13d, 0x34(%rsp)
je 0xdcaf
movq 0x40(%rsp), %rax
leal (%rax,%r13), %r14d
movl 0x30(%rsp), %edi
xorl %esi, %esi
movl 0x28(%rsp), %edx
callq 0x4a3b
movl %eax, %r12d
movl %r14d, %edi
xorl %esi, %esi
movl 0x2c(%rsp), %edx
callq 0x4a3b
leaq 0x80(%rsp), %rdx
movq 0x10(%rdx), %rcx
movq %rcx, 0x10(%rsp)
movups (%rdx), %xmm0
movups %xmm0, (%rsp)
movl %eax, %edi
movl %r12d, %esi
movl %ebx, %edx
callq 0xb589
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm1
movups %xmm1, (%rsp)
movl %r13d, %edi
movl %ebp, %esi
movl %ebx, %edx
callq 0xb5fe
incl %r13d
jmp 0xdc39
incl %ebp
jmp 0xdc21
incl %ebx
jmp 0xdc15
movq %r15, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: rotate_image
image rotate_image(image im, float rad)
{
    int x, y, c;
    float cx = im.w/2.;
    float cy = im.h/2.;
    image rot = make_image(im.w, im.h, im.c);
    for(c = 0; c < im.c; ++c){
        for(y = 0; y < im.h; ++y){
            for(x = 0; x < im.w; ++x){
                float rx = cos(rad)*(x-cx) - sin(rad)*(y-cy) + cx;
                float ry = sin(rad)*(x-cx) + cos(rad)*(y-cy) + 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 $0x68, %rsp
movss %xmm0, 0x20(%rsp)
movq %rdi, %rbx
leaq 0xa0(%rsp), %r14
movl (%r14), %ebp
movl 0x4(%r14), %r15d
cvtsi2sd %ebp, %xmm0
movsd 0x3e155(%rip), %xmm1    # 0x4c120
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x2c(%rsp)
cvtsi2sd %r15d, %xmm0
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x28(%rsp)
movl 0x8(%r14), %r13d
movl %ebp, %esi
movl %r15d, %edx
movl %r13d, %ecx
callq 0xb45a
cvtss2sd 0x20(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
xorl %r12d, %r12d
testl %ebp, %ebp
cmovlel %r12d, %ebp
cvtss2sd 0x2c(%rsp), %xmm0
movsd %xmm0, 0x58(%rsp)
testl %r15d, %r15d
cmovlel %r12d, %r15d
movl %r15d, 0x3c(%rsp)
cvtss2sd 0x28(%rsp), %xmm0
movsd %xmm0, 0x50(%rsp)
testl %r13d, %r13d
cmovlel %r12d, %r13d
movl %r13d, 0x38(%rsp)
cmpl 0x38(%rsp), %r12d
je 0xe166
xorl %r13d, %r13d
cmpl 0x3c(%rsp), %r13d
je 0xe15e
cvtsi2ss %r13d, %xmm0
subss 0x28(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x40(%rsp)
xorl %r15d, %r15d
cmpl %r15d, %ebp
je 0xe156
movsd 0x20(%rsp), %xmm0
callq 0x31e0
cvtsi2ss %r15d, %xmm1
movsd %xmm0, 0x30(%rsp)
subss 0x2c(%rsp), %xmm1
cvtss2sd %xmm1, %xmm0
movsd %xmm0, 0x48(%rsp)
movsd 0x20(%rsp), %xmm0
callq 0x33d0
mulsd 0x40(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
mulsd 0x48(%rsp), %xmm1
subsd %xmm0, %xmm1
addsd 0x58(%rsp), %xmm1
cvtsd2ss %xmm1, %xmm0
movss %xmm0, 0x30(%rsp)
movsd 0x20(%rsp), %xmm0
callq 0x33d0
movsd %xmm0, 0x60(%rsp)
movsd 0x20(%rsp), %xmm0
callq 0x31e0
mulsd 0x40(%rsp), %xmm0
movsd 0x60(%rsp), %xmm1
mulsd 0x48(%rsp), %xmm1
addsd %xmm0, %xmm1
addsd 0x50(%rsp), %xmm1
cvtsd2ss %xmm1, %xmm1
movq 0x10(%r14), %rax
movq %rax, 0x10(%rsp)
movups (%r14), %xmm0
movups %xmm0, (%rsp)
movss 0x30(%rsp), %xmm0
movl %r12d, %edi
callq 0xd971
movq 0x10(%rbx), %rax
movq %rax, 0x10(%rsp)
movupd (%rbx), %xmm1
movupd %xmm1, (%rsp)
movl %r15d, %edi
movl %r13d, %esi
movl %r12d, %edx
callq 0xb5fe
incl %r15d
jmp 0xe073
incl %r13d
jmp 0xe050
incl %r12d
jmp 0xe042
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: best_3d_shift_r
int best_3d_shift_r(image a, image b, int min, int max)
{
    if(min == max) return min;
    int mid = floor((min + max) / 2.);
    image c1 = crop_image(b, 0, mid, b.w, b.h);
    image c2 = crop_image(b, 0, mid+1, b.w, b.h);
    float d1 = dist_array(c1.data, a.data, a.w*a.h*a.c, 10);
    float d2 = dist_array(c2.data, a.data, a.w*a.h*a.c, 10);
    free_image(c1);
    free_image(c2);
    if(d1 < d2) return best_3d_shift_r(a, b, min, mid);
    else return best_3d_shift_r(a, b, mid+1, max);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %edi, %ebx
cmpl %esi, %edi
je 0xe38f
movl %esi, %r14d
leaq 0xc8(%rsp), %rbp
leal (%r14,%rbx), %eax
cvtsi2sd %eax, %xmm0
mulsd 0x3dee1(%rip), %xmm0    # 0x4c120
callq 0x33e0
cvttsd2si %xmm0, %r15d
movl (%rbp), %r12d
movl 0x4(%rbp), %r13d
movq 0x10(%rbp), %rax
movq %rax, 0x10(%rsp)
movups (%rbp), %xmm0
movups %xmm0, (%rsp)
leaq 0x48(%rsp), %rdi
xorl %esi, %esi
movl %r15d, %edx
movl %r12d, %ecx
movl %r13d, %r8d
callq 0xdba7
movq %r15, 0x40(%rsp)
leal 0x1(%r15), %edx
movq 0x10(%rbp), %rax
movq %rax, 0x10(%rsp)
movups (%rbp), %xmm0
movups %xmm0, (%rsp)
leaq 0x60(%rsp), %r15
movq %r15, %rdi
xorl %esi, %esi
movl %edx, 0x34(%rsp)
movl %r12d, %ecx
movl %r13d, %r8d
callq 0xdba7
leaq 0x48(%rsp), %rax
movq 0x10(%rax), %r12
leaq 0xb0(%rsp), %rax
movq 0x10(%rax), %r13
movl 0x4(%rax), %ebp
imull (%rax), %ebp
imull 0x8(%rax), %ebp
pushq $0xa
popq %rcx
movq %r12, %rdi
movq %r13, %rsi
movl %ebp, %edx
callq 0x4a5b
movss %xmm0, 0x3c(%rsp)
movq 0x10(%r15), %r15
movq %r15, %rdi
movq %r13, %rsi
movl %ebp, %edx
pushq $0xa
popq %rcx
callq 0x4a5b
movss %xmm0, 0x38(%rsp)
movq %r12, %rdi
callq 0x3040
movq %r15, %rdi
callq 0x3040
movss 0x38(%rsp), %xmm0
ucomiss 0x3c(%rsp), %xmm0
jbe 0xe350
leaq 0xc8(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0x28(%rsp)
movups (%rcx), %xmm0
movups %xmm0, 0x18(%rsp)
leaq 0xb0(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0x10(%rsp)
movups (%rcx), %xmm0
movups %xmm0, (%rsp)
movl %ebx, %edi
movq 0x40(%rsp), %rsi
jmp 0xe388
leaq 0xc8(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0x28(%rsp)
movups (%rcx), %xmm0
movups %xmm0, 0x18(%rsp)
leaq 0xb0(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0x10(%rsp)
movups (%rcx), %xmm0
movups %xmm0, (%rsp)
movl 0x34(%rsp), %edi
movl %r14d, %esi
callq 0xe20c
movl %eax, %ebx
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: best_3d_shift
int best_3d_shift(image a, image b, int min, int max)
{
    int i;
    int best = 0;
    float best_distance = FLT_MAX;
    for(i = min; i <= max; i += 2){
        image c = crop_image(b, 0, i, b.w, b.h);
        float d = dist_array(c.data, a.data, a.w*a.h*a.c, 100);
        if(d < best_distance){
            best_distance = d;
            best = i;
        }
        printf("%d %f\n", i, d);
        free_image(c);
    }
    return best;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %esi, 0x2c(%rsp)
movl %edi, %ebp
leaq 0x98(%rsp), %rax
movl (%rax), %ecx
movl %ecx, 0x28(%rsp)
movl 0x4(%rax), %r15d
movl 0x84(%rsp), %r12d
imull 0x80(%rsp), %r12d
movq 0x90(%rsp), %r13
imull 0x88(%rsp), %r12d
movss 0x3de60(%rip), %xmm0    # 0x4c250
xorl %ebx, %ebx
cmpl 0x2c(%rsp), %ebp
jg 0xe488
leaq 0x98(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0x10(%rsp)
movss %xmm0, 0x24(%rsp)
movups (%rcx), %xmm0
movups %xmm0, (%rsp)
leaq 0x30(%rsp), %rdi
xorl %esi, %esi
movl %ebp, %edx
movl 0x28(%rsp), %ecx
movl %r15d, %r8d
callq 0xdba7
movq 0x40(%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
movl %r12d, %edx
pushq $0x64
popq %rcx
callq 0x4a5b
movaps %xmm0, %xmm2
movss 0x24(%rsp), %xmm1
ucomiss %xmm0, %xmm1
cmoval %ebp, %ebx
cvtss2sd %xmm0, %xmm0
minss %xmm1, %xmm2
movss %xmm2, 0x24(%rsp)
leaq 0x40310(%rip), %rdi     # 0x4e779
movl %ebp, %esi
movb $0x1, %al
callq 0x3160
movq %r14, %rdi
callq 0x3040
addl $0x2, %ebp
movss 0x24(%rsp), %xmm0
jmp 0xe3f2
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: composite_3d
void composite_3d(char *f1, char *f2, char *out, int delta)
{
    if(!out) out = "out";
    image a = load_image(f1, 0,0,0);
    image b = load_image(f2, 0,0,0);
    int shift = best_3d_shift_r(a, b, -a.h/100, a.h/100);

    image c1 = crop_image(b, 10, shift, b.w, b.h);
    float d1 = dist_array(c1.data, a.data, a.w*a.h*a.c, 100);
    image c2 = crop_image(b, -10, shift, b.w, b.h);
    float d2 = dist_array(c2.data, a.data, a.w*a.h*a.c, 100);

    if(d2 < d1 && 0){
        image swap = a;
        a = b;
        b = swap;
        shift = -shift;
        printf("swapped, %d\n", shift);
    }
    else{
        printf("%d\n", shift);
    }

    image c = crop_image(b, delta, shift, a.w, a.h);
    int i;
    for(i = 0; i < c.w*c.h; ++i){
        c.data[i] = a.data[i];
    }
    save_image(c, out);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movl %ecx, 0x34(%rsp)
movq %rdx, 0x38(%rsp)
movq %rsi, %rbx
movq %rdi, %rsi
leaq 0xa0(%rsp), %r14
xorl %r12d, %r12d
movq %r14, %rdi
xorl %edx, %edx
callq 0x10058
leaq 0x88(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x10058
movl 0x4(%r14), %ecx
pushq $-0x64
popq %rsi
movl %ecx, %eax
cltd
idivl %esi
movl %eax, %edi
pushq $0x64
popq %rbp
movl %ecx, %eax
cltd
idivl %ebp
movq 0x10(%r15), %rcx
movq %rcx, 0x28(%rsp)
movups (%r15), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x10(%r14), %rcx
movq %rcx, 0x10(%rsp)
movups (%r14), %xmm0
movups %xmm0, (%rsp)
movl %eax, %esi
callq 0xe20c
movl %eax, %r13d
movl (%r15), %ecx
movl 0x4(%r15), %r8d
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
leaq 0x70(%rsp), %rbx
pushq $0xa
popq %rsi
movq %rbx, %rdi
movl %r13d, %edx
callq 0xdba7
movq 0x10(%rbx), %rdi
movq 0x10(%r14), %rsi
movl 0x4(%r14), %edx
imull (%r14), %edx
imull 0x8(%r14), %edx
movl %ebp, %ecx
callq 0x4a5b
movl (%r15), %ecx
movl 0x4(%r15), %r8d
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
leaq 0x58(%rsp), %rbx
pushq $-0xa
popq %rsi
movq %rbx, %rdi
movl %r13d, %edx
callq 0xdba7
movq 0x10(%rbx), %rdi
movq 0x10(%r14), %rsi
movl (%r14), %ebp
movl 0x4(%r14), %ebx
movl %ebx, %edx
imull %ebp, %edx
imull 0x8(%r14), %edx
pushq $0x64
popq %rcx
callq 0x4a5b
leaq 0x42e91(%rip), %rdi     # 0x51451
movl %r13d, %esi
xorl %eax, %eax
callq 0x3160
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
leaq 0x40(%rsp), %r15
movq %r15, %rdi
movl 0x34(%rsp), %esi
movl %r13d, %edx
movl %ebp, %ecx
movl %ebx, %r8d
callq 0xdba7
movslq (%r15), %rcx
movslq 0x4(%r15), %rax
imulq %rcx, %rax
movq 0x10(%r14), %rcx
movq 0x10(%r15), %rdx
cmpq %rax, %r12
jge 0xe61d
movss (%rcx,%r12,4), %xmm0
movss %xmm0, (%rdx,%r12,4)
incq %r12
jmp 0xe607
movq 0x38(%rsp), %rax
testq %rax, %rax
leaq 0x43baa(%rip), %rdi     # 0x521d6
cmovneq %rax, %rdi
movq 0x50(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x40(%rsp), %xmm0
movups %xmm0, (%rsp)
pushq $0x3
popq %rsi
pushq $0x50
popq %rdx
callq 0xd51f
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: load_image
image load_image(char *filename, int w, int h, int c)
{
    image out = load_image_stb(filename, c);

    if((h && w) && (h != out.h || w != out.w)){
        image resized = resize_image(out, w, h);
        free_image(out);
        out = resized;
    }
    return out;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x38, %rsp
movl %ecx, %ebp
movl %edx, %r14d
movq %rdi, %rbx
movl %r8d, %edx
callq 0x10058
testl %ebp, %ebp
sete %al
testl %r14d, %r14d
sete %cl
orb %al, %cl
jne 0xe6cd
cmpl %ebp, 0x4(%rbx)
jne 0xe693
cmpl %r14d, (%rbx)
je 0xe6cd
movq 0x10(%rbx), %rax
movq %rax, 0x10(%rsp)
movups (%rbx), %xmm0
movups %xmm0, (%rsp)
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0xc3ee
movq 0x10(%rbx), %rdi
callq 0x3040
movq 0x10(%r15), %rax
movq %rax, 0x10(%rbx)
movups (%r15), %xmm0
movups %xmm0, (%rbx)
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: letterbox_image_into
void letterbox_image_into(image im, int w, int h, image boxed)
{
    int new_w = im.w;
    int new_h = im.h;
    if (((float)w/im.w) < ((float)h/im.h)) {
        new_w = w;
        new_h = (im.h * w)/im.w;
    } else {
        new_h = h;
        new_w = (im.w * h)/im.h;
    }
    image resized = resize_image(im, new_w, new_h);
    embed_image(resized, boxed, (w-new_w)/2, (h-new_h)/2); 
    free_image(resized);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %esi, %ebx
movl %edi, %ebp
leaq 0x98(%rsp), %r13
leaq 0x80(%rsp), %rcx
movd %esi, %xmm0
movd %edi, %xmm1
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
cvtdq2ps %xmm1, %xmm1
movsd (%rcx), %xmm0
cvtdq2ps %xmm0, %xmm2
divps %xmm2, %xmm1
movaps %xmm1, %xmm2
shufps $0x55, %xmm1, %xmm2     # xmm2 = xmm2[1,1],xmm1[1,1]
ucomiss %xmm1, %xmm2
jbe 0xe73d
pshufd $0x55, %xmm0, %xmm1     # xmm1 = xmm0[1,1,1,1]
movd %xmm1, %eax
imull %ebp, %eax
movd %xmm0, %esi
cltd
idivl %esi
movl %eax, %r15d
movl %ebp, %r12d
jmp 0xe756
movd %xmm0, %eax
imull %ebx, %eax
pshufd $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movd %xmm0, %esi
cltd
idivl %esi
movl %eax, %r12d
movl %ebx, %r15d
movq 0x10(%rcx), %rax
movq %rax, 0x10(%rsp)
movups (%rcx), %xmm0
movups %xmm0, (%rsp)
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0xc3ee
subl %r12d, %ebp
pushq $0x2
popq %rcx
movl %ebp, %eax
cltd
idivl %ecx
movl %eax, %edi
subl %r15d, %ebx
movl %ebx, %eax
cltd
idivl %ecx
movq 0x10(%r13), %rcx
movq %rcx, 0x28(%rsp)
movups (%r13), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x10(%r14), %rcx
movq %rcx, 0x10(%rsp)
movups (%r14), %xmm0
movups %xmm0, (%rsp)
movl %eax, %esi
callq 0xb8af
movq 0x10(%r14), %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3040
// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: letterbox_image
image letterbox_image(image im, int w, int h)
{
    int new_w = im.w;
    int new_h = im.h;
    if (((float)w/im.w) < ((float)h/im.h)) {
        new_w = w;
        new_h = (im.h * w)/im.w;
    } else {
        new_h = h;
        new_w = (im.w * h)/im.h;
    }
    image resized = resize_image(im, new_w, new_h);
    image boxed = make_image(w, h, im.c);
    fill_image(boxed, .5);
    //int i;
    //for(i = 0; i < boxed.w*boxed.h*boxed.c; ++i) boxed.data[i] = 0;
    embed_image(resized, boxed, (w-new_w)/2, (h-new_h)/2); 
    free_image(resized);
    return boxed;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %rbx
leaq 0x80(%rsp), %r15
movd %edx, %xmm0
movd %esi, %xmm1
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
cvtdq2ps %xmm1, %xmm1
movsd (%r15), %xmm0
cvtdq2ps %xmm0, %xmm2
divps %xmm2, %xmm1
movaps %xmm1, %xmm2
shufps $0x55, %xmm1, %xmm2     # xmm2 = xmm2[1,1],xmm1[1,1]
ucomiss %xmm1, %xmm2
jbe 0xe830
pshufd $0x55, %xmm0, %xmm1     # xmm1 = xmm0[1,1,1,1]
movd %xmm1, %eax
imull %r14d, %eax
movd %xmm0, %ecx
cltd
idivl %ecx
movl %eax, %r12d
movl %r14d, %r13d
jmp 0xe849
movd %xmm0, %eax
imull %ebp, %eax
pshufd $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movd %xmm0, %ecx
cltd
idivl %ecx
movl %eax, %r13d
movl %ebp, %r12d
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
leaq 0x30(%rsp), %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0xc3ee
movl 0x8(%r15), %ecx
movq %rbx, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0xb45a
movq 0x10(%rbx), %rax
movq %rax, 0x10(%rsp)
movups (%rbx), %xmm0
movups %xmm0, (%rsp)
movss 0x3d9a1(%rip), %xmm0    # 0x4c234
callq 0xe178
subl %r13d, %r14d
pushq $0x2
popq %rcx
movl %r14d, %eax
cltd
idivl %ecx
movl %eax, %edi
subl %r12d, %ebp
movl %ebp, %eax
cltd
idivl %ecx
movq 0x10(%rbx), %rcx
movq %rcx, 0x28(%rsp)
movups (%rbx), %xmm0
movups %xmm0, 0x18(%rsp)
leaq 0x30(%rsp), %rdx
movq 0x10(%rdx), %rcx
movq %rcx, 0x10(%rsp)
movups (%rdx), %xmm0
movq %rdx, %r14
movups %xmm0, (%rsp)
movl %eax, %esi
callq 0xb8af
movq 0x10(%r14), %rdi
callq 0x3040
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: resize_max
image resize_max(image im, int max)
{
    int w = im.w;
    int h = im.h;
    if(w > h){
        h = (h * max) / w;
        w = max;
    } else {
        w = (w * max) / h;
        h = max;
    }
    if(w == im.w && h == im.h) return im;
    image resized = resize_image(im, w, h);
    return resized;
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
movl %esi, %ecx
movq %rdi, %rbx
movl 0x30(%rsp), %edi
movl 0x34(%rsp), %r8d
cmpl %r8d, %edi
jle 0xe920
movl %r8d, %eax
imull %ecx, %eax
cltd
idivl %edi
movl %ecx, %esi
movl %eax, %ecx
jmp 0xe92b
movl %edi, %eax
imull %ecx, %eax
cltd
idivl %r8d
movl %eax, %esi
leaq 0x30(%rsp), %rax
xorl %esi, %edi
xorl %ecx, %r8d
orl %edi, %r8d
jne 0xe94a
movq 0x10(%rax), %rcx
movq %rcx, 0x10(%rbx)
movups (%rax), %xmm0
movups %xmm0, (%rbx)
jmp 0xe964
movq 0x10(%rax), %rdx
movq %rdx, 0x10(%rsp)
movups (%rax), %xmm0
movups %xmm0, (%rsp)
movq %rbx, %rdi
movl %ecx, %edx
callq 0xc3ee
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: resize_min
image resize_min(image im, int min)
{
    int w = im.w;
    int h = im.h;
    if(w < h){
        h = (h * min) / w;
        w = min;
    } else {
        w = (w * min) / h;
        h = min;
    }
    if(w == im.w && h == im.h) return im;
    image resized = resize_image(im, w, h);
    return resized;
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
movl %esi, %ecx
movq %rdi, %rbx
movl 0x30(%rsp), %edi
movl 0x34(%rsp), %r8d
cmpl %r8d, %edi
jge 0xe994
movl %r8d, %eax
imull %ecx, %eax
cltd
idivl %edi
movl %ecx, %esi
movl %eax, %ecx
jmp 0xe99f
movl %edi, %eax
imull %ecx, %eax
cltd
idivl %r8d
movl %eax, %esi
leaq 0x30(%rsp), %rax
xorl %esi, %edi
xorl %ecx, %r8d
orl %edi, %r8d
jne 0xe9be
movq 0x10(%rax), %rcx
movq %rcx, 0x10(%rbx)
movups (%rax), %xmm0
movups %xmm0, (%rbx)
jmp 0xe9d8
movq 0x10(%rax), %rdx
movq %rdx, 0x10(%rsp)
movups (%rax), %xmm0
movups %xmm0, (%rsp)
movq %rbx, %rdi
movl %ecx, %edx
callq 0xc3ee
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
retq