// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: hsv_to_rgb
void hsv_to_rgb(image im)
{
    assert(im.c == 3);
    int i, j;
    float r, g, b;
    float h, s, v;
    float f, p, q, t;
    for(j = 0; j < im.h; ++j){
        for(i = 0; i < im.w; ++i){
            h = 6 * get_pixel(im, i , j, 0);
            s = get_pixel(im, i , j, 1);
            v = get_pixel(im, i , j, 2);
            if (s == 0) {
                r = g = b = v;
            } else {
                int index = floor(h);
                f = h - index;
                p = v*(1-s);
                q = v*(1-s*f);
                t = v*(1-s*(1-f));
                if(index == 0){
                    r = v; g = t; b = p;
                } else if(index == 1){
                    r = q; g = v; b = p;
                } else if(index == 2){
                    r = p; g = v; b = t;
                } else if(index == 3){
                    r = p; g = q; b = v;
                } else if(index == 4){
                    r = t; g = p; b = v;
                } else {
                    r = v; g = p; b = q;
                }
            }
            set_pixel(im, i, j, 0, r);
            set_pixel(im, i, j, 1, g);
            set_pixel(im, i, j, 2, b);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
cmpl $0x3, 0x98(%rsp)
jne 0x1a6b5
leaq 0x90(%rsp), %r15
movslq 0x4(%r15), %rax
movq %rax, 0x40(%rsp)
testq %rax, %rax
jle 0x1a6a6
movl (%r15), %ebp
movq 0x10(%r15), %rax
movq %rax, 0x48(%rsp)
movq 0x40(%rsp), %rax
imull %ebp, %eax
movq %rax, 0x30(%rsp)
addl %eax, %eax
movl %eax, 0x24(%rsp)
movq $0x0, 0x28(%rsp)
xorl %ebx, %ebx
testl %ebp, %ebp
jle 0x1a67c
movslq 0x24(%rsp), %rax
movq 0x48(%rsp), %rdx
leaq (%rdx,%rax,4), %rax
movq %rax, 0x50(%rsp)
movslq 0x30(%rsp), %rax
leaq (%rdx,%rax,4), %r12
movslq 0x28(%rsp), %rax
leaq (%rdx,%rax,4), %r13
xorl %r14d, %r14d
movss (%r13,%r14,4), %xmm0
movss %xmm0, 0x1c(%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
movss %xmm0, 0x20(%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 0x20(%rsp), %xmm2
ucomiss 0x3ab47(%rip), %xmm2    # 0x550a0
jne 0x1a58c
jp 0x1a58c
movaps %xmm0, %xmm2
movaps %xmm0, %xmm3
movss %xmm0, (%r13,%r14,4)
movss %xmm3, (%r12,%r14,4)
movq 0x50(%rsp), %rax
movss %xmm2, (%rax,%r14,4)
incq %r14
cmpq %r14, %rbp
jne 0x1a4f9
jmp 0x1a67c
movaps %xmm0, %xmm1
movss %xmm0, 0x18(%rsp)
movss 0x1c(%rsp), %xmm0
mulss 0x3aced(%rip), %xmm0    # 0x55290
movss %xmm0, 0x1c(%rsp)
movss %xmm1, 0x3c(%rsp)
callq 0x33c0
movss 0x3c(%rsp), %xmm5
cvttss2si %xmm0, %eax
cvttps2dq %xmm0, %xmm0
cvtdq2ps %xmm0, %xmm0
movss 0x1c(%rsp), %xmm6
subss %xmm0, %xmm6
movss 0x3aa31(%rip), %xmm3    # 0x55008
movaps %xmm3, %xmm1
movss 0x20(%rsp), %xmm2
subss %xmm2, %xmm1
mulss %xmm5, %xmm1
mulss %xmm6, %xmm2
movaps %xmm3, %xmm0
subss %xmm2, %xmm0
mulss %xmm5, %xmm0
cmpl $0x4, %eax
ja 0x1a66b
movaps %xmm3, %xmm2
subss %xmm6, %xmm2
movss 0x20(%rsp), %xmm4
mulss %xmm2, %xmm4
movaps %xmm3, %xmm2
subss %xmm4, %xmm2
mulss %xmm2, %xmm5
leaq 0x3aef9(%rip), %rcx     # 0x55518
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movaps %xmm1, %xmm2
movaps %xmm5, %xmm3
jmp 0x1a671
movss 0x18(%rsp), %xmm2
movaps %xmm1, %xmm3
movaps %xmm5, %xmm0
jmp 0x1a563
movaps %xmm5, %xmm2
movss 0x18(%rsp), %xmm3
jmp 0x1a655
movss 0x18(%rsp), %xmm2
movaps %xmm0, %xmm3
movaps %xmm1, %xmm0
jmp 0x1a563
movaps %xmm1, %xmm2
movss 0x18(%rsp), %xmm3
jmp 0x1a563
movaps %xmm0, %xmm2
movaps %xmm1, %xmm3
movss 0x18(%rsp), %xmm0
jmp 0x1a563
incq %rbx
addl %ebp, 0x24(%rsp)
movq 0x30(%rsp), %rax
addl %ebp, %eax
movq %rax, 0x30(%rsp)
movq 0x28(%rsp), %rax
addl %ebp, %eax
movq %rax, 0x28(%rsp)
cmpq 0x40(%rsp), %rbx
jne 0x1a4c9
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3d1a4(%rip), %rdi     # 0x57860
leaq 0x3d0d9(%rip), %rsi     # 0x5779c
leaq 0x3d1e5(%rip), %rcx     # 0x578af
movl $0x3e6, %edx            # imm = 0x3E6
callq 0x31b0