// File: /workspace/github_cpp_makefile_star2_O2/miklhh[P]mandelbrot/src/color.cpp
// Function: get_color(unsigned int, std::complex<double> const&, std::complex<double> const&)
rgb_t get_color(
    unsigned int iterations, 
    const std::complex<double> & zn, 
    const std::complex<double> & c)
{
    rgb_t color{ 0, 0, 0, 0 };

    /* If it converges. */
    extern unsigned int max_iterations;
    if (iterations == max_iterations)
    {
        return color;
    }
    else
    {
        double convergence_value = get_convergence_value(iterations, zn, c);
        rgb_t color = hsl_to_rgb(
            {
                log(10 * convergence_value),
                1,
                0.7
            });
        return color;
    }
}

// Assembly:
leaq 0x5f81(%rip), %rcx      # 0x91c8
xorl %eax, %eax
cmpl %edi, (%rcx)
je 0x3406
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movl %edi, %ebx
movups (%rdx), %xmm0
movaps %xmm0, (%rsp)
movupd (%rsi), %xmm0
leaq 0x10(%rsp), %r14
movapd %xmm0, (%r14)
pushq $0x5
popq %rbp
subl $0x1, %ebp
jb 0x3294
movq %r14, %rdi
movq %r14, %rsi
callq 0x3481
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
addpd (%rsp), %xmm0
movapd %xmm0, 0x10(%rsp)
jmp 0x3273
addl $0x5, %ebx
cvtsi2sd %ebx, %xmm0
movsd %xmm0, (%rsp)
leaq 0x10(%rsp), %rdi
callq 0x34a6
callq 0x21b0
divsd 0x1f71(%rip), %xmm0     # 0x5228
callq 0x2340
movsd (%rsp), %xmm1
subsd %xmm0, %xmm1
mulsd 0x1f63(%rip), %xmm1     # 0x5230
movapd %xmm1, %xmm0
callq 0x21b0
movl $0x3e8, %eax            # imm = 0x3E8
movsd 0x1f55(%rip), %xmm4     # 0x5238
xorpd %xmm1, %xmm1
movsd 0x1f51(%rip), %xmm2     # 0x5240
subl $0x1, %eax
jb 0x330e
ucomisd %xmm0, %xmm1
movapd %xmm4, %xmm3
ja 0x3308
ucomisd %xmm4, %xmm0
movapd %xmm2, %xmm3
jbe 0x330e
addsd %xmm3, %xmm0
jmp 0x32ef
divsd 0x1f32(%rip), %xmm0     # 0x5248
movsd %xmm0, (%rsp)
movsd 0x1f2d(%rip), %xmm1     # 0x5250
callq 0x2260
movsd (%rsp), %xmm4
addsd 0x1f23(%rip), %xmm0     # 0x5258
andpd 0x1f63(%rip), %xmm0     # 0x52a0
movsd 0x1f1b(%rip), %xmm1     # 0x5260
movapd %xmm1, %xmm2
subsd %xmm0, %xmm2
movsd 0x1f13(%rip), %xmm3     # 0x5268
mulsd %xmm3, %xmm2
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm4
jb 0x336f
ucomisd %xmm4, %xmm1
jb 0x336f
movapd %xmm2, %xmm1
jmp 0x33b5
ucomisd 0x1ee9(%rip), %xmm4     # 0x5260
movsd 0x1ee9(%rip), %xmm1     # 0x5268
jb 0x3395
movsd 0x1ec7(%rip), %xmm3     # 0x5250
ucomisd %xmm4, %xmm3
jb 0x3395
movapd %xmm2, %xmm3
jmp 0x33b5
ucomisd 0x1eb3(%rip), %xmm4     # 0x5250
xorpd %xmm3, %xmm3
jb 0x3407
movsd 0x1ec5(%rip), %xmm0     # 0x5270
ucomisd %xmm4, %xmm0
jb 0x3407
movapd %xmm2, %xmm0
movsd 0x1ed3(%rip), %xmm2     # 0x5290
addsd %xmm2, %xmm3
movsd 0x1ecf(%rip), %xmm4     # 0x5298
mulsd %xmm4, %xmm3
cvttsd2si %xmm3, %ecx
addsd %xmm2, %xmm1
mulsd %xmm4, %xmm1
cvttsd2si %xmm1, %edx
addsd %xmm2, %xmm0
mulsd %xmm4, %xmm0
cvttsd2si %xmm0, %eax
movl $0xff, %esi
andl %esi, %ecx
andl %esi, %edx
shll $0x8, %edx
orl %ecx, %edx
andl %esi, %eax
shll $0x10, %eax
orl %edx, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
ucomisd 0x1e61(%rip), %xmm4     # 0x5270
movsd 0x1e51(%rip), %xmm0     # 0x5268
jb 0x342b
movsd 0x1e57(%rip), %xmm1     # 0x5278
ucomisd %xmm4, %xmm1
jae 0x3369
ucomisd 0x1e45(%rip), %xmm4     # 0x5278
jb 0x344b
xorpd %xmm1, %xmm1
movsd 0x1e3f(%rip), %xmm3     # 0x5280
ucomisd %xmm4, %xmm3
jae 0x338f
ucomisd 0x1e2d(%rip), %xmm4     # 0x5280
xorpd %xmm1, %xmm1
jb 0x3474
movsd 0x1e27(%rip), %xmm0     # 0x5288
ucomisd %xmm4, %xmm0
jb 0x3474
movsd 0x1df9(%rip), %xmm3     # 0x5268
jmp 0x33b1
xorpd %xmm0, %xmm0
xorpd %xmm3, %xmm3
jmp 0x33b5