// File: /workspace/github_cpp_makefile_star2_O1/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 0x4e35(%rip), %rcx      # 0x81d8
xorl %eax, %eax
cmpl %edi, (%rcx)
je 0x3593
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x38, %rsp
movl %edi, %ebx
movupd (%rsi), %xmm0
movsd (%rdx), %xmm1
movsd %xmm1, 0x8(%rsp)
movsd 0x8(%rdx), %xmm1
movsd %xmm1, 0x20(%rsp)
leaq 0x28(%rsp), %r14
movupd %xmm0, (%r14)
movl $0x5, %ebp
leaq 0x10(%rsp), %r15
movups 0x28(%rsp), %xmm0
movaps %xmm0, 0x10(%rsp)
movq %r15, %rdi
movq %r14, %rsi
callq 0x360e
movsd 0x10(%rsp), %xmm0
addsd 0x8(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
addsd 0x20(%rsp), %xmm1
movsd %xmm0, 0x28(%rsp)
movsd %xmm1, 0x30(%rsp)
decl %ebp
jne 0x33e6
addl $0x5, %ebx
cvtsi2sd %ebx, %xmm2
movsd %xmm2, 0x8(%rsp)
callq 0x2380
callq 0x21b0
divsd 0x1dbe(%rip), %xmm0     # 0x5200
callq 0x2360
movsd 0x8(%rsp), %xmm1
subsd %xmm0, %xmm1
mulsd 0x1daf(%rip), %xmm1     # 0x5208
movapd %xmm1, %xmm0
callq 0x21b0
movl $0x3e8, %eax            # imm = 0x3E8
movsd 0x1da1(%rip), %xmm4     # 0x5210
xorpd %xmm1, %xmm1
movsd 0x1d9d(%rip), %xmm2     # 0x5218
ucomisd %xmm0, %xmm1
movapd %xmm4, %xmm3
ja 0x348f
ucomisd %xmm4, %xmm0
movapd %xmm2, %xmm3
jbe 0x3497
addsd %xmm3, %xmm0
decl %eax
jne 0x347b
divsd 0x1d81(%rip), %xmm0     # 0x5220
movsd %xmm0, 0x8(%rsp)
movsd 0x1d7b(%rip), %xmm1     # 0x5228
callq 0x2280
movsd 0x8(%rsp), %xmm4
addsd 0x1d70(%rip), %xmm0     # 0x5230
andpd 0x1db8(%rip), %xmm0     # 0x5280
movsd 0x1d68(%rip), %xmm1     # 0x5238
movapd %xmm1, %xmm2
subsd %xmm0, %xmm2
movsd 0x1d60(%rip), %xmm3     # 0x5240
mulsd %xmm3, %xmm2
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm4
jb 0x34fa
ucomisd %xmm4, %xmm1
jb 0x34fa
movapd %xmm2, %xmm1
jmp 0x3540
ucomisd 0x1d36(%rip), %xmm4     # 0x5238
movsd 0x1d36(%rip), %xmm1     # 0x5240
jb 0x3520
movsd 0x1d14(%rip), %xmm3     # 0x5228
ucomisd %xmm4, %xmm3
jb 0x3520
movapd %xmm2, %xmm3
jmp 0x3540
ucomisd 0x1d00(%rip), %xmm4     # 0x5228
xorpd %xmm3, %xmm3
jb 0x3594
movsd 0x1d12(%rip), %xmm0     # 0x5248
ucomisd %xmm4, %xmm0
jb 0x3594
movapd %xmm2, %xmm0
movsd 0x1d20(%rip), %xmm2     # 0x5268
addsd %xmm2, %xmm3
movsd 0x1d1c(%rip), %xmm4     # 0x5270
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 $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
ucomisd 0x1cac(%rip), %xmm4     # 0x5248
movsd 0x1c9c(%rip), %xmm0     # 0x5240
jb 0x35b8
movsd 0x1ca2(%rip), %xmm1     # 0x5250
ucomisd %xmm4, %xmm1
jae 0x34f4
ucomisd 0x1c90(%rip), %xmm4     # 0x5250
jb 0x35d8
xorpd %xmm1, %xmm1
movsd 0x1c8a(%rip), %xmm3     # 0x5258
ucomisd %xmm4, %xmm3
jae 0x351a
ucomisd 0x1c78(%rip), %xmm4     # 0x5258
xorpd %xmm1, %xmm1
jb 0x3601
movsd 0x1c72(%rip), %xmm0     # 0x5260
ucomisd %xmm4, %xmm0
jb 0x3601
movsd 0x1c44(%rip), %xmm3     # 0x5240
jmp 0x353c
xorpd %xmm0, %xmm0
xorpd %xmm3, %xmm3
jmp 0x3540