// File: /workspace/github_c_makefile_star2_O1/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 0x19b38
leaq 0xa0(%rsp), %r15
movslq 0x4(%r15), %rax
movq %rax, 0x38(%rsp)
testq %rax, %rax
setg %al
jle 0x19b0a
movl (%r15), %ebp
movq 0x10(%r15), %rcx
movq %rcx, 0x40(%rsp)
movq 0x38(%rsp), %rcx
imull %ebp, %ecx
movq %rcx, 0x28(%rsp)
addl %ecx, %ecx
movl %ecx, 0x1c(%rsp)
movq $0x0, 0x20(%rsp)
xorl %ebx, %ebx
testl %ebp, %ebp
jle 0x19ad7
testb $0x1, %al
je 0x19b19
movslq 0x1c(%rsp), %rax
movq 0x40(%rsp), %rcx
leaq (%rcx,%rax,4), %rax
movq %rax, 0x48(%rsp)
movslq 0x28(%rsp), %rax
leaq (%rcx,%rax,4), %r12
movslq 0x20(%rsp), %rax
leaq (%rcx,%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 0x15476
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 0x15476
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 0x19a35
jnp 0x19ab3
movaps %xmm4, %xmm3
minss %xmm5, %xmm3
minss %xmm0, %xmm3
movaps %xmm1, %xmm2
subss %xmm3, %xmm2
ucomiss %xmm1, %xmm4
jne 0x19a58
jp 0x19a58
subss %xmm0, %xmm5
divss %xmm2, %xmm5
jmp 0x19a87
ucomiss %xmm1, %xmm5
jne 0x19a74
jp 0x19a74
subss %xmm4, %xmm0
divss %xmm2, %xmm0
addss 0x397f1(%rip), %xmm0    # 0x53260
movaps %xmm0, %xmm5
jmp 0x19a87
subss %xmm5, %xmm4
divss %xmm2, %xmm4
addss 0x397d8(%rip), %xmm4    # 0x5325c
movaps %xmm4, %xmm5
divss %xmm1, %xmm2
movaps %xmm5, %xmm0
movss 0x397ce(%rip), %xmm4    # 0x53264
addss %xmm4, %xmm0
movaps %xmm5, %xmm3
cmpltss 0x395d2(%rip), %xmm3    # 0x53078
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 0x199c0
incq %rbx
movq 0x38(%rsp), %rcx
cmpq %rcx, %rbx
setb %al
addl %ebp, 0x1c(%rsp)
movq 0x28(%rsp), %rsi
addl %ebp, %esi
movq %rsi, 0x28(%rsp)
movq 0x20(%rsp), %rsi
addl %ebp, %esi
movq %rsi, 0x20(%rsp)
cmpq %rcx, %rbx
jne 0x19988
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3c99d(%rip), %rdi     # 0x564bd
leaq 0x3bb9d(%rip), %rsi     # 0x556c4
leaq 0x3c9ad(%rip), %rcx     # 0x564db
movl $0x31, %edx
callq 0x31c0
leaq 0x3bc49(%rip), %rdi     # 0x55788
leaq 0x3bb7e(%rip), %rsi     # 0x556c4
leaq 0x3bc73(%rip), %rcx     # 0x557c0
movl $0x3c1, %edx            # imm = 0x3C1
callq 0x31c0