// File: /workspace/github_cpp_makefile_star2_O2/phillip-h[P]fractal-gen/fractalgen.cpp
// Function: main
int main(int argc, char** argv)
{
    if (argc < 4) {
        cout << "too few arguments!\n";
        cout << "usage: fractal-gen <width> <height> <scale>\n";
        cout << "                   ";
        cout << "[color A] [color B] [color C]\n";
        cout << "                   ";
        cout << "[cr+ci] [color depth] [offx] [offy]\n";
        return -1;
    }
    
    unsigned width = atoi(argv[1]);
    unsigned height = atoi(argv[2]);
    double size = atof(argv[3]); 
    unsigned color_depth = 255;
    double offx = -0.5;
    double offy = 0.0;
    bool mandel = true;
    complex c_arg(0, 0);
    auto file = "fractal.png";

    auto A_R = 0;
    auto A_G = 0;
    auto A_B = 0;

    auto B_R = 255;
    auto B_G = 255;
    auto B_B = 255;

    auto D_R = 0;
    auto D_G = 0;
    auto D_B = 0;

    if (argc > 4) {
        std::string str(argv[4]);
        if (str.at(0) == '#')
            str = str.substr(1, str.size() - 1);
        if (str.size() != 6) {
            cout << "error -- invalid color!\n";
            cout << "express colors as '#RRGGBB'.\n";
            return -1;
        }

        std::string sub_str = str.substr(0, 2);
        A_R = htoi(sub_str);

        sub_str = str.substr(2, 2);
        A_G = htoi(sub_str);
        
        sub_str = str.substr(4, 2);
        A_B = htoi(sub_str);
    }

    if (argc > 5) {
        std::string str(argv[5]);
        if (str.at(0) == '#')
            str = str.substr(1, str.size() - 1);
        if (str.size() != 6) {
            cout << "error -- invalid color!\n";
            cout << "express colors as '#RRGGBB'.\n";
            return -1;
        }

        std::string sub_str = str.substr(0, 2);
        B_R = htoi(sub_str);

        sub_str = str.substr(2, 2);
        B_G = htoi(sub_str);
        
        sub_str = str.substr(4, 2);
        B_B = htoi(sub_str);
    }
    
    if (argc > 6) {
        std::string str(argv[6]);
        if (str.at(0) == '#')
            str = str.substr(1, str.size() - 1);
        if (str.size() != 6) {
            cout << "error -- invalid color!\n";
            cout << "express colors as '#RRGGBB'.\n";
            return -1;
        }

        std::string sub_str = str.substr(0, 2);
        D_R = htoi(sub_str);

        sub_str = str.substr(2, 2);
        D_G = htoi(sub_str);
        
        sub_str = str.substr(4, 2);
        D_B = htoi(sub_str);
    }

    if (argc > 7 && std::string(argv[7]) != "mandelbrot") {
        mandel = false;
        offx = 0;
        offy = 0;
        std::string str(argv[7]);
        unsigned pos = 0;
        for (unsigned i = 0; i < str.size(); i++)
        {
            if (str.at(i) == '+') {
                pos = i + 1;
                break;
            }
        }
        if (pos == 0) {
            cout << "invalid complex argument!\n";
            return -1;
        }
        double real = atof(str.substr(0, pos - 1).c_str());
        double imag = atof(str.substr(pos, str.size() - pos).c_str());
        c_arg = complex(real, imag);
    }

    if (argc > 8)
        color_depth = atof(argv[8]);
    if (argc > 9)
        offx = atof(argv[9]);
    if (argc > 10)
        offy = atof(argv[10]);
    if (argc > 11)
        cout << "warning -- extra arguments, ignoring them.\n";

    cout << "fractal information:\n\n";
    
    if (mandel) {
        cout << "fractal type -- mandelbrot\n";
    } else {
        cout << "fractal type -- julia\n";
        cout << "complex argument -- " << c_arg.to_str() << "\n";
    }

    cout << "\n";
    cout << "width       -- " << width << "\n";
    cout << "height      -- " << height << "\n";
    cout << "pixels      -- " << (width * height * 4) << "\n";
    cout << "scale       -- " << size << "\n";
    cout << "color A     -- (";
    cout << A_R << ", " << A_G << ", " << A_B << ")\n";
    cout << "color B     -- (";
    cout << B_R << ", " << B_G << ", " << B_B << ")\n";
    cout << "color C     -- (";
    cout << D_R << ", " << D_G << ", " << D_B << ")\n";
    cout << "color depth -- " << color_depth << "\n";
    cout << "offx        -- " << offx << "\n";
    cout << "offy        -- " << offy << "\n";

    vector<unsigned char> image(width * height * 4);

    auto lerp = [&] (double x0, double y0,
                    double x1, double y1,
                    double t)
    {
        double m = (y1 - y0) / (x1 - x0);
        return y0 + t * m;
    };

    auto comp_color_r = [&] (unsigned val)
    {
        if (val == color_depth)
            return D_R;
        double rat = (double) val / color_depth;
        double dc = lerp(0, A_R, 1, B_R, rat);
        return (int) dc;
    };

    auto comp_color_g = [&] (unsigned val)
    {
        if (val == color_depth)
            return D_G;
        double rat = (double) val / color_depth;
        double dc = lerp(0, A_G, 1, B_G, rat);
        return (int) dc;
    };

    auto comp_color_b = [&] (unsigned val)
    {
        if (val == color_depth)
            return D_B;
        double rat = (double) val / color_depth;
        double dc = lerp(0, A_B, 1, B_B, rat);
        return (int) dc;
    };

    double r;
    double i;
    complex c;
    unsigned color;
    for (unsigned x = 0; x < width; x++)
    {
        for (unsigned y = 0; y < height; y++)
        {
            r = offx - size / 2 + size * x / width;
            i = offy - size / 2 + size * y / height;
            c = complex(r, i);
            if (mandel)
                color = eval(c, color_depth, c);
            else
                color = eval(c, color_depth, c_arg);
            set_pixel(comp_color_r(color),
                      comp_color_g(color),
                      comp_color_b(color), 
                      x, y, image, height);
        }
    }

    unsigned error = lodepng::encode(file, image, width, height);
    if (error)
        cout << "error -- " << lodepng_error_text(error) << std::endl;
    
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x278, %rsp            # imm = 0x278
cmpl $0x3, %edi
jg 0x26a3
movq 0x12997(%rip), %rbx     # 0x14fd8
leaq 0xb9ee(%rip), %rsi      # 0xe036
movq %rbx, %rdi
callq 0x2110
leaq 0xb9f3(%rip), %rsi      # 0xe04a
movq %rbx, %rdi
callq 0x2110
leaq 0xba11(%rip), %r14      # 0xe077
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2110
leaq 0xba13(%rip), %rsi      # 0xe08b
movq %rbx, %rdi
callq 0x2110
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2110
leaq 0xba18(%rip), %rsi      # 0xe0aa
movq %rbx, %rdi
callq 0x2110
pushq $-0x1
popq %r15
jmp 0x3558
movl %edi, %r13d
movq 0x8(%rsi), %rdi
movq %rsi, %rbx
callq 0x2220
movq 0x10(%rbx), %rdi
movl %eax, 0x5c(%rsp)
callq 0x2220
movq 0x18(%rbx), %rdi
movl %eax, %ebp
callq 0x21a0
vmovsd %xmm0, 0xc0(%rsp)
vxorps %xmm0, %xmm0, %xmm0
movl $0x0, 0x14(%rsp)
vmovaps %xmm0, 0xf0(%rsp)
vmovsd 0xb920(%rip), %xmm0     # 0xe010
vmovsd %xmm0, 0x50(%rsp)
vxorpd %xmm0, %xmm0, %xmm0
vmovsd %xmm0, 0xb8(%rsp)
cmpl $0x4, %r13d
jne 0x27f2
movl $0xff, 0x1c(%rsp)
movl $0x0, 0x24(%rsp)
movl $0x0, 0x20(%rsp)
xorl %r13d, %r13d
movl $0x0, 0xb0(%rsp)
movl $0x0, 0xa8(%rsp)
movl $0xff, 0xa0(%rsp)
movl $0xff, 0x88(%rsp)
movl $0xff, 0x90(%rsp)
xorl %ebx, %ebx
movq 0x12870(%rip), %rdi     # 0x14fd8
leaq 0xb9f5(%rip), %rsi      # 0xe164
movl %r13d, 0x48(%rsp)
callq 0x2110
movl %ebx, 0x18(%rsp)
movl %ebp, %r13d
testb %bl, %bl
je 0x29a5
movq 0x12849(%rip), %r15     # 0x14fd8
leaq 0xba01(%rip), %rsi      # 0xe197
movq %r15, %rdi
callq 0x2110
leaq 0xba09(%rip), %rsi      # 0xe1ae
movq %r15, %rdi
callq 0x2110
leaq 0x28(%rsp), %r12
leaq 0xf0(%rsp), %rsi
movq %rax, %r15
movq %r12, %rdi
callq 0x3754
movq %r15, %rdi
movq %r12, %rsi
callq 0x20f0
leaq 0xb9a2(%rip), %rsi      # 0xe179
movq %rax, %rdi
callq 0x2110
movl 0x5c(%rsp), %ebp
leaq 0x28(%rsp), %rdi
callq 0x22e8
jmp 0x29bc
movq 0x20(%rbx), %rsi
movq %rbx, 0x98(%rsp)
leaq 0x28(%rsp), %rdi
leaq 0x60(%rsp), %rdx
callq 0x2060
leaq 0x28(%rsp), %rdi
xorl %esi, %esi
callq 0x22b0
cmpb $0x23, (%rax)
jne 0x2851
leaq 0x28(%rsp), %rsi
movq 0x8(%rsi), %rcx
decq %rcx
leaq 0x60(%rsp), %rdi
pushq $0x1
popq %rdx
callq 0x2140
leaq 0x60(%rsp), %rbx
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq 0x2190
movq %rbx, %rdi
callq 0x22e8
movq 0x30(%rsp), %rbx
movl %r13d, 0x80(%rsp)
cmpq $0x6, %rbx
jne 0x2f14
leaq 0x60(%rsp), %rdi
leaq 0x28(%rsp), %rsi
pushq $0x2
popq %rcx
xorl %edx, %edx
callq 0x2140
leaq 0x258(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x21d0
leaq 0x258(%rsp), %rdi
callq 0x253c
leaq 0x258(%rsp), %rdi
movl %eax, %r14d
callq 0x22e8
leaq 0xd0(%rsp), %rdi
leaq 0x28(%rsp), %rsi
pushq $0x2
popq %rcx
movq %rcx, %rdx
callq 0x2140
leaq 0x60(%rsp), %r15
leaq 0xd0(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x2190
movq %r12, %rdi
callq 0x22e8
leaq 0x238(%rsp), %rdi
movq %r15, %rsi
callq 0x21d0
leaq 0x238(%rsp), %rdi
callq 0x253c
leaq 0x238(%rsp), %rdi
movl %eax, %r15d
callq 0x22e8
leaq 0xd0(%rsp), %rdi
leaq 0x28(%rsp), %rsi
pushq $0x4
popq %rdx
pushq $0x2
popq %rcx
callq 0x2140
leaq 0x60(%rsp), %r12
leaq 0xd0(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x2190
movq %r13, %rdi
callq 0x22e8
leaq 0x218(%rsp), %rdi
movq %r12, %rsi
callq 0x21d0
leaq 0x218(%rsp), %rdi
movl $0xff, 0x1c(%rsp)
callq 0x253c
movzbl %r15b, %ecx
movzbl %al, %eax
leaq 0x218(%rsp), %rdi
movzbl %r14b, %r13d
movl %ecx, 0xb0(%rsp)
movl %eax, 0xa8(%rsp)
callq 0x22e8
leaq 0x60(%rsp), %rdi
callq 0x22e8
xorl %r15d, %r15d
jmp 0x2f5f
movq 0x1262c(%rip), %rdi     # 0x14fd8
movl 0x5c(%rsp), %ebp
leaq 0xb7c4(%rip), %rsi      # 0xe17b
callq 0x2110
movq 0x12615(%rip), %r14     # 0x14fd8
leaq 0xb7af(%rip), %r15      # 0xe179
movq %r15, %rsi
movq %r14, %rdi
callq 0x2110
leaq 0xb7e7(%rip), %rsi      # 0xe1c3
movq %r14, %rdi
callq 0x2110
movl %ebp, %esi
movq %rax, %rdi
callq 0x20b0
movq %rax, %rdi
movq %r15, %rsi
callq 0x2110
leaq 0xb7d3(%rip), %rsi      # 0xe1d3
movq %r14, %rdi
callq 0x2110
movl %r13d, %ebx
movl %r13d, %esi
movq %rax, %rdi
callq 0x20b0
movq %rax, %rdi
movq %r15, %rsi
callq 0x2110
leaq 0xb7bb(%rip), %rsi      # 0xe1e3
movq %r14, %rdi
callq 0x2110
movl %ebp, %esi
imull %r13d, %esi
movq %rax, %rdi
shll $0x2, %esi
movq %rsi, 0x80(%rsp)
callq 0x20b0
movq %rax, %rdi
movq %r15, %rsi
callq 0x2110
leaq 0xb798(%rip), %rsi      # 0xe1f3
movq %r14, %rdi
callq 0x2110
vmovsd 0xc0(%rsp), %xmm0
movq %rax, %rdi
callq 0x2240
movq %rax, %rdi
movq %r15, %rsi
callq 0x2110
leaq 0xb77d(%rip), %rsi      # 0xe203
movq %r14, %rdi
callq 0x2110
movl 0x48(%rsp), %esi
movq %r14, %rdi
callq 0x2270
leaq 0xb773(%rip), %r15      # 0xe214
movq %rax, %rdi
movq %r15, %rsi
callq 0x2110
movl 0xb0(%rsp), %esi
movq %rax, %rdi
callq 0x2270
movq %rax, %rdi
movq %r15, %rsi
callq 0x2110
movl 0xa8(%rsp), %esi
movq %rax, %rdi
callq 0x2270
leaq 0xb73b(%rip), %r12      # 0xe217
movq %rax, %rdi
movq %r12, %rsi
callq 0x2110
leaq 0xb72c(%rip), %rsi      # 0xe21a
movq %r14, %rdi
callq 0x2110
movl 0x90(%rsp), %esi
movq %r14, %rdi
callq 0x2270
movq %rax, %rdi
movq %r15, %rsi
callq 0x2110
movl 0x88(%rsp), %esi
movq %rax, %rdi
callq 0x2270
movq %rax, %rdi
movq %r15, %rsi
callq 0x2110
movl 0xa0(%rsp), %r13d
movq %rax, %rdi
movl %r13d, %esi
callq 0x2270
movq %rax, %rdi
movq %r12, %rsi
callq 0x2110
leaq 0xb6dc(%rip), %rsi      # 0xe22b
movq %r14, %rdi
callq 0x2110
movl 0x14(%rsp), %esi
movq %r14, %rdi
callq 0x2270
movq %rax, %rdi
movq %r15, %rsi
callq 0x2110
movl 0x24(%rsp), %esi
movq %rax, %rdi
callq 0x2270
movq %rax, %rdi
movq %r15, %rsi
callq 0x2110
movl 0x20(%rsp), %esi
movq %rax, %rdi
callq 0x2270
movq %rax, %rdi
movq %r12, %rsi
callq 0x2110
leaq 0xb699(%rip), %rsi      # 0xe23c
movq %r14, %rdi
callq 0x2110
movl 0x1c(%rsp), %r15d
movq %rax, %rdi
movl %r15d, %esi
callq 0x20b0
leaq 0xb5b7(%rip), %r12      # 0xe179
movq %rax, %rdi
movq %r12, %rsi
callq 0x2110
leaq 0xb678(%rip), %rsi      # 0xe24c
movq %r14, %rdi
callq 0x2110
vmovsd 0x50(%rsp), %xmm0
movq %rax, %rdi
callq 0x2240
movq %rax, %rdi
movq %r12, %rsi
callq 0x2110
leaq 0xb660(%rip), %rsi      # 0xe25c
movq %r14, %rdi
callq 0x2110
vmovsd 0xb8(%rsp), %xmm0
movq %rax, %rdi
callq 0x2240
movq %rax, %rdi
movq %r12, %rsi
callq 0x2110
movq 0x80(%rsp), %rsi
leaq 0x60(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x3836
vmovsd 0xc0(%rsp), %xmm0
vmovsd 0x50(%rsp), %xmm1
movl %ebx, %r14d
vmulsd 0xb3c7(%rip), %xmm0, %xmm0 # 0xe018
vsubsd %xmm0, %xmm1, %xmm1
vmovsd %xmm1, 0xc8(%rsp)
vcvtusi2sd %ebp, %xmm2, %xmm1
movl %r15d, %ebp
vmovsd %xmm1, 0x108(%rsp)
vmovsd 0xb8(%rsp), %xmm1
vsubsd %xmm0, %xmm1, %xmm0
vmovsd %xmm0, 0xb8(%rsp)
vcvtusi2sd %ebx, %xmm2, %xmm0
movl $0xff, %ebx
vmovsd %xmm0, 0x80(%rsp)
vcvtusi2sd %r15d, %xmm2, %xmm0
vcvtsi2sdl 0x48(%rsp), %xmm2, %xmm1
leaq 0x60(%rsp), %r15
vmovsd %xmm0, 0x98(%rsp)
vcvtsi2sdl 0x90(%rsp), %xmm2, %xmm0
vmovsd %xmm1, 0x90(%rsp)
vsubsd %xmm1, %xmm0, %xmm0
vcvtsi2sdl 0xb0(%rsp), %xmm2, %xmm1
vmovsd %xmm0, 0x48(%rsp)
vcvtsi2sdl 0x88(%rsp), %xmm2, %xmm0
vmovsd %xmm1, 0xb0(%rsp)
vsubsd %xmm1, %xmm0, %xmm0
vcvtsi2sdl 0xa8(%rsp), %xmm2, %xmm1
vmovsd %xmm0, 0x88(%rsp)
vcvtsi2sd %r13d, %xmm2, %xmm0
xorl %r13d, %r13d
vsubsd %xmm1, %xmm0, %xmm0
vmovsd %xmm1, 0xa8(%rsp)
vmovsd %xmm0, 0xa0(%rsp)
cmpl 0x5c(%rsp), %r13d
je 0x2e8b
vcvtusi2sd %r13d, %xmm2, %xmm0
vmulsd 0xc0(%rsp), %xmm0, %xmm0
xorl %r12d, %r12d
vdivsd 0x108(%rsp), %xmm0, %xmm0
vaddsd 0xc8(%rsp), %xmm0, %xmm0
vmovsd %xmm0, 0x50(%rsp)
cmpl %r12d, %r14d
je 0x2e83
vcvtusi2sd %r12d, %xmm4, %xmm0
vmulsd 0xc0(%rsp), %xmm0, %xmm0
cmpb $0x0, 0x18(%rsp)
vdivsd 0x80(%rsp), %xmm0, %xmm0
vaddsd 0xb8(%rsp), %xmm0, %xmm0
je 0x2dc1
vmovsd 0x50(%rsp), %xmm1
leaq 0x110(%rsp), %rdi
leaq 0x140(%rsp), %rdx
vmovsd %xmm1, 0x110(%rsp)
vmovapd 0xf0(%rsp), %xmm1
vmovsd %xmm0, 0x118(%rsp)
vmovapd %xmm1, 0x140(%rsp)
jmp 0x2dfb
vmovsd 0x50(%rsp), %xmm1
leaq 0x130(%rsp), %rdi
leaq 0x120(%rsp), %rdx
vmovsd %xmm1, 0x130(%rsp)
vmovsd %xmm1, 0x120(%rsp)
vmovsd %xmm0, 0x138(%rsp)
vmovsd %xmm0, 0x128(%rsp)
movl %ebp, %esi
callq 0x244c
movl 0x24(%rsp), %esi
movl 0x14(%rsp), %edi
movl 0x20(%rsp), %edx
cmpl %eax, %ebp
je 0x2e63
vcvtusi2sd %eax, %xmm4, %xmm0
vdivsd 0x98(%rsp), %xmm0, %xmm0
vmovsd 0x48(%rsp), %xmm1
vmovsd 0x88(%rsp), %xmm3
vmovsd 0xa0(%rsp), %xmm2
vfmadd213sd 0x90(%rsp), %xmm0, %xmm1 # xmm1 = (xmm0 * xmm1) + mem
vfmadd213sd 0xb0(%rsp), %xmm0, %xmm3 # xmm3 = (xmm0 * xmm3) + mem
vfmadd213sd 0xa8(%rsp), %xmm2, %xmm0 # xmm0 = (xmm2 * xmm0) + mem
vcvttsd2si %xmm1, %edi
vcvttsd2si %xmm3, %esi
vcvttsd2si %xmm0, %edx
andl %ebx, %edi
andl %ebx, %esi
andl %ebx, %edx
movl %r14d, (%rsp)
movl %r13d, %ecx
movl %r12d, %r8d
movq %r15, %r9
callq 0x24c8
incl %r12d
jmp 0x2d54
incl %r13d
jmp 0x2d1f
leaq 0xb23d(%rip), %rsi      # 0xe0cf
leaq 0x28(%rsp), %rdi
leaq 0xd0(%rsp), %rdx
callq 0x2060
leaq 0x28(%rsp), %rdi
leaq 0x60(%rsp), %rsi
pushq $0x6
popq %r8
pushq $0x8
popq %r9
movl 0x5c(%rsp), %edx
movl %r14d, %ecx
callq 0xb007
leaq 0x28(%rsp), %rdi
movl %eax, %ebx
callq 0x22e8
testl %ebx, %ebx
je 0x2f02
movq 0x120ff(%rip), %rdi     # 0x14fd8
leaq 0xb38c(%rip), %rsi      # 0xe26c
callq 0x2110
movl %ebx, %edi
movq %rax, %r14
callq 0xaa1c
movq %r14, %rdi
movq %rax, %rsi
callq 0x2110
movq %rax, %rdi
callq 0x2080
leaq 0x60(%rsp), %rdi
callq 0x3b4c
xorl %r15d, %r15d
jmp 0x3558
movq 0x120bd(%rip), %rdi     # 0x14fd8
leaq 0xb1b9(%rip), %rsi      # 0xe0db
callq 0x2110
movq 0x120aa(%rip), %rdi     # 0x14fd8
leaq 0xb1bf(%rip), %rsi      # 0xe0f4
callq 0x2110
movl $0xff, 0x1c(%rsp)
pushq $-0x1
popq %r15
movl $0x0, 0xa8(%rsp)
movl $0x0, 0xb0(%rsp)
xorl %r13d, %r13d
leaq 0x28(%rsp), %rdi
callq 0x22e8
cmpq $0x6, %rbx
jne 0x3558
cmpl $0x6, 0x80(%rsp)
movl $0x0, 0x14(%rsp)
jb 0x3149
movq 0x98(%rsp), %rax
movq 0x28(%rax), %rsi
leaq 0x28(%rsp), %rdi
leaq 0x60(%rsp), %rdx
callq 0x2060
leaq 0x28(%rsp), %rdi
xorl %esi, %esi
callq 0x22b0
cmpb $0x23, (%rax)
jne 0x2fe8
leaq 0x28(%rsp), %rsi
movq 0x8(%rsi), %rcx
decq %rcx
leaq 0x60(%rsp), %rdi
pushq $0x1
popq %rdx
callq 0x2140
leaq 0x60(%rsp), %rbx
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq 0x2190
movq %rbx, %rdi
callq 0x22e8
movq 0x30(%rsp), %rbx
cmpq $0x6, %rbx
jne 0x315e
leaq 0x60(%rsp), %rdi
leaq 0x28(%rsp), %rsi
pushq $0x2
popq %rcx
xorl %edx, %edx
callq 0x2140
leaq 0x1f8(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x21d0
leaq 0x1f8(%rsp), %rdi
callq 0x253c
leaq 0x1f8(%rsp), %rdi
movb %al, 0x14(%rsp)
movl %r15d, 0x48(%rsp)
callq 0x22e8
leaq 0xd0(%rsp), %rdi
leaq 0x28(%rsp), %rsi
pushq $0x2
popq %rcx
movq %rcx, %rdx
callq 0x2140
leaq 0x60(%rsp), %r15
leaq 0xd0(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x2190
movq %r12, %rdi
callq 0x22e8
leaq 0x1d8(%rsp), %rdi
movq %r15, %rsi
callq 0x21d0
leaq 0x1d8(%rsp), %rdi
callq 0x253c
leaq 0x1d8(%rsp), %rdi
movl %eax, %r14d
movl %r13d, %r15d
callq 0x22e8
leaq 0xd0(%rsp), %rdi
leaq 0x28(%rsp), %rsi
pushq $0x4
popq %rdx
pushq $0x2
popq %rcx
callq 0x2140
leaq 0x60(%rsp), %r12
leaq 0xd0(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x2190
movq %r13, %rdi
callq 0x22e8
leaq 0x1b8(%rsp), %rdi
movq %r12, %rsi
callq 0x21d0
movl %r15d, %r13d
movl 0x48(%rsp), %r15d
movl $0xff, 0x1c(%rsp)
leaq 0x1b8(%rsp), %rdi
callq 0x253c
movb 0x14(%rsp), %cl
movzbl %cl, %ecx
movzbl %r14b, %edx
movzbl %al, %eax
leaq 0x1b8(%rsp), %rdi
movl %ecx, 0x90(%rsp)
movl %edx, 0x88(%rsp)
movl %eax, 0xa0(%rsp)
callq 0x22e8
leaq 0x60(%rsp), %rdi
callq 0x22e8
jmp 0x31a9
movl $0x0, 0x24(%rsp)
movl $0x0, 0x20(%rsp)
jmp 0x273e
movq 0x11e73(%rip), %rdi     # 0x14fd8
leaq 0xaf6f(%rip), %rsi      # 0xe0db
callq 0x2110
movq 0x11e60(%rip), %rdi     # 0x14fd8
leaq 0xaf75(%rip), %rsi      # 0xe0f4
callq 0x2110
pushq $-0x1
popq %r15
movl $0xff, 0xa0(%rsp)
movl $0xff, 0x88(%rsp)
movl $0xff, 0x90(%rsp)
leaq 0x28(%rsp), %rdi
callq 0x22e8
cmpq $0x6, %rbx
jne 0x3558
cmpl $0x6, 0x80(%rsp)
movl $0x0, 0x14(%rsp)
jne 0x31e4
movl $0x0, 0x24(%rsp)
movl $0x0, 0x20(%rsp)
jmp 0x275f
movq 0x98(%rsp), %rax
movq 0x30(%rax), %rsi
leaq 0x28(%rsp), %rdi
leaq 0x60(%rsp), %rdx
callq 0x2060
leaq 0x28(%rsp), %rdi
xorl %esi, %esi
callq 0x22b0
cmpb $0x23, (%rax)
jne 0x3243
leaq 0x28(%rsp), %rsi
movq 0x8(%rsi), %rcx
decq %rcx
leaq 0x60(%rsp), %rdi
pushq $0x1
popq %rdx
callq 0x2140
leaq 0x60(%rsp), %rbx
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq 0x2190
movq %rbx, %rdi
callq 0x22e8
movq 0x30(%rsp), %rbx
cmpq $0x6, %rbx
jne 0x339b
leaq 0x60(%rsp), %rdi
leaq 0x28(%rsp), %rsi
pushq $0x2
popq %rcx
xorl %edx, %edx
callq 0x2140
leaq 0x198(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x21d0
leaq 0x198(%rsp), %rdi
callq 0x253c
leaq 0x198(%rsp), %rdi
movb %al, 0x14(%rsp)
movl %r15d, 0x48(%rsp)
callq 0x22e8
leaq 0xd0(%rsp), %rdi
leaq 0x28(%rsp), %rsi
pushq $0x2
popq %rcx
movq %rcx, %rdx
callq 0x2140
leaq 0x60(%rsp), %r15
leaq 0xd0(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x2190
movq %r12, %rdi
callq 0x22e8
leaq 0x178(%rsp), %rdi
movq %r15, %rsi
callq 0x21d0
leaq 0x178(%rsp), %rdi
callq 0x253c
leaq 0x178(%rsp), %rdi
movl %eax, %r14d
movl %r13d, %r15d
callq 0x22e8
leaq 0xd0(%rsp), %rdi
leaq 0x28(%rsp), %rsi
pushq $0x4
popq %rdx
pushq $0x2
popq %rcx
callq 0x2140
leaq 0x60(%rsp), %r12
leaq 0xd0(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x2190
movq %r13, %rdi
callq 0x22e8
leaq 0x158(%rsp), %rdi
movq %r12, %rsi
callq 0x21d0
movl %r15d, %r13d
movl 0x48(%rsp), %r15d
movl $0xff, 0x1c(%rsp)
leaq 0x158(%rsp), %rdi
callq 0x253c
movb 0x14(%rsp), %cl
movzbl %cl, %ecx
movzbl %r14b, %edx
movzbl %al, %eax
leaq 0x158(%rsp), %rdi
movl %ecx, 0x14(%rsp)
movl %edx, 0x24(%rsp)
movl %eax, 0x20(%rsp)
callq 0x22e8
leaq 0x60(%rsp), %rdi
callq 0x22e8
jmp 0x33dd
movq 0x11c36(%rip), %rdi     # 0x14fd8
leaq 0xad32(%rip), %rsi      # 0xe0db
callq 0x2110
movq 0x11c23(%rip), %rdi     # 0x14fd8
leaq 0xad38(%rip), %rsi      # 0xe0f4
callq 0x2110
pushq $-0x1
popq %r15
movl $0x0, 0x20(%rsp)
movl $0x0, 0x24(%rsp)
movl $0x0, 0x14(%rsp)
leaq 0x28(%rsp), %rdi
callq 0x22e8
cmpq $0x6, %rbx
jne 0x3558
cmpl $0x8, 0x80(%rsp)
jb 0x275f
movq 0x98(%rsp), %rax
movq 0x38(%rax), %rsi
leaq 0x28(%rsp), %rdi
leaq 0x60(%rsp), %rdx
callq 0x2060
leaq 0xacf1(%rip), %rsi      # 0xe112
leaq 0x28(%rsp), %rdi
callq 0x3749
leaq 0x28(%rsp), %rdi
movl %eax, %ebx
callq 0x22e8
movl %ebx, 0x18(%rsp)
testb %bl, %bl
je 0x3523
movq 0x98(%rsp), %rax
movl %r15d, 0x48(%rsp)
movq 0x38(%rax), %rsi
leaq 0x28(%rsp), %rdi
leaq 0x60(%rsp), %rdx
callq 0x2060
leaq 0x28(%rsp), %r12
xorl %ebx, %ebx
movl %ebx, %r15d
cmpq %r15, 0x30(%rsp)
jbe 0x352d
movq %r12, %rdi
movq %r15, %rsi
callq 0x22b0
cmpb $0x2b, (%rax)
leal 0x1(%r15), %ebx
jne 0x346a
testl %ebx, %ebx
je 0x352d
leaq 0x60(%rsp), %rdi
leaq 0x28(%rsp), %rsi
xorl %edx, %edx
movq %r15, %rcx
callq 0x2140
leaq 0x60(%rsp), %r15
movq (%r15), %rdi
callq 0x21a0
movq %r15, %rdi
vmovsd %xmm0, 0x50(%rsp)
callq 0x22e8
leaq 0x28(%rsp), %rsi
movl %ebx, %edx
movq 0x8(%rsi), %rcx
subq %rdx, %rcx
leaq 0x60(%rsp), %rdi
callq 0x2140
leaq 0x60(%rsp), %r15
movq (%r15), %rdi
callq 0x21a0
movq %r15, %rdi
vmovsd %xmm0, 0xc8(%rsp)
callq 0x22e8
vmovsd 0x50(%rsp), %xmm0
vmovsd 0xc8(%rsp), %xmm1
movl 0x48(%rsp), %r15d
xorl %ebx, %ebx
vmovsd %xmm0, 0xf0(%rsp)
vmovsd %xmm1, 0xf8(%rsp)
jmp 0x3546
vmovsd 0xaae5(%rip), %xmm0     # 0xe010
jmp 0x356d
movq 0x11aa4(%rip), %rdi     # 0x14fd8
leaq 0xabe2(%rip), %rsi      # 0xe11d
callq 0x2110
pushq $-0x1
popq %r15
movb $0x1, %bl
leaq 0x28(%rsp), %rdi
callq 0x22e8
vxorpd %xmm0, %xmm0, %xmm0
testb %bl, %bl
je 0x356d
movl %r15d, %eax
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x80(%rsp), %ebx
vmovsd %xmm0, 0x50(%rsp)
cmpl $0x9, %ebx
jl 0x35dd
movq 0x98(%rsp), %r15
movq 0x40(%r15), %rdi
callq 0x21a0
vcvttsd2usi %xmm0, %eax
movl %eax, 0x1c(%rsp)
cmpl $0x9, %ebx
je 0x35dd
movq 0x48(%r15), %rdi
callq 0x21a0
vmovsd %xmm0, 0x50(%rsp)
cmpl $0xb, %ebx
jb 0x35dd
movq 0x50(%r15), %rdi
callq 0x21a0
vmovsd %xmm0, 0xb8(%rsp)
cmpl $0xb, %ebx
je 0x35dd
movq 0x11a07(%rip), %rdi     # 0x14fd8
leaq 0xab60(%rip), %rsi      # 0xe138
callq 0x2110
movl 0x18(%rsp), %ebx
jmp 0x2761
jmp 0x36eb
jmp 0x36eb
jmp 0x36eb
jmp 0x36d5
jmp 0x36eb
jmp 0x36d5
movq %rax, %rbx
leaq 0x158(%rsp), %rdi
jmp 0x36b7
jmp 0x36dc
movq %rax, %rbx
leaq 0x178(%rsp), %rdi
jmp 0x36b7
jmp 0x36dc
movq %rax, %rbx
leaq 0x198(%rsp), %rdi
jmp 0x36b7
jmp 0x36eb
jmp 0x36eb
jmp 0x36d5
jmp 0x36dc
jmp 0x36eb
movq %rax, %rbx
leaq 0x1b8(%rsp), %rdi
jmp 0x36b7
jmp 0x36eb
jmp 0x36dc
movq %rax, %rbx
leaq 0x1d8(%rsp), %rdi
jmp 0x36b7
jmp 0x36dc
movq %rax, %rbx
leaq 0x1f8(%rsp), %rdi
jmp 0x36b7
jmp 0x36eb
jmp 0x36eb
jmp 0x36d5
jmp 0x36dc
leaq 0x218(%rsp), %rdi
movq %rax, %rbx
jmp 0x36b7
jmp 0x36eb
jmp 0x36dc
movq %rax, %rbx
leaq 0x238(%rsp), %rdi
jmp 0x36b7
jmp 0x36dc
movq %rax, %rbx
leaq 0x258(%rsp), %rdi
callq 0x22e8
jmp 0x36df
jmp 0x36eb
jmp 0x36eb
jmp 0x36d5
leaq 0x28(%rsp), %rdi
movq %rax, %rbx
callq 0x22e8
jmp 0x36ff
jmp 0x36fc
movq %rax, %rbx
jmp 0x3709
jmp 0x36eb
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x22e8
jmp 0x36ee
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x22e8
jmp 0x3709
jmp 0x36fc
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x3b4c
movq %rbx, %rdi
callq 0x2280
nop