// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x60, %rsp
leaq 0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpl $0x3, 0x8(%rax)
jne 0x13bc8
jmp 0x13be7
leaq 0x5f5ab(%rip), %rdi     # 0x7317a
leaq 0x5f4d3(%rip), %rsi     # 0x730a9
movl $0x3e6, %edx            # imm = 0x3E6
leaq 0x5f5e7(%rip), %rcx     # 0x731c9
callq 0x3180
movl $0x0, -0x8(%rbp)
movq -0x40(%rbp), %rcx
movl -0x8(%rbp), %eax
cmpl 0x4(%rcx), %eax
jge 0x13f30
movl $0x0, -0x4(%rbp)
movq -0x40(%rbp), %rcx
movl -0x4(%rbp), %eax
cmpl (%rcx), %eax
jge 0x13f20
movq -0x40(%rbp), %rax
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
xorl %edx, %edx
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xe580
movq -0x40(%rbp), %rax
movaps %xmm0, %xmm1
movss 0x5d5e3(%rip), %xmm0    # 0x71230
mulss %xmm1, %xmm0
movss %xmm0, -0x18(%rbp)
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
movl $0x1, %edx
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xe580
movq -0x40(%rbp), %rax
movss %xmm0, -0x1c(%rbp)
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
movl $0x2, %edx
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xe580
movss %xmm0, -0x20(%rbp)
movss -0x1c(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x13cde
jp 0x13cde
movss -0x20(%rbp), %xmm0
movss %xmm0, -0x14(%rbp)
movss %xmm0, -0x10(%rbp)
movss %xmm0, -0xc(%rbp)
jmp 0x13e7f
movss -0x18(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
callq 0x33b0
cvttsd2si %xmm0, %eax
movl %eax, -0x34(%rbp)
movss -0x18(%rbp), %xmm0
cvtsi2ssl -0x34(%rbp), %xmm1
subss %xmm1, %xmm0
movss %xmm0, -0x24(%rbp)
movss -0x20(%rbp), %xmm0
movss 0x5d2f9(%rip), %xmm1    # 0x7100c
subss -0x1c(%rbp), %xmm1
mulss %xmm1, %xmm0
movss %xmm0, -0x28(%rbp)
movss -0x20(%rbp), %xmm0
movss -0x1c(%rbp), %xmm1
movss -0x24(%rbp), %xmm2
movd %xmm1, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm1
mulss %xmm2, %xmm1
movss 0x5d2c3(%rip), %xmm2    # 0x7100c
addss %xmm2, %xmm1
mulss %xmm1, %xmm0
movss %xmm0, -0x2c(%rbp)
movss -0x20(%rbp), %xmm0
movss -0x1c(%rbp), %xmm1
movss 0x5d2a4(%rip), %xmm2    # 0x7100c
subss -0x24(%rbp), %xmm2
movd %xmm1, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm1
mulss %xmm2, %xmm1
movss 0x5d286(%rip), %xmm2    # 0x7100c
addss %xmm2, %xmm1
mulss %xmm1, %xmm0
movss %xmm0, -0x30(%rbp)
cmpl $0x0, -0x34(%rbp)
jne 0x13dbc
movss -0x20(%rbp), %xmm0
movss %xmm0, -0xc(%rbp)
movss -0x30(%rbp), %xmm0
movss %xmm0, -0x10(%rbp)
movss -0x28(%rbp), %xmm0
movss %xmm0, -0x14(%rbp)
jmp 0x13e7d
cmpl $0x1, -0x34(%rbp)
jne 0x13de5
movss -0x2c(%rbp), %xmm0
movss %xmm0, -0xc(%rbp)
movss -0x20(%rbp), %xmm0
movss %xmm0, -0x10(%rbp)
movss -0x28(%rbp), %xmm0
movss %xmm0, -0x14(%rbp)
jmp 0x13e7b
cmpl $0x2, -0x34(%rbp)
jne 0x13e0b
movss -0x28(%rbp), %xmm0
movss %xmm0, -0xc(%rbp)
movss -0x20(%rbp), %xmm0
movss %xmm0, -0x10(%rbp)
movss -0x30(%rbp), %xmm0
movss %xmm0, -0x14(%rbp)
jmp 0x13e79
cmpl $0x3, -0x34(%rbp)
jne 0x13e31
movss -0x28(%rbp), %xmm0
movss %xmm0, -0xc(%rbp)
movss -0x2c(%rbp), %xmm0
movss %xmm0, -0x10(%rbp)
movss -0x20(%rbp), %xmm0
movss %xmm0, -0x14(%rbp)
jmp 0x13e77
cmpl $0x4, -0x34(%rbp)
jne 0x13e57
movss -0x30(%rbp), %xmm0
movss %xmm0, -0xc(%rbp)
movss -0x28(%rbp), %xmm0
movss %xmm0, -0x10(%rbp)
movss -0x20(%rbp), %xmm0
movss %xmm0, -0x14(%rbp)
jmp 0x13e75
movss -0x20(%rbp), %xmm0
movss %xmm0, -0xc(%rbp)
movss -0x28(%rbp), %xmm0
movss %xmm0, -0x10(%rbp)
movss -0x2c(%rbp), %xmm0
movss %xmm0, -0x14(%rbp)
jmp 0x13e77
jmp 0x13e79
jmp 0x13e7b
jmp 0x13e7d
jmp 0x13e7f
movq -0x40(%rbp), %rax
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
movss -0xc(%rbp), %xmm0
xorl %edx, %edx
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xe6b0
movq -0x40(%rbp), %rax
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
movss -0x10(%rbp), %xmm0
movl $0x1, %edx
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xe6b0
movq -0x40(%rbp), %rax
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
movss -0x14(%rbp), %xmm0
movl $0x2, %edx
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xe6b0
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x13c05
jmp 0x13f22
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x13bee
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)