// File: /workspace/github_cpp_makefile_star2_O2/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 0xbce0
leaq -0x168(%rbp), %rdx
leaq -0x160(%rbp), %rcx
leaq -0x158(%rbp), %r8
movq %r15, %rdi
movq %r14, %rsi
callq 0xc820
xorl %eax, %eax
cmpl $0x1, 0x1690(%r14)
sete %al
leaq 0x20a9a(%rip), %rcx     # 0x2ff20
movsd (%rcx,%rax,8), %xmm6
movsd (%r13), %xmm0
movsd (%rbx), %xmm1
cmpb $0x1, 0x229(%r12)
movsd %xmm1, -0x90(%rbp)
movsd %xmm0, -0x88(%rbp)
jne 0xf4e3
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 0xbd50
jmp 0xf522
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 0xbe50
testl %eax, %eax
je 0xf587
movl %eax, %r13d
movq 0x2da30(%rip), %rbx     # 0x3cf60
movslq 0xd670(%rbx), %rax
cmpq $0x30, %rax
jg 0xfed4
imulq $0x50, %rax, %rax
leaq (%rbx,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x21ca3(%rip), %rsi     # 0x311fa
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 0xfed4
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 0xbd20
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 0xb2c0
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 0xb110
movsd %xmm0, -0x58(%rbp)
movsd -0x48(%rbp), %xmm0
subsd -0x90(%rbp), %xmm0
movsd -0x50(%rbp), %xmm1
subsd -0x88(%rbp), %xmm1
callq 0xb110
movl -0x78(%rbp), %ecx
cmpl $0x1e, %ecx
fldt 0x1e9cc(%rip)           # 0x2e030
fldt 0x1e9d6(%rip)           # 0x2e040
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 0xf6ca
subsd %xmm1, %xmm2
movapd %xmm2, %xmm1
jmp 0xf6ce
subsd %xmm2, %xmm1
movsd %xmm1, -0x130(%rbp)
fldl -0x130(%rbp)
fldt 0x2084e(%rip)           # 0x2ff30
fxch %st(1)
fucomi %st(1), %st
fstp %st(1)
movsd -0x68(%rbp), %xmm2
jbe 0xf701
movq %r15, %r13
fldt 0x20858(%rip)           # 0x2ff50
faddp %st, %st(1)
movsd -0x60(%rbp), %xmm1
jmp 0xf719
fxch %st(2)
fucomi %st(2), %st
movsd -0x60(%rbp), %xmm1
movq %r15, %r13
jbe 0xf717
fldt 0x2082b(%rip)           # 0x2ff40
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 0xf753
movl %ebx, %eax
xorl $0x1, %eax
xorl $0x14, %ecx
orl %eax, %ecx
jne 0xf78d
fstp %st(0)
movsd %xmm0, -0x80(%rbp)
movsd -0x48(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd -0x50(%rbp), %xmm1
subsd %xmm2, %xmm1
callq 0xb110
movapd %xmm0, %xmm1
movsd -0x38(%rbp), %xmm0
ucomisd -0x40(%rbp), %xmm0
jb 0xf7c9
leaq 0x1e9e9(%rip), %rdi     # 0x2e171
jmp 0xfb66
movapd %xmm1, %xmm0
subsd -0x48(%rbp), %xmm0
movapd %xmm2, %xmm1
subsd -0x50(%rbp), %xmm1
fstpt -0x78(%rbp)
callq 0xb110
movapd %xmm0, %xmm1
fldt 0x207af(%rip)           # 0x2ff60
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 0xc6c0
mulsd -0x38(%rbp), %xmm0
addsd -0x68(%rbp), %xmm0
movsd %xmm0, -0xb8(%rbp)
movsd -0x78(%rbp), %xmm0
callq 0xb200
mulsd -0x38(%rbp), %xmm0
addsd -0x60(%rbp), %xmm0
movsd 0x206a3(%rip), %xmm1    # 0x2fea8
ucomisd -0x58(%rbp), %xmm1
movsd %xmm0, -0x78(%rbp)
fldz
ja 0xf83a
fstp %st(0)
movsd -0x58(%rbp), %xmm1
movsd %xmm1, -0x118(%rbp)
fldl -0x118(%rbp)
fldt 0x20742(%rip)           # 0x2ff70
fxch %st(1)
fucomi %st(1), %st
fstp %st(1)
jbe 0xf95b
fstp %st(0)
movq %r12, -0x80(%rbp)
callq 0xb240
movq (%rax), %rax
cmpl $0x2, (%rax)
jne 0xf8a6
callq 0xb240
movq (%rax), %r12
movsd 0x28(%r12), %xmm1
movsd 0x30(%r12), %xmm0
subsd 0x20(%r12), %xmm0
subsd 0x18(%r12), %xmm1
callq 0xb2c0
movl -0x2c(%rbp), %eax
movl %eax, %ecx
xorl $0x1, %ecx
orl %r15d, %ecx
movsd %xmm0, -0x58(%rbp)
je 0xf897
movl %ebx, %ecx
xorl $0x1, %ecx
notl %eax
orl %ecx, %eax
jne 0xfac6
movsd -0x40(%rbp), %xmm0
subsd -0x38(%rbp), %xmm0
jmp 0xfad0
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 0xc140
fmull -0x110(%rbp)
fstpl -0x100(%rbp)
movsd -0x100(%rbp), %xmm0
movl -0x2c(%rbp), %r12d
movl %r12d, %eax
xorl $0x1, %eax
orl %eax, %r15d
je 0xf907
xorl $0x1, %ebx
movl %r12d, %eax
notl %eax
orl %ebx, %eax
jne 0xfbb0
movsd -0x40(%rbp), %xmm1
movsd -0x38(%rbp), %xmm2
subsd %xmm2, %xmm1
addsd %xmm2, %xmm0
movsd %xmm1, -0x40(%rbp)
divsd %xmm1, %xmm0
movapd 0x1e6f6(%rip), %xmm1    # 0x2e020
andpd %xmm0, %xmm1
ucomisd 0x2056a(%rip), %xmm1    # 0x2fea0
movq %r13, %r15
ja 0xfc36
callq 0xc3b0
cmpl $0x1, %r12d
jne 0xfcb1
addsd -0xd0(%rbp), %xmm0
jmp 0xfcc1
fldt 0x2061f(%rip)           # 0x2ff80
faddp %st, %st(1)
fabs
fldl 0x20545(%rip)           # 0x2feb0
fucompi %st(1), %st
fstp %st(0)
fldz
jbe 0xf997
fstp %st(0)
movl -0x2c(%rbp), %eax
movl %eax, %ecx
xorl $0x1, %ecx
orl %r15d, %ecx
fldz
je 0xf997
fstp %st(0)
movl %ebx, %ecx
xorl $0x1, %ecx
notl %eax
orl %ecx, %eax
fldz
jne 0xf83a
fstp %st(0)
movsd -0x58(%rbp), %xmm0
ucomisd 0x2050a(%rip), %xmm0    # 0x2feb0
jbe 0xfa89
xorl %r15d, %r15d
cmpl $0x2, %ebx
setne %r15b
movsd -0x80(%rbp), %xmm0
callq 0xc6c0
mulsd -0x38(%rbp), %xmm0
addsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x80(%rbp), %xmm0
callq 0xb200
movsd -0x38(%rbp), %xmm1
mulsd %xmm0, %xmm1
addsd -0x90(%rbp), %xmm1
movsd %xmm1, -0x38(%rbp)
movq %r14, %rdi
callq 0xb340
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 0xb3f0
movq %r14, %rdi
callq 0xb340
movsd -0x40(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
jmp 0xfaa1
movq %r14, %rdi
callq 0xb340
movsd -0xd8(%rbp), %xmm0
movsd -0xe0(%rbp), %xmm1
callq 0xba60
movl 0x1d0(%r12), %ebx
movsd -0x50(%rbp), %xmm2
movsd -0x48(%rbp), %xmm3
movl -0x2c(%rbp), %esi
movq %r13, %r15
movq %r13, %rdi
jmp 0xfdbd
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 0xb2c0
xorpd %xmm1, %xmm1
movsd -0x58(%rbp), %xmm3
ucomisd %xmm1, %xmm3
jne 0xfb03
jnp 0xfb5f
ucomisd %xmm1, %xmm0
jne 0xfb0b
jnp 0xfb5f
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 0x1e4dc(%rip), %xmm0    # 0x2e020
andpd %xmm1, %xmm0
ucomisd 0x20350(%rip), %xmm0    # 0x2fea0
jbe 0xfc4a
leaq 0x217c2(%rip), %rdi     # 0x3131f
jmp 0xfb66
leaq 0x21776(%rip), %rdi     # 0x312dc
callq 0xb220
movq %r13, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xb8e0
movq 0x2d3e1(%rip), %rbx     # 0x3cf60
leaq 0xc6d0(%rbx), %rdi
leaq 0x2166d(%rip), %rsi     # 0x311fa
pushq $0x50
popq %rdx
callq 0xb940
andw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
pushq $0x5
popq %r13
jmp 0xfed4
movsd -0x40(%rbp), %xmm1
movsd -0x38(%rbp), %xmm2
addsd %xmm2, %xmm1
subsd %xmm2, %xmm0
movsd %xmm1, -0x40(%rbp)
divsd %xmm1, %xmm0
movapd 0x1e44d(%rip), %xmm1    # 0x2e020
andpd %xmm0, %xmm1
ucomisd 0x202c1(%rip), %xmm1    # 0x2fea0
movq %r13, %r15
ja 0xfc36
callq 0xc3b0
cmpl $0x1, %r12d
movsd -0xd0(%rbp), %xmm1
movsd %xmm1, -0xf8(%rbp)
fldt 0x2035d(%rip)           # 0x2ff60
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 0xfcc1
leaq 0x21656(%rip), %rdi     # 0x31293
callq 0xb220
movq %r15, %rdi
jmp 0xfb6e
movapd %xmm1, %xmm0
callq 0xbab0
movsd -0x48(%rbp), %xmm2
subsd 0x30(%r12), %xmm2
movsd %xmm0, -0x38(%rbp)
movsd -0x50(%rbp), %xmm1
subsd 0x28(%r12), %xmm1
movapd %xmm2, %xmm0
callq 0xb110
movl 0x38(%r12), %eax
movl %eax, %ecx
xorl $0x1, %ecx
orl %ecx, %r15d
je 0xfc95
xorl $0x1, %ebx
notl %eax
orl %ebx, %eax
jne 0xfd2a
cmpl $0x1, -0x2c(%rbp)
jne 0xfd34
movsd -0x38(%rbp), %xmm1
addsd %xmm0, %xmm1
movapd %xmm1, %xmm0
jmp 0xfd39
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 0xc6c0
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 0xb200
movsd -0x40(%rbp), %xmm1
mulsd %xmm0, %xmm1
addsd -0xc8(%rbp), %xmm1
movq %r15, %rdi
movq %r14, %rsi
movsd -0x38(%rbp), %xmm0
callq 0xb7c0
testl %eax, %eax
jne 0xf526
jmp 0xfda7
cmpl $0x1, -0x2c(%rbp)
jne 0xfc9f
subsd -0x38(%rbp), %xmm0
movq %r13, %r15
movsd 0x28(%r12), %xmm1
movsd %xmm1, -0x40(%rbp)
movsd %xmm0, -0x38(%rbp)
callq 0xc6c0
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 0xb200
movsd -0x58(%rbp), %xmm1
mulsd %xmm0, %xmm1
addsd -0xc8(%rbp), %xmm1
movq %r13, %rdi
movq %r14, %rsi
movsd -0x40(%rbp), %xmm0
callq 0xb7c0
testl %eax, %eax
movq -0x80(%rbp), %rbx
jne 0xf526
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 0xbc80
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 0xb3f0
movq %r15, %rdi
movq %r14, %rsi
movsd -0x68(%rbp), %xmm0
movsd -0x60(%rbp), %xmm1
movsd -0x98(%rbp), %xmm2
callq 0xbe80
movq %r15, %rdi
movq %r14, %rsi
movsd -0xb8(%rbp), %xmm0
movsd -0x78(%rbp), %xmm1
movsd -0x98(%rbp), %xmm2
callq 0xc2c0
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
nop