// File: /workspace/github_cpp_makefile_star2_O3/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, -0xb0(%rbp)
movsd %xmm6, -0x78(%rbp)
movsd %xmm5, -0xa8(%rbp)
movsd %xmm4, -0x88(%rbp)
movsd %xmm3, -0x80(%rbp)
movsd %xmm2, -0xb8(%rbp)
movsd %xmm1, -0xd8(%rbp)
movsd %xmm0, -0xd0(%rbp)
movq %rcx, %r14
movq %rdx, %r12
movl %esi, -0x8c(%rbp)
movq %rdi, %rbx
leaq -0xe8(%rbp), %rdx
leaq -0xe0(%rbp), %rcx
leaq -0x108(%rbp), %r8
movq %r14, %rsi
callq 0xb6b0
leaq -0x118(%rbp), %rdx
leaq -0x110(%rbp), %rcx
leaq -0x1a8(%rbp), %r8
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb6b0
leaq -0x1a0(%rbp), %r13
leaq -0x198(%rbp), %r15
leaq -0xf0(%rbp), %r8
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0xabf0
movsd -0xd0(%rbp), %xmm0
movsd -0xd8(%rbp), %xmm1
movsd (%r15), %xmm3
ucomisd %xmm1, %xmm3
movsd (%r13), %xmm4
jne 0x178c6
jp 0x178c6
ucomisd %xmm0, %xmm4
jne 0x178c6
jp 0x178c6
movl -0x8c(%rbp), %eax
cmpl $0xa, %eax
je 0x17bee
testl %eax, %eax
movsd -0x88(%rbp), %xmm7
movsd -0x80(%rbp), %xmm6
jne 0x181c9
movl 0x1d0(%r12), %esi
subsd %xmm4, %xmm0
subsd %xmm3, %xmm1
movsd -0xb8(%rbp), %xmm8
movapd %xmm8, %xmm2
subsd -0xf0(%rbp), %xmm2
movsd -0xe8(%rbp), %xmm3
movsd -0xe0(%rbp), %xmm4
movsd 0x10(%rbp), %xmm5
movsd %xmm5, 0x18(%rsp)
movsd -0xb0(%rbp), %xmm5
movsd %xmm5, 0x10(%rsp)
movsd -0x78(%rbp), %xmm5
movsd %xmm5, 0x8(%rsp)
movsd -0xa8(%rbp), %xmm5
movsd %xmm5, (%rsp)
movq %r14, %rdi
movapd %xmm8, %xmm5
callq 0xb6f0
jmp 0x18060
movl 0x624(%r14), %r15d
movsd 0x618(%r14), %xmm2
movaps %xmm2, -0xa0(%rbp)
movsd -0xe0(%rbp), %xmm2
movsd %xmm2, -0x30(%rbp)
movapd %xmm2, %xmm0
subsd %xmm3, %xmm0
movsd -0xe8(%rbp), %xmm2
movsd %xmm2, -0xc8(%rbp)
movapd %xmm2, %xmm1
subsd %xmm4, %xmm1
movsd %xmm3, -0x48(%rbp)
movsd %xmm4, -0x68(%rbp)
callq 0xa100
movapd %xmm0, -0x60(%rbp)
movsd -0xd8(%rbp), %xmm0
subsd -0x48(%rbp), %xmm0
movsd -0xd0(%rbp), %xmm1
subsd -0x68(%rbp), %xmm1
movsd %xmm0, -0x100(%rbp)
movsd %xmm1, -0xf8(%rbp)
callq 0xa100
cmpl $0x2, %r15d
jne 0x179aa
movapd -0x60(%rbp), %xmm2
movsd %xmm2, -0x180(%rbp)
fldt 0x1c5da(%rip)           # 0x33f40
faddl -0x180(%rbp)
fstpl -0x178(%rbp)
movapd %xmm2, %xmm3
cmpltsd %xmm0, %xmm3
movapd %xmm3, %xmm1
andnpd %xmm2, %xmm1
movsd -0x178(%rbp), %xmm2
andpd %xmm3, %xmm2
orpd %xmm1, %xmm2
movapd %xmm2, -0x60(%rbp)
movapd %xmm2, %xmm1
subsd %xmm0, %xmm1
movsd 0x1c560(%rip), %xmm2    # 0x33f08
jmp 0x17a04
cmpl $0x1, %r15d
jne 0x17cb6
movsd %xmm0, -0x190(%rbp)
fldt 0x1c57e(%rip)           # 0x33f40
faddl -0x190(%rbp)
fstpl -0x188(%rbp)
movapd %xmm0, %xmm3
movapd -0x60(%rbp), %xmm2
cmpltsd %xmm2, %xmm3
movapd %xmm3, %xmm1
andnpd %xmm0, %xmm1
movsd -0x188(%rbp), %xmm0
andpd %xmm3, %xmm0
orpd %xmm1, %xmm0
movapd %xmm0, %xmm1
subsd %xmm2, %xmm1
movsd 0x1c4fc(%rip), %xmm2    # 0x33f00
movsd %xmm1, -0x170(%rbp)
fldt 0x1a61e(%rip)           # 0x32030
faddl -0x170(%rbp)
fstpl -0x168(%rbp)
movsd -0x168(%rbp), %xmm1
movsd %xmm1, -0x70(%rbp)
movsd %xmm2, -0xc0(%rbp)
addsd %xmm2, %xmm0
movapd %xmm0, -0x40(%rbp)
callq 0xb550
mulsd -0xa0(%rbp), %xmm0
addsd -0xd0(%rbp), %xmm0
movsd %xmm0, -0x128(%rbp)
movsd %xmm0, -0x118(%rbp)
movapd -0x40(%rbp), %xmm0
callq 0xa1d0
mulsd -0xa0(%rbp), %xmm0
addsd -0xd8(%rbp), %xmm0
movsd %xmm0, -0x120(%rbp)
movsd %xmm0, -0x110(%rbp)
movaps -0x40(%rbp), %xmm0
callq 0xb550
movaps -0x40(%rbp), %xmm0
callq 0xa1d0
movsd 0x1c403(%rip), %xmm0    # 0x33ea8
ucomisd -0x70(%rbp), %xmm0
fldz
ja 0x17ad5
fstp %st(0)
movsd -0x70(%rbp), %xmm0
movsd %xmm0, -0x160(%rbp)
fldl -0x160(%rbp)
fldt 0x1c4a7(%rip)           # 0x33f70
fxch %st(1)
fucomi %st(1), %st
fstp %st(1)
jbe 0x17cc2
fstp %st(0)
callq 0xa210
movq (%rax), %rax
cmpl $0x2, (%rax)
jne 0x17c71
movq %r12, -0xc0(%rbp)
cmpl $0x2, %r15d
sete -0xc8(%rbp)
callq 0xa210
movq (%rax), %rax
movsd 0x28(%rax), %xmm1
movsd %xmm1, -0x70(%rbp)
movsd 0x30(%rax), %xmm0
movsd %xmm0, -0x60(%rbp)
subsd 0x20(%rax), %xmm0
movl 0x38(%rax), %r12d
subsd 0x18(%rax), %xmm1
callq 0xa290
movsd %xmm0, -0x40(%rbp)
movsd -0x100(%rbp), %xmm0
movsd -0xf8(%rbp), %xmm1
callq 0xa100
xorl %r13d, %r13d
cmpl $0x1, %r12d
sete %r13b
movsd %xmm0, -0x148(%rbp)
movl %r13d, %eax
shll $0x4, %eax
leaq 0x1cfad(%rip), %rcx     # 0x34b10
fldt (%rax,%rcx)
faddl -0x148(%rbp)
fstpl -0x140(%rbp)
movsd -0x140(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movsd -0x60(%rbp), %xmm0
subsd -0x48(%rbp), %xmm0
movsd -0x70(%rbp), %xmm1
subsd -0x68(%rbp), %xmm1
callq 0xa100
movl %r12d, -0x48(%rbp)
notl %r12d
andb -0xc8(%rbp), %r13b
jne 0x17bb7
movl %r15d, %eax
xorl $0x1, %eax
orl %r12d, %eax
jne 0x17d90
movapd -0xa0(%rbp), %xmm1
addsd -0x40(%rbp), %xmm1
movsd %xmm1, -0x68(%rbp)
movsd -0x30(%rbp), %xmm1
subsd %xmm0, %xmm1
movapd %xmm1, %xmm0
callq 0xb550
mulsd -0x68(%rbp), %xmm0
testb %r13b, %r13b
je 0x17db9
jmp 0x17dc2
movl 0x1d0(%r12), %esi
subsd %xmm4, %xmm0
subsd %xmm3, %xmm1
movsd -0xb8(%rbp), %xmm6
movapd %xmm6, %xmm2
subsd -0xf0(%rbp), %xmm2
movsd -0xe8(%rbp), %xmm3
movsd -0xe0(%rbp), %xmm4
movsd 0x10(%rbp), %xmm5
movsd %xmm5, 0x18(%rsp)
movsd -0xb0(%rbp), %xmm5
movsd %xmm5, 0x10(%rsp)
movsd -0x78(%rbp), %xmm5
movsd %xmm5, 0x8(%rsp)
movsd -0xa8(%rbp), %xmm5
movsd %xmm5, (%rsp)
movq %r14, %rdi
movapd %xmm6, %xmm5
movsd -0x80(%rbp), %xmm6
movsd -0x88(%rbp), %xmm7
callq 0xb6e0
jmp 0x18060
movsd -0x70(%rbp), %xmm0
movsd %xmm0, -0x158(%rbp)
fldt 0x1c2dc(%rip)           # 0x33f60
faddl -0x158(%rbp)
fmuls 0x1cea0(%rip)           # 0x34b30
fstpl -0x150(%rbp)
movsd -0x150(%rbp), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x17d20
jp 0x17d20
leaq 0x1e95a(%rip), %rdi     # 0x3660b
jmp 0x181d0
leaq 0x1e7ca(%rip), %rdi     # 0x36487
jmp 0x181d0
fldt 0x1c2e8(%rip)           # 0x33fb0
fxch %st(1)
fucompi %st(1), %st
fstp %st(0)
fldz
jbe 0x17eeb
fstp %st(0)
callq 0xa210
movq (%rax), %rcx
cmpq 0x8(%rax), %rcx
fldz
je 0x17eeb
fstp %st(0)
callq 0xa210
movq (%rax), %rax
cmpl $0x2, (%rax)
fldz
jne 0x17eeb
fstp %st(0)
callq 0xa210
movq (%rax), %rax
movl 0x38(%rax), %eax
cmpl $0x1, %r15d
jne 0x17ee0
cmpl $0x1, %eax
jmp 0x17ee3
callq 0xa580
movapd -0xa0(%rbp), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, -0xa0(%rbp)
movapd -0x60(%rbp), %xmm0
addsd -0xc0(%rbp), %xmm0
movapd %xmm0, -0x60(%rbp)
callq 0xb550
mulsd -0xa0(%rbp), %xmm0
addsd -0xc8(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movapd -0x60(%rbp), %xmm0
callq 0xa1d0
movapd -0xa0(%rbp), %xmm1
mulsd %xmm0, %xmm1
addsd -0x30(%rbp), %xmm1
movq %rbx, %rdi
movq %r14, %rsi
movsd -0x40(%rbp), %xmm0
jmp 0x17ec7
movsd -0x40(%rbp), %xmm1
subsd -0xa0(%rbp), %xmm1
movsd %xmm1, -0x68(%rbp)
movsd -0x30(%rbp), %xmm1
subsd %xmm0, %xmm1
movapd %xmm1, %xmm0
callq 0xb550
mulsd -0x68(%rbp), %xmm0
xorl $0x1, %r15d
orl %r12d, %r15d
jne 0x17dfb
subsd -0xa0(%rbp), %xmm0
divsd -0x40(%rbp), %xmm0
movapd 0x1a249(%rip), %xmm1    # 0x32020
andpd %xmm0, %xmm1
ucomisd 0x1c0bd(%rip), %xmm1    # 0x33ea0
ja 0x17e47
callq 0xaa00
cmpl $0x1, -0x48(%rbp)
jne 0x17e53
movsd -0x30(%rbp), %xmm1
subsd %xmm0, %xmm1
jmp 0x17e5c
movapd -0xa0(%rbp), %xmm1
addsd %xmm0, %xmm1
divsd -0x40(%rbp), %xmm1
movapd 0x1a20c(%rip), %xmm0    # 0x32020
andpd %xmm1, %xmm0
ucomisd 0x1c080(%rip), %xmm0    # 0x33ea0
movq -0xc0(%rbp), %r12
ja 0x17e47
movapd %xmm1, %xmm0
callq 0xaa00
cmpl $0x1, -0x48(%rbp)
jne 0x17ed5
movsd -0x30(%rbp), %xmm1
addsd %xmm0, %xmm1
jmp 0x17e63
leaq 0x1e7fa(%rip), %rdi     # 0x36648
jmp 0x181d0
movsd -0x30(%rbp), %xmm1
addsd %xmm0, %xmm1
movq -0xc0(%rbp), %r12
movsd %xmm1, -0x138(%rbp)
fldt 0x1c0ef(%rip)           # 0x33f60
faddl -0x138(%rbp)
fstpl -0x130(%rbp)
movsd -0x130(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
callq 0xb550
mulsd -0x40(%rbp), %xmm0
addsd -0x70(%rbp), %xmm0
movsd %xmm0, -0xa0(%rbp)
movsd -0x48(%rbp), %xmm0
callq 0xa1d0
movsd -0x40(%rbp), %xmm1
mulsd %xmm0, %xmm1
addsd -0x60(%rbp), %xmm1
movq %rbx, %rdi
movq %r14, %rsi
movsd -0xa0(%rbp), %xmm0
callq 0xa760
testl %eax, %eax
jne 0x17f3f
jmp 0x17fc4
movsd -0x30(%rbp), %xmm1
subsd %xmm0, %xmm1
jmp 0x17e63
cmpl $-0x1, %eax
fldz
je 0x17ad5
fstp %st(0)
movaps -0x40(%rbp), %xmm0
callq 0xb550
movsd %xmm0, -0x60(%rbp)
movaps -0x40(%rbp), %xmm0
callq 0xa1d0
movaps %xmm0, %xmm1
movsd -0x70(%rbp), %xmm0
ucomisd 0x1bf9c(%rip), %xmm0    # 0x33eb0
jbe 0x17faa
movsd %xmm1, -0x40(%rbp)
movq %rbx, %rdi
movq %r14, %rsi
movsd -0xc8(%rbp), %xmm0
movsd -0x30(%rbp), %xmm1
callq 0xa760
testl %eax, %eax
je 0x180fc
movl %eax, %r13d
movq 0x29017(%rip), %rbx     # 0x40f60
movslq 0xd670(%rbx), %rax
cmpq $0x30, %rax
jg 0x1821a
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%rbx,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x1e609(%rip), %rsi     # 0x3657d
movl $0x50, %edx
callq 0xa8a0
movslq 0xd670(%rbx), %rax
leaq (%rax,%rax,4), %rcx
shlq $0x4, %rcx
xorl %edx, %edx
movb %dl, 0xc71f(%rbx,%rcx)
incl %eax
movl %eax, 0xd670(%rbx)
movb %dl, 0xc720(%rbx,%rcx)
jmp 0x1821a
movq %r14, %rdi
callq 0xa300
movsd -0xc8(%rbp), %xmm0
movsd -0x30(%rbp), %xmm1
callq 0xa9b0
cmpl $0x0, -0x8c(%rbp)
jne 0x17fd6
movq 0x28ff4(%rip), %rax     # 0x40fc8
jmp 0x17fdd
movq 0x28f9b(%rip), %rax     # 0x40f78
movsd -0xb8(%rbp), %xmm0
movsd -0x78(%rbp), %xmm1
movsd -0x88(%rbp), %xmm7
movsd -0x80(%rbp), %xmm6
movsd 0x10(%rbp), %xmm3
movl 0x1d0(%r12), %esi
movapd %xmm0, %xmm2
subsd -0xf0(%rbp), %xmm2
movsd %xmm3, 0x18(%rsp)
movsd -0xb0(%rbp), %xmm4
movsd %xmm4, 0x10(%rsp)
movsd %xmm1, 0x8(%rsp)
movsd -0xa8(%rbp), %xmm3
movsd %xmm3, (%rsp)
movq %r14, %rdi
movapd %xmm0, %xmm5
movsd -0xf8(%rbp), %xmm0
movsd -0x100(%rbp), %xmm1
movsd -0x128(%rbp), %xmm3
movsd -0x120(%rbp), %xmm4
callq *%rax
movsd -0x118(%rbp), %xmm0
movsd -0x110(%rbp), %xmm1
movq %rbx, %rdi
movq %r14, %rsi
movsd -0xb8(%rbp), %xmm2
callq 0xb170
movsd -0x80(%rbp), %xmm0
movsd %xmm0, 0x8(%r14)
movsd -0x88(%rbp), %xmm0
movsd %xmm0, 0x20(%r14)
movsd -0xa8(%rbp), %xmm0
movsd %xmm0, 0x38(%r14)
movsd -0x78(%rbp), %xmm0
movsd %xmm0, 0x50(%r14)
movsd -0xb0(%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 -0xb8(%rbp), %xmm2
callq 0xad80
xorl %r13d, %r13d
jmp 0x1821a
movapd -0xa0(%rbp), %xmm0
movsd -0x60(%rbp), %xmm9
mulsd %xmm0, %xmm9
movsd -0x68(%rbp), %xmm8
addsd %xmm8, %xmm9
movsd -0x40(%rbp), %xmm10
mulsd %xmm0, %xmm10
movsd -0x48(%rbp), %xmm4
addsd %xmm4, %xmm10
movl -0x8c(%rbp), %eax
testl %eax, %eax
je 0x1822f
cmpl $0xa, %eax
movsd -0xb0(%rbp), %xmm0
movsd -0x78(%rbp), %xmm1
movsd -0xa8(%rbp), %xmm2
movsd -0x88(%rbp), %xmm7
movsd -0x80(%rbp), %xmm6
movsd 0x10(%rbp), %xmm3
jne 0x181c9
xorl %eax, %eax
cmpl $0x2, %r15d
setne %al
movl 0x1d0(%r12), %esi
leal -0x1(%rax,%rax), %edx
movsd -0x108(%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 0xa3b0
jmp 0x182a7
leaq 0x1e1ab(%rip), %rdi     # 0x3637b
callq 0xa1f0
movq %rbx, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xa850
movq 0x28d77(%rip), %rbx     # 0x40f60
leaq 0xc6d0(%rbx), %rdi
leaq 0x1e386(%rip), %rsi     # 0x3657d
movl $0x50, %edx
callq 0xa8a0
movw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
movl $0x5, %r13d
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 -0x108(%rbp), %xmm5
movsd 0x10(%rbp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd -0xb0(%rbp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd -0x78(%rbp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd -0xa8(%rbp), %xmm0
movsd %xmm0, (%rsp)
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
xorpd %xmm2, %xmm2
movq %r14, %rdi
movapd %xmm9, %xmm3
movapd %xmm10, %xmm4
movsd -0x80(%rbp), %xmm6
movsd -0x88(%rbp), %xmm7
movsd %xmm9, -0x60(%rbp)
movsd %xmm10, -0x40(%rbp)
callq 0xb6f0
movq %r14, %rdi
callq 0xa300
movsd -0x60(%rbp), %xmm0
movsd -0x40(%rbp), %xmm1
jmp 0x17fbf