// File: 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
movq %rsp, %rbp
subq $0x1d0, %rsp            # imm = 0x1D0
movl $0x4100, %edi           # imm = 0x4100
callq 0x30c0
callq 0x34e0
movss 0xed9a(%rip), %xmm0     # 0x1354c
movss %xmm0, -0x4(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x8(%rbp)
movss 0x9b1d(%rip), %xmm0     # 0xe2e4
mulss 0xed81(%rip), %xmm0     # 0x13550
callq 0x6600
cvtss2sd %xmm0, %xmm0
movsd 0x9a80(%rip), %xmm1     # 0xe260
mulsd %xmm1, %xmm0
movsd 0x9a7c(%rip), %xmm1     # 0xe268
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0xc(%rbp)
movss 0xed4f(%rip), %xmm0     # 0x13550
cvtss2sd %xmm0, %xmm1
movsd 0x9a4b(%rip), %xmm0     # 0xe258
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x10(%rbp)
movss 0x9abe(%rip), %xmm0     # 0xe2e0
movss %xmm0, -0x14(%rbp)
movss 0x9aad(%rip), %xmm0     # 0xe2dc
movss %xmm0, -0x18(%rbp)
movss 0x9aa0(%rip), %xmm0     # 0xe2dc
movss %xmm0, -0x1c(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x28(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x38(%rbp)
movss -0x4(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movss -0x8(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
movss -0xc(%rbp), %xmm2
cvtss2sd %xmm2, %xmm2
callq 0x33b0
movss -0x10(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movss -0x14(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
movss -0x18(%rbp), %xmm2
cvtss2sd %xmm2, %xmm2
movss -0x1c(%rbp), %xmm3
cvtss2sd %xmm3, %xmm3
callq 0x34a0
movss -0x4(%rbp), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm3
movss -0x8(%rbp), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm4
movss -0xc(%rbp), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm5
movss -0x10(%rbp), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm6
movss -0x14(%rbp), %xmm7
movss -0x18(%rbp), %xmm9
movss -0x1c(%rbp), %xmm8
xorps %xmm2, %xmm2
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
leaq -0x38(%rbp), %rdx
movaps %xmm2, %xmm0
movaps %xmm2, %xmm1
movss %xmm9, (%rsp)
movss %xmm8, 0x8(%rsp)
callq 0x5530
movss 0xec2a(%rip), %xmm0     # 0x13554
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x40(%rbp)
testb $0x1, 0xec1e(%rip)      # 0x13558
je 0x4d69
movb 0xec13(%rip), %al       # 0x13559
andb $0x1, %al
movzbl %al, %esi
movl $0xb52, %edi            # imm = 0xB52
callq 0x3080
movq 0x99c4(%rip), %rax      # 0xe320
movq %rax, -0x50(%rbp)
movq 0x99c1(%rip), %rax      # 0xe328
movq %rax, -0x48(%rbp)
movl $0x0, -0x54(%rbp)
cmpl $0x3, -0x54(%rbp)
jge 0x49a4
movsd 0x9920(%rip), %xmm0     # 0xe2a0
mulsd -0x40(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
movslq -0x54(%rbp), %rax
addss -0x50(%rbp,%rax,4), %xmm0
movss %xmm0, -0x50(%rbp,%rax,4)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x4972
leaq -0x50(%rbp), %rsi
movl $0xb53, %edi            # imm = 0xB53
callq 0x3720
movq 0x9977(%rip), %rax      # 0xe330
movq %rax, -0x70(%rbp)
movq 0x9974(%rip), %rax      # 0xe338
movq %rax, -0x68(%rbp)
movl $0x0, -0x74(%rbp)
cmpl $0x3, -0x74(%rbp)
jge 0x49ff
movss 0xeb7f(%rip), %xmm0     # 0x1355c
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movslq -0x74(%rbp), %rax
movss %xmm0, -0x70(%rbp,%rax,4)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x49cf
leaq -0x70(%rbp), %rdx
movl $0x4000, %edi           # imm = 0x4000
movl $0x1203, %esi           # imm = 0x1203
callq 0x36a0
movsd -0x40(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd 0x985a(%rip), %xmm1     # 0xe290
mulsd %xmm1, %xmm0
movsd 0x980e(%rip), %xmm1     # 0xe250
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x78(%rbp)
movss -0x78(%rbp), %xmm0
movss %xmm0, -0x90(%rbp)
movss -0x78(%rbp), %xmm0
movss %xmm0, -0x8c(%rbp)
movss -0x78(%rbp), %xmm0
movss %xmm0, -0x88(%rbp)
movss 0x9862(%rip), %xmm0     # 0xe2e0
movss %xmm0, -0x84(%rbp)
leaq -0x90(%rbp), %rdx
movl $0x4000, %edi           # imm = 0x4000
movl $0x1200, %esi           # imm = 0x1200
callq 0x36a0
movsd -0x40(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd 0x97c8(%rip), %xmm1     # 0xe288
mulsd %xmm1, %xmm0
movsd 0x9784(%rip), %xmm1     # 0xe250
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x94(%rbp)
movss -0x94(%rbp), %xmm0
movss %xmm0, -0xb0(%rbp)
movss -0x94(%rbp), %xmm0
movss %xmm0, -0xac(%rbp)
movss -0x94(%rbp), %xmm0
movss %xmm0, -0xa8(%rbp)
movss 0x97cc(%rip), %xmm0     # 0xe2e0
movss %xmm0, -0xa4(%rbp)
leaq -0xb0(%rbp), %rdx
movl $0x4000, %edi           # imm = 0x4000
movl $0x1201, %esi           # imm = 0x1201
callq 0x36a0
movsd -0x40(%rbp), %xmm0
movsd 0x9749(%rip), %xmm1     # 0xe288
mulsd %xmm1, %xmm0
movsd 0x9735(%rip), %xmm1     # 0xe280
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0xb4(%rbp)
movss -0xb4(%rbp), %xmm0
movss %xmm0, -0xd0(%rbp)
movss -0xb4(%rbp), %xmm0
movss %xmm0, -0xcc(%rbp)
movss -0xb4(%rbp), %xmm0
movss %xmm0, -0xc8(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0xc4(%rbp)
leaq -0xd0(%rbp), %rdx
movl $0x4000, %edi           # imm = 0x4000
movl $0x1202, %esi           # imm = 0x1202
callq 0x36a0
movss 0x9738(%rip), %xmm0     # 0xe2ec
movss %xmm0, -0xe0(%rbp)
movss 0x9728(%rip), %xmm0     # 0xe2ec
movss %xmm0, -0xdc(%rbp)
movss 0x9714(%rip), %xmm0     # 0xe2e8
movss %xmm0, -0xd8(%rbp)
movsd 0xe97c(%rip), %xmm0     # 0x13560
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0xd4(%rbp)
leaq -0xe0(%rbp), %rdx
movl $0x408, %edi            # imm = 0x408
movl $0x1200, %esi           # imm = 0x1200
callq 0x3740
xorps %xmm0, %xmm0
movss %xmm0, -0xf0(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0xec(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0xe8(%rbp)
movsd 0xe931(%rip), %xmm0     # 0x13560
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0xe4(%rbp)
leaq -0xf0(%rbp), %rdx
movl $0x405, %edi            # imm = 0x405
movl $0x1201, %esi           # imm = 0x1201
callq 0x3740
movsd -0x40(%rbp), %xmm0
movsd 0x961a(%rip), %xmm1     # 0xe278
mulsd %xmm1, %xmm0
movsd 0x9616(%rip), %xmm1     # 0xe280
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0xf4(%rbp)
movsd 0xe8de(%rip), %xmm0     # 0x13560
movss -0xf4(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
mulsd %xmm1, %xmm0
movsd 0x95c6(%rip), %xmm1     # 0xe260
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x110(%rbp)
movsd 0xe8ae(%rip), %xmm0     # 0x13560
movss -0xf4(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x10c(%rbp)
movsd 0xe88a(%rip), %xmm0     # 0x13560
movss -0xf4(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x108(%rbp)
movsd 0xe866(%rip), %xmm0     # 0x13560
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x104(%rbp)
leaq -0x110(%rbp), %rdx
movl $0x408, %edi            # imm = 0x408
movl $0x1202, %esi           # imm = 0x1202
callq 0x3740
movl 0x95ea(%rip), %eax      # 0xe30c
movl %eax, -0x114(%rbp)
movsd 0x9540(%rip), %xmm0     # 0xe270
mulsd -0x40(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
addss -0x114(%rbp), %xmm0
movss %xmm0, -0x114(%rbp)
leaq -0x114(%rbp), %rdx
movl $0x408, %edi            # imm = 0x408
movl $0x1601, %esi           # imm = 0x1601
callq 0x3740
movl $0x1d01, %edi           # imm = 0x1D01
callq 0x3670
movq $0x0, -0x120(%rbp)
cmpq $0x0, 0xe7bc(%rip)      # 0x13538
je 0x4dc6
movq 0xe7e3(%rip), %rax      # 0x13568
movslq 0xe7e4(%rip), %rcx      # 0x13570
cqto
idivq %rcx
movq %rax, -0x120(%rbp)
movsd -0x28(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
movsd -0x30(%rbp), %xmm1
cvtsd2ss %xmm1, %xmm1
movsd -0x38(%rbp), %xmm2
cvtsd2ss %xmm2, %xmm2
movq 0xe77e(%rip), %rdi      # 0x13538
movq -0x120(%rbp), %rsi
callq 0x59c0
movl $0x7, %edi
callq 0x30a0
movl $0x0, -0x124(%rbp)
movslq -0x124(%rbp), %rax
cmpq -0x120(%rbp), %rax
jge 0x550f
movq 0xe743(%rip), %rax      # 0x13538
movslq -0x124(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x130(%rbp)
movl $0x0, -0x134(%rbp)
cmpl $0x2, -0x134(%rbp)
jge 0x54f9
movl $0x0, -0x138(%rbp)
movl -0x138(%rbp), %eax
cmpl 0xe739(%rip), %eax      # 0x13570
jge 0x54e3
movq -0x130(%rbp), %rax
movl 0x20(%rax), %eax
addl -0x138(%rbp), %eax
movl %eax, -0x13c(%rbp)
movl -0x13c(%rbp), %eax
addl 0xe715(%rip), %eax      # 0x13574
movl %eax, -0x140(%rbp)
movslq -0x140(%rbp), %rax
movq 0xe6f5(%rip), %rcx      # 0x13568
subq $0x1, %rcx
cmpq %rcx, %rax
jl 0x4e81
jmp 0x54cf
movq 0xe6a8(%rip), %rax      # 0x13530
movslq -0x13c(%rbp), %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rax
movzbl 0x1(%rax), %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x1b1(%rbp)
jg 0x4ee3
movq -0x148(%rbp), %rax
movzbl 0x2(%rax), %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x1b1(%rbp)
jg 0x4ee3
movq -0x148(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
setg %al
movb %al, -0x1b1(%rbp)
movb -0x1b1(%rbp), %al
andb $0x1, %al
movb %al, -0x149(%rbp)
movb -0x149(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x4f06
jmp 0x54cf
movsd -0x28(%rbp), %xmm0
movq -0x148(%rbp), %rax
subsd 0x8(%rax), %xmm0
movsd %xmm0, -0x158(%rbp)
movsd -0x30(%rbp), %xmm0
movq -0x148(%rbp), %rax
subsd 0x10(%rax), %xmm0
movsd %xmm0, -0x160(%rbp)
movsd -0x38(%rbp), %xmm0
movq -0x148(%rbp), %rax
subsd 0x18(%rax), %xmm0
movsd %xmm0, -0x168(%rbp)
cmpl $0x0, -0x134(%rbp)
jne 0x4f65
movq -0x148(%rbp), %rax
movb $0x0, 0x3(%rax)
cmpl $0x0, -0x134(%rbp)
jne 0x5005
movsd -0x158(%rbp), %xmm1
movq -0x148(%rbp), %rax
movsd 0x20(%rax), %xmm2
movsd -0x160(%rbp), %xmm0
movq -0x148(%rbp), %rax
mulsd 0x28(%rax), %xmm0
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd -0x168(%rbp), %xmm0
movq -0x148(%rbp), %rax
movsd 0x30(%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x170(%rbp)
movsd -0x170(%rbp), %xmm1
xorps %xmm0, %xmm0
movl $0x1, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
ucomisd %xmm1, %xmm0
cmoval %ecx, %eax
movb %al, %cl
movq -0x148(%rbp), %rax
movb %cl, 0x3(%rax)
movq -0x148(%rbp), %rax
movsbl 0x3(%rax), %eax
cmpl $0x0, %eax
jle 0x5003
jmp 0x54cf
jmp 0x501c
movq -0x148(%rbp), %rax
movsbl 0x3(%rax), %eax
cmpl $0x0, %eax
jg 0x501a
jmp 0x54cf
jmp 0x501c
movq -0x148(%rbp), %rax
movzbl 0x2(%rax), %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x174(%rbp)
movq -0x148(%rbp), %rax
movzbl 0x1(%rax), %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x178(%rbp)
movq -0x148(%rbp), %rax
movzbl (%rax), %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x17c(%rbp)
movss -0x178(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
ja 0x5084
movss -0x174(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x5169
movsd 0xe4d4(%rip), %xmm0     # 0x13560
movsd 0x91bc(%rip), %xmm1     # 0xe250
ucomisd %xmm1, %xmm0
jne 0x50eb
jp 0x50eb
cvttss2si -0x17c(%rbp), %eax
movb %al, %sil
cvttss2si -0x178(%rbp), %eax
movb %al, %dl
cvttss2si -0x174(%rbp), %eax
movb %al, %cl
movss 0xe4b5(%rip), %xmm0     # 0x13578
cvtss2sd %xmm0, %xmm0
movsd 0x91c9(%rip), %xmm1     # 0xe298
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movzbl %sil, %edi
movzbl %dl, %esi
movzbl %cl, %edx
movzbl %al, %ecx
callq 0x3610
jmp 0x5164
movss -0x17c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0xe461(%rip), %xmm1     # 0x13560
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movb %al, %sil
movss -0x178(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movb %al, %dl
movss -0x174(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movb %al, %cl
movss 0xe43a(%rip), %xmm0     # 0x13578
cvtss2sd %xmm0, %xmm0
movsd 0x914e(%rip), %xmm1     # 0xe298
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movzbl %sil, %edi
movzbl %dl, %esi
movzbl %cl, %edx
movzbl %al, %ecx
callq 0x3610
jmp 0x5237
movq -0x148(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
jle 0x5235
movss -0x17c(%rbp), %xmm0
movss %xmm0, -0x180(%rbp)
movss -0x17c(%rbp), %xmm1
cvtss2sd %xmm1, %xmm0
movss 0x9150(%rip), %xmm2     # 0xe2f0
divss %xmm2, %xmm1
cvtss2sd %xmm1, %xmm1
movsd 0x90a8(%rip), %xmm2     # 0xe258
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x184(%rbp)
movss -0x180(%rbp), %xmm0
movss -0x184(%rbp), %xmm1
addss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x907c(%rip), %xmm1     # 0xe260
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x180(%rbp)
movss -0x17c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0xe358(%rip), %xmm1     # 0x13560
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movb %al, %cl
movss -0x180(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
xorl %edx, %edx
movzbl %cl, %edi
movl %edx, %esi
movzbl %al, %ecx
callq 0x3610
jmp 0x5237
testb $0x1, 0xe31a(%rip)      # 0x13558
je 0x5269
movq -0x148(%rbp), %rax
movsd 0x20(%rax), %xmm0
movq -0x148(%rbp), %rax
movsd 0x28(%rax), %xmm1
movq -0x148(%rbp), %rax
movsd 0x30(%rax), %xmm2
callq 0x3120
movl $0x0, -0x188(%rbp)
cmpl $0x2, -0x188(%rbp)
jge 0x54cd
cmpl $0x1, -0x188(%rbp)
jne 0x529a
movl $0x408, %edi            # imm = 0x408
movl $0x1b01, %esi           # imm = 0x1B01
callq 0x32f0
jmp 0x52a9
movl $0x408, %edi            # imm = 0x408
movl $0x1b02, %esi           # imm = 0x1B02
callq 0x32f0
movq 0xe280(%rip), %rax      # 0x13530
movslq -0x140(%rbp), %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x190(%rbp)
movl -0x138(%rbp), %eax
addl $0x1, %eax
cmpl 0xe29c(%rip), %eax      # 0x13570
jne 0x53d1
movq 0xe24f(%rip), %rax      # 0x13530
movl -0x13c(%rbp), %ecx
addl $0x1, %ecx
subl 0xe284(%rip), %ecx      # 0x13574
movslq %ecx, %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x198(%rbp)
movq 0xe228(%rip), %rax      # 0x13530
movl -0x140(%rbp), %ecx
addl $0x1, %ecx
subl 0xe25d(%rip), %ecx      # 0x13574
movslq %ecx, %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x1a0(%rbp)
movq -0x148(%rbp), %rax
movsd 0x8(%rax), %xmm0
movq -0x148(%rbp), %rax
movsd 0x10(%rax), %xmm1
movq -0x148(%rbp), %rax
movsd 0x18(%rax), %xmm2
callq 0x35f0
movq -0x198(%rbp), %rax
movsd 0x8(%rax), %xmm0
movq -0x198(%rbp), %rax
movsd 0x10(%rax), %xmm1
movq -0x198(%rbp), %rax
movsd 0x18(%rax), %xmm2
callq 0x35f0
movq -0x1a0(%rbp), %rax
movsd 0x8(%rax), %xmm0
movq -0x1a0(%rbp), %rax
movsd 0x10(%rax), %xmm1
movq -0x1a0(%rbp), %rax
movsd 0x18(%rax), %xmm2
callq 0x35f0
movq -0x190(%rbp), %rax
movsd 0x8(%rax), %xmm0
movq -0x190(%rbp), %rax
movsd 0x10(%rax), %xmm1
movq -0x190(%rbp), %rax
movsd 0x18(%rax), %xmm2
callq 0x35f0
jmp 0x54b7
movq 0xe158(%rip), %rax      # 0x13530
movl -0x13c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x1a8(%rbp)
movq 0xe137(%rip), %rax      # 0x13530
movl -0x140(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x1b0(%rbp)
movq -0x148(%rbp), %rax
movsd 0x8(%rax), %xmm0
movq -0x148(%rbp), %rax
movsd 0x10(%rax), %xmm1
movq -0x148(%rbp), %rax
movsd 0x18(%rax), %xmm2
callq 0x35f0
movq -0x1a8(%rbp), %rax
movsd 0x8(%rax), %xmm0
movq -0x1a8(%rbp), %rax
movsd 0x10(%rax), %xmm1
movq -0x1a8(%rbp), %rax
movsd 0x18(%rax), %xmm2
callq 0x35f0
movq -0x1b0(%rbp), %rax
movsd 0x8(%rax), %xmm0
movq -0x1b0(%rbp), %rax
movsd 0x10(%rax), %xmm1
movq -0x1b0(%rbp), %rax
movsd 0x18(%rax), %xmm2
callq 0x35f0
movq -0x190(%rbp), %rax
movsd 0x8(%rax), %xmm0
movq -0x190(%rbp), %rax
movsd 0x10(%rax), %xmm1
movq -0x190(%rbp), %rax
movsd 0x18(%rax), %xmm2
callq 0x35f0
jmp 0x54b9
movl -0x188(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x188(%rbp)
jmp 0x5273
jmp 0x54cf
movl -0x138(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x138(%rbp)
jmp 0x4e2b
jmp 0x54e5
movl -0x134(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x134(%rbp)
jmp 0x4e14
jmp 0x54fb
movl -0x124(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x124(%rbp)
jmp 0x4dda
callq 0x34f0
callq 0x35a0
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbp
retq
nopw %cs:(%rax,%rax)