// File: /workspace/github_cpp_makefile_star2_O1/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 $0x198, %rsp            # imm = 0x198
movsd %xmm7, -0xc0(%rbp)
movsd %xmm6, -0xb8(%rbp)
movsd %xmm5, -0xb0(%rbp)
movsd %xmm4, -0x98(%rbp)
movsd %xmm3, -0x68(%rbp)
movsd %xmm2, -0xa8(%rbp)
movsd %xmm1, -0x80(%rbp)
movsd %xmm0, -0x88(%rbp)
movq %rcx, %rbx
movq %rdx, %r13
movl %esi, -0x60(%rbp)
movq %rdi, %r15
movl 0xc67c(%rcx), %eax
movl %eax, -0x38(%rbp)
leaq -0xf0(%rbp), %r12
leaq -0xe8(%rbp), %r14
leaq -0x190(%rbp), %r8
movq %rcx, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0xabf0
leaq -0x188(%rbp), %rdx
leaq -0x180(%rbp), %rcx
leaq -0x178(%rbp), %r8
movq %r15, %rdi
movq %rbx, %rsi
callq 0xb6b0
xorl %eax, %eax
cmpl $0x1, 0x1690(%rbx)
sete %al
leaq 0x2868d(%rip), %rcx     # 0x36f20
movsd (%rcx,%rax,8), %xmm6
movsd (%r12), %xmm0
movsd (%r14), %xmm1
cmpb $0x1, 0x229(%r13)
jne 0xe8e6
movsd 0x230(%r13), %xmm4
leaq -0x48(%rbp), %rcx
leaq -0x40(%rbp), %r8
leaq -0x2c(%rbp), %r9
movq %r15, %rdi
movl -0x60(%rbp), %r14d
movl %r14d, %esi
movl -0x38(%rbp), %edx
movsd -0x88(%rbp), %xmm2
movsd -0x80(%rbp), %xmm3
movaps %xmm6, %xmm5
callq 0xac60
jmp 0xe92e
xorl %ecx, %ecx
cmpl $0x0, 0x66c(%rbx)
sete %cl
leaq -0x2c(%rbp), %rax
movq %rax, (%rsp)
leaq -0x48(%rbp), %r8
leaq -0x40(%rbp), %r9
movq %r15, %rdi
movl -0x60(%rbp), %r14d
movl %r14d, %esi
movl -0x38(%rbp), %edx
movsd -0x88(%rbp), %xmm2
movsd -0x80(%rbp), %xmm3
movsd -0x68(%rbp), %xmm4
movsd -0x98(%rbp), %xmm5
callq 0xad50
movl %eax, %r12d
testl %eax, %eax
je 0xe99d
movq 0x35624(%rip), %rbx     # 0x43f60
movslq 0xd670(%rbx), %rax
cmpq $0x30, %rax
jg 0xf439
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%rbx,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x29893(%rip), %rsi     # 0x381fa
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 0xf439
movsd -0x88(%rbp), %xmm5
movsd -0x80(%rbp), %xmm6
movsd -0xf0(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movsd -0xe8(%rbp), %xmm1
movsd %xmm1, -0x98(%rbp)
movsd -0x190(%rbp), %xmm2
movsd -0x48(%rbp), %xmm3
movsd -0x40(%rbp), %xmm4
movl -0x2c(%rbp), %esi
movq %r15, %rdi
movsd -0xa8(%rbp), %xmm7
movq %r13, %rdx
movq %rbx, %rcx
callq 0xac30
movq %rbx, %rax
movl 0x624(%rbx), %ebx
movq %rax, -0x78(%rbp)
movsd 0x618(%rax), %xmm0
movsd %xmm0, -0x60(%rbp)
movsd -0x48(%rbp), %xmm0
subsd -0x88(%rbp), %xmm0
movsd -0x40(%rbp), %xmm1
subsd -0x80(%rbp), %xmm1
callq 0xa290
movsd %xmm0, -0x38(%rbp)
movsd -0x180(%rbp), %xmm0
movsd %xmm0, -0x100(%rbp)
subsd -0x98(%rbp), %xmm0
movsd -0x188(%rbp), %xmm1
movsd %xmm1, -0xf8(%rbp)
subsd -0x68(%rbp), %xmm1
callq 0xa100
movsd %xmm0, -0x90(%rbp)
movsd -0x40(%rbp), %xmm0
subsd -0x98(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
subsd -0x68(%rbp), %xmm1
callq 0xa100
cmpl $0x1e, %r14d
fldt 0x265a3(%rip)           # 0x35030
fldt 0x265ad(%rip)           # 0x35040
fld %st(0)
fcmove %st(2), %st
cmpl $0x2, %ebx
fxch %st(1)
fcmove %st(2), %st
movsd -0x90(%rbp), %xmm1
movsd %xmm1, -0x170(%rbp)
faddl -0x170(%rbp)
fstpl -0x168(%rbp)
movsd -0x168(%rbp), %xmm1
movsd %xmm0, -0x160(%rbp)
fldl -0x160(%rbp)
fadd %st, %st(1)
fxch %st(1)
fstpl -0x158(%rbp)
movsd -0x158(%rbp), %xmm2
movsd %xmm1, -0xd8(%rbp)
je 0xeaf6
subsd %xmm1, %xmm2
movapd %xmm2, %xmm1
jmp 0xeafa
subsd %xmm2, %xmm1
movsd %xmm1, -0x150(%rbp)
fldl -0x150(%rbp)
fldt 0x28422(%rip)           # 0x36f30
fxch %st(1)
fucomi %st(1), %st
fstp %st(1)
movq %r15, -0x70(%rbp)
movsd -0x88(%rbp), %xmm2
jbe 0xeb31
fldt 0x28428(%rip)           # 0x36f50
faddp %st, %st(1)
movsd -0x80(%rbp), %xmm1
jmp 0xeb46
fxch %st(2)
fucomi %st(2), %st
movsd -0x80(%rbp), %xmm1
jbe 0xeb44
fldt 0x283fe(%rip)           # 0x36f40
faddp %st, %st(3)
fxch %st(2)
fxch %st(2)
fstpt -0x19c(%rbp)
movl %r14d, %eax
xorl $0x1e, %eax
movl %ebx, %r15d
xorl $0x2, %r15d
fxch %st(1)
fstpl -0x148(%rbp)
movsd -0x148(%rbp), %xmm3
movsd %xmm3, -0x90(%rbp)
orl %r15d, %eax
je 0xeb8a
movl %ebx, %eax
xorl $0x1, %eax
xorl $0x14, %r14d
orl %eax, %r14d
jne 0xec20
fstp %st(0)
movsd %xmm0, -0xe0(%rbp)
movsd -0x40(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd -0x48(%rbp), %xmm1
subsd %xmm2, %xmm1
callq 0xa100
movapd %xmm0, %xmm1
movsd -0x60(%rbp), %xmm0
ucomisd -0x38(%rbp), %xmm0
jb 0xec65
leaq 0x265ab(%rip), %rdi     # 0x35171
callq 0xa1f0
movq -0x70(%rbp), %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xa850
movq 0x35380(%rip), %rbx     # 0x43f60
movl $0x0, 0xd670(%rbx)
leaq 0xc6d0(%rbx), %rdi
leaq 0x29602(%rip), %rsi     # 0x381fa
movl $0x50, %edx
callq 0xa8a0
movw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
movl $0x5, %r12d
jmp 0xf439
movapd %xmm1, %xmm0
subsd -0x40(%rbp), %xmm0
movapd %xmm2, %xmm1
subsd -0x48(%rbp), %xmm1
fstpt -0xd0(%rbp)
callq 0xa100
movapd %xmm0, %xmm1
fldt 0x28319(%rip)           # 0x36f60
fldt -0xd0(%rbp)
faddp %st, %st(1)
fstpl -0x140(%rbp)
movsd -0x140(%rbp), %xmm0
movsd %xmm0, -0xe0(%rbp)
movsd %xmm1, -0xa0(%rbp)
movapd %xmm1, %xmm0
callq 0xb550
mulsd -0x60(%rbp), %xmm0
addsd -0x88(%rbp), %xmm0
movsd %xmm0, -0xd0(%rbp)
movsd -0xa0(%rbp), %xmm0
callq 0xa1d0
mulsd -0x60(%rbp), %xmm0
addsd -0x80(%rbp), %xmm0
movsd 0x281fe(%rip), %xmm1    # 0x36ea8
ucomisd -0x90(%rbp), %xmm1
movsd %xmm0, -0xa0(%rbp)
fldz
ja 0xece8
fstp %st(0)
movsd -0x90(%rbp), %xmm1
movsd %xmm1, -0x138(%rbp)
fldl -0x138(%rbp)
fldt 0x28294(%rip)           # 0x36f70
fxch %st(1)
fucomi %st(1), %st
fstp %st(1)
jbe 0xee19
fstp %st(0)
movq %r13, -0x98(%rbp)
callq 0xa210
movq (%rax), %rax
cmpl $0x2, (%rax)
jne 0xed53
callq 0xa210
movq (%rax), %r13
movsd 0x28(%r13), %xmm1
movsd 0x30(%r13), %xmm0
subsd 0x20(%r13), %xmm0
subsd 0x18(%r13), %xmm1
callq 0xa290
movl -0x2c(%rbp), %eax
movl %eax, %ecx
xorl $0x1, %ecx
orl %r15d, %ecx
movsd %xmm0, -0x68(%rbp)
je 0xed44
movl %ebx, %ecx
xorl $0x1, %ecx
notl %eax
orl %ecx, %eax
jne 0xef9b
movsd -0x38(%rbp), %xmm0
subsd -0x60(%rbp), %xmm0
jmp 0xefa5
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x130(%rbp)
movsd -0x90(%rbp), %xmm0
movsd %xmm0, -0x128(%rbp)
fldt -0x19c(%rbp)
faddl -0x128(%rbp)
fstpt (%rsp)
callq 0xb010
fmull -0x130(%rbp)
fstpl -0x120(%rbp)
movsd -0x120(%rbp), %xmm0
movl -0x2c(%rbp), %r13d
movl %r13d, %eax
xorl $0x1, %eax
orl %eax, %r15d
je 0xedb7
xorl $0x1, %ebx
movl %r13d, %eax
notl %eax
orl %ebx, %eax
jne 0xf0ab
movsd -0x38(%rbp), %xmm1
movsd -0x60(%rbp), %xmm2
subsd %xmm2, %xmm1
addsd %xmm2, %xmm0
movsd %xmm1, -0x38(%rbp)
divsd %xmm1, %xmm0
movapd 0x26246(%rip), %xmm1    # 0x35020
andpd %xmm0, %xmm1
movapd %xmm1, -0x60(%rbp)
ucomisd 0x280b5(%rip), %xmm1    # 0x36ea0
movq -0x70(%rbp), %r15
ja 0xf134
callq 0xb250
movapd %xmm0, %xmm1
cmpl $0x1, %r13d
movq -0x78(%rbp), %rbx
jne 0xf1fc
addsd -0xd8(%rbp), %xmm1
jmp 0xf20c
fldt 0x28161(%rip)           # 0x36f80
faddp %st, %st(1)
fabs
fldl 0x28087(%rip)           # 0x36eb0
fucompi %st(1), %st
fstp %st(0)
fldz
jbe 0xee55
fstp %st(0)
movl -0x2c(%rbp), %eax
movl %eax, %ecx
xorl $0x1, %ecx
orl %r15d, %ecx
fldz
je 0xee55
fstp %st(0)
movl %ebx, %ecx
xorl $0x1, %ecx
notl %eax
orl %ecx, %eax
fldz
jne 0xece8
fstp %st(0)
movsd -0x90(%rbp), %xmm0
ucomisd 0x28049(%rip), %xmm0    # 0x36eb0
jbe 0xef4d
xorl %r15d, %r15d
cmpl $0x2, %ebx
setne %r15b
movsd -0xe0(%rbp), %xmm0
callq 0xb550
mulsd -0x60(%rbp), %xmm0
addsd -0x68(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0xe0(%rbp), %xmm0
callq 0xa1d0
movsd -0x60(%rbp), %xmm1
mulsd %xmm0, %xmm1
addsd -0x98(%rbp), %xmm1
movsd %xmm1, -0x60(%rbp)
movq -0x78(%rbp), %rbx
movq %rbx, %rdi
callq 0xa300
movl 0x1d0(%r13), %esi
leal -0x1(,%r15,2), %edx
movsd -0x178(%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 -0xc0(%rbp), %xmm0
movsd %xmm0, (%rsp)
xorps %xmm0, %xmm0
movq %rbx, %rdi
movsd -0x38(%rbp), %xmm1
movsd -0x60(%rbp), %xmm2
movsd -0x68(%rbp), %xmm3
movsd -0x98(%rbp), %xmm4
movsd -0xb0(%rbp), %xmm6
movsd -0xb8(%rbp), %xmm7
callq 0xa3b0
movq %rbx, %rdi
callq 0xa300
movsd -0x38(%rbp), %xmm0
movsd -0x60(%rbp), %xmm1
jmp 0xef69
movq -0x78(%rbp), %rbx
movq %rbx, %rdi
callq 0xa300
movsd -0xf8(%rbp), %xmm0
movsd -0x100(%rbp), %xmm1
callq 0xa9b0
movl 0x1d0(%r13), %r14d
movsd -0x48(%rbp), %xmm2
movsd -0x40(%rbp), %xmm3
movl -0x2c(%rbp), %esi
movq -0x70(%rbp), %r15
movq %r15, %rdi
movsd -0x68(%rbp), %xmm0
movsd -0x98(%rbp), %xmm1
jmp 0xf32b
movsd -0x38(%rbp), %xmm0
addsd -0x60(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd 0x28(%r13), %xmm1
movsd 0x30(%r13), %xmm0
subsd -0x40(%rbp), %xmm0
subsd -0x48(%rbp), %xmm1
callq 0xa290
xorpd %xmm1, %xmm1
movsd -0x68(%rbp), %xmm3
ucomisd %xmm1, %xmm3
jne 0xefd6
jnp 0xf032
ucomisd %xmm1, %xmm0
jne 0xefde
jnp 0xf032
movapd %xmm0, %xmm2
mulsd %xmm0, %xmm2
movapd %xmm3, %xmm1
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
movsd -0x38(%rbp), %xmm2
mulsd %xmm2, %xmm2
subsd %xmm2, %xmm1
movapd %xmm3, %xmm2
addsd %xmm3, %xmm2
mulsd %xmm0, %xmm2
divsd %xmm2, %xmm1
movapd 0x26009(%rip), %xmm0    # 0x35020
andpd %xmm1, %xmm0
ucomisd 0x27e7d(%rip), %xmm0    # 0x36ea0
jbe 0xf198
leaq 0x292ef(%rip), %rdi     # 0x3831f
jmp 0xf039
leaq 0x292a3(%rip), %rdi     # 0x382dc
callq 0xa1f0
movq -0x70(%rbp), %r15
movq %r15, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xa850
movq 0x34f0a(%rip), %r14     # 0x43f60
movl $0x0, 0xd670(%r14)
leaq 0xc6d0(%r14), %rdi
leaq 0x2918b(%rip), %rsi     # 0x381fa
movl $0x50, %edx
callq 0xa8a0
movb $0x0, 0xc71f(%r14)
movl $0x1, 0xd670(%r14)
addq $0xc720, %r14           # imm = 0xC720
movl $0x5, %r13d
movq -0x78(%rbp), %rbx
movb $0x0, (%r14)
xorl %eax, %eax
movl %r13d, %r12d
jmp 0xf2f5
movsd -0x38(%rbp), %xmm1
movsd -0x60(%rbp), %xmm2
addsd %xmm2, %xmm1
subsd %xmm2, %xmm0
movsd %xmm1, -0x38(%rbp)
divsd %xmm1, %xmm0
movapd 0x25f52(%rip), %xmm1    # 0x35020
andpd %xmm0, %xmm1
movapd %xmm1, -0x60(%rbp)
ucomisd 0x27dc1(%rip), %xmm1    # 0x36ea0
movq -0x70(%rbp), %r15
ja 0xf134
callq 0xb250
cmpl $0x1, %r13d
movsd -0xd8(%rbp), %xmm1
movsd %xmm1, -0x118(%rbp)
fldt 0x27e5c(%rip)           # 0x36f60
faddl -0x118(%rbp)
movsd %xmm0, -0x110(%rbp)
fldl -0x110(%rbp)
fld %st(0)
fchs
fxch %st(1)
fcmove %st(1), %st
fstp %st(1)
faddp %st, %st(1)
fstpl -0x108(%rbp)
movsd -0x108(%rbp), %xmm1
jmp 0xf192
leaq 0x29158(%rip), %rdi     # 0x38293
callq 0xa1f0
movq %r15, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xa850
movq 0x34e0c(%rip), %r14     # 0x43f60
movl $0x0, 0xd670(%r14)
leaq 0xc6d0(%r14), %rdi
leaq 0x2908d(%rip), %rsi     # 0x381fa
movl $0x50, %edx
callq 0xa8a0
movw $0x0, 0xc71f(%r14)
movl $0x1, 0xd670(%r14)
movl $0x5, %r12d
movq -0x78(%rbp), %rbx
jmp 0xf20c
movapd %xmm1, %xmm0
callq 0xaa00
movsd -0x40(%rbp), %xmm2
subsd 0x30(%r13), %xmm2
movsd %xmm0, -0x60(%rbp)
movsd -0x48(%rbp), %xmm1
subsd 0x28(%r13), %xmm1
movapd %xmm2, %xmm0
callq 0xa100
movl 0x38(%r13), %eax
movl %eax, %ecx
xorl $0x1, %ecx
orl %ecx, %r15d
je 0xf1e0
xorl $0x1, %ebx
notl %eax
orl %ebx, %eax
jne 0xf44e
cmpl $0x1, -0x2c(%rbp)
jne 0xf458
movsd -0x60(%rbp), %xmm1
addsd %xmm0, %xmm1
movapd %xmm1, %xmm0
jmp 0xf45d
movsd -0xd8(%rbp), %xmm0
subsd %xmm1, %xmm0
movapd %xmm0, %xmm1
movapd -0x60(%rbp), %xmm0
ucomisd 0x27c87(%rip), %xmm0    # 0x36ea0
ja 0xf2f3
movsd %xmm1, -0x68(%rbp)
movsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movapd %xmm1, %xmm0
callq 0xb550
mulsd -0x38(%rbp), %xmm0
addsd -0x60(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movsd -0x68(%rbp), %xmm0
callq 0xa1d0
movsd -0x38(%rbp), %xmm1
mulsd %xmm0, %xmm1
addsd -0x90(%rbp), %xmm1
movq %r15, %rdi
movq %rbx, %rsi
movsd -0x60(%rbp), %xmm0
callq 0xa760
movl %eax, %r13d
testl %eax, %eax
sete %al
je 0xf2f5
movq 0x34cd1(%rip), %r14     # 0x43f60
movslq 0xd670(%r14), %rax
cmpq $0x30, %rax
jg 0xf0a1
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%r14,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x28f40(%rip), %rsi     # 0x381fa
movl $0x50, %edx
callq 0xa8a0
movslq 0xd670(%r14), %rcx
leaq (%rcx,%rcx,4), %rdx
shlq $0x4, %rdx
xorl %eax, %eax
movb %al, 0xc71f(%r14,%rdx)
incl %ecx
movl %ecx, 0xd670(%r14)
movb %al, 0xc720(%r14,%rdx)
jmp 0xf0a3
xorl %eax, %eax
testb %al, %al
je 0xf439
movq -0x98(%rbp), %rax
movl 0x1d0(%rax), %r14d
movsd -0xf0(%rbp), %xmm0
movsd -0xe8(%rbp), %xmm1
movsd -0x48(%rbp), %xmm2
movsd -0x40(%rbp), %xmm3
movl -0x2c(%rbp), %esi
movq %r15, %rdi
movsd -0x88(%rbp), %xmm4
movsd -0x80(%rbp), %xmm5
callq 0xab90
movsd -0x48(%rbp), %xmm3
movsd -0x40(%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 -0xc0(%rbp), %xmm1
movsd %xmm1, (%rsp)
movq %rbx, %rdi
movl %r14d, %esi
movsd -0xd0(%rbp), %xmm1
movsd -0xa0(%rbp), %xmm2
movsd -0xa8(%rbp), %xmm5
movsd -0xb0(%rbp), %xmm6
movsd -0xb8(%rbp), %xmm7
callq 0xa3b0
movq %r15, %rdi
movq %rbx, %rsi
movsd -0x88(%rbp), %xmm0
movsd -0x80(%rbp), %xmm1
movsd -0xa8(%rbp), %xmm2
callq 0xad80
movq %r15, %rdi
movq %rbx, %rsi
movsd -0xd0(%rbp), %xmm0
movsd -0xa0(%rbp), %xmm1
movsd -0xa8(%rbp), %xmm2
callq 0xb170
movsd -0xb0(%rbp), %xmm0
movsd %xmm0, 0x8(%rbx)
movsd -0xb8(%rbp), %xmm0
movsd %xmm0, 0x20(%rbx)
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, 0x38(%rbx)
movsd 0x10(%rbp), %xmm0
movsd %xmm0, 0x50(%rbx)
movsd 0x18(%rbp), %xmm0
movsd %xmm0, 0x68(%rbx)
movsd 0x20(%rbp), %xmm0
movsd %xmm0, 0x80(%rbx)
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x1, -0x2c(%rbp)
jne 0xf1ea
subsd -0x60(%rbp), %xmm0
movq -0x70(%rbp), %r15
movq -0x78(%rbp), %rbx
movsd 0x28(%r13), %xmm1
movsd %xmm1, -0x38(%rbp)
movsd %xmm0, -0x60(%rbp)
callq 0xb550
mulsd -0x68(%rbp), %xmm0
addsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd 0x30(%r13), %xmm0
movsd %xmm0, -0x90(%rbp)
movsd -0x60(%rbp), %xmm0
callq 0xa1d0
movsd -0x68(%rbp), %xmm1
mulsd %xmm0, %xmm1
addsd -0x90(%rbp), %xmm1
movq %r15, %rdi
movq %rbx, %rsi
movsd -0x38(%rbp), %xmm0
callq 0xa760
movl %eax, %r13d
testl %eax, %eax
sete %al
je 0xf2f5
movq 0x34a89(%rip), %r15     # 0x43f60
movslq 0xd670(%r15), %rax
cmpq $0x30, %rax
jg 0xf539
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%r15,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x28cfc(%rip), %rsi     # 0x381fa
movl $0x50, %edx
callq 0xa8a0
movslq 0xd670(%r15), %rax
leaq (%rax,%rax,4), %rcx
shlq $0x4, %rcx
leaq (%r15,%rcx), %r14
addq $0xc720, %r14           # imm = 0xC720
movb $0x0, -0x1(%r14)
incl %eax
movl %eax, 0xd670(%r15)
movq -0x70(%rbp), %r15
jmp 0xf09d
xorl %eax, %eax
movl %r13d, %r12d
movq -0x70(%rbp), %r15
jmp 0xf2f5
nop