// File: /workspace/github_c_makefile_star2_O1/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 0x19dd6
leaq 0x90(%rsp), %r15
movslq 0x4(%r15), %rax
movq %rax, 0x40(%rsp)
testq %rax, %rax
setg %al
jle 0x19da8
movl (%r15), %ebp
movq 0x10(%r15), %rcx
movq %rcx, 0x48(%rsp)
movq 0x40(%rsp), %rcx
imull %ebp, %ecx
movq %rcx, 0x30(%rsp)
addl %ecx, %ecx
movl %ecx, 0x24(%rsp)
movq $0x0, 0x28(%rsp)
xorl %ebx, %ebx
testl %ebp, %ebp
jle 0x19d75
testb $0x1, %al
je 0x19db7
movslq 0x24(%rsp), %rax
movq 0x48(%rsp), %rcx
leaq (%rcx,%rax,4), %rax
movq %rax, 0x50(%rsp)
movslq 0x30(%rsp), %rax
leaq (%rcx,%rax,4), %r12
movslq 0x28(%rsp), %rax
leaq (%rcx,%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 0x15476
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 0x15476
movss 0x20(%rsp), %xmm2
ucomiss 0x39426(%rip), %xmm2    # 0x53078
jne 0x19c85
jp 0x19c85
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 0x19bf2
jmp 0x19d75
movaps %xmm0, %xmm1
movss %xmm0, 0x18(%rsp)
movss 0x1c(%rsp), %xmm0
mulss 0x395c8(%rip), %xmm0    # 0x53264
movss %xmm0, 0x1c(%rsp)
movss %xmm1, 0x3c(%rsp)
callq 0x33d0
movss 0x3c(%rsp), %xmm5
cvttss2si %xmm0, %eax
cvttps2dq %xmm0, %xmm0
cvtdq2ps %xmm0, %xmm0
movss 0x1c(%rsp), %xmm6
subss %xmm0, %xmm6
movss 0x39338(%rip), %xmm3    # 0x53008
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 0x19d64
movaps %xmm3, %xmm2
subss %xmm6, %xmm2
movss 0x20(%rsp), %xmm4
mulss %xmm2, %xmm4
movaps %xmm3, %xmm2
subss %xmm4, %xmm2
mulss %xmm2, %xmm5
leaq 0x39720(%rip), %rcx     # 0x53438
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movaps %xmm1, %xmm2
movaps %xmm5, %xmm3
jmp 0x19d6a
movss 0x18(%rsp), %xmm2
movaps %xmm1, %xmm3
movaps %xmm5, %xmm0
jmp 0x19c5c
movaps %xmm5, %xmm2
movss 0x18(%rsp), %xmm3
jmp 0x19d4e
movss 0x18(%rsp), %xmm2
movaps %xmm0, %xmm3
movaps %xmm1, %xmm0
jmp 0x19c5c
movaps %xmm1, %xmm2
movss 0x18(%rsp), %xmm3
jmp 0x19c5c
movaps %xmm0, %xmm2
movaps %xmm1, %xmm3
movss 0x18(%rsp), %xmm0
jmp 0x19c5c
incq %rbx
movq 0x40(%rsp), %rcx
cmpq %rcx, %rbx
setb %al
addl %ebp, 0x24(%rsp)
movq 0x30(%rsp), %rsi
addl %ebp, %esi
movq %rsi, 0x30(%rsp)
movq 0x28(%rsp), %rsi
addl %ebp, %esi
movq %rsi, 0x28(%rsp)
cmpq %rcx, %rbx
jne 0x19bba
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3c6ff(%rip), %rdi     # 0x564bd
leaq 0x3b8ff(%rip), %rsi     # 0x556c4
leaq 0x3c70f(%rip), %rcx     # 0x564db
movl $0x31, %edx
callq 0x31c0
leaq 0x3b9ab(%rip), %rdi     # 0x55788
leaq 0x3b8e0(%rip), %rsi     # 0x556c4
leaq 0x3b9ec(%rip), %rcx     # 0x557d7
movl $0x3e6, %edx            # imm = 0x3E6
callq 0x31c0