// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: rgb_to_hsv
void rgb_to_hsv(image im)
{
    assert(im.c == 3);
    int i, j;
    float r, g, b;
    float h, s, v;
    for(j = 0; j < im.h; ++j){
        for(i = 0; i < im.w; ++i){
            r = get_pixel(im, i , j, 0);
            g = get_pixel(im, i , j, 1);
            b = get_pixel(im, i , j, 2);
            float max = three_way_max(r,g,b);
            float min = three_way_min(r,g,b);
            float delta = max - min;
            v = max;
            if(max == 0){
                s = 0;
                h = 0;
            }else{
                s = delta/max;
                if(r == max){
                    h = (g - b) / delta;
                } else if (g == max) {
                    h = 2 + (b - r) / delta;
                } else {
                    h = 4 + (r - g) / delta;
                }
                if (h < 0) h += 6;
                h = h/6.;
            }
            set_pixel(im, i, j, 0, h);
            set_pixel(im, i, j, 1, s);
            set_pixel(im, i, j, 2, v);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
cmpl $0x3, 0xa8(%rsp)
jne 0x1a44a
leaq 0xa0(%rsp), %r15
movslq 0x4(%r15), %rax
movq %rax, 0x38(%rsp)
testq %rax, %rax
jle 0x1a43b
movl (%r15), %ebp
movq 0x10(%r15), %rax
movq %rax, 0x40(%rsp)
movq 0x38(%rsp), %rax
imull %ebp, %eax
movq %rax, 0x28(%rsp)
addl %eax, %eax
movl %eax, 0x1c(%rsp)
movq $0x0, 0x20(%rsp)
xorl %ebx, %ebx
testl %ebp, %ebp
jle 0x1a411
movslq 0x1c(%rsp), %rax
movq 0x40(%rsp), %rdx
leaq (%rdx,%rax,4), %rax
movq %rax, 0x48(%rsp)
movslq 0x28(%rsp), %rax
leaq (%rdx,%rax,4), %r12
movslq 0x20(%rsp), %rax
leaq (%rdx,%rax,4), %r13
xorl %r14d, %r14d
movss (%r13,%r14,4), %xmm0
movss %xmm0, 0x34(%rsp)
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
movl %r14d, %edi
movl %ebx, %esi
movl $0x1, %edx
callq 0x15f12
movaps %xmm0, 0x50(%rsp)
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
movl %r14d, %edi
movl %ebx, %esi
movl $0x2, %edx
callq 0x15f12
movss 0x34(%rsp), %xmm4
movaps 0x50(%rsp), %xmm5
movaps %xmm4, %xmm1
maxss %xmm5, %xmm1
maxss %xmm0, %xmm1
xorps %xmm2, %xmm2
ucomiss %xmm2, %xmm1
xorps %xmm3, %xmm3
jne 0x1a36f
jnp 0x1a3ed
movaps %xmm4, %xmm3
minss %xmm5, %xmm3
minss %xmm0, %xmm3
movaps %xmm1, %xmm2
subss %xmm3, %xmm2
ucomiss %xmm1, %xmm4
jne 0x1a392
jp 0x1a392
subss %xmm0, %xmm5
divss %xmm2, %xmm5
jmp 0x1a3c1
ucomiss %xmm1, %xmm5
jne 0x1a3ae
jp 0x1a3ae
subss %xmm4, %xmm0
divss %xmm2, %xmm0
addss 0x3aee3(%rip), %xmm0    # 0x5528c
movaps %xmm0, %xmm5
jmp 0x1a3c1
subss %xmm5, %xmm4
divss %xmm2, %xmm4
addss 0x3aeca(%rip), %xmm4    # 0x55288
movaps %xmm4, %xmm5
divss %xmm1, %xmm2
movaps %xmm5, %xmm0
movss 0x3aec0(%rip), %xmm4    # 0x55290
addss %xmm4, %xmm0
movaps %xmm5, %xmm3
cmpltss 0x3acc0(%rip), %xmm3    # 0x550a0
andps %xmm3, %xmm0
andnps %xmm5, %xmm3
orps %xmm0, %xmm3
divss %xmm4, %xmm3
movss %xmm3, (%r13,%r14,4)
movss %xmm2, (%r12,%r14,4)
movq 0x48(%rsp), %rax
movss %xmm1, (%rax,%r14,4)
incq %r14
cmpq %r14, %rbp
jne 0x1a2fa
incq %rbx
addl %ebp, 0x1c(%rsp)
movq 0x28(%rsp), %rax
addl %ebp, %eax
movq %rax, 0x28(%rsp)
movq 0x20(%rsp), %rax
addl %ebp, %eax
movq %rax, 0x20(%rsp)
cmpq 0x38(%rsp), %rbx
jne 0x1a2ca
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3d40f(%rip), %rdi     # 0x57860
leaq 0x3d344(%rip), %rsi     # 0x5779c
leaq 0x3d439(%rip), %rcx     # 0x57898
movl $0x3c1, %edx            # imm = 0x3C1
callq 0x31b0