// File: /workspace/github_c_makefile_star2_O2/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 $0x58, %rsp
cmpl $0x3, 0x98(%rsp)
jne 0xf231
leaq 0x90(%rsp), %r12
movl (%r12), %eax
xorl %ecx, %ecx
testl %eax, %eax
movl $0x0, %edx
movl %eax, 0x1c(%rsp)
cmovgl %eax, %edx
movq %rdx, 0x38(%rsp)
movl 0x4(%r12), %eax
testl %eax, %eax
cmovlel %ecx, %eax
movq %rax, 0x28(%rsp)
movq 0x10(%r12), %rax
movq %rax, 0x20(%rsp)
pushq $0x1
popq %rbx
pushq $0x2
popq %rbp
xorl %r14d, %r14d
cmpq 0x28(%rsp), %r14
je 0xf222
movq %rcx, 0x30(%rsp)
movl %ecx, %eax
movq 0x20(%rsp), %rcx
leaq (%rcx,%rax,4), %r13
xorl %r15d, %r15d
cmpq %r15, 0x38(%rsp)
je 0xf211
movq 0x10(%r12), %rax
movq %rax, 0x10(%rsp)
movups (%r12), %xmm0
movups %xmm0, (%rsp)
movl %r15d, %edi
movl %r14d, %esi
xorl %edx, %edx
callq 0xb589
movss %xmm0, 0x18(%rsp)
movq 0x10(%r12), %rax
movq %rax, 0x10(%rsp)
movups (%r12), %xmm0
movups %xmm0, (%rsp)
movl %r15d, %edi
movl %r14d, %esi
movl %ebx, %edx
callq 0xb589
movaps %xmm0, 0x40(%rsp)
movq 0x10(%r12), %rax
movq %rax, 0x10(%rsp)
movups (%r12), %xmm0
movups %xmm0, (%rsp)
movl %r15d, %edi
movl %r14d, %esi
movl %ebp, %edx
callq 0xb589
movss 0x18(%rsp), %xmm3
movaps 0x40(%rsp), %xmm5
movaps %xmm0, %xmm1
movaps %xmm3, %xmm4
maxss %xmm5, %xmm4
maxss %xmm0, %xmm4
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm4
xorps %xmm2, %xmm2
jne 0xf138
jnp 0xf1b6
movaps %xmm3, %xmm2
minss %xmm5, %xmm2
minss %xmm1, %xmm2
movaps %xmm4, %xmm0
subss %xmm2, %xmm0
ucomiss %xmm4, %xmm3
jne 0xf15b
jp 0xf15b
subss %xmm1, %xmm5
divss %xmm0, %xmm5
jmp 0xf18a
ucomiss %xmm4, %xmm5
jne 0xf177
jp 0xf177
subss %xmm3, %xmm1
divss %xmm0, %xmm1
addss 0x3d0ea(%rip), %xmm1    # 0x4c25c
movaps %xmm1, %xmm5
jmp 0xf18a
subss %xmm5, %xmm3
divss %xmm0, %xmm3
addss 0x3d0d1(%rip), %xmm3    # 0x4c258
movaps %xmm3, %xmm5
divss %xmm4, %xmm0
movaps %xmm5, %xmm1
movss 0x3d0c7(%rip), %xmm3    # 0x4c260
addss %xmm3, %xmm1
movaps %xmm5, %xmm2
cmpltss 0x3cecf(%rip), %xmm2    # 0x4c078
andps %xmm2, %xmm1
andnps %xmm5, %xmm2
orps %xmm1, %xmm2
divss %xmm3, %xmm2
movss %xmm2, (%r13,%r15,4)
movq 0x10(%r12), %rax
movq %rax, 0x10(%rsp)
movups (%r12), %xmm1
movups %xmm1, (%rsp)
movl %r15d, %edi
movl %r14d, %esi
movl %ebx, %edx
movss %xmm4, 0x18(%rsp)
callq 0xb5fe
movq 0x10(%r12), %rax
movq %rax, 0x10(%rsp)
movups (%r12), %xmm0
movups %xmm0, (%rsp)
movl %r15d, %edi
movl %r14d, %esi
movl %ebp, %edx
movss 0x18(%rsp), %xmm0
callq 0xb5fe
incq %r15
jmp 0xf09c
incq %r14
movq 0x30(%rsp), %rcx
addl 0x1c(%rsp), %ecx
jmp 0xf07e
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3f548(%rip), %rdi     # 0x4e780
leaq 0x3f47d(%rip), %rsi     # 0x4e6bc
leaq 0x3f572(%rip), %rcx     # 0x4e7b8
movl $0x3c1, %edx            # imm = 0x3C1
callq 0x31b0