// File: /workspace/github_c_makefile_star2_O2/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 0xf4e5
leaq 0x90(%rsp), %r12
movl (%r12), %eax
xorl %ecx, %ecx
testl %eax, %eax
movl $0x0, %edx
movl %eax, 0x30(%rsp)
cmovgl %eax, %edx
movq %rdx, 0x50(%rsp)
movl 0x4(%r12), %eax
testl %eax, %eax
cmovlel %ecx, %eax
movq %rax, 0x40(%rsp)
movq 0x10(%r12), %rax
movq %rax, 0x38(%rsp)
pushq $0x1
popq %rbx
pushq $0x2
popq %rbp
xorl %r14d, %r14d
cmpq 0x40(%rsp), %r14
je 0xf4d6
movq %rcx, 0x48(%rsp)
movl %ecx, %eax
movq 0x38(%rsp), %rcx
leaq (%rcx,%rax,4), %r13
xorl %r15d, %r15d
cmpq %r15, 0x50(%rsp)
je 0xf4c5
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, 0x2c(%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
movss %xmm0, 0x24(%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
movaps %xmm0, %xmm2
movaps %xmm0, %xmm1
movss 0x24(%rsp), %xmm0
ucomiss 0x3cd21(%rip), %xmm0    # 0x4c078
jne 0xf3b9
jp 0xf3b9
movss %xmm1, 0x24(%rsp)
movaps %xmm1, %xmm0
movss %xmm1, (%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
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 0x24(%rsp), %xmm0
callq 0xb5fe
incq %r15
jmp 0xf2cd
movss %xmm1, 0x28(%rsp)
movss 0x2c(%rsp), %xmm0
mulss 0x3ce93(%rip), %xmm0    # 0x4c260
movss %xmm0, 0x2c(%rsp)
movss %xmm2, 0x34(%rsp)
callq 0x33c0
movss 0x34(%rsp), %xmm5
cvttss2si %xmm0, %eax
cvttps2dq %xmm0, %xmm0
cvtdq2ps %xmm0, %xmm0
movss 0x2c(%rsp), %xmm1
subss %xmm0, %xmm1
movss 0x3cc07(%rip), %xmm3    # 0x4c008
movaps %xmm3, %xmm2
movss 0x24(%rsp), %xmm0
subss %xmm0, %xmm2
mulss %xmm5, %xmm2
movaps %xmm1, %xmm4
mulss %xmm1, %xmm0
movaps %xmm3, %xmm1
subss %xmm0, %xmm1
mulss %xmm5, %xmm1
cmpl $0x4, %eax
ja 0xf4b1
movaps %xmm3, %xmm0
subss %xmm4, %xmm0
movss 0x24(%rsp), %xmm4
mulss %xmm0, %xmm4
movaps %xmm3, %xmm0
subss %xmm4, %xmm0
mulss %xmm0, %xmm5
leaq 0x3cfe8(%rip), %rcx     # 0x4c438
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movss %xmm2, 0x24(%rsp)
movaps %xmm5, %xmm0
jmp 0xf4ba
movss 0x28(%rsp), %xmm0
movss %xmm0, 0x24(%rsp)
movaps %xmm2, %xmm0
movaps %xmm5, %xmm1
jmp 0xf364
movss %xmm5, 0x24(%rsp)
movss 0x28(%rsp), %xmm0
jmp 0xf498
movss 0x28(%rsp), %xmm0
movss %xmm0, 0x24(%rsp)
movaps %xmm1, %xmm0
movaps %xmm2, %xmm1
jmp 0xf364
movss %xmm2, 0x24(%rsp)
movss 0x28(%rsp), %xmm0
jmp 0xf364
movss %xmm1, 0x24(%rsp)
movaps %xmm2, %xmm0
movss 0x28(%rsp), %xmm1
jmp 0xf364
incq %r14
movq 0x48(%rsp), %rcx
addl 0x30(%rsp), %ecx
jmp 0xf2af
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3f294(%rip), %rdi     # 0x4e780
leaq 0x3f1c9(%rip), %rsi     # 0x4e6bc
leaq 0x3f2d5(%rip), %rcx     # 0x4e7cf
movl $0x3e6, %edx            # imm = 0x3E6
callq 0x31b0