// File: /workspace/github_cpp_makefile_star2_O3/sundale[P]gcode/rs274ngc/interp_convert.cc
// Function: Interp::convert_arc_comp2(int, block_struct*, setup_struct*, double, double, double, double, double, double, double, double, double, double, double)
int Interp::convert_arc_comp2(int move,  //!< either G_2 (cw arc) or G_3 (ccw arc)          
                              block_pointer block,       //!< pointer to a block of RS274/NGC instructions  
                              setup_pointer settings,    //!< pointer to machine settings                   
                              double end_x,      //!< x-value at end of programmed (then actual) arc
                              double end_y,      //!< y-value at end of programmed (then actual) arc
                              double end_z,      //!< z-value at end of arc 
                              double offset_x, double offset_y,
                              double AA_end,     //!< a-value at end of arc
                              double BB_end,     //!< b-value at end of arc
                              double CC_end,     //!< c-value at end of arc
                              double u, double v, double w) //!< uvw at end of arc
{
    double alpha;                 /* direction of tangent to start of arc */
    double arc_radius;
    double beta;                  /* angle between two tangents above */
    double centerx, centery;              /* center of arc */
    double delta;                 /* direction of radius from start of arc to center of arc */
    double gamma;                 /* direction of perpendicular to arc at end */
    double midx, midy;
    int side;
    double small = TOLERANCE_CONCAVE_CORNER;      /* angle for testing corners */
    double opx, opy, opz;
    double theta;                 /* direction of tangent to last cut */
    double tolerance;
    double tool_radius;
    int turn;                     /* number of full or partial circles CCW */
    int plane = settings->plane;
    double cx, cy, cz;
    double new_end_x, new_end_y;

    /* find basic arc data: center_x, center_y, and turn */

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

    tolerance = (settings->length_units == CANON_UNITS_INCHES) ?
        TOLERANCE_INCH : TOLERANCE_MM;

    if (block->r_flag) {
        CHP(arc_data_r(move, plane, opx, opy, end_x, end_y,
                       block->r_number, &centerx, &centery, &turn, tolerance));
    } else {
        CHP(arc_data_ijk(move, plane,
                         opx, opy, end_x, end_y,
                         (settings->ijk_distance_mode == MODE_ABSOLUTE),
                         offset_x, offset_y,
                         &centerx, &centery, &turn, tolerance));
    }

    inverse_time_rate_arc(opx, opy, opz, centerx, centery,
                          turn, end_x, end_y, end_z, block, settings);

    side = settings->cutter_comp_side;
    tool_radius = settings->cutter_comp_radius;   /* always is positive */
    arc_radius = hypot((centerx - end_x), (centery - end_y));
    theta = atan2(cy - opy, cx - opx);
    theta = (side == LEFT) ? (theta - M_PI_2l) : (theta + M_PI_2l);
    delta = atan2(centery - opy, centerx - opx);
    alpha = (move == G_3) ? (delta - M_PI_2l) : (delta + M_PI_2l);
    beta = (side == LEFT) ? (theta - alpha) : (alpha - theta);

    // normalize beta -90 to +270?
    beta = (beta > (1.5 * M_PIl)) ? (beta - (2 * M_PIl)) : (beta < -M_PI_2l) ? (beta + (2 * M_PIl)) : beta;

    if (((side == LEFT) && (move == G_3)) || ((side == RIGHT) && (move == G_2))) {
        // we are cutting inside the arc
        gamma = atan2((centery - end_y), (centerx - end_x));
        CHKS((arc_radius <= tool_radius),
            NCE_TOOL_RADIUS_NOT_LESS_THAN_ARC_RADIUS_WITH_COMP);
    } else {
        gamma = atan2((end_y - centery), (end_x - centerx));
        delta = (delta + M_PIl);
    }

    // move arc endpoint to the compensated position
    new_end_x = end_x + tool_radius * cos(gamma);
    new_end_y = end_y + tool_radius * sin(gamma);

    if (beta < -small || 
        beta > M_PIl + small ||
        // special detection for convex corner on tangent arc->arc (like atop the middle of "m" shape)
        // or tangent line->arc (atop "h" shape)
        (fabs(beta - M_PIl) < small && !TOOL_INSIDE_ARC(side, turn))
        ) {
        // concave
        if (qc().front().type != QARC_FEED) {
            // line->arc
            double cy = arc_radius * sin(beta - M_PI_2l);
            double toward_nominal;
            double dist_from_center;
            double angle_from_center;
          
            if TOOL_INSIDE_ARC(side, turn) {
                // tool is inside the arc
                dist_from_center = arc_radius - tool_radius;
                toward_nominal = cy + tool_radius;
                double l = toward_nominal / dist_from_center;
                CHKS((l > 1.0 || l < -1.0), _("Arc move in concave corner cannot be reached by the tool without gouging"));
                if(turn == 1) {
                    angle_from_center = theta + asin(l);
                } else {
                    angle_from_center = theta - asin(l);
                }
            } else {
                dist_from_center = arc_radius + tool_radius; 
                toward_nominal = cy - tool_radius;
                double l = toward_nominal / dist_from_center;
                CHKS((l > 1.0 || l < -1.0), _("Arc move in concave corner cannot be reached by the tool without gouging"));
                if(turn == 1) {
                    angle_from_center = theta + M_PIl - asin(l);
                } else {
                    angle_from_center = theta + M_PIl + asin(l);
                }
            }          
          
            midx = centerx + dist_from_center * cos(angle_from_center);
            midy = centery + dist_from_center * sin(angle_from_center);

            CHP(move_endpoint_and_flush(settings, midx, midy));
        } else {
            // arc->arc
            struct arc_feed &prev = qc().front().data.arc_feed;
            double oldrad = hypot(prev.center2 - prev.end2, prev.center1 - prev.end1);
            double newrad;
            if TOOL_INSIDE_ARC(side, turn) {
                newrad = arc_radius - tool_radius;
            } else {
                newrad = arc_radius + tool_radius;
            }
              
            double arc_cc, pullback, cc_dir, a;
            arc_cc = hypot(prev.center2 - centery, prev.center1 - centerx);

            CHKS((oldrad == 0 || arc_cc == 0), _("Arc to arc motion is invalid because the arcs have the same center"));
            a = (SQ(oldrad) + SQ(arc_cc) - SQ(newrad)) / (2 * oldrad * arc_cc);
            
            CHKS((a > 1.0 || a < -1.0), (_("Arc to arc motion makes a corner the compensated tool can't fit in without gouging")));
            pullback = acos(a);
            cc_dir = atan2(centery - prev.center2, centerx - prev.center1);

            double dir;
            if TOOL_INSIDE_ARC(side, prev.turn) {
                if(turn == 1) 
                    dir = cc_dir + pullback;
                else
                    dir = cc_dir - pullback;
            }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movsd %xmm7, -0xb0(%rbp)
movsd %xmm6, -0xa8(%rbp)
movsd %xmm5, -0xa0(%rbp)
movsd %xmm4, -0x40(%rbp)
movsd %xmm3, -0x58(%rbp)
movsd %xmm2, -0x98(%rbp)
movsd %xmm1, -0x60(%rbp)
movsd %xmm0, -0x68(%rbp)
movq %rcx, %r14
movq %rdx, %r12
movl %esi, -0x78(%rbp)
movq %rdi, %r15
movl 0xc67c(%rcx), %eax
movl %eax, -0x38(%rbp)
leaq -0x180(%rbp), %r13
leaq -0x178(%rbp), %rbx
leaq -0x170(%rbp), %r8
movq %rcx, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0xabf0
leaq -0x168(%rbp), %rdx
leaq -0x160(%rbp), %rcx
leaq -0x158(%rbp), %r8
movq %r15, %rdi
movq %r14, %rsi
callq 0xb6b0
xorl %eax, %eax
cmpl $0x1, 0x1690(%r14)
sete %al
leaq 0x257ea(%rip), %rcx     # 0x33f20
movsd (%rcx,%rax,8), %xmm6
movsd (%r13), %xmm0
movsd (%rbx), %xmm1
cmpb $0x1, 0x229(%r12)
movsd %xmm1, -0x90(%rbp)
movsd %xmm0, -0x88(%rbp)
jne 0xe793
movsd 0x230(%r12), %xmm4
leaq -0x50(%rbp), %rcx
leaq -0x48(%rbp), %r8
leaq -0x2c(%rbp), %r9
movq %r15, %rdi
movl -0x78(%rbp), %esi
movl -0x38(%rbp), %edx
movsd -0x68(%rbp), %xmm2
movsd -0x60(%rbp), %xmm3
movaps %xmm6, %xmm5
callq 0xac60
jmp 0xe7d2
xorl %ecx, %ecx
cmpl $0x0, 0x66c(%r14)
sete %cl
leaq -0x2c(%rbp), %rax
movq %rax, (%rsp)
leaq -0x50(%rbp), %r8
leaq -0x48(%rbp), %r9
movq %r15, %rdi
movl -0x78(%rbp), %esi
movl -0x38(%rbp), %edx
movsd -0x68(%rbp), %xmm2
movsd -0x60(%rbp), %xmm3
movsd -0x58(%rbp), %xmm4
movsd -0x40(%rbp), %xmm5
callq 0xad50
testl %eax, %eax
je 0xe841
movl %eax, %r13d
movq 0x32780(%rip), %rbx     # 0x40f60
movslq 0xd670(%rbx), %rax
cmpq $0x30, %rax
jg 0xf193
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%rbx,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x269ef(%rip), %rsi     # 0x351fa
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 0xf193
movsd -0x170(%rbp), %xmm2
movsd -0x50(%rbp), %xmm3
movsd -0x48(%rbp), %xmm4
movl -0x2c(%rbp), %esi
movq %r15, %rdi
movsd -0x88(%rbp), %xmm0
movsd -0x90(%rbp), %xmm1
movsd -0x68(%rbp), %xmm5
movsd -0x60(%rbp), %xmm6
movsd -0x98(%rbp), %xmm7
movq %r12, %rdx
movq %r14, %rcx
callq 0xac30
movl 0x624(%r14), %ebx
movsd 0x618(%r14), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x50(%rbp), %xmm0
subsd -0x68(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
subsd -0x60(%rbp), %xmm1
callq 0xa290
movsd %xmm0, -0x40(%rbp)
movsd -0x160(%rbp), %xmm0
movsd %xmm0, -0xe0(%rbp)
subsd -0x90(%rbp), %xmm0
movsd -0x168(%rbp), %xmm1
movsd %xmm1, -0xd8(%rbp)
subsd -0x88(%rbp), %xmm1
callq 0xa100
movsd %xmm0, -0x58(%rbp)
movsd -0x48(%rbp), %xmm0
subsd -0x90(%rbp), %xmm0
movsd -0x50(%rbp), %xmm1
subsd -0x88(%rbp), %xmm1
callq 0xa100
movl -0x78(%rbp), %ecx
cmpl $0x1e, %ecx
fldt 0x23712(%rip)           # 0x32030
fldt 0x2371c(%rip)           # 0x32040
fld %st(0)
fcmove %st(2), %st
cmpl $0x2, %ebx
fxch %st(1)
fcmove %st(2), %st
movsd -0x58(%rbp), %xmm1
movsd %xmm1, -0x150(%rbp)
faddl -0x150(%rbp)
fstpl -0x148(%rbp)
movsd -0x148(%rbp), %xmm1
movsd %xmm0, -0x140(%rbp)
fldl -0x140(%rbp)
fadd %st, %st(1)
fxch %st(1)
fstpl -0x138(%rbp)
movsd -0x138(%rbp), %xmm2
movsd %xmm1, -0xd0(%rbp)
je 0xe984
subsd %xmm1, %xmm2
movapd %xmm2, %xmm1
jmp 0xe988
subsd %xmm2, %xmm1
movsd %xmm1, -0x130(%rbp)
fldl -0x130(%rbp)
fldt 0x25594(%rip)           # 0x33f30
fxch %st(1)
fucomi %st(1), %st
fstp %st(1)
movsd -0x68(%rbp), %xmm2
jbe 0xe9bb
movq %r15, %r13
fldt 0x2559e(%rip)           # 0x33f50
faddp %st, %st(1)
movsd -0x60(%rbp), %xmm1
jmp 0xe9d3
fxch %st(2)
fucomi %st(2), %st
movsd -0x60(%rbp), %xmm1
movq %r15, %r13
jbe 0xe9d1
fldt 0x25571(%rip)           # 0x33f40
faddp %st, %st(3)
fxch %st(2)
fxch %st(2)
fstpt -0xc8(%rbp)
movl %ecx, %eax
xorl $0x1e, %eax
movl %ebx, %r15d
xorl $0x2, %r15d
fxch %st(1)
fstpl -0x128(%rbp)
movsd -0x128(%rbp), %xmm3
movsd %xmm3, -0x58(%rbp)
orl %r15d, %eax
je 0xea0d
movl %ebx, %eax
xorl $0x1, %eax
xorl $0x14, %ecx
orl %eax, %ecx
jne 0xea47
fstp %st(0)
movsd %xmm0, -0x80(%rbp)
movsd -0x48(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd -0x50(%rbp), %xmm1
subsd %xmm2, %xmm1
callq 0xa100
movapd %xmm0, %xmm1
movsd -0x38(%rbp), %xmm0
ucomisd -0x40(%rbp), %xmm0
jb 0xea83
leaq 0x2372f(%rip), %rdi     # 0x32171
jmp 0xee20
movapd %xmm1, %xmm0
subsd -0x48(%rbp), %xmm0
movapd %xmm2, %xmm1
subsd -0x50(%rbp), %xmm1
fstpt -0x78(%rbp)
callq 0xa100
movapd %xmm0, %xmm1
fldt 0x254f5(%rip)           # 0x33f60
fldt -0x78(%rbp)
faddp %st, %st(1)
fstpl -0x120(%rbp)
movsd -0x120(%rbp), %xmm0
movsd %xmm0, -0x80(%rbp)
movsd %xmm1, -0x78(%rbp)
movapd %xmm1, %xmm0
callq 0xb550
mulsd -0x38(%rbp), %xmm0
addsd -0x68(%rbp), %xmm0
movsd %xmm0, -0xb8(%rbp)
movsd -0x78(%rbp), %xmm0
callq 0xa1d0
mulsd -0x38(%rbp), %xmm0
addsd -0x60(%rbp), %xmm0
movsd 0x253e9(%rip), %xmm1    # 0x33ea8
ucomisd -0x58(%rbp), %xmm1
movsd %xmm0, -0x78(%rbp)
fldz
ja 0xeaf4
fstp %st(0)
movsd -0x58(%rbp), %xmm1
movsd %xmm1, -0x118(%rbp)
fldl -0x118(%rbp)
fldt 0x25488(%rip)           # 0x33f70
fxch %st(1)
fucomi %st(1), %st
fstp %st(1)
jbe 0xec15
fstp %st(0)
movq %r12, -0x80(%rbp)
callq 0xa210
movq (%rax), %rax
cmpl $0x2, (%rax)
jne 0xeb60
callq 0xa210
movq (%rax), %r12
movsd 0x28(%r12), %xmm1
movsd 0x30(%r12), %xmm0
subsd 0x20(%r12), %xmm0
subsd 0x18(%r12), %xmm1
callq 0xa290
movl -0x2c(%rbp), %eax
movl %eax, %ecx
xorl $0x1, %ecx
orl %r15d, %ecx
movsd %xmm0, -0x58(%rbp)
je 0xeb51
movl %ebx, %ecx
xorl $0x1, %ecx
notl %eax
orl %ecx, %eax
jne 0xed80
movsd -0x40(%rbp), %xmm0
subsd -0x38(%rbp), %xmm0
jmp 0xed8a
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x110(%rbp)
movsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x108(%rbp)
fldt -0xc8(%rbp)
faddl -0x108(%rbp)
fstpt (%rsp)
callq 0xb010
fmull -0x110(%rbp)
fstpl -0x100(%rbp)
movsd -0x100(%rbp), %xmm0
movl -0x2c(%rbp), %r12d
movl %r12d, %eax
xorl $0x1, %eax
orl %eax, %r15d
je 0xebc1
xorl $0x1, %ebx
movl %r12d, %eax
notl %eax
orl %ebx, %eax
jne 0xee6f
movsd -0x40(%rbp), %xmm1
movsd -0x38(%rbp), %xmm2
subsd %xmm2, %xmm1
addsd %xmm2, %xmm0
movsd %xmm1, -0x40(%rbp)
divsd %xmm1, %xmm0
movapd 0x2343c(%rip), %xmm1    # 0x32020
andpd %xmm0, %xmm1
ucomisd 0x252b0(%rip), %xmm1    # 0x33ea0
movq %r13, %r15
ja 0xeef5
callq 0xb250
cmpl $0x1, %r12d
jne 0xef70
addsd -0xd0(%rbp), %xmm0
jmp 0xef80
fldt 0x25365(%rip)           # 0x33f80
faddp %st, %st(1)
fabs
fldl 0x2528b(%rip)           # 0x33eb0
fucompi %st(1), %st
fstp %st(0)
fldz
jbe 0xec51
fstp %st(0)
movl -0x2c(%rbp), %eax
movl %eax, %ecx
xorl $0x1, %ecx
orl %r15d, %ecx
fldz
je 0xec51
fstp %st(0)
movl %ebx, %ecx
xorl $0x1, %ecx
notl %eax
orl %ecx, %eax
fldz
jne 0xeaf4
fstp %st(0)
movsd -0x58(%rbp), %xmm0
ucomisd 0x25250(%rip), %xmm0    # 0x33eb0
jbe 0xed43
xorl %r15d, %r15d
cmpl $0x2, %ebx
setne %r15b
movsd -0x80(%rbp), %xmm0
callq 0xb550
mulsd -0x38(%rbp), %xmm0
addsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x80(%rbp), %xmm0
callq 0xa1d0
movsd -0x38(%rbp), %xmm1
mulsd %xmm0, %xmm1
addsd -0x90(%rbp), %xmm1
movsd %xmm1, -0x38(%rbp)
movq %r14, %rdi
callq 0xa300
movl 0x1d0(%r12), %esi
leal -0x1(,%r15,2), %edx
movsd -0x158(%rbp), %xmm5
movsd 0x20(%rbp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x18(%rbp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x10(%rbp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd -0xb0(%rbp), %xmm0
movsd %xmm0, (%rsp)
xorps %xmm0, %xmm0
movq %r14, %rdi
movsd -0x40(%rbp), %xmm1
movsd -0x38(%rbp), %xmm2
movsd -0x88(%rbp), %xmm3
movsd -0x90(%rbp), %xmm4
movsd -0xa0(%rbp), %xmm6
movsd -0xa8(%rbp), %xmm7
callq 0xa3b0
movq %r14, %rdi
callq 0xa300
movsd -0x40(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
jmp 0xed5b
movq %r14, %rdi
callq 0xa300
movsd -0xd8(%rbp), %xmm0
movsd -0xe0(%rbp), %xmm1
callq 0xa9b0
movl 0x1d0(%r12), %ebx
movsd -0x50(%rbp), %xmm2
movsd -0x48(%rbp), %xmm3
movl -0x2c(%rbp), %esi
movq %r13, %r15
movq %r13, %rdi
jmp 0xf07c
movsd -0x40(%rbp), %xmm0
addsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movsd 0x28(%r12), %xmm1
movsd 0x30(%r12), %xmm0
subsd -0x48(%rbp), %xmm0
subsd -0x50(%rbp), %xmm1
callq 0xa290
xorpd %xmm1, %xmm1
movsd -0x58(%rbp), %xmm3
ucomisd %xmm1, %xmm3
jne 0xedbd
jnp 0xee19
ucomisd %xmm1, %xmm0
jne 0xedc5
jnp 0xee19
movapd %xmm0, %xmm2
mulsd %xmm0, %xmm2
movapd %xmm3, %xmm1
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
movsd -0x40(%rbp), %xmm2
mulsd %xmm2, %xmm2
subsd %xmm2, %xmm1
movapd %xmm3, %xmm2
addsd %xmm3, %xmm2
mulsd %xmm0, %xmm2
divsd %xmm2, %xmm1
movapd 0x23222(%rip), %xmm0    # 0x32020
andpd %xmm1, %xmm0
ucomisd 0x25096(%rip), %xmm0    # 0x33ea0
jbe 0xef09
leaq 0x26508(%rip), %rdi     # 0x3531f
jmp 0xee20
leaq 0x264bc(%rip), %rdi     # 0x352dc
callq 0xa1f0
movq %r13, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xa850
movq 0x32127(%rip), %rbx     # 0x40f60
leaq 0xc6d0(%rbx), %rdi
leaq 0x263b3(%rip), %rsi     # 0x351fa
movl $0x50, %edx
callq 0xa8a0
movw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
movl $0x5, %r13d
jmp 0xf193
movsd -0x40(%rbp), %xmm1
movsd -0x38(%rbp), %xmm2
addsd %xmm2, %xmm1
subsd %xmm2, %xmm0
movsd %xmm1, -0x40(%rbp)
divsd %xmm1, %xmm0
movapd 0x2318e(%rip), %xmm1    # 0x32020
andpd %xmm0, %xmm1
ucomisd 0x25002(%rip), %xmm1    # 0x33ea0
movq %r13, %r15
ja 0xeef5
callq 0xb250
cmpl $0x1, %r12d
movsd -0xd0(%rbp), %xmm1
movsd %xmm1, -0xf8(%rbp)
fldt 0x2509e(%rip)           # 0x33f60
faddl -0xf8(%rbp)
movsd %xmm0, -0xf0(%rbp)
fldl -0xf0(%rbp)
fld %st(0)
fchs
fxch %st(1)
fcmove %st(1), %st
fstp %st(1)
faddp %st, %st(1)
fstpl -0xe8(%rbp)
movsd -0xe8(%rbp), %xmm0
jmp 0xef80
leaq 0x26397(%rip), %rdi     # 0x35293
callq 0xa1f0
movq %r15, %rdi
jmp 0xee28
movapd %xmm1, %xmm0
callq 0xaa00
movsd -0x48(%rbp), %xmm2
subsd 0x30(%r12), %xmm2
movsd %xmm0, -0x38(%rbp)
movsd -0x50(%rbp), %xmm1
subsd 0x28(%r12), %xmm1
movapd %xmm2, %xmm0
callq 0xa100
movl 0x38(%r12), %eax
movl %eax, %ecx
xorl $0x1, %ecx
orl %ecx, %r15d
je 0xef54
xorl $0x1, %ebx
notl %eax
orl %ebx, %eax
jne 0xefe9
cmpl $0x1, -0x2c(%rbp)
jne 0xeff3
movsd -0x38(%rbp), %xmm1
addsd %xmm0, %xmm1
movapd %xmm1, %xmm0
jmp 0xeff8
movsd -0xd0(%rbp), %xmm1
subsd %xmm0, %xmm1
movapd %xmm1, %xmm0
movq -0x80(%rbp), %rbx
movsd %xmm0, -0x58(%rbp)
movsd -0x50(%rbp), %xmm1
movsd %xmm1, -0x38(%rbp)
callq 0xb550
mulsd -0x40(%rbp), %xmm0
addsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x48(%rbp), %xmm0
movsd %xmm0, -0xc8(%rbp)
movsd -0x58(%rbp), %xmm0
callq 0xa1d0
movsd -0x40(%rbp), %xmm1
mulsd %xmm0, %xmm1
addsd -0xc8(%rbp), %xmm1
movq %r15, %rdi
movq %r14, %rsi
movsd -0x38(%rbp), %xmm0
callq 0xa760
testl %eax, %eax
jne 0xe7d6
jmp 0xf066
cmpl $0x1, -0x2c(%rbp)
jne 0xef5e
subsd -0x38(%rbp), %xmm0
movq %r13, %r15
movsd 0x28(%r12), %xmm1
movsd %xmm1, -0x40(%rbp)
movsd %xmm0, -0x38(%rbp)
callq 0xb550
mulsd -0x58(%rbp), %xmm0
addsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movsd 0x30(%r12), %xmm0
movsd %xmm0, -0xc8(%rbp)
movsd -0x38(%rbp), %xmm0
callq 0xa1d0
movsd -0x58(%rbp), %xmm1
mulsd %xmm0, %xmm1
addsd -0xc8(%rbp), %xmm1
movq %r13, %rdi
movq %r14, %rsi
movsd -0x40(%rbp), %xmm0
callq 0xa760
testl %eax, %eax
movq -0x80(%rbp), %rbx
jne 0xe7d6
movl 0x1d0(%rbx), %ebx
movsd -0x50(%rbp), %xmm2
movsd -0x48(%rbp), %xmm3
movl -0x2c(%rbp), %esi
movq %r15, %rdi
movsd -0x88(%rbp), %xmm0
movsd -0x90(%rbp), %xmm1
movsd -0x68(%rbp), %xmm4
movsd -0x60(%rbp), %xmm5
callq 0xab90
movsd -0x50(%rbp), %xmm3
movsd -0x48(%rbp), %xmm4
movl -0x2c(%rbp), %edx
movsd 0x20(%rbp), %xmm1
movsd %xmm1, 0x18(%rsp)
movsd 0x18(%rbp), %xmm1
movsd %xmm1, 0x10(%rsp)
movsd 0x10(%rbp), %xmm1
movsd %xmm1, 0x8(%rsp)
movsd -0xb0(%rbp), %xmm1
movsd %xmm1, (%rsp)
movq %r14, %rdi
movl %ebx, %esi
movsd -0xb8(%rbp), %xmm1
movsd -0x78(%rbp), %xmm2
movsd -0x98(%rbp), %xmm5
movsd -0xa0(%rbp), %xmm6
movsd -0xa8(%rbp), %xmm7
callq 0xa3b0
movq %r15, %rdi
movq %r14, %rsi
movsd -0x68(%rbp), %xmm0
movsd -0x60(%rbp), %xmm1
movsd -0x98(%rbp), %xmm2
callq 0xad80
movq %r15, %rdi
movq %r14, %rsi
movsd -0xb8(%rbp), %xmm0
movsd -0x78(%rbp), %xmm1
movsd -0x98(%rbp), %xmm2
callq 0xb170
movsd -0xa0(%rbp), %xmm0
movsd %xmm0, 0x8(%r14)
movsd -0xa8(%rbp), %xmm0
movsd %xmm0, 0x20(%r14)
movsd -0xb0(%rbp), %xmm0
movsd %xmm0, 0x38(%r14)
movsd 0x10(%rbp), %xmm0
movsd %xmm0, 0x50(%r14)
movsd 0x18(%rbp), %xmm0
movsd %xmm0, 0x68(%r14)
movsd 0x20(%rbp), %xmm0
movsd %xmm0, 0x80(%r14)
xorl %r13d, %r13d
movl %r13d, %eax
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq