// File: /workspace/github_cpp_makefile_star2_O1/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 $0x1c8, %rsp            # imm = 0x1C8
movsd %xmm7, -0xd8(%rbp)
movsd %xmm6, -0xd0(%rbp)
movsd %xmm5, -0xc8(%rbp)
movsd %xmm4, -0xa8(%rbp)
movsd %xmm3, -0xa0(%rbp)
movsd %xmm2, -0x40(%rbp)
movsd %xmm1, -0x48(%rbp)
movsd %xmm0, -0x38(%rbp)
movq %rcx, %r14
movq %rdx, %r12
movl %esi, %r15d
movq %rdi, %rbx
leaq -0x100(%rbp), %rdx
leaq -0xf8(%rbp), %rcx
leaq -0x128(%rbp), %r8
movq %r14, %rsi
callq 0xb6b0
leaq -0x120(%rbp), %rdx
leaq -0x118(%rbp), %rcx
leaq -0x1c8(%rbp), %r8
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb6b0
leaq -0x110(%rbp), %rdx
leaq -0x1c0(%rbp), %r13
leaq -0x108(%rbp), %r8
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rcx
callq 0xabf0
movsd -0x48(%rbp), %xmm2
movsd (%r13), %xmm3
ucomisd %xmm2, %xmm3
jne 0x18469
jp 0x18469
movsd -0x110(%rbp), %xmm1
ucomisd -0x38(%rbp), %xmm1
jne 0x18469
jp 0x18469
movsd -0x38(%rbp), %xmm0
cmpl $0xa, %r15d
je 0x186a1
testl %r15d, %r15d
movsd -0x40(%rbp), %xmm5
movsd -0xa8(%rbp), %xmm7
movsd -0xa0(%rbp), %xmm6
jne 0x18a5c
movl 0x1d0(%r12), %esi
subsd %xmm1, %xmm0
movapd %xmm2, %xmm1
subsd %xmm3, %xmm1
movapd %xmm5, %xmm2
subsd -0x108(%rbp), %xmm2
movsd -0x100(%rbp), %xmm3
movsd -0xf8(%rbp), %xmm4
movsd 0x10(%rbp), %xmm8
movsd %xmm8, 0x18(%rsp)
movsd -0xd8(%rbp), %xmm8
movsd %xmm8, 0x10(%rsp)
movsd -0xd0(%rbp), %xmm8
movsd %xmm8, 0x8(%rsp)
movsd -0xc8(%rbp), %xmm8
movsd %xmm8, (%rsp)
movq %r14, %rdi
callq 0xb6f0
jmp 0x19075
movl %r15d, -0x2c(%rbp)
movl 0x624(%r14), %r15d
movsd 0x618(%r14), %xmm0
movaps %xmm0, -0x70(%rbp)
movsd -0xf8(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
subsd %xmm3, %xmm0
movsd -0x100(%rbp), %xmm1
movsd -0x110(%rbp), %xmm4
movsd %xmm4, -0x80(%rbp)
movsd %xmm1, -0x50(%rbp)
subsd %xmm4, %xmm1
movsd %xmm3, -0x58(%rbp)
callq 0xa100
movapd %xmm0, -0xf0(%rbp)
movsd -0x48(%rbp), %xmm0
subsd -0x58(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
subsd -0x80(%rbp), %xmm1
movsd %xmm0, -0x140(%rbp)
movsd %xmm1, -0x138(%rbp)
callq 0xa100
cmpl $0x2, %r15d
jne 0x18551
movapd -0xf0(%rbp), %xmm2
movsd %xmm2, -0x1a8(%rbp)
fldt 0x1ea36(%rip)           # 0x36f40
faddl -0x1a8(%rbp)
fstpl -0x1a0(%rbp)
movapd %xmm2, %xmm3
cmpltsd %xmm0, %xmm3
movapd %xmm3, %xmm1
andnpd %xmm2, %xmm1
movsd -0x1a0(%rbp), %xmm2
andpd %xmm3, %xmm2
orpd %xmm1, %xmm2
movapd %xmm2, -0xf0(%rbp)
movapd %xmm2, %xmm3
subsd %xmm0, %xmm3
movsd 0x1e9b1(%rip), %xmm1    # 0x36f00
jmp 0x185ae
cmpl $0x1, %r15d
jne 0x18695
movsd %xmm0, -0x1b8(%rbp)
fldt 0x1e9d7(%rip)           # 0x36f40
faddl -0x1b8(%rbp)
fstpl -0x1b0(%rbp)
movapd %xmm0, %xmm3
movapd -0xf0(%rbp), %xmm2
cmpltsd %xmm2, %xmm3
movapd %xmm3, %xmm1
andnpd %xmm0, %xmm1
movsd -0x1b0(%rbp), %xmm0
andpd %xmm3, %xmm0
orpd %xmm1, %xmm0
movapd %xmm0, %xmm3
subsd %xmm2, %xmm3
movsd 0x1e94a(%rip), %xmm1    # 0x36ef8
movsd %xmm3, -0x198(%rbp)
fldt 0x1ca74(%rip)           # 0x35030
faddl -0x198(%rbp)
fstpl -0x190(%rbp)
movsd -0x190(%rbp), %xmm2
movsd %xmm2, -0x78(%rbp)
movsd %xmm1, -0x130(%rbp)
addsd %xmm1, %xmm0
movapd %xmm0, -0xc0(%rbp)
callq 0xb550
mulsd -0x70(%rbp), %xmm0
addsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x120(%rbp)
movapd -0xc0(%rbp), %xmm0
callq 0xa1d0
mulsd -0x70(%rbp), %xmm0
addsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x118(%rbp)
movapd -0xc0(%rbp), %xmm0
callq 0xb550
mulsd -0x70(%rbp), %xmm0
addsd -0x80(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movapd -0xc0(%rbp), %xmm0
callq 0xa1d0
mulsd -0x70(%rbp), %xmm0
addsd -0x58(%rbp), %xmm0
movsd 0x1e84b(%rip), %xmm1    # 0x36ea8
movsd -0x78(%rbp), %xmm2
ucomisd %xmm2, %xmm1
movapd %xmm2, %xmm1
ja 0x1868e
movsd %xmm1, -0x188(%rbp)
fldl -0x188(%rbp)
fldt 0x1e8f0(%rip)           # 0x36f70
fxch %st(1)
fucomi %st(1), %st
fstp %st(1)
jbe 0x1872b
fstp %st(0)
xorl %eax, %eax
jmp 0x187c9
leaq 0x20deb(%rip), %rdi     # 0x39487
jmp 0x18a63
movl 0x1d0(%r12), %esi
subsd %xmm1, %xmm0
movapd %xmm2, %xmm1
subsd %xmm3, %xmm1
movsd -0x40(%rbp), %xmm6
movapd %xmm6, %xmm2
subsd -0x108(%rbp), %xmm2
movsd -0x100(%rbp), %xmm3
movsd -0xf8(%rbp), %xmm4
movsd 0x10(%rbp), %xmm5
movsd %xmm5, 0x18(%rsp)
movsd -0xd8(%rbp), %xmm5
movsd %xmm5, 0x10(%rsp)
movsd -0xd0(%rbp), %xmm5
movsd %xmm5, 0x8(%rsp)
movsd -0xc8(%rbp), %xmm5
movsd %xmm5, (%rsp)
movq %r14, %rdi
movapd %xmm6, %xmm5
movsd -0xa0(%rbp), %xmm6
movsd -0xa8(%rbp), %xmm7
callq 0xb6e0
jmp 0x19075
movsd %xmm0, -0x88(%rbp)
fldt 0x1e877(%rip)           # 0x36fb0
fxch %st(1)
fucompi %st(1), %st
fstp %st(0)
jbe 0x1878c
callq 0xa210
movq (%rax), %rcx
cmpq 0x8(%rax), %rcx
je 0x1878c
callq 0xa210
movq (%rax), %rax
cmpl $0x2, (%rax)
jne 0x1878c
cmpl $0x1, %r15d
jne 0x18774
callq 0xa210
movq (%rax), %rax
cmpl $0x1, 0x38(%rax)
je 0x1911b
cmpl $0x2, %r15d
jne 0x1878c
callq 0xa210
movq (%rax), %rax
cmpl $-0x1, 0x38(%rax)
je 0x1911b
movapd -0xc0(%rbp), %xmm0
callq 0xb550
mulsd -0x70(%rbp), %xmm0
addsd -0x80(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movapd -0xc0(%rbp), %xmm0
callq 0xa1d0
mulsd -0x70(%rbp), %xmm0
addsd -0x58(%rbp), %xmm0
movb $0x1, %al
movsd -0x78(%rbp), %xmm1
ucomisd 0x1e6df(%rip), %xmm1    # 0x36eb0
setbe %cl
movl %eax, %edx
xorb $0x1, %dl
orb %cl, %dl
jne 0x18874
movsd %xmm0, -0x88(%rbp)
movq %rbx, %rdi
movq %r14, %rsi
movsd -0x50(%rbp), %xmm0
movsd -0x98(%rbp), %xmm1
callq 0xa760
testl %eax, %eax
je 0x189a5
movl %eax, %r13d
movq 0x2b74d(%rip), %rbx     # 0x43f60
movslq 0xd670(%rbx), %rax
cmpq $0x30, %rax
jg 0x19106
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%rbx,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x20d3f(%rip), %rsi     # 0x3957d
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 0x19106
testb %al, %al
je 0x188aa
movq %r14, %rdi
callq 0xa300
movsd -0x50(%rbp), %xmm0
movsd -0x98(%rbp), %xmm1
callq 0xa9b0
movsd -0x40(%rbp), %xmm5
movsd -0x48(%rbp), %xmm2
movsd -0x38(%rbp), %xmm1
movl -0x2c(%rbp), %r15d
jmp 0x18fd3
callq 0xa210
movq (%rax), %rax
cmpl $0x2, (%rax)
jne 0x18abc
movq %r12, -0x50(%rbp)
cmpl $0x2, %r15d
sete -0x90(%rbp)
callq 0xa210
movq (%rax), %rax
movsd 0x28(%rax), %xmm1
movsd %xmm1, -0x78(%rbp)
movsd 0x30(%rax), %xmm0
movsd %xmm0, -0xf0(%rbp)
subsd 0x20(%rax), %xmm0
movl 0x38(%rax), %r12d
subsd 0x18(%rax), %xmm1
callq 0xa290
movsd %xmm0, -0xc0(%rbp)
movsd -0x140(%rbp), %xmm0
movsd -0x138(%rbp), %xmm1
callq 0xa100
xorl %r13d, %r13d
cmpl $0x1, %r12d
sete %r13b
movsd %xmm0, -0x170(%rbp)
movl %r13d, %eax
shll $0x4, %eax
leaq 0x1f1d7(%rip), %rcx     # 0x37b10
fldt (%rax,%rcx)
faddl -0x170(%rbp)
fstpl -0x168(%rbp)
movsd -0x168(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
movsd -0xf0(%rbp), %xmm0
subsd -0x58(%rbp), %xmm0
movsd -0x78(%rbp), %xmm1
subsd -0x80(%rbp), %xmm1
callq 0xa100
movl %r12d, -0x80(%rbp)
notl %r12d
andb -0x90(%rbp), %r13b
jne 0x18993
movl %r15d, %eax
xorl $0x1, %eax
orl %r12d, %eax
jne 0x18d1e
movapd -0x70(%rbp), %xmm1
addsd -0xc0(%rbp), %xmm1
jmp 0x18d2b
movl -0x2c(%rbp), %r13d
testl %r13d, %r13d
je 0x18b7e
cmpl $0xa, %r13d
movsd -0xd8(%rbp), %xmm0
movsd -0xd0(%rbp), %xmm1
movsd -0xc8(%rbp), %xmm2
movsd -0xa8(%rbp), %xmm7
movsd -0xa0(%rbp), %xmm6
movsd 0x10(%rbp), %xmm3
jne 0x18a5c
xorl %eax, %eax
cmpl $0x2, %r15d
setne %al
movl 0x1d0(%r12), %esi
leal -0x1(%rax,%rax), %edx
movsd -0x128(%rbp), %xmm5
movsd %xmm3, 0x18(%rsp)
movsd %xmm0, 0x10(%rsp)
movsd %xmm1, 0x8(%rsp)
movsd %xmm2, (%rsp)
xorpd %xmm0, %xmm0
movq %r14, %rdi
movsd -0x90(%rbp), %xmm1
movsd -0x88(%rbp), %xmm2
movsd -0x80(%rbp), %xmm3
movsd -0x58(%rbp), %xmm4
callq 0xa3b0
movq %r14, %rdi
callq 0xa300
movsd -0x90(%rbp), %xmm0
movsd -0x88(%rbp), %xmm1
jmp 0x1888d
leaq 0x20918(%rip), %rdi     # 0x3937b
callq 0xa1f0
movq %rbx, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xa850
movq 0x2b4e4(%rip), %rbx     # 0x43f60
movl $0x0, 0xd670(%rbx)
leaq 0xc6d0(%rbx), %rdi
leaq 0x20ae9(%rip), %rsi     # 0x3957d
movl $0x50, %edx
callq 0xa8a0
movw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
movl $0x5, %r13d
jmp 0x19106
movsd -0x78(%rbp), %xmm0
movsd %xmm0, -0x180(%rbp)
fldt 0x1e491(%rip)           # 0x36f60
faddl -0x180(%rbp)
fmuls 0x1f055(%rip)           # 0x37b30
fstpl -0x178(%rbp)
movsd -0x178(%rbp), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x18c29
jp 0x18c29
leaq 0x20b07(%rip), %rdi     # 0x3960b
callq 0xa1f0
movq %rbx, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xa850
movq 0x2b443(%rip), %r15     # 0x43f60
movl $0x0, 0xd670(%r15)
leaq 0xc6d0(%r15), %rdi
leaq 0x20a47(%rip), %rsi     # 0x3957d
movl $0x50, %edx
callq 0xa8a0
movb $0x0, 0xc71f(%r15)
movl $0x1, 0xd670(%r15)
addq $0xc720, %r15           # imm = 0xC720
movl $0x5, %r13d
movb $0x0, (%r15)
xorl %eax, %eax
movsd -0x40(%rbp), %xmm5
movsd -0x48(%rbp), %xmm2
movsd -0x38(%rbp), %xmm1
movl -0x2c(%rbp), %r15d
jmp 0x18fcb
movl 0x1d0(%r12), %esi
movsd -0x128(%rbp), %xmm5
movsd 0x10(%rbp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd -0xd8(%rbp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd -0xd0(%rbp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd -0xc8(%rbp), %xmm0
movsd %xmm0, (%rsp)
xorps %xmm0, %xmm0
xorpd %xmm1, %xmm1
xorpd %xmm2, %xmm2
movq %r14, %rdi
movsd -0x90(%rbp), %xmm3
movsd -0x88(%rbp), %xmm4
movsd -0xa0(%rbp), %xmm6
movsd -0xa8(%rbp), %xmm7
callq 0xb6f0
movq %r14, %rdi
callq 0xa300
movsd -0x90(%rbp), %xmm0
movsd -0x88(%rbp), %xmm1
callq 0xa9b0
movsd -0x40(%rbp), %xmm5
movsd -0x48(%rbp), %xmm2
movsd -0x38(%rbp), %xmm1
movl %r13d, %r15d
jmp 0x18fd3
callq 0xa580
movapd -0x70(%rbp), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, -0x70(%rbp)
movapd -0xf0(%rbp), %xmm0
addsd -0x130(%rbp), %xmm0
movapd %xmm0, -0xf0(%rbp)
callq 0xb550
mulsd -0x70(%rbp), %xmm0
addsd -0x50(%rbp), %xmm0
movsd %xmm0, -0xc0(%rbp)
movapd -0xf0(%rbp), %xmm0
callq 0xa1d0
movapd -0x70(%rbp), %xmm1
mulsd %xmm0, %xmm1
addsd -0x98(%rbp), %xmm1
movq %rbx, %rdi
movq %r14, %rsi
movsd -0xc0(%rbp), %xmm0
callq 0xa760
movl %eax, %r13d
testl %eax, %eax
sete %al
je 0x18b66
movq %r12, -0x50(%rbp)
movq 0x2b2ab(%rip), %r12     # 0x43f60
movslq 0xd670(%r12), %rax
cmpq $0x30, %rax
jg 0x1912a
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%r12,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x2089c(%rip), %rsi     # 0x3957d
movl $0x50, %edx
callq 0xa8a0
movslq 0xd670(%r12), %rax
leaq (%rax,%rax,4), %rcx
shlq $0x4, %rcx
leaq (%r12,%rcx), %r15
addq $0xc720, %r15           # imm = 0xC720
movb $0x0, -0x1(%r15)
incl %eax
movl %eax, 0xd670(%r12)
movq -0x50(%rbp), %r12
jmp 0x18b60
movsd -0xc0(%rbp), %xmm1
subsd -0x70(%rbp), %xmm1
movsd %xmm1, -0x58(%rbp)
movsd -0x98(%rbp), %xmm1
subsd %xmm0, %xmm1
movapd %xmm1, %xmm0
callq 0xb550
mulsd -0x58(%rbp), %xmm0
testb %r13b, %r13b
jne 0x18d5c
xorl $0x1, %r15d
orl %r12d, %r15d
jne 0x18de1
subsd -0x70(%rbp), %xmm0
divsd -0xc0(%rbp), %xmm0
movapd 0x1c2af(%rip), %xmm1    # 0x35020
andpd %xmm0, %xmm1
movapd %xmm1, -0x70(%rbp)
ucomisd 0x1e11e(%rip), %xmm1    # 0x36ea0
ja 0x18e67
callq 0xaa00
cmpl $0x1, -0x80(%rbp)
movq -0x50(%rbp), %r12
jne 0x18d9f
xorpd 0x1e171(%rip), %xmm0    # 0x36f10
movsd -0x40(%rbp), %xmm5
movsd -0x48(%rbp), %xmm2
movsd -0x38(%rbp), %xmm1
movl -0x2c(%rbp), %r15d
addsd -0x98(%rbp), %xmm0
movsd %xmm0, -0x150(%rbp)
fldt 0x1e198(%rip)           # 0x36f60
faddl -0x150(%rbp)
fstpl -0x148(%rbp)
movsd -0x148(%rbp), %xmm3
jmp 0x18ed6
movapd -0x70(%rbp), %xmm1
addsd %xmm0, %xmm1
divsd -0xc0(%rbp), %xmm1
movapd 0x1c226(%rip), %xmm0    # 0x35020
andpd %xmm1, %xmm0
movapd %xmm0, -0x70(%rbp)
ucomisd 0x1e095(%rip), %xmm0    # 0x36ea0
ja 0x18e67
movapd %xmm1, %xmm0
callq 0xaa00
cmpl $0x1, -0x80(%rbp)
movq -0x50(%rbp), %r12
je 0x18e28
xorpd 0x1e0e8(%rip), %xmm0    # 0x36f10
movsd -0x40(%rbp), %xmm5
movsd -0x48(%rbp), %xmm2
movsd -0x38(%rbp), %xmm1
movl -0x2c(%rbp), %r15d
addsd -0x98(%rbp), %xmm0
movsd %xmm0, -0x160(%rbp)
fldt 0x1e10f(%rip)           # 0x36f60
faddl -0x160(%rbp)
fstpl -0x158(%rbp)
movsd -0x158(%rbp), %xmm3
jmp 0x18ed6
leaq 0x207da(%rip), %rdi     # 0x39648
callq 0xa1f0
movq %rbx, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xa850
movq 0x2b0d9(%rip), %r15     # 0x43f60
movl $0x0, 0xd670(%r15)
leaq 0xc6d0(%r15), %rdi
leaq 0x206dd(%rip), %rsi     # 0x3957d
movl $0x50, %edx
callq 0xa8a0
movw $0x0, 0xc71f(%r15)
movl $0x1, 0xd670(%r15)
movsd -0x40(%rbp), %xmm5
movsd -0x48(%rbp), %xmm2
movsd -0x38(%rbp), %xmm1
movq -0x50(%rbp), %r12
movl -0x2c(%rbp), %r15d
movapd -0x70(%rbp), %xmm0
ucomisd 0x1dfbd(%rip), %xmm0    # 0x36ea0
ja 0x18fac
movsd %xmm3, -0x58(%rbp)
movapd %xmm3, %xmm0
callq 0xb550
mulsd -0xc0(%rbp), %xmm0
addsd -0x78(%rbp), %xmm0
movsd %xmm0, -0x70(%rbp)
movsd -0x58(%rbp), %xmm0
callq 0xa1d0
movsd -0xc0(%rbp), %xmm1
mulsd %xmm0, %xmm1
addsd -0xf0(%rbp), %xmm1
movq %rbx, %rdi
movq %r14, %rsi
movsd -0x70(%rbp), %xmm0
callq 0xa760
movl %eax, %r13d
testl %eax, %eax
sete %al
je 0x18fb6
movq 0x2b018(%rip), %r15     # 0x43f60
movslq 0xd670(%r15), %rax
cmpq $0x30, %rax
jg 0x18b64
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%r15,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x2060a(%rip), %rsi     # 0x3957d
movl $0x50, %edx
callq 0xa8a0
movslq 0xd670(%r15), %rcx
leaq (%rcx,%rcx,4), %rdx
shlq $0x4, %rdx
xorl %eax, %eax
movb %al, 0xc71f(%r15,%rdx)
incl %ecx
movl %ecx, 0xd670(%r15)
movb %al, 0xc720(%r15,%rdx)
jmp 0x18b66
movl $0x5, %r13d
xorl %eax, %eax
jmp 0x18fcb
movl $0x5, %r13d
movsd -0x40(%rbp), %xmm5
movsd -0x48(%rbp), %xmm2
movsd -0x38(%rbp), %xmm1
testb %al, %al
je 0x19106
testl %r15d, %r15d
jne 0x18fe1
movq 0x2afe9(%rip), %rax     # 0x43fc8
jmp 0x18fe8
movq 0x2af90(%rip), %rax     # 0x43f78
movsd -0xa8(%rbp), %xmm7
movsd -0xa0(%rbp), %xmm6
movl 0x1d0(%r12), %esi
movapd %xmm1, %xmm0
subsd -0x110(%rbp), %xmm0
movapd %xmm2, %xmm1
subsd -0x1c0(%rbp), %xmm1
movapd %xmm5, %xmm2
subsd -0x108(%rbp), %xmm2
movsd -0x120(%rbp), %xmm3
movsd -0x118(%rbp), %xmm4
movsd 0x10(%rbp), %xmm8
movsd %xmm8, 0x18(%rsp)
movsd -0xd8(%rbp), %xmm8
movsd %xmm8, 0x10(%rsp)
movsd -0xd0(%rbp), %xmm8
movsd %xmm8, 0x8(%rsp)
movsd -0xc8(%rbp), %xmm8
movsd %xmm8, (%rsp)
movq %r14, %rdi
callq *%rax
movsd -0x120(%rbp), %xmm0
movsd -0x118(%rbp), %xmm1
movq %rbx, %rdi
movq %r14, %rsi
movsd -0x40(%rbp), %xmm2
callq 0xb170
movsd -0xa0(%rbp), %xmm0
movsd %xmm0, 0x8(%r14)
movsd -0xa8(%rbp), %xmm0
movsd %xmm0, 0x20(%r14)
movsd -0xc8(%rbp), %xmm0
movsd %xmm0, 0x38(%r14)
movsd -0xd0(%rbp), %xmm0
movsd %xmm0, 0x50(%r14)
movsd -0xd8(%rbp), %xmm0
movsd %xmm0, 0x68(%r14)
movsd 0x10(%rbp), %xmm0
movsd %xmm0, 0x80(%r14)
movq %rbx, %rdi
movq %r14, %rsi
movsd -0x38(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
movsd -0x40(%rbp), %xmm2
callq 0xad80
xorl %r13d, %r13d
movl %r13d, %eax
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
movsd -0x88(%rbp), %xmm0
jmp 0x187c4
xorl %eax, %eax
movsd -0x40(%rbp), %xmm5
movsd -0x48(%rbp), %xmm2
movsd -0x38(%rbp), %xmm1
movq -0x50(%rbp), %r12
jmp 0x18b75