// File: /workspace/github_cpp_makefile_star2_O3/intheswim[P]FractalTubes/infra.cpp
// Function: redrawMethod()
void redrawMethod()
{    
    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
    
	glLoadIdentity();
    
    float tX = x_shift;
    
    float tY = 0;
    
    float tZ = -3.0f + 0.5 * cos(rotation * 0.02f);
    
    float angle = 2.0 * rotation;
    float rX = 1.0 ;
    float rY = 0.5;
    float rZ = 0.5 ;
    
#ifdef USE_RUNTIME
    tZ = tX = 0;
    
    tZ = -3.0f + baseZ;
    
    angle = baseY + 2 * rotation;
    rX = 1;
    rY = 0;
    rZ = 0;
    
    float rX2 = 0;
    float rY2 = 1;
    float rZ2 = 0;
    float angle2 = baseX;
#endif
    
    double eye_x = 0, eye_y = 0, eye_z = 0;
    
  	glTranslated ( tX, tY, tZ );
    glRotated ( angle, rX, rY, rZ ); // (angle, x, y, z)
    
#ifdef USE_RUNTIME
    glRotated ( angle2, rX2, rY2, rZ2 );
#endif
    
    getTransformedCoords (0, 0, 0, -tX, -tY, -tZ,
                          -angle, rX, rY, rZ,
                          eye_x, eye_y, eye_z);
    
#ifdef USE_RUNTIME
    getTransformedCoords (eye_x, eye_y, eye_z, 0, 0, 0,
                          -angle2, rX2, rY2, rZ2,
                          eye_x, eye_y, eye_z);
#endif
        
    double shine = shineFactor;
    
    if (USE_LIGHT)
    {
        glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, light2Sides);
        
        GLfloat ambGlobal[] = { 0.2, 0.2, 0.2, 1.0 };
        
        for (int i=0; i < 3; i++)
        {
            ambGlobal[i] += (float)(shine * 0.06f);
        }
        
        glLightModelfv (GL_LIGHT_MODEL_AMBIENT, ambGlobal);
        
        GLfloat light_position[4] = { 0.0, 5.0, 0.0, 1.0 };
            
        for (int i=0; i < 3; i++)
        {
            light_position[i] = -distance2Light;
        }
    
        glLightfv( GL_LIGHT0, GL_POSITION, light_position);
        
        float ambK = (1 - shine * 0.05) ;
        
        GLfloat ambientColor[] = { ambK, ambK, ambK, 1 };
        glLightfv (GL_LIGHT0, GL_AMBIENT, ambientColor);

        float diffK = (1 - shine * 0.09) ;
        
        GLfloat diffuseColor[] = { diffK, diffK, diffK, 1 };
        glLightfv (GL_LIGHT0, GL_DIFFUSE, diffuseColor);

        float specK = (0.1 + shine * 0.09) ;
        
        GLfloat specularColor[] = { specK, specK, specK, 0.0 };
        glLightfv (GL_LIGHT0, GL_SPECULAR, specularColor);
        
        GLfloat mat_ambient_front[] = { 0.1f, 0.1f, 0.9f, (float)image_alpha };
        
        glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, mat_ambient_front);
        
        GLfloat mat_diffuse_back[] = { 0, 0, 0, (float)image_alpha };
        
        glMaterialfv(GL_BACK, GL_DIFFUSE, mat_diffuse_back);
                
        float specMat = 0.1 + shine * 0.08;
        
        GLfloat mat_specular[] = { (float)(image_alpha * specMat * 0.5f), 
                                    (float)(image_alpha * specMat), 
                                    (float)(image_alpha * specMat), 
                                    (float)(image_alpha) };
    
        glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, mat_specular);
    
        GLfloat mat_shininess[] = { 7.0 };
        
        mat_shininess[0] += (float)(12.0f * shine);
    
        glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, mat_shininess);
    
        glShadeModel ( SHADE_MODE );
        
    } // USE_LIGHT
    
    
    long core_cnt = 0;
    
    // we sort "cores" (centers of the "rings") by distance to the observer, starting from far to near.
    // Then for each core we draw the correspomding "ring", in 2 phases:
    // forst "back/rear" points, then "front".
    // This way we make sure that all points are distplayed from "back" to "front" and
    // correspondingly we can show as many leves of transparency as we want.
    // (See polygon transparency order OpenGL issue for more detail).
    
    // P.S.
    // Original code had no "separate" rings. They were all part of one big spiral.
    // When drawing as points this had no difference; however when drawing as connected
    // "rectangles" it was not possible to guarantee 100% that all points appear from
    // back to front, even with additional hacks I tried there was still part of the
    // "ring" which was showing the split line.
    
    if (corePoints != NULL)
    {
        core_cnt = m3d_pt_count / m3d_pt_cycle;
        
        sortByDistanceToEye (eye_x, eye_y, eye_z, corePoints, core_cnt);
    }
           
    glBegin ( GL_QUADS ); 
    {
        for (int core = 0; core < core_cnt; core++)
        {
            struct corePointData *cpd = &(corePoints[core]);
            
            for (int mode = 0; mode < 2; mode++)
            {
                for (int j = 0; j < m3d_pt_cycle; j++)
                    // for (int i=0, next = grid_step; i < m3d_pt_count - grid_step - 1; i++, next++)
                    // for (int i = m3d_pt_count - grid_step - 2, next = i + grid_step; i >= 0; i--, next--)
                {
                    int i = cpd->index + j;
                    int next = i + grid_step;
                    
                    if (next >= m3d_pt_count - 1)
                    {
                        continue;
                    }
                    
                    struct pointData *pd = pointData + i;
                    
                    bool show = (pd->ucGreen > 0 || pd->ucBlue > 0 || pd->ucRed > 0);
                    
                    if (show == false)
                    {
                        continue;
                    }
                    
                    double vx = eye_x - pd->x;
                    double vy = eye_y - pd->y;
                    double vz = eye_z - pd->z;
                    
                    if (mode==0) { pd->cMult = 0; }
                    
                    if (mode == 0)
                    {
                       // if (mult > 0) continue; // passes back only
                        double mult = vx * pd->normx + vy * pd->normy + vz * pd->normz;
                        pd->cMult = (mult < 0) ? -1 : 1;
                        
                        if (pd->cMult > 0) continue;
                    }
                    else
                    {
                        if (pd->cMult <= 0) continue; // passes front only
                    }
                    
                    float b = pd->ucBlue;
                    float g = pd->ucGreen;
                    float r = pd->ucRed;
                    
                    if (g > 0 || b > 0)
                    {
                        if (image_alpha == 1.0)
                        {
                            glColor4ub( r, g, b, (unsigned char)(stdAlpha * 255.0));                            
                        }
                        else
                        {
                            glColor4ub( r * image_alpha, g * image_alpha , b * image_alpha, (unsigned char)(stdAlpha * 255.0));
                        }
                    }
                    else
                    {
                        if (pd->ucRed > 0)
                        {
                            float alpha = r;
                            
                            float alpha2 = r * (2.0 - r /255.0f);
                                                        
                            alpha = 0.5 * (alpha + alpha2);
                            
                            glColor4ub ( (unsigned char)(r * image_alpha), 0, 0, (unsigned char)(alpha * image_alpha));
                        }
                    }
                    
                    
                    if ( USE_LIGHT )
                    {
                        glNormal3d ( pd->normx, pd->normy, pd->normz );
                    }

                    for (int mode2=0; mode2 < 2; mode2++)
                    {
                        if (mode2==1)
                        {
                            glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
                        }
                        else
                        {
                            glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
                        }
                    
                        struct pointData *pdNext = pointData + next;
                    
                        if (j + 1 == m3d_pt_cycle) // last point connects to first on this "ring"
                        {
                            struct pointData *pd1 = pointData + (i + 1 - grid_step);
                        
                            struct pointData *pdNext1 = pointData + (next + 1 - grid_step);
                        
                            glVertex3d ( pd->x , pd->y , pd->z );
                            glVertex3d ( pd1->x , pd1->y , pd1->z );
                            glVertex3d ( pdNext1->x , pdNext1->y , pdNext1->z );
                            glVertex3d ( pdNext->x , pdNext->y , pdNext->z );
                        }
                        else
                        {
                            struct pointData *pd1 = pointData + (i + 1);
                        
                            struct pointData *pdNext1 = pointData + (next + 1);
                                                
                            glVertex3d ( pd->x , pd->y , pd->z );
                            glVertex3d ( pd1->x , pd1->y , pd1->z );
                            glVertex3d ( pdNext1->x , pdNext1->y , pdNext1->z );
                            glVertex3d ( pdNext->x , pdNext->y , pdNext->z );
                        }

                   }  // mode1
                    
                }
            }
        } // 2nd for

        glEnd();
    }
        
    glFlush();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movl $0x4100, %edi           # imm = 0x4100
callq 0x30b0
callq 0x33f0
movss 0x812b(%rip), %xmm0     # 0xc4c4
movss %xmm0, 0x10(%rsp)
movss 0x8121(%rip), %xmm0     # 0xc4c8
mulss 0x4f4d(%rip), %xmm0     # 0x92fc
callq 0x3210
cvtss2sd %xmm0, %xmm0
mulsd 0x4e98(%rip), %xmm0     # 0x9258
addsd 0x4e98(%rip), %xmm0     # 0x9260
cvtsd2ss %xmm0, %xmm1
movss 0x80f4(%rip), %xmm0     # 0xc4c8
addss %xmm0, %xmm0
movss %xmm0, (%rsp)
xorps %xmm0, %xmm0
cvtss2sd 0x10(%rsp), %xmm0
movss %xmm1, 0x14(%rsp)
cvtss2sd %xmm1, %xmm2
xorps %xmm1, %xmm1
callq 0x3310
xorps %xmm0, %xmm0
cvtss2sd (%rsp), %xmm0
movsd %xmm0, (%rsp)
movsd 0x4e43(%rip), %xmm1     # 0x9250
movsd 0x4e43(%rip), %xmm2     # 0x9258
movaps %xmm2, %xmm3
callq 0x33c0
movsd (%rsp), %xmm0
mulsd 0x4e3e(%rip), %xmm0     # 0x9268
divsd 0x4e3e(%rip), %xmm0     # 0x9270
movsd %xmm0, (%rsp)
callq 0x3600
movsd %xmm0, 0x18(%rsp)
movsd (%rsp), %xmm0
callq 0x3080
movaps %xmm0, %xmm5
cmpb $0x1, 0x807a(%rip)      # 0xc4d0
jne 0x46ef
movsd %xmm5, 0x50(%rsp)
movss 0x8062(%rip), %xmm0     # 0xc4cc
movss %xmm0, 0xc(%rsp)
cvtss2sd %xmm0, %xmm0
movsd %xmm0, (%rsp)
movzbl 0x8051(%rip), %esi      # 0xc4d1
movl $0xb52, %edi            # imm = 0xB52
callq 0x3070
movaps 0x4edf(%rip), %xmm0     # 0x9370
movaps %xmm0, 0x20(%rsp)
movss 0x4e62(%rip), %xmm0     # 0x9300
mulss 0xc(%rsp), %xmm0
xorl %eax, %eax
movss 0x20(%rsp,%rax,4), %xmm1
addss %xmm0, %xmm1
movss %xmm1, 0x20(%rsp,%rax,4)
incq %rax
cmpq $0x3, %rax
jne 0x44a6
leaq 0x20(%rsp), %rsi
movl $0xb53, %edi            # imm = 0xB53
callq 0x3610
movaps 0x4eab(%rip), %xmm0     # 0x9380
leaq 0xf0(%rsp), %rdx
movss 0x7fef(%rip), %xmm1     # 0xc4d4
xorps 0x4e54(%rip), %xmm1     # 0x9340
movaps %xmm0, (%rdx)
movss %xmm1, (%rdx)
movss %xmm1, 0x4(%rdx)
movss %xmm1, 0x8(%rdx)
movl $0x4000, %edi           # imm = 0x4000
movl $0x1203, %esi           # imm = 0x1203
callq 0x35a0
movsd 0x4d8c(%rip), %xmm0     # 0x92a0
mulsd (%rsp), %xmm0
movsd 0x4d2f(%rip), %xmm1     # 0x9250
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
leaq 0xe0(%rsp), %rdx
movss %xmm0, (%rdx)
movss %xmm0, 0x4(%rdx)
movss %xmm0, 0x8(%rdx)
movl $0x3f800000, %ebx       # imm = 0x3F800000
movl %ebx, 0xc(%rdx)
movl $0x4000, %edi           # imm = 0x4000
movl $0x1200, %esi           # imm = 0x1200
callq 0x35a0
movsd 0x4d4a(%rip), %xmm1     # 0x92a8
mulsd (%rsp), %xmm1
movsd %xmm1, 0x48(%rsp)
movsd 0x4cdf(%rip), %xmm0     # 0x9250
subsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
leaq 0xd0(%rsp), %rdx
movss %xmm0, (%rdx)
movss %xmm0, 0x4(%rdx)
movss %xmm0, 0x8(%rdx)
movl %ebx, 0xc(%rdx)
movl $0x4000, %edi           # imm = 0x4000
movl $0x1201, %esi           # imm = 0x1201
callq 0x35a0
movsd 0x48(%rsp), %xmm0
addsd 0x4d01(%rip), %xmm0     # 0x92b0
cvtsd2ss %xmm0, %xmm0
leaq 0xc0(%rsp), %rdx
movss %xmm0, (%rdx)
movss %xmm0, 0x4(%rdx)
movss %xmm0, 0x8(%rdx)
xorl %ebx, %ebx
movl %ebx, 0xc(%rdx)
movl $0x4000, %edi           # imm = 0x4000
movl $0x1202, %esi           # imm = 0x1202
callq 0x35a0
movsd 0x4d6b(%rip), %xmm0     # 0x9350
leaq 0xb0(%rsp), %rdx
movsd %xmm0, (%rdx)
movl $0x3f666666, 0x8(%rdx)  # imm = 0x3F666666
xorps %xmm0, %xmm0
cvtsd2ss 0x7ed5(%rip), %xmm0     # 0xc4d8
movss %xmm0, 0xc(%rdx)
movl $0x408, %edi            # imm = 0x408
movl $0x1200, %esi           # imm = 0x1200
callq 0x3640
leaq 0xa0(%rsp), %rdx
movq $0x0, (%rdx)
movl %ebx, 0x8(%rdx)
xorps %xmm0, %xmm0
cvtsd2ss 0x7ea4(%rip), %xmm0     # 0xc4d8
movss %xmm0, 0xc(%rdx)
movl $0x405, %edi            # imm = 0x405
movl $0x1201, %esi           # imm = 0x1201
callq 0x3640
movsd (%rsp), %xmm0
mulsd 0x4c63(%rip), %xmm0     # 0x92b8
addsd 0x4c53(%rip), %xmm0     # 0x92b0
cvtsd2ss %xmm0, %xmm0
movsd 0x7e6f(%rip), %xmm1     # 0xc4d8
cvtss2sd %xmm0, %xmm0
mulsd %xmm1, %xmm0
movsd 0x4bdf(%rip), %xmm2     # 0x9258
mulsd %xmm0, %xmm2
cvtsd2ss %xmm2, %xmm2
leaq 0x90(%rsp), %rdx
movss %xmm2, (%rdx)
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
cvtpd2ps %xmm0, %xmm0
movss %xmm0, 0x4(%rdx)
movlpd %xmm0, 0x8(%rdx)
movl $0x408, %edi            # imm = 0x408
movl $0x1202, %esi           # imm = 0x1202
callq 0x3640
movss 0xc(%rsp), %xmm0
mulss 0x4c48(%rip), %xmm0     # 0x9304
addss 0x4c44(%rip), %xmm0     # 0x9308
leaq 0x8c(%rsp), %rdx
movss %xmm0, (%rdx)
movl $0x408, %edi            # imm = 0x408
movl $0x1601, %esi           # imm = 0x1601
callq 0x3640
movl $0x1d01, %edi           # imm = 0x1D01
callq 0x3570
movsd 0x50(%rsp), %xmm5
movq 0x7dc2(%rip), %r14      # 0xc4b8
testq %r14, %r14
je 0x4a37
xorps %xmm2, %xmm2
movsd 0x4b45(%rip), %xmm8     # 0x9250
movsd 0x18(%rsp), %xmm7
subsd %xmm7, %xmm8
xorps %xmm3, %xmm3
movsd 0x4b57(%rip), %xmm0     # 0x9278
mulsd %xmm8, %xmm0
movsd 0x4b52(%rip), %xmm4     # 0x9280
mulsd %xmm5, %xmm4
movsd 0x4b4d(%rip), %xmm9     # 0x9288
mulsd %xmm8, %xmm9
mulsd 0x4b47(%rip), %xmm8     # 0x9290
mulsd 0x4b47(%rip), %xmm5     # 0x9298
subss 0x10(%rsp), %xmm3
subss 0x14(%rsp), %xmm2
addsd %xmm7, %xmm0
movapd %xmm9, %xmm1
subsd %xmm4, %xmm1
addsd %xmm4, %xmm9
addsd %xmm8, %xmm7
movapd %xmm8, %xmm4
addsd %xmm5, %xmm4
cvtss2sd %xmm3, %xmm3
subsd %xmm5, %xmm8
movapd %xmm1, %xmm5
xorpd %xmm10, %xmm10
mulsd %xmm10, %xmm5
mulsd %xmm3, %xmm0
addsd %xmm5, %xmm0
cvtss2sd %xmm2, %xmm2
movapd %xmm7, %xmm5
mulsd %xmm10, %xmm5
movapd %xmm9, %xmm6
mulsd %xmm3, %xmm6
addsd %xmm5, %xmm6
mulsd %xmm10, %xmm4
mulsd %xmm3, %xmm1
addsd %xmm4, %xmm1
mulsd %xmm2, %xmm9
addsd %xmm0, %xmm9
mulsd %xmm2, %xmm8
addsd %xmm6, %xmm8
mulsd %xmm2, %xmm7
addsd %xmm1, %xmm7
addsd %xmm10, %xmm9
addsd %xmm10, %xmm8
addsd %xmm10, %xmm7
movq 0x7ceb(%rip), %rax      # 0xc4e0
movslq 0x7cec(%rip), %rcx      # 0xc4e8
cqto
idivq %rcx
movq %rax, %rbp
testq %rax, %rax
movsd %xmm7, 0x18(%rsp)
movsd %xmm8, 0x78(%rsp)
movsd %xmm9, 0x70(%rsp)
jle 0x4885
xorps %xmm2, %xmm2
cvtsd2ss %xmm7, %xmm2
xorps %xmm1, %xmm1
cvtsd2ss %xmm8, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm9, %xmm0
cvtss2sd %xmm0, %xmm0
cvtss2sd %xmm1, %xmm1
cvtss2sd %xmm2, %xmm2
leaq 0x18(%r14), %rax
movq %rbp, %rcx
movsd -0x18(%rax), %xmm3
subsd %xmm0, %xmm3
movsd -0x10(%rax), %xmm4
subsd %xmm1, %xmm4
mulsd %xmm4, %xmm4
mulsd %xmm3, %xmm3
addsd %xmm4, %xmm3
movsd -0x8(%rax), %xmm4
subsd %xmm2, %xmm4
mulsd %xmm4, %xmm4
addsd %xmm3, %xmm4
movsd %xmm4, (%rax)
addq $0x28, %rax
decq %rcx
jne 0x4847
jmp 0x488b
je 0x4a37
leaq (,%rbp,4), %rax
addq %rbp, %rax
leaq (%r14,%rax,8), %r15
bsrq %rbp, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
leaq -0x54d(%rip), %rcx      # 0x4361
movq %r14, %rdi
movq %r15, %rsi
callq 0x56a2
cmpq $0x11, %rbp
jl 0x4a46
leaq 0x28(%r14), %rbx
movl $0x28, %r12d
movq %r14, %rdi
leaq (%r14,%r12), %r13
movsd 0x18(%r14,%r12), %xmm0
ucomisd 0x18(%r14), %xmm0
ja 0x494e
movq 0x10(%r13), %rax
movq %rax, 0x30(%rsp)
movupd (%r13), %xmm1
movapd %xmm1, 0x20(%rsp)
movq 0x20(%r13), %rax
ucomisd 0x18(%rdi), %xmm0
movq %r13, %rcx
jbe 0x4930
movq %rbx, %rdx
leaq -0x28(%rdx), %rcx
movq -0x8(%rdx), %rsi
movq %rsi, 0x20(%rdx)
movupd -0x28(%rdx), %xmm1
movups -0x18(%rdx), %xmm2
movups %xmm2, 0x10(%rdx)
movupd %xmm1, (%rdx)
ucomisd -0x38(%rdx), %xmm0
movq %rcx, %rdx
ja 0x4909
movq 0x30(%rsp), %rdx
movq %rdx, 0x10(%rcx)
movapd 0x20(%rsp), %xmm1
movupd %xmm1, (%rcx)
movsd %xmm0, 0x18(%rcx)
movq %rax, 0x20(%rcx)
jmp 0x499d
movq 0x20(%r13), %rax
movq %rax, 0x40(%rsp)
movups (%r13), %xmm0
movups 0x10(%r13), %xmm1
movaps %xmm1, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
subq %r12, %rdi
addq $0x50, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x3550
movapd 0x20(%rsp), %xmm0
movapd 0x30(%rsp), %xmm1
movupd %xmm0, (%r14)
movupd %xmm1, 0x10(%r14)
movq 0x40(%rsp), %rax
movq %rax, 0x20(%r14)
addq $0x28, %r12
addq $0x28, %rbx
movq %r13, %rdi
cmpq $0x280, %r12            # imm = 0x280
jne 0x48d0
addq $0x280, %r14            # imm = 0x280
movq 0x10(%r14), %rax
movq %rax, 0x30(%rsp)
movups (%r14), %xmm0
movaps %xmm0, 0x20(%rsp)
movsd 0x18(%r14), %xmm0
movq 0x20(%r14), %rax
ucomisd -0x10(%r14), %xmm0
movq %r14, %rcx
jbe 0x4a0d
movq %r14, %rdx
leaq -0x28(%rdx), %rcx
movq -0x8(%rdx), %rsi
movq %rsi, 0x20(%rdx)
movupd -0x28(%rdx), %xmm1
movups -0x18(%rdx), %xmm2
movups %xmm2, 0x10(%rdx)
movupd %xmm1, (%rdx)
ucomisd -0x38(%rdx), %xmm0
movq %rcx, %rdx
ja 0x49e6
movq 0x30(%rsp), %rdx
movq %rdx, 0x10(%rcx)
movapd 0x20(%rsp), %xmm1
movupd %xmm1, (%rcx)
movsd %xmm0, 0x18(%rcx)
movq %rax, 0x20(%rcx)
addq $0x28, %r14
cmpq %r15, %r14
jne 0x49bc
jmp 0x4b40
movl $0x7, %edi
callq 0x3090
jmp 0x4f0a
cmpq $0x1, %rbp
jne 0x4a61
movl $0x7, %edi
callq 0x3090
movsd 0x18(%rsp), %xmm3
jmp 0x4b59
leaq 0x28(%r14), %rax
movq %r14, %rdi
movq %rax, %rbx
movsd 0x18(%rax), %xmm0
ucomisd 0x18(%r14), %xmm0
ja 0x4ae1
movq 0x10(%rbx), %rax
movq %rax, 0x30(%rsp)
movupd (%rbx), %xmm1
movapd %xmm1, 0x20(%rsp)
movq 0x20(%rbx), %rax
ucomisd 0x18(%rdi), %xmm0
movq %rbx, %rcx
jbe 0x4ac3
movq %rbx, %rdx
leaq -0x28(%rdx), %rcx
movq -0x8(%rdx), %rsi
movq %rsi, 0x20(%rdx)
movupd -0x28(%rdx), %xmm1
movups -0x18(%rdx), %xmm2
movups %xmm2, 0x10(%rdx)
movupd %xmm1, (%rdx)
ucomisd -0x38(%rdx), %xmm0
movq %rcx, %rdx
ja 0x4a9c
movq 0x30(%rsp), %rdx
movq %rdx, 0x10(%rcx)
movapd 0x20(%rsp), %xmm1
movupd %xmm1, (%rcx)
movsd %xmm0, 0x18(%rcx)
movq %rax, 0x20(%rcx)
jmp 0x4b30
movq 0x20(%rbx), %rax
movq %rax, 0x40(%rsp)
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movaps %xmm1, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movq %rbx, %rdx
subq %r14, %rdx
subq %rdx, %rdi
addq $0x50, %rdi
movq %r14, %rsi
callq 0x3550
movapd 0x20(%rsp), %xmm0
movapd 0x30(%rsp), %xmm1
movupd %xmm0, (%r14)
movupd %xmm1, 0x10(%r14)
movq 0x40(%rsp), %rax
movq %rax, 0x20(%r14)
leaq 0x28(%rbx), %rax
movq %rbx, %rdi
cmpq %r15, %rax
jne 0x4a68
movl $0x7, %edi
callq 0x3090
testq %rbp, %rbp
movsd 0x18(%rsp), %xmm3
jle 0x4f0a
movl 0x7989(%rip), %eax      # 0xc4e8
xorl %edx, %edx
movq %rbp, 0x60(%rsp)
movq 0x794b(%rip), %rcx      # 0xc4b8
movq %rdx, 0x68(%rsp)
leaq (%rdx,%rdx,4), %rdx
leaq (%rcx,%rdx,8), %rsi
addq $0x20, %rsi
movb $0x1, %dil
movq %rsi, 0x80(%rsp)
testl %eax, %eax
jle 0x4ee5
xorl %r14d, %r14d
movl %edi, 0x5c(%rsp)
movslq (%rsi), %rcx
movslq %r14d, %rbp
addq %rcx, %rbp
movslq 0x7944(%rip), %rcx      # 0xc4ec
movslq %ebp, %r15
addq %rcx, %r15
movq 0x792b(%rip), %rcx      # 0xc4e0
decq %rcx
cmpq %r15, %rcx
jle 0x4ed9
movq 0x78e8(%rip), %rbx      # 0xc4b0
imulq $0x38, %rbp, %rdx
movb 0x1(%rbx,%rdx), %cl
movq %rdx, (%rsp)
addq %rdx, %rbx
testb %cl, %cl
jne 0x4bea
cmpb $0x0, 0x2(%rbx)
jne 0x4bea
cmpb $0x0, (%rbx)
je 0x4ed9
testb $0x1, %dil
je 0x4c44
movapd %xmm3, %xmm0
subsd 0x18(%rbx), %xmm0
movsd 0x78(%rsp), %xmm1
subsd 0x10(%rbx), %xmm1
movsd 0x70(%rsp), %xmm2
subsd 0x8(%rbx), %xmm2
mulsd 0x28(%rbx), %xmm1
mulsd 0x20(%rbx), %xmm2
mulsd 0x30(%rbx), %xmm0
addsd %xmm1, %xmm2
addsd %xmm2, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
seta %dl
negb %dl
orb $0x1, %dl
ucomisd %xmm0, %xmm1
movb %dl, 0x3(%rbx)
ja 0x4c4e
jmp 0x4ed9
cmpb $0x0, 0x3(%rbx)
jle 0x4ed9
movb 0x2(%rbx), %dl
movzbl (%rbx), %eax
movl %ecx, %esi
orb %dl, %sil
je 0x4c9f
movsd 0x7875(%rip), %xmm0     # 0xc4d8
ucomisd 0x45e5(%rip), %xmm0     # 0x9250
movzbl %cl, %esi
movzbl %dl, %edx
jne 0x4d11
jp 0x4d11
xorps %xmm0, %xmm0
cvtss2sd 0x7868(%rip), %xmm0     # 0xc4f0
mulsd 0x4638(%rip), %xmm0     # 0x92c8
cvttsd2si %xmm0, %ecx
movzbl %al, %edi
movzbl %cl, %ecx
jmp 0x4d65
testb %al, %al
je 0x4d6a
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movzbl %al, %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movaps %xmm0, %xmm2
divss 0x4649(%rip), %xmm2     # 0x930c
cvtss2sd %xmm2, %xmm2
addsd 0x45f1(%rip), %xmm2     # 0x92c0
mulsd %xmm1, %xmm2
cvtsd2ss %xmm2, %xmm2
addss %xmm0, %xmm2
mulss 0x462d(%rip), %xmm2     # 0x9310
movsd 0x77ed(%rip), %xmm0     # 0xc4d8
mulsd %xmm0, %xmm1
cvttsd2si %xmm1, %edi
xorps %xmm1, %xmm1
cvtss2sd %xmm2, %xmm1
mulsd %xmm0, %xmm1
cvttsd2si %xmm1, %ecx
movl $0xff, %eax
andl %eax, %edi
andl %eax, %ecx
xorl %esi, %esi
xorl %edx, %edx
jmp 0x4d65
movzbl %al, %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
mulsd %xmm0, %xmm1
cvttsd2si %xmm1, %edi
xorps %xmm1, %xmm1
cvtsi2sd %esi, %xmm1
mulsd %xmm0, %xmm1
cvttsd2si %xmm1, %esi
xorps %xmm1, %xmm1
cvtsi2sd %edx, %xmm1
mulsd %xmm0, %xmm1
cvttsd2si %xmm1, %edx
xorps %xmm0, %xmm0
cvtss2sd 0x77a4(%rip), %xmm0     # 0xc4f0
mulsd 0x4574(%rip), %xmm0     # 0x92c8
cvttsd2si %xmm0, %ecx
movl $0xff, %eax
andl %eax, %ecx
andl %eax, %edi
andl %eax, %esi
andl %eax, %edx
callq 0x3510
cmpb $0x1, 0x775f(%rip)      # 0xc4d0
jne 0x4d87
movsd 0x20(%rbx), %xmm0
movsd 0x28(%rbx), %xmm1
movsd 0x30(%rbx), %xmm2
callq 0x3110
movq %r14, 0x48(%rsp)
leal 0x1(%r14), %r13d
leal 0x1(%rbp), %eax
movl %eax, 0x14(%rsp)
leal 0x1(%r15), %eax
movl %eax, 0xc(%rsp)
movb $0x1, %bpl
movl $0x1b02, %esi           # imm = 0x1B02
imulq $0x38, %r15, %r15
movl %r13d, 0x10(%rsp)
movq %r15, 0x50(%rsp)
movl $0x408, %edi            # imm = 0x408
callq 0x3260
movq 0x76ea(%rip), %r14      # 0xc4b0
leaq (%r14,%r15), %r12
cmpl 0x7717(%rip), %r13d     # 0xc4e8
jne 0x4e42
movl 0x7713(%rip), %eax      # 0xc4ec
movl 0x14(%rsp), %ecx
subl %eax, %ecx
movslq %ecx, %rcx
imulq $0x38, %rcx, %r15
movl 0xc(%rsp), %ecx
subl %eax, %ecx
movslq %ecx, %rax
imulq $0x38, %rax, %r13
movsd 0x8(%rbx), %xmm0
movsd 0x10(%rbx), %xmm1
movsd 0x18(%rbx), %xmm2
callq 0x34f0
movsd 0x8(%r14,%r15), %xmm0
movsd 0x10(%r14,%r15), %xmm1
movsd 0x18(%r14,%r15), %xmm2
movq 0x50(%rsp), %r15
callq 0x34f0
movsd 0x8(%r14,%r13), %xmm0
movsd 0x10(%r14,%r13), %xmm1
movsd 0x18(%r14,%r13), %xmm2
movl 0x10(%rsp), %r13d
jmp 0x4e89
movsd 0x8(%rbx), %xmm0
movsd 0x10(%rbx), %xmm1
movsd 0x18(%rbx), %xmm2
callq 0x34f0
movq (%rsp), %rax
movsd 0x40(%r14,%rax), %xmm0
movsd 0x48(%r14,%rax), %xmm1
movsd 0x50(%r14,%rax), %xmm2
callq 0x34f0
movsd 0x40(%r12), %xmm0
movsd 0x48(%r12), %xmm1
movsd 0x50(%r12), %xmm2
callq 0x34f0
movsd 0x8(%r12), %xmm0
movsd 0x10(%r12), %xmm1
movsd 0x18(%r12), %xmm2
callq 0x34f0
movl $0x1b01, %esi           # imm = 0x1B01
testb $0x1, %bpl
movl $0x0, %ebp
jne 0x4db5
movl 0x7626(%rip), %eax      # 0xc4e8
movsd 0x18(%rsp), %xmm3
movq 0x80(%rsp), %rsi
movl 0x5c(%rsp), %edi
movq 0x48(%rsp), %r14
incl %r14d
cmpl %eax, %r14d
jl 0x4b98
testb $0x1, %dil
movl $0x0, %edi
jne 0x4b89
movq 0x68(%rsp), %rdx
incq %rdx
movq 0x60(%rsp), %rbp
cmpq %rbp, %rdx
jne 0x4b66
callq 0x3400
callq 0x34b0
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq