// File: /workspace/github_cpp_makefile_star2_O2/sundale[P]gcode/rs274ngc/interp_convert.cc
// Function: Interp::convert_straight_comp2(int, block_struct*, setup_struct*, double, double, double, double, double, double, double, double, double)
int Interp::convert_straight_comp2(int move,     //!< either G_0 or G_1                        
                                   block_pointer block,  //!< pointer to a block of RS274 instructions 
                                   setup_pointer settings,       //!< pointer to machine settings              
                                   double px,    //!< X coordinate of programmed end point     
                                   double py,    //!< Y coordinate of programmed end point     
                                   double pz,    //!< Z coordinate of end point                
                                   double AA_end,        //!< A coordinate of end point
                                   double BB_end,        //!< B coordinate of end point
                                   double CC_end,        //!< C coordinate of end point
                                   double u_end, double v_end, double w_end)
{
    double alpha;
    double beta;
    double end_x, end_y, end_z;                 /* x-coordinate of actual end point */
    double gamma;
    double mid_x, mid_y;                 /* x-coordinate of end of added arc, if needed */
    double radius;
    int side;
    double small = TOLERANCE_CONCAVE_CORNER;      /* radians, testing corners */
    double opx, opy, opz;      /* old programmed beginning point */
    double theta;
    double cx, cy, cz;
    int concave;

    comp_get_current(settings, &cx, &cy, &cz);
    comp_get_current(settings, &end_x, &end_y, &end_z);
    comp_get_programmed(settings, &opx, &opy, &opz);

    if ((py == opy) && (px == opx)) {     /* no XY motion */
        if (move == G_0) {
            enqueue_STRAIGHT_TRAVERSE(settings, block->line_number, 
                                      px - opx, py - opy, pz - opz, 
                                      cx, cy, pz,
                                      AA_end, BB_end, CC_end, u_end, v_end, w_end);
        } else if (move == G_1) {
            enqueue_STRAIGHT_FEED(settings, block->line_number, 
                                  px - opx, py - opy, pz - opz, 
                                  cx, cy, pz, AA_end, BB_end, CC_end, u_end, v_end, w_end);
        } else
            ERS(NCE_BUG_CODE_NOT_G0_OR_G1);
        // end already filled out, above
    } else {
        // some XY motion
        side = settings->cutter_comp_side;
        radius = settings->cutter_comp_radius;      /* will always be positive */
        theta = atan2(cy - opy, cx - opx);
        alpha = atan2(py - opy, px - opx);

        if (side == LEFT) {
            if (theta < alpha)
                theta = (theta + (2 * M_PIl));
            beta = ((theta - alpha) - M_PI_2l);
            gamma = M_PI_2l;
        } else if (side == RIGHT) {
            if (alpha < theta)
                alpha = (alpha + (2 * M_PIl));
            beta = ((alpha - theta) - M_PI_2l);
            gamma = -M_PI_2l;
        } else
            ERS(NCE_BUG_SIDE_NOT_RIGHT_OR_LEFT);
        end_x = (px + (radius * cos(alpha + gamma)));
        end_y = (py + (radius * sin(alpha + gamma)));
        mid_x = (opx + (radius * cos(alpha + gamma)));
        mid_y = (opy + (radius * sin(alpha + gamma)));
    
        if ((beta < -small) || (beta > (M_PIl + small))) {
            concave = 1;
        } else if (beta > (M_PIl - small) && 
                   (!qc().empty() && qc().front().type == QARC_FEED && 
                    ((side == RIGHT && qc().front().data.arc_feed.turn == 1) || 
                     (side == LEFT && qc().front().data.arc_feed.turn == -1)))) {
            // this is an "h" shape, tool on right, going right to left
            // over the hemispherical round part, then up next to the
            // vertical part (or, the mirror case).  there are two ways
            // to stay to the "right", either loop down and around, or
            // stay above and right.  we're forcing above and right.
            concave = 1;
        } else {
            concave = 0;
            mid_x = (opx + (radius * cos(alpha + gamma)));
            mid_y = (opy + (radius * sin(alpha + gamma)));
        }

        if (!concave && (beta > small)) {       /* ARC NEEDED */
            CHP(move_endpoint_and_flush(settings, cx, cy));
            if(move == G_1) {
                enqueue_ARC_FEED(settings, block->line_number,
                                 0.0, // doesn't matter, since we will not move this arc's endpoint
                                 mid_x, mid_y, opx, opy,
                                 ((side == LEFT) ? -1 : 1), cz,
                                 AA_end, BB_end, CC_end, u_end, v_end, w_end);
                dequeue_canons(settings);
                set_endpoint(mid_x, mid_y);
            } else if(move == G_0) {
                // we can't go around the corner because there is no
                // arc traverse.  but, if we do this anyway, at least
                // most of our rapid will be parallel to the original
                // programmed one.  if nothing else, this will look a
                // little less confusing in the preview.
                enqueue_STRAIGHT_TRAVERSE(settings, block->line_number,
                                          0.0, 0.0, 0.0, 
                                          mid_x, mid_y, cz, 
                                          AA_end, BB_end, CC_end,
                                          u_end, v_end, w_end);
                dequeue_canons(settings);
                set_endpoint(mid_x, mid_y);
            } else ERS(NCE_BUG_CODE_NOT_G0_OR_G1);
        } else if (concave) {
            if (qc().front().type != QARC_FEED) {
                // line->line
                double retreat;
                // half the angle of the inside corner
                double halfcorner = (beta + M_PIl) / 2.0;
                CHKS((halfcorner == 0.0), (_("Zero degree inside corner is invalid for cutter compensation")));
                retreat = radius / tan(halfcorner);
                // move back along the compensated path
                // this should replace the endpoint of the previous move
                mid_x = cx + retreat * cos(theta + gamma);
                mid_y = cy + retreat * sin(theta + gamma);
                // we actually want to move the previous line's endpoint here.  That's the same as 
                // discarding that line and doing this one instead.
                CHP(move_endpoint_and_flush(settings, mid_x, mid_y));
            } else {
                // arc->line
                // beware: the arc we saved is the compensated one.
                arc_feed prev = qc().front().data.arc_feed;
                double oldrad = hypot(prev.center2 - prev.end2, prev.center1 - prev.end1);
                double oldrad_uncomp;

                // new line's direction
                double base_dir = atan2(py - opy, px - opx);
                double theta;
                double phi;

                theta = (prev.turn == 1) ? base_dir + M_PI_2l : base_dir - M_PI_2l;
                phi = atan2(prev.center2 - opy, prev.center1 - opx);
                if TOOL_INSIDE_ARC(side, prev.turn) {
                    oldrad_uncomp = oldrad + radius;
                } else {
                    oldrad_uncomp = oldrad - radius;
                }

                double alpha = theta - phi;
                // distance to old arc center perpendicular to the new line
                double d = oldrad_uncomp * cos(alpha);
                double d2;
                double angle_from_center;

                if TOOL_INSIDE_ARC(side, prev.turn) {
                    d2 = d - radius;
                    double l = d2/oldrad;
                    CHKS((l > 1.0 || l < -1.0), _("Arc to straight motion makes a corner the compensated tool can't fit in without gouging"));
                    if(prev.turn == 1) 
                        angle_from_center = - acos(l) + theta + M_PIl;
                    else
                        angle_from_center = acos(l) + theta + M_PIl;
                } else {
                    d2 = d + radius;
                    double l = d2/oldrad;
                    CHKS((l > 1.0 || l < -1.0), _("Arc to straight motion makes a corner the compensated tool can't fit in without gouging"));
                    if(prev.turn == 1) 
                        angle_from_center = acos(l) + theta + M_PIl;
                    else
                        angle_from_center = - acos(l) + theta + M_PIl;
                }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movsd %xmm7, -0xc0(%rbp)
movsd %xmm6, -0x70(%rbp)
movsd %xmm5, -0xb8(%rbp)
movsd %xmm4, -0x80(%rbp)
movsd %xmm3, -0x78(%rbp)
movsd %xmm2, -0xc8(%rbp)
movsd %xmm1, -0xd8(%rbp)
movsd %xmm0, -0xd0(%rbp)
movq %rcx, %r14
movq %rdx, %r12
movl %esi, -0x84(%rbp)
movq %rdi, %rbx
leaq -0xf0(%rbp), %rdx
leaq -0xe8(%rbp), %rcx
leaq -0x110(%rbp), %r8
movq %r14, %rsi
callq 0xc820
leaq -0x120(%rbp), %rdx
leaq -0x118(%rbp), %rcx
leaq -0x1b0(%rbp), %r8
movq %rbx, %rdi
movq %r14, %rsi
callq 0xc820
leaq -0x1a8(%rbp), %r13
leaq -0x1a0(%rbp), %r15
leaq -0xf8(%rbp), %r8
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0xbce0
movsd -0xd0(%rbp), %xmm0
movsd -0xd8(%rbp), %xmm1
movsd (%r15), %xmm3
ucomisd %xmm1, %xmm3
movsd (%r13), %xmm4
jne 0x17e68
jp 0x17e68
ucomisd %xmm0, %xmm4
jne 0x17e68
jp 0x17e68
movl -0x84(%rbp), %eax
cmpl $0xa, %eax
je 0x18177
testl %eax, %eax
movsd -0x80(%rbp), %xmm7
movsd -0x78(%rbp), %xmm6
jne 0x18738
movl 0x1d0(%r12), %esi
subsd %xmm4, %xmm0
subsd %xmm3, %xmm1
movsd -0xc8(%rbp), %xmm8
movapd %xmm8, %xmm2
subsd -0xf8(%rbp), %xmm2
movsd -0xf0(%rbp), %xmm3
movsd -0xe8(%rbp), %xmm4
movsd 0x10(%rbp), %xmm5
movsd %xmm5, 0x18(%rsp)
movsd -0xc0(%rbp), %xmm5
movsd %xmm5, 0x10(%rsp)
movsd -0x70(%rbp), %xmm5
movsd %xmm5, 0x8(%rsp)
movsd -0xb8(%rbp), %xmm5
movsd %xmm5, (%rsp)
movq %r14, %rdi
movapd %xmm8, %xmm5
callq 0xc860
jmp 0x185d2
movl 0x624(%r14), %r15d
movsd 0x618(%r14), %xmm2
movaps %xmm2, -0xa0(%rbp)
movsd -0xe8(%rbp), %xmm2
movsd %xmm2, -0x48(%rbp)
movapd %xmm2, %xmm0
subsd %xmm3, %xmm0
movsd -0xf0(%rbp), %xmm2
movsd %xmm2, -0xa8(%rbp)
movapd %xmm2, %xmm1
subsd %xmm4, %xmm1
movsd %xmm3, -0x50(%rbp)
movsd %xmm4, -0xb0(%rbp)
callq 0xb110
movapd %xmm0, -0x60(%rbp)
movsd -0xd8(%rbp), %xmm0
subsd -0x50(%rbp), %xmm0
movsd -0xd0(%rbp), %xmm1
subsd -0xb0(%rbp), %xmm1
movsd %xmm0, -0x108(%rbp)
movsd %xmm1, -0x100(%rbp)
callq 0xb110
cmpl $0x2, %r15d
jne 0x17f52
movapd -0x60(%rbp), %xmm2
movsd %xmm2, -0x188(%rbp)
fldt 0x18032(%rip)           # 0x2ff40
faddl -0x188(%rbp)
fstpl -0x180(%rbp)
movapd %xmm2, %xmm3
cmpltsd %xmm0, %xmm3
movapd %xmm3, %xmm1
andnpd %xmm2, %xmm1
movsd -0x180(%rbp), %xmm2
andpd %xmm3, %xmm2
orpd %xmm1, %xmm2
movapd %xmm2, -0x60(%rbp)
movapd %xmm2, %xmm1
subsd %xmm0, %xmm1
movsd 0x17fb0(%rip), %xmm2    # 0x2ff00
jmp 0x17fac
cmpl $0x1, %r15d
jne 0x1823c
movsd %xmm0, -0x198(%rbp)
fldt 0x17fd6(%rip)           # 0x2ff40
faddl -0x198(%rbp)
fstpl -0x190(%rbp)
movapd %xmm0, %xmm3
movapd -0x60(%rbp), %xmm2
cmpltsd %xmm2, %xmm3
movapd %xmm3, %xmm1
andnpd %xmm0, %xmm1
movsd -0x190(%rbp), %xmm0
andpd %xmm3, %xmm0
orpd %xmm1, %xmm0
movapd %xmm0, %xmm1
subsd %xmm2, %xmm1
movsd 0x17f4c(%rip), %xmm2    # 0x2fef8
movsd %xmm1, -0x178(%rbp)
fldt 0x16076(%rip)           # 0x2e030
faddl -0x178(%rbp)
fstpl -0x170(%rbp)
movsd -0x170(%rbp), %xmm1
movsd %xmm1, -0x68(%rbp)
movsd %xmm2, -0xe0(%rbp)
addsd %xmm2, %xmm0
movapd %xmm0, -0x40(%rbp)
callq 0xc6c0
mulsd -0xa0(%rbp), %xmm0
addsd -0xd0(%rbp), %xmm0
movsd %xmm0, -0x130(%rbp)
movsd %xmm0, -0x120(%rbp)
movapd -0x40(%rbp), %xmm0
callq 0xb200
mulsd -0xa0(%rbp), %xmm0
addsd -0xd8(%rbp), %xmm0
movsd %xmm0, -0x128(%rbp)
movsd %xmm0, -0x118(%rbp)
movaps -0x40(%rbp), %xmm0
callq 0xc6c0
movaps -0x40(%rbp), %xmm0
callq 0xb200
movsd 0x17e5b(%rip), %xmm0    # 0x2fea8
ucomisd -0x68(%rbp), %xmm0
fldz
ja 0x1807d
fstp %st(0)
movsd -0x68(%rbp), %xmm0
movsd %xmm0, -0x168(%rbp)
fldl -0x168(%rbp)
fldt 0x17eff(%rip)           # 0x2ff70
fxch %st(1)
fucomi %st(1), %st
fstp %st(1)
jbe 0x18248
fstp %st(0)
callq 0xb240
movq (%rax), %rax
cmpl $0x2, (%rax)
jne 0x181f7
movq %r12, -0xa8(%rbp)
cmpl $0x2, %r15d
sete -0xe0(%rbp)
callq 0xb240
movq (%rax), %rax
movsd 0x28(%rax), %xmm1
movsd %xmm1, -0x68(%rbp)
movsd 0x30(%rax), %xmm0
movsd %xmm0, -0x60(%rbp)
subsd 0x20(%rax), %xmm0
movl 0x38(%rax), %r13d
subsd 0x18(%rax), %xmm1
callq 0xb2c0
movsd %xmm0, -0x40(%rbp)
movsd -0x108(%rbp), %xmm0
movsd -0x100(%rbp), %xmm1
callq 0xb110
xorl %r12d, %r12d
cmpl $0x1, %r13d
sete %r12b
movsd %xmm0, -0x150(%rbp)
movl %r12d, %eax
shll $0x4, %eax
leaq 0x18a05(%rip), %rcx     # 0x30b10
fldt (%rax,%rcx)
faddl -0x150(%rbp)
fstpl -0x148(%rbp)
movsd -0x148(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x60(%rbp), %xmm0
subsd -0x50(%rbp), %xmm0
movsd -0x68(%rbp), %xmm1
subsd -0xb0(%rbp), %xmm1
callq 0xb110
movl %r13d, -0xb0(%rbp)
notl %r13d
andb -0xe0(%rbp), %r12b
jne 0x18165
movl %r15d, %eax
xorl $0x1, %eax
orl %r13d, %eax
jne 0x18316
movapd -0xa0(%rbp), %xmm1
addsd -0x40(%rbp), %xmm1
jmp 0x18323
movl 0x1d0(%r12), %esi
subsd %xmm4, %xmm0
subsd %xmm3, %xmm1
movsd -0xc8(%rbp), %xmm6
movapd %xmm6, %xmm2
subsd -0xf8(%rbp), %xmm2
movsd -0xf0(%rbp), %xmm3
movsd -0xe8(%rbp), %xmm4
movsd 0x10(%rbp), %xmm5
movsd %xmm5, 0x18(%rsp)
movsd -0xc0(%rbp), %xmm5
movsd %xmm5, 0x10(%rsp)
movsd -0x70(%rbp), %xmm5
movsd %xmm5, 0x8(%rsp)
movsd -0xb8(%rbp), %xmm5
movsd %xmm5, (%rsp)
movq %r14, %rdi
movapd %xmm6, %xmm5
movsd -0x78(%rbp), %xmm6
movsd -0x80(%rbp), %xmm7
callq 0xc850
jmp 0x185d2
movsd -0x68(%rbp), %xmm0
movsd %xmm0, -0x160(%rbp)
fldt 0x17d56(%rip)           # 0x2ff60
faddl -0x160(%rbp)
fmuls 0x1891a(%rip)           # 0x30b30
fstpl -0x158(%rbp)
movsd -0x158(%rbp), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x182a6
jp 0x182a6
leaq 0x1a3de(%rip), %rdi     # 0x32615
jmp 0x1873f
leaq 0x1a24e(%rip), %rdi     # 0x32491
jmp 0x1873f
fldt 0x17d62(%rip)           # 0x2ffb0
fxch %st(1)
fucompi %st(1), %st
fstp %st(0)
fldz
jbe 0x1846a
fstp %st(0)
callq 0xb240
movq (%rax), %rcx
cmpq 0x8(%rax), %rcx
fldz
je 0x1846a
fstp %st(0)
callq 0xb240
movq (%rax), %rax
cmpl $0x2, (%rax)
fldz
jne 0x1846a
fstp %st(0)
callq 0xb240
movq (%rax), %rax
movl 0x38(%rax), %eax
cmpl $0x1, %r15d
jne 0x1845f
cmpl $0x1, %eax
jmp 0x18462
callq 0xb5c0
movapd -0xa0(%rbp), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, -0xa0(%rbp)
movapd -0x60(%rbp), %xmm0
addsd -0xe0(%rbp), %xmm0
movapd %xmm0, -0x60(%rbp)
callq 0xc6c0
mulsd -0xa0(%rbp), %xmm0
addsd -0xa8(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movapd -0x60(%rbp), %xmm0
callq 0xb200
movapd -0xa0(%rbp), %xmm1
mulsd %xmm0, %xmm1
addsd -0x48(%rbp), %xmm1
movq %rbx, %rdi
movq %r14, %rsi
movsd -0x40(%rbp), %xmm0
jmp 0x18445
movsd -0x40(%rbp), %xmm1
subsd -0xa0(%rbp), %xmm1
movsd %xmm1, -0x50(%rbp)
movsd -0x48(%rbp), %xmm1
subsd %xmm0, %xmm1
movapd %xmm1, %xmm0
callq 0xc6c0
mulsd -0x50(%rbp), %xmm0
testb %r12b, %r12b
jne 0x1834d
xorl $0x1, %r15d
orl %r13d, %r15d
jne 0x18394
subsd -0xa0(%rbp), %xmm0
divsd -0x40(%rbp), %xmm0
movapd 0x15cbe(%rip), %xmm1    # 0x2e020
andpd %xmm0, %xmm1
ucomisd 0x17b32(%rip), %xmm1    # 0x2fea0
movq -0xa8(%rbp), %r12
ja 0x18453
callq 0xbab0
cmpl $0x1, -0xb0(%rbp)
jne 0x183d8
movsd -0x48(%rbp), %xmm1
subsd %xmm0, %xmm1
jmp 0x183e1
movapd -0xa0(%rbp), %xmm1
addsd %xmm0, %xmm1
divsd -0x40(%rbp), %xmm1
movapd 0x15c73(%rip), %xmm0    # 0x2e020
andpd %xmm1, %xmm0
ucomisd 0x17ae7(%rip), %xmm0    # 0x2fea0
movq -0xa8(%rbp), %r12
ja 0x18453
movapd %xmm1, %xmm0
callq 0xbab0
cmpl $0x1, -0xb0(%rbp)
jne 0x18389
movsd -0x48(%rbp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, -0x140(%rbp)
fldt 0x17b71(%rip)           # 0x2ff60
faddl -0x140(%rbp)
fstpl -0x138(%rbp)
movsd -0x138(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
callq 0xc6c0
mulsd -0x40(%rbp), %xmm0
addsd -0x68(%rbp), %xmm0
movsd %xmm0, -0xa0(%rbp)
movsd -0x50(%rbp), %xmm0
callq 0xb200
movsd -0x40(%rbp), %xmm1
mulsd %xmm0, %xmm1
addsd -0x60(%rbp), %xmm1
movq %rbx, %rdi
movq %r14, %rsi
movsd -0xa0(%rbp), %xmm0
callq 0xb7c0
testl %eax, %eax
jne 0x184be
jmp 0x18539
leaq 0x1a1f8(%rip), %rdi     # 0x32652
jmp 0x1873f
cmpl $-0x1, %eax
fldz
je 0x1807d
fstp %st(0)
movaps -0x40(%rbp), %xmm0
callq 0xc6c0
movsd %xmm0, -0x60(%rbp)
movaps -0x40(%rbp), %xmm0
callq 0xb200
movaps %xmm0, %xmm1
movsd -0x68(%rbp), %xmm0
ucomisd 0x17a1d(%rip), %xmm0    # 0x2feb0
jbe 0x1851f
movsd %xmm1, -0x40(%rbp)
movq %rbx, %rdi
movq %r14, %rsi
movsd -0xa8(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
callq 0xb7c0
testl %eax, %eax
je 0x1866b
movl %eax, %r13d
movq 0x24a98(%rip), %rbx     # 0x3cf60
movslq 0xd670(%rbx), %rax
cmpq $0x30, %rax
jg 0x18784
imulq $0x50, %rax, %rax
leaq (%rbx,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x1a098(%rip), %rsi     # 0x32587
pushq $0x50
popq %rdx
callq 0xb940
movslq 0xd670(%rbx), %rax
imulq $0x50, %rax, %rcx
xorl %edx, %edx
movb %dl, 0xc71f(%rbx,%rcx)
incl %eax
movl %eax, 0xd670(%rbx)
movb %dl, 0xc720(%rbx,%rcx)
jmp 0x18784
movq %r14, %rdi
callq 0xb340
movsd -0xa8(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
callq 0xba60
cmpl $0x0, -0x84(%rbp)
jne 0x1854b
movq 0x24a7f(%rip), %rax     # 0x3cfc8
jmp 0x18552
movq 0x24a26(%rip), %rax     # 0x3cf78
movsd -0xc8(%rbp), %xmm0
movsd -0x70(%rbp), %xmm1
movsd -0x80(%rbp), %xmm7
movsd -0x78(%rbp), %xmm6
movsd 0x10(%rbp), %xmm3
movl 0x1d0(%r12), %esi
movapd %xmm0, %xmm2
subsd -0xf8(%rbp), %xmm2
movsd %xmm3, 0x18(%rsp)
movsd -0xc0(%rbp), %xmm4
movsd %xmm4, 0x10(%rsp)
movsd %xmm1, 0x8(%rsp)
movsd -0xb8(%rbp), %xmm3
movsd %xmm3, (%rsp)
movq %r14, %rdi
movapd %xmm0, %xmm5
movsd -0x100(%rbp), %xmm0
movsd -0x108(%rbp), %xmm1
movsd -0x130(%rbp), %xmm3
movsd -0x128(%rbp), %xmm4
callq *%rax
movsd -0x120(%rbp), %xmm0
movsd -0x118(%rbp), %xmm1
movq %rbx, %rdi
movq %r14, %rsi
movsd -0xc8(%rbp), %xmm2
callq 0xc2c0
movsd -0x78(%rbp), %xmm0
movsd %xmm0, 0x8(%r14)
movsd -0x80(%rbp), %xmm0
movsd %xmm0, 0x20(%r14)
movsd -0xb8(%rbp), %xmm0
movsd %xmm0, 0x38(%r14)
movsd -0x70(%rbp), %xmm0
movsd %xmm0, 0x50(%r14)
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, 0x68(%r14)
movsd 0x10(%rbp), %xmm0
movsd %xmm0, 0x80(%r14)
movq %rbx, %rdi
movq %r14, %rsi
movsd -0xd0(%rbp), %xmm0
movsd -0xd8(%rbp), %xmm1
movsd -0xc8(%rbp), %xmm2
callq 0xbe80
xorl %r13d, %r13d
jmp 0x18784
movapd -0xa0(%rbp), %xmm0
movsd -0x60(%rbp), %xmm9
mulsd %xmm0, %xmm9
movsd -0xb0(%rbp), %xmm8
addsd %xmm8, %xmm9
movsd -0x40(%rbp), %xmm10
mulsd %xmm0, %xmm10
movsd -0x50(%rbp), %xmm4
addsd %xmm4, %xmm10
movl -0x84(%rbp), %eax
testl %eax, %eax
je 0x18799
cmpl $0xa, %eax
movsd -0xc0(%rbp), %xmm0
movsd -0x70(%rbp), %xmm1
movsd -0xb8(%rbp), %xmm2
movsd -0x80(%rbp), %xmm7
movsd -0x78(%rbp), %xmm6
movsd 0x10(%rbp), %xmm3
jne 0x18738
xorl %eax, %eax
cmpl $0x2, %r15d
setne %al
movl 0x1d0(%r12), %esi
leal -0x1(%rax,%rax), %edx
movsd -0x110(%rbp), %xmm5
movsd %xmm3, 0x18(%rsp)
movsd %xmm0, 0x10(%rsp)
movsd %xmm1, 0x8(%rsp)
movsd %xmm2, (%rsp)
xorpd %xmm0, %xmm0
movq %r14, %rdi
movapd %xmm9, %xmm1
movapd %xmm10, %xmm2
movapd %xmm8, %xmm3
movsd %xmm9, -0x60(%rbp)
movsd %xmm10, -0x40(%rbp)
callq 0xb3f0
jmp 0x1880e
leaq 0x19c46(%rip), %rdi     # 0x32385
callq 0xb220
movq %rbx, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xb8e0
movq 0x24808(%rip), %rbx     # 0x3cf60
leaq 0xc6d0(%rbx), %rdi
leaq 0x19e21(%rip), %rsi     # 0x32587
pushq $0x50
popq %rdx
callq 0xb940
andw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
pushq $0x5
popq %r13
movl %r13d, %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x1d0(%r12), %esi
movsd -0x110(%rbp), %xmm5
movsd 0x10(%rbp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd -0x70(%rbp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd -0xb8(%rbp), %xmm0
movsd %xmm0, (%rsp)
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
xorpd %xmm2, %xmm2
movq %r14, %rdi
movapd %xmm9, %xmm3
movapd %xmm10, %xmm4
movsd -0x78(%rbp), %xmm6
movsd -0x80(%rbp), %xmm7
movsd %xmm9, -0x60(%rbp)
movsd %xmm10, -0x40(%rbp)
callq 0xc860
movq %r14, %rdi
callq 0xb340
movsd -0x60(%rbp), %xmm0
movsd -0x40(%rbp), %xmm1
jmp 0x18534
nop