// File: /workspace/github_cpp_makefile_star2_O1/miklhh[P]mandelbrot/src/supersampling.cpp
// Function: get_px_4x_ss(int, int)
rgb_t get_px_4x_ss(int px_x, int px_y)
{
    using std::complex;
    double x = double((px_x - scr_width / 2) * scale.x + offset.x);
    double y = double((px_y - scr_height / 2) * scale.y + offset.y);
    complex<double> c(x, y);
    complex<double> z(0, 0);

    /* 'Pixel': 1. */
    complex<double> c1(x - scale.x / 4, y - scale.y / 4);
    complex<double> z1(0, 0);
    unsigned int iterations1;
    for (iterations1 = 0; iterations1 < max_iterations; iterations1++)
    {
        z1 = z1 * z1 + c1;
        if (test_escape(z1, 2.0)) { break; }
    }
    rgb_t color1 = get_color(iterations1, z1, c1);
    /* 'Pixel': 2. */
    complex<double> c2(c.real() - scale.x / 4, c.imag() + scale.y / 4);
    complex<double> z2(0, 0);
    unsigned int iterations2;
    for (iterations2 = 0; iterations2 < max_iterations; iterations2++)
    {
        z2 = z2 * z2 + c2;
        if (test_escape(z2, 2.0)) { break; }
    }
    rgb_t color2 = get_color(iterations2, z2, c2);
    /* 'Pixel': 3. */
    complex<double> c3(c.real() + scale.x / 4, c.imag() - scale.y / 4);
    complex<double> z3(0, 0);
    unsigned int iterations3;
    for (iterations3 = 0; iterations3 < max_iterations; iterations3++)
    {
        z3 = z3 * z3 + c3;
        if (test_escape(z3, 2.0)) { break; }
    }
    rgb_t color3 = get_color(iterations3, z3, c3);
    /* 'Pixel': 4. */
    complex<double> c4(c.real() + scale.x / 4, c.imag() + scale.y / 4);
    complex<double> z4(0, 0);
    unsigned int iterations4;
    for (iterations4 = 0; iterations4 < max_iterations; iterations4++)
    {
        z4 = z4 * z4 + c4;
        if (test_escape(z4, 2.0)) { break; }
    }
    rgb_t color4 = get_color(iterations4, z4, c4);
    /* Calculate the avrage and return the color. */
    rgb_t color;
    color.alpha = get_average(color1.alpha, color2.alpha, color3.alpha, color4.alpha);
    color.blue = get_average(color1.blue, color2.blue, color3.blue, color4.blue);
    color.green = get_average(color1.green, color2.green, color3.green, color4.green);
    color.red = get_average(color1.red, color2.red, color3.red, color4.red);
    return color;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
leaq 0x1863(%rip), %rax      # 0x5004
movl (%rax), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
subl %ecx, %edi
cvtsi2sd %edi, %xmm2
movsd 0x4ab6(%rip), %xmm0     # 0x8270
mulsd %xmm0, %xmm2
addsd 0x4aba(%rip), %xmm2     # 0x8280
leaq 0x183b(%rip), %rax      # 0x5008
movl (%rax), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
subl %ecx, %esi
cvtsi2sd %esi, %xmm3
movsd 0x4a92(%rip), %xmm1     # 0x8278
mulsd %xmm1, %xmm3
addsd 0x4a96(%rip), %xmm3     # 0x8288
movsd 0x1a96(%rip), %xmm4     # 0x5290
mulsd %xmm4, %xmm0
movsd %xmm2, 0x18(%rsp)
subsd %xmm0, %xmm2
mulsd %xmm4, %xmm1
movsd %xmm3, 0x10(%rsp)
movapd %xmm3, %xmm0
subsd %xmm1, %xmm0
movsd %xmm2, 0xa8(%rsp)
movsd %xmm0, 0xb0(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x60(%rsp)
leaq 0x499b(%rip), %r12      # 0x81d8
xorl %ebx, %ebx
cmpl $0x0, (%r12)
movl $0x0, %ebp
je 0x38b0
xorl %ebp, %ebp
movq %rsp, %r14
leaq 0x60(%rsp), %r15
movaps 0x60(%rsp), %xmm0
movaps %xmm0, (%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x360e
movsd (%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
addsd 0xa8(%rsp), %xmm0
addsd 0xb0(%rsp), %xmm1
movsd %xmm0, 0x60(%rsp)
movsd %xmm1, 0x68(%rsp)
mulsd %xmm0, %xmm0
mulsd %xmm1, %xmm1
addsd %xmm0, %xmm1
ucomisd 0x19aa(%rip), %xmm1     # 0x5250
ja 0x38b0
incl %ebp
cmpl (%r12), %ebp
jb 0x3855
leaq 0x60(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
movl %ebp, %edi
callq 0x339c
movl %eax, 0x2c(%rsp)
movsd 0x49a0(%rip), %xmm0     # 0x8270
movsd 0x19b8(%rip), %xmm2     # 0x5290
mulsd %xmm2, %xmm0
movsd 0x18(%rsp), %xmm1
subsd %xmm0, %xmm1
movsd 0x498a(%rip), %xmm0     # 0x8278
mulsd %xmm2, %xmm0
addsd 0x10(%rsp), %xmm0
movsd %xmm1, 0x98(%rsp)
movsd %xmm0, 0xa0(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x50(%rsp)
cmpl $0x0, (%r12)
je 0x3980
xorl %ebx, %ebx
movq %rsp, %r14
leaq 0x50(%rsp), %r15
movaps 0x50(%rsp), %xmm0
movaps %xmm0, (%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x360e
movsd (%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
addsd 0x98(%rsp), %xmm0
addsd 0xa0(%rsp), %xmm1
movsd %xmm0, 0x50(%rsp)
movsd %xmm1, 0x58(%rsp)
mulsd %xmm0, %xmm0
mulsd %xmm1, %xmm1
addsd %xmm0, %xmm1
ucomisd 0x18da(%rip), %xmm1     # 0x5250
ja 0x3980
incl %ebx
cmpl (%r12), %ebx
jb 0x3925
leaq 0x50(%rsp), %rsi
leaq 0x98(%rsp), %rdx
movl %ebx, %edi
callq 0x339c
movl %eax, 0x28(%rsp)
movsd 0x48d0(%rip), %xmm0     # 0x8270
movsd 0x18e8(%rip), %xmm2     # 0x5290
mulsd %xmm2, %xmm0
addsd 0x18(%rsp), %xmm0
movsd 0x48be(%rip), %xmm1     # 0x8278
mulsd %xmm2, %xmm1
movsd 0x10(%rsp), %xmm2
subsd %xmm1, %xmm2
movsd %xmm0, 0x88(%rsp)
movsd %xmm2, 0x90(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
xorl %ebp, %ebp
cmpl $0x0, (%r12)
movl $0x0, %ebx
je 0x3a57
xorl %ebx, %ebx
movq %rsp, %r14
leaq 0x40(%rsp), %r15
movaps 0x40(%rsp), %xmm0
movaps %xmm0, (%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x360e
movsd (%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
addsd 0x88(%rsp), %xmm0
addsd 0x90(%rsp), %xmm1
movsd %xmm0, 0x40(%rsp)
movsd %xmm1, 0x48(%rsp)
mulsd %xmm0, %xmm0
mulsd %xmm1, %xmm1
addsd %xmm0, %xmm1
ucomisd 0x1803(%rip), %xmm1     # 0x5250
ja 0x3a57
incl %ebx
cmpl (%r12), %ebx
jb 0x39fc
leaq 0x40(%rsp), %rsi
leaq 0x88(%rsp), %rdx
movl %ebx, %edi
callq 0x339c
movl %eax, 0x24(%rsp)
movsd 0x47f9(%rip), %xmm0     # 0x8270
movsd 0x1811(%rip), %xmm2     # 0x5290
mulsd %xmm2, %xmm0
movsd 0x18(%rsp), %xmm1
addsd %xmm0, %xmm1
mulsd 0x47e3(%rip), %xmm2     # 0x8278
movsd 0x10(%rsp), %xmm0
addsd %xmm2, %xmm0
movsd %xmm1, 0x78(%rsp)
movsd %xmm0, 0x80(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x30(%rsp)
cmpl $0x0, (%r12)
je 0x3b21
xorl %ebp, %ebp
movq %rsp, %r14
leaq 0x30(%rsp), %r15
movaps 0x30(%rsp), %xmm0
movaps %xmm0, (%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x360e
movsd (%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
addsd 0x78(%rsp), %xmm0
addsd 0x80(%rsp), %xmm1
movsd %xmm0, 0x30(%rsp)
movsd %xmm1, 0x38(%rsp)
mulsd %xmm0, %xmm0
mulsd %xmm1, %xmm1
addsd %xmm0, %xmm1
ucomisd 0x1739(%rip), %xmm1     # 0x5250
ja 0x3b21
incl %ebp
cmpl (%r12), %ebp
jb 0x3ac9
leaq 0x30(%rsp), %rsi
leaq 0x78(%rsp), %rdx
movl %ebp, %edi
callq 0x339c
movl 0x2c(%rsp), %ebx
movl %ebx, %edx
shrl $0x18, %edx
movl 0x28(%rsp), %ecx
movl %ecx, %r15d
shrl $0x18, %r15d
addl %edx, %r15d
movl %ebx, %r12d
movl %ecx, %esi
movl $0xff, %r14d
movzbl %bh, %edx
movl %edx, %r13d
movzbl %ch, %ebp
andl %r14d, %ebx
andl %r14d, %ecx
addl %ebx, %ecx
movl 0x24(%rsp), %edx
movl %edx, %r11d
movl %edx, %r10d
movzbl %dh, %edi
andl %r14d, %edx
addl %ecx, %edx
movl %eax, %r9d
movl %eax, %r8d
movzbl %ah, %ebx
andl %r14d, %eax
addl %edx, %eax
addl %r13d, %ebp
addl %edi, %ebp
addl %ebx, %ebp
shrl $0x18, %r11d
addl %r15d, %r11d
shrl $0x18, %r9d
addl %r11d, %r9d
shll $0x16, %r9d
shrl $0x10, %r12d
shrl $0x10, %esi
shrl $0x10, %r10d
shrl $0x10, %r8d
andl %r14d, %r12d
andl %r14d, %esi
addl %r12d, %esi
andl %r14d, %r10d
addl %esi, %r10d
andl %r14d, %r8d
addl %r10d, %r8d
shll $0xe, %r8d
andl $0xff0000, %r8d         # imm = 0xFF0000
shll $0x6, %ebp
andl $0xff00, %ebp           # imm = 0xFF00
shrl $0x2, %eax
orl %r9d, %eax
andl $0xff0000ff, %eax       # imm = 0xFF0000FF
orl %r8d, %eax
orl %ebp, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq