// File: /workspace/github_cpp_makefile_star2_O1/sundale[P]gcode/rs274ngc/interp_find.cc
// Function: Interp::find_ends(block_struct*, setup_struct*, double*, double*, double*, double*, double*, double*, double*, double*, double*)
int Interp::find_ends(block_pointer block,       //!< pointer to a block of RS274/NGC instructions
                      setup_pointer s,    //!< pointer to machine settings                 
                      double *px,        //!< pointer to end_x                            
                      double *py,        //!< pointer to end_y                            
                      double *pz,        //!< pointer to end_z                            
                      double *AA_p,      //!< pointer to end_a                      
                      double *BB_p,      //!< pointer to end_b                      
                      double *CC_p,      //!< pointer to end_c                      
                      double *u_p, double *v_p, double *w_p)
{
    int middle;
    int comp;

    middle = s->cutter_comp_firstmove == OFF;
    comp = (s->cutter_comp_side != OFF);

    if (block->g_modes[0] == G_53) {      /* distance mode is absolute in this case */
#ifdef DEBUG_EMC
        COMMENT("interpreter: offsets temporarily suspended");
#endif
        CHKS((block->radius_flag || block->theta_flag), _("Cannot use polar coordinates with G53"));

        double cx = s->current_x;
        double cy = s->current_y;
        rotate(&cx, &cy, s->rotation_xy);

        if(block->x_flag == ON) {
            *px = block->x_number - s->origin_offset_x - s->axis_offset_x - s->tool_offset.tran.x;
        } else {
            *px = cx;
        }

        if(block->y_flag == ON) {
            *py = block->y_number - s->origin_offset_y - s->axis_offset_y - s->tool_offset.tran.y;
        } else {
            *py = cy;
        }

        rotate(px, py, -s->rotation_xy);

        if(block->z_flag == ON) {
            *pz = block->z_number - s->origin_offset_z - s->axis_offset_z - s->tool_offset.tran.z;
        } else {
            *pz = s->current_z;
        }

        if(block->a_flag == ON) {
            if(s->a_axis_wrapped) {
                CHP(unwrap_rotary(AA_p, block->a_number, 
                                  block->a_number - s->AA_origin_offset - s->AA_axis_offset - s->tool_offset.a,
                                  s->AA_current, 'A'));
            } else {
                *AA_p = block->a_number - s->AA_origin_offset - s->AA_axis_offset;
            }
        } else {
            *AA_p = s->AA_current;
        }

        if(block->b_flag == ON) {
            if(s->b_axis_wrapped) {
                CHP(unwrap_rotary(BB_p, block->b_number, 
                                  block->b_number - s->BB_origin_offset - s->BB_axis_offset - s->tool_offset.b,
                                  s->BB_current, 'B'));
            } else {
                *BB_p = block->b_number - s->BB_origin_offset - s->BB_axis_offset;
            }
        } else {
            *BB_p = s->BB_current;
        }

        if(block->c_flag == ON) {
            if(s->c_axis_wrapped) {
                CHP(unwrap_rotary(CC_p, block->c_number, 
                                  block->c_number - s->CC_origin_offset - s->CC_axis_offset - s->tool_offset.c,
                                  s->CC_current, 'C'));
            } else {
                *CC_p = block->c_number - s->CC_origin_offset - s->CC_axis_offset;
            }
        } else {
            *CC_p = s->CC_current;
        }

        if(block->u_flag == ON) {
            *u_p = block->u_number - s->u_origin_offset - s->u_axis_offset - s->tool_offset.u;
        } else {
            *u_p = s->u_current;
        }

        if(block->v_flag == ON) {
            *v_p = block->v_number - s->v_origin_offset - s->v_axis_offset - s->tool_offset.v;
        } else {
            *v_p = s->v_current;
        }

        if(block->w_flag == ON) {
            *w_p = block->w_number - s->w_origin_offset - s->w_axis_offset - s->tool_offset.w;
        } else {
            *w_p = s->w_current;
        }
    } else if (s->distance_mode == MODE_ABSOLUTE) {

        if(block->x_flag == ON) {
            *px = block->x_number;
        } else {
            // both cutter comp planes affect X ...
            *px = (comp && middle) ? s->program_x : s->current_x;
        }

        if(block->y_flag == ON) {
            *py = block->y_number;
        } else {
            // but only XY affects Y ...
            *py = (comp && middle && s->plane == CANON_PLANE_XY) ? s->program_y : s->current_y;
        }

        if(block->radius_flag == ON && block->theta_flag == ON) {
            CHKS((block->x_flag == ON || block->y_flag == ON), _("Cannot specify X or Y words with polar coordinate"));
            *px = block->radius * cos(D2R(block->theta));
            *py = block->radius * sin(D2R(block->theta));
        } else if(block->radius_flag == ON) {
            double theta;
            CHKS((block->x_flag == ON || block->y_flag == ON), _("Cannot specify X or Y words with polar coordinate"));
            CHKS((*py == 0 && *px == 0), _("Must specify angle in polar coordinate if at the origin"));
            theta = atan2(*py, *px);
            *px = block->radius * cos(theta);
            *py = block->radius * sin(theta);
        } else  if(block->theta_flag == ON) {
            double radius;
            CHKS((block->x_flag == ON || block->y_flag == ON), _("Cannot specify X or Y words with polar coordinate"));
            radius = hypot(*py, *px);
            *px = radius * cos(D2R(block->theta));
            *py = radius * sin(D2R(block->theta));
        }

        if(block->z_flag == ON) {
            *pz = block->z_number;
        } else {
            // and only XZ affects Z.
            *pz = (comp && middle && s->plane == CANON_PLANE_XZ) ? s->program_z : s->current_z;
        }

        if(block->a_flag == ON) {
            if(s->a_axis_wrapped) {
                CHP(unwrap_rotary(AA_p, block->a_number, block->a_number, s->AA_current, 'A'));
            } else {
                *AA_p = block->a_number;
            }
        } else {
            *AA_p = s->AA_current;
        }

        if(block->b_flag == ON) {
            if(s->b_axis_wrapped) {
                CHP(unwrap_rotary(BB_p, block->b_number, block->b_number, s->BB_current, 'B'));
            } else {
                *BB_p = block->b_number;
            }
        } else {
            *BB_p = s->BB_current;
        }

        if(block->c_flag == ON) {
            if(s->c_axis_wrapped) {
                CHP(unwrap_rotary(CC_p, block->c_number, block->c_number, s->CC_current, 'C'));
            } else {
                *CC_p = block->c_number;
            }
        } else {
            *CC_p = s->CC_current;
        }

        *u_p = (block->u_flag == ON) ? block->u_number : s->u_current;
        *v_p = (block->v_flag == ON) ? block->v_number : s->v_current;
        *w_p = (block->w_flag == ON) ? block->w_number : s->w_current;

    } else {                      /* mode is MODE_INCREMENTAL */

        // both cutter comp planes affect X ...
        *px = (comp && middle) ? s->program_x: s->current_x;
        if(block->x_flag == ON) *px += block->x_number;

        // but only XY affects Y ...
        *py = (comp && middle && s->plane == CANON_PLANE_XY) ? s->program_y: s->current_y;
        if(block->y_flag == ON) *py += block->y_number;

        if(block->radius_flag == ON) {
            double radius, theta;
            CHKS((block->x_flag == ON || block->y_flag == ON), _("Cannot specify X or Y words with polar coordinate"));
            CHKS((*py == 0 && *px == 0), _("Incremental motion with polar coordinates is indeterminate when at the origin"));
            theta = atan2(*py, *px);
            radius = hypot(*py, *px) + block->radius;
            *px = radius * cos(theta);
            *py = radius * sin(theta);
        }

        if(block->theta_flag == ON) {
            double radius, theta;
            CHKS((block->x_flag == ON || block->y_flag == ON), _("Cannot specify X or Y words with polar coordinate"));
            CHKS((*py == 0 && *px == 0), _("G91 motion with polar coordinates is indeterminate when at the origin"));
            theta = atan2(*py, *px) + D2R(block->theta);
            radius = hypot(*py, *px);
            *px = radius * cos(theta);
            *py = radius * sin(theta);
        }

        // and only XZ affects Z.
        *pz = (comp && middle && s->plane == CANON_PLANE_XZ) ? s->program_z: s->current_z;
        if(block->z_flag == ON) *pz += block->z_number;

        *AA_p = s->AA_current;
        if(block->a_flag == ON) *AA_p += block->a_number;

        *BB_p = s->BB_current;
        if(block->b_flag == ON) *BB_p += block->b_number;

        *CC_p = s->CC_current;
        if(block->c_flag == ON) *CC_p += block->c_number;

        *u_p = s->u_current;
        if(block->u_flag == ON) *u_p += block->u_number;

        *v_p = s->v_current;
        if(block->v_flag == ON) *v_p += block->v_number;

        *w_p = s->w_current;
        if(block->w_flag == ON) *w_p += block->w_number;
    }
    return INTERP_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r8, %r15
movq %rcx, %r12
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r13
movq 0x38(%rbp), %rsi
movq 0x30(%rbp), %rdi
movq 0x28(%rbp), %r8
movq 0x20(%rbp), %r10
movq 0x18(%rbp), %r11
movq 0x10(%rbp), %rdx
cmpl $0x212, 0x150(%r14) # imm = 0x212
jne 0x270e7
cmpl $0x0, 0x2a0(%r14)
jne 0x270d3
cmpl $0x0, 0x2b0(%r14)
je 0x2724e
leaq 0x13766(%rip), %rdi     # 0x3a840
callq 0xa1f0
movq %r13, %rdi
jmp 0x27477
movq %r9, -0x48(%rbp)
movq %r13, -0x30(%rbp)
movb 0xc689(%rbx), %al
movl 0x624(%rbx), %ecx
cmpl $0x0, 0x668(%rbx)
je 0x271de
testl %ecx, %ecx
setne %cl
testb %al, %al
sete %r13b
andb %cl, %r13b
leaq 0x600(%rbx), %rax
leaq 0xc690(%rbx), %rcx
testb %r13b, %r13b
cmovneq %rcx, %rax
movsd (%rax), %xmm0
movsd %xmm0, (%r12)
movb 0x270(%r14), %al
cmpb $0x1, %al
jne 0x2714f
addsd 0x278(%r14), %xmm0
movsd %xmm0, (%r12)
testb %r13b, %r13b
je 0x27162
movl $0xc698, %ecx           # imm = 0xC698
cmpl $0x1, 0xc67c(%rbx)
je 0x27167
movl $0x608, %ecx            # imm = 0x608
movsd (%rbx,%rcx), %xmm0
movsd %xmm0, (%r15)
movb 0x280(%r14), %cl
cmpb $0x1, %cl
jne 0x2718b
addsd 0x288(%r14), %xmm0
movsd %xmm0, (%r15)
cmpl $0x1, 0x2a0(%r14)
jne 0x273af
orb %cl, %al
cmpb $0x1, %al
je 0x27467
movsd (%r15), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x27340
jp 0x27340
movsd (%r12), %xmm2
ucomisd %xmm1, %xmm2
jne 0x27340
jp 0x27340
leaq 0x12f2c(%rip), %rdi     # 0x3a105
jmp 0x2746e
testl %ecx, %ecx
setne %cl
testb %al, %al
sete %r13b
movb 0x270(%r14), %al
andb %cl, %r13b
leaq 0x600(%rbx), %rcx
leaq 0xc690(%rbx), %rdx
testb %r13b, %r13b
cmovneq %rdx, %rcx
leaq 0x278(%r14), %rdx
testb %al, %al
cmoveq %rcx, %rdx
movsd (%rdx), %xmm0
movsd %xmm0, (%r12)
movb 0x280(%r14), %cl
cmpb $0x1, %cl
jne 0x27237
leaq 0x288(%r14), %rdx
jmp 0x272bd
testb %r13b, %r13b
je 0x272b6
cmpl $0x1, 0xc67c(%rbx)
jne 0x272b6
leaq 0xc698(%rbx), %rdx
jmp 0x272bd
movq %r9, -0x48(%rbp)
movq %r13, %rdi
movsd 0x600(%rbx), %xmm0
leaq -0x58(%rbp), %rsi
movsd %xmm0, (%rsi)
movsd 0x608(%rbx), %xmm0
leaq -0x50(%rbp), %rdx
movsd %xmm0, (%rdx)
movsd 0x17b8(%rbx), %xmm0
callq 0xb1a0
cmpb $0x1, 0x270(%r14)
jne 0x274c8
movsd 0x278(%r14), %xmm0
subsd 0x17a0(%rbx), %xmm0
subsd 0x118(%rbx), %xmm0
subsd 0xd678(%rbx), %xmm0
jmp 0x274cd
leaq 0x608(%rbx), %rdx
movsd (%rdx), %xmm0
movsd %xmm0, (%r15)
movl 0x2a0(%r14), %edx
cmpl $0x1, %edx
jne 0x2744f
cmpl $0x1, 0x2b0(%r14)
jne 0x27411
orb %cl, %al
cmpb $0x1, %al
je 0x27467
movsd 0x2a8(%r14), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd 0x2b8(%r14), %xmm0
mulsd 0xfbc3(%rip), %xmm0     # 0x36ed0
divsd 0xfbc3(%rip), %xmm0     # 0x36ed8
callq 0xb550
mulsd -0x38(%rbp), %xmm0
movsd %xmm0, (%r12)
movsd 0xfba3(%rip), %xmm0     # 0x36ed0
movsd 0x2a8(%r14), %xmm1
movsd %xmm1, -0x38(%rbp)
jmp 0x27763
movsd (%r12), %xmm1
callq 0xa100
movsd %xmm0, -0x38(%rbp)
movsd (%r15), %xmm0
movsd (%r12), %xmm1
callq 0xa290
addsd 0x2a8(%r14), %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x38(%rbp), %xmm0
callq 0xb550
mulsd -0x40(%rbp), %xmm0
movsd %xmm0, (%r12)
movsd -0x38(%rbp), %xmm0
callq 0xa1d0
movq 0x10(%rbp), %rdx
movq 0x18(%rbp), %r11
movq 0x20(%rbp), %r10
movq 0x28(%rbp), %r8
movq 0x30(%rbp), %rdi
movq 0x38(%rbp), %rsi
mulsd -0x40(%rbp), %xmm0
movsd %xmm0, (%r15)
cmpl $0x1, 0x2b0(%r14)
jne 0x27cbb
cmpb $0x0, 0x270(%r14)
jne 0x27467
cmpb $0x1, 0x280(%r14)
je 0x27467
movsd (%r15), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x27c38
jp 0x27c38
movsd (%r12), %xmm2
ucomisd %xmm1, %xmm2
jne 0x27c38
jp 0x27c38
leaq 0x1354f(%rip), %rdi     # 0x3a95e
jmp 0x2746e
cmpl $0x1, %edx
jne 0x2744f
orb %cl, %al
cmpb $0x1, %al
je 0x27467
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x27e02
jp 0x27e02
movsd (%r12), %xmm2
ucomisd %xmm1, %xmm2
jne 0x27e02
jp 0x27e02
leaq 0x134d9(%rip), %rdi     # 0x3a926
jmp 0x2746e
cmpl $0x1, 0x2b0(%r14)
jne 0x27797
orb %cl, %al
cmpb $0x1, %al
jne 0x27722
leaq 0x13486(%rip), %rdi     # 0x3a8f4
callq 0xa1f0
movq -0x30(%rbp), %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xa850
movq 0x1cad8(%rip), %rbx     # 0x43f60
movl $0x0, 0xd670(%rbx)
leaq 0xc6d0(%rbx), %rdi
leaq 0x133c6(%rip), %rsi     # 0x3a866
movl $0x50, %edx
callq 0xa8a0
movw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
movl $0x5, %r15d
jmp 0x27db0
movsd -0x58(%rbp), %xmm0
movsd %xmm0, (%r12)
cmpb $0x1, 0x280(%r14)
jne 0x27500
movsd 0x288(%r14), %xmm0
subsd 0x17a8(%rbx), %xmm0
subsd 0x120(%rbx), %xmm0
subsd 0xd680(%rbx), %xmm0
jmp 0x27505
movsd -0x50(%rbp), %xmm0
movsd %xmm0, (%r15)
movsd 0x17b8(%rbx), %xmm0
xorps 0xf9f7(%rip), %xmm0     # 0x36f10
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0xb1a0
cmpb $0x1, 0x290(%r14)
jne 0x27554
movsd 0x298(%r14), %xmm0
subsd 0x17b0(%rbx), %xmm0
subsd 0x128(%rbx), %xmm0
subsd 0xd688(%rbx), %xmm0
jmp 0x2755c
movsd 0x610(%rbx), %xmm0
movq 0x38(%rbp), %r9
movq 0x30(%rbp), %rdi
movq 0x28(%rbp), %r8
movq 0x20(%rbp), %rsi
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rcx
movq -0x48(%rbp), %rdx
movsd %xmm0, (%rdx)
cmpb $0x1, (%r14)
jne 0x27636
cmpl $0x0, 0x1e6cc(%rbx)
movsd 0x8(%r14), %xmm0
movapd %xmm0, %xmm1
subsd 0x10(%rbx), %xmm1
subsd (%rbx), %xmm1
je 0x2763b
subsd 0xd690(%rbx), %xmm1
movsd 0x8(%rbx), %xmm2
movq %r13, %rdi
movq %rcx, %rsi
movl $0x41, %edx
callq 0xac90
movl %eax, %r15d
testl %eax, %eax
je 0x27de9
movq 0x1c98b(%rip), %rbx     # 0x43f60
movslq 0xd670(%rbx), %rax
cmpq $0x30, %rax
jg 0x27b81
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%rbx,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x13266(%rip), %rsi     # 0x3a866
movl $0x50, %edx
callq 0xa8a0
movslq 0xd670(%rbx), %rcx
leaq (%rcx,%rcx,4), %rdx
shlq $0x4, %rdx
xorl %eax, %eax
movb %al, 0xc71f(%rbx,%rdx)
incl %ecx
movl %ecx, 0xd670(%rbx)
movb %al, 0xc720(%rbx,%rdx)
jmp 0x27c2b
movsd 0x8(%rbx), %xmm1
movsd %xmm1, (%rcx)
cmpb $0x1, 0x10(%r14)
jne 0x27aa9
cmpl $0x0, 0x1e6d0(%rbx)
movsd 0x18(%r14), %xmm0
movapd %xmm0, %xmm1
subsd 0x28(%rbx), %xmm1
subsd 0x18(%rbx), %xmm1
je 0x27aae
subsd 0xd698(%rbx), %xmm1
movsd 0x20(%rbx), %xmm2
movq %r13, %rdi
movq %rax, %rsi
movl $0x42, %edx
callq 0xac90
movq 0x20(%rbp), %rsi
movq 0x28(%rbp), %r8
movq 0x30(%rbp), %rdi
movq 0x38(%rbp), %r9
movl %eax, %r12d
testl %eax, %eax
je 0x27714
movq 0x1c8ba(%rip), %r15     # 0x43f60
movslq 0xd670(%r15), %rax
cmpq $0x30, %rax
jg 0x27711
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%r15,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x13199(%rip), %rsi     # 0x3a866
movl $0x50, %edx
callq 0xa8a0
movq 0x20(%rbp), %rsi
movq 0x28(%rbp), %r8
movq 0x30(%rbp), %rdi
movq 0x38(%rbp), %r9
movslq 0xd670(%r15), %rax
leaq (%rax,%rax,4), %rcx
shlq $0x4, %rcx
xorl %edx, %edx
movb %dl, 0xc71f(%r15,%rcx)
incl %eax
movl %eax, 0xd670(%r15)
movb %dl, 0xc720(%r15,%rcx)
movl %r12d, %r15d
testl %r12d, %r12d
jne 0x27b81
jmp 0x27ab2
movsd (%r12), %xmm1
callq 0xa290
movsd %xmm0, -0x38(%rbp)
movsd 0x2b8(%r14), %xmm0
mulsd 0xf78d(%rip), %xmm0     # 0x36ed0
divsd 0xf78d(%rip), %xmm0     # 0x36ed8
callq 0xb550
mulsd -0x38(%rbp), %xmm0
movsd %xmm0, (%r12)
movsd 0xf76d(%rip), %xmm0     # 0x36ed0
mulsd 0x2b8(%r14), %xmm0
divsd 0xf764(%rip), %xmm0     # 0x36ed8
callq 0xa1d0
mulsd -0x38(%rbp), %xmm0
movsd %xmm0, (%r15)
movq 0x38(%rbp), %rsi
movq 0x30(%rbp), %rdi
movq 0x28(%rbp), %r8
movq 0x20(%rbp), %r10
movq 0x18(%rbp), %r11
movq %rsi, %rdx
cmpb $0x1, 0x290(%r14)
movq 0x10(%rbp), %rsi
jne 0x277b1
leaq 0x298(%r14), %rax
jmp 0x277cf
testb %r13b, %r13b
je 0x277c8
cmpl $0x3, 0xc67c(%rbx)
jne 0x277c8
leaq 0xc6a0(%rbx), %rax
jmp 0x277cf
leaq 0x610(%rbx), %rax
movq -0x30(%rbp), %rcx
movsd (%rax), %xmm0
movq -0x48(%rbp), %rax
movsd %xmm0, (%rax)
cmpb $0x1, (%r14)
jne 0x2788a
cmpl $0x0, 0x1e6cc(%rbx)
movsd 0x8(%r14), %xmm0
je 0x2788f
movq %rdx, %r13
movsd 0x8(%rbx), %xmm2
movq %rcx, %rdi
movapd %xmm0, %xmm1
movl $0x41, %edx
callq 0xac90
movl %eax, %r12d
testl %eax, %eax
je 0x27dc2
movq 0x1c739(%rip), %r15     # 0x43f60
movslq 0xd670(%r15), %rax
cmpq $0x30, %rax
jg 0x27882
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%r15,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x13018(%rip), %rsi     # 0x3a866
movl $0x50, %edx
callq 0xa8a0
movslq 0xd670(%r15), %rax
leaq (%rax,%rax,4), %rcx
shlq $0x4, %rcx
xorl %edx, %edx
movb %dl, 0xc71f(%r15,%rcx)
incl %eax
movl %eax, 0xd670(%r15)
movb %dl, 0xc720(%r15,%rcx)
movl %r12d, %r15d
jmp 0x27dc8
movsd 0x8(%rbx), %xmm0
movsd %xmm0, (%rsi)
movl $0x5, %r15d
movq %rdx, %rsi
cmpb $0x1, 0x10(%r14)
jne 0x2796f
cmpl $0x0, 0x1e6d0(%rbx)
movsd 0x18(%r14), %xmm0
je 0x27974
movsd 0x20(%rbx), %xmm2
movq %rcx, %rdi
movq %r11, %rsi
movapd %xmm0, %xmm1
movl $0x42, %edx
movq %r8, %r13
callq 0xac90
movq 0x20(%rbp), %r10
movq %r13, %r8
movq 0x30(%rbp), %rdi
movq 0x38(%rbp), %rsi
movl %eax, %r12d
testl %eax, %eax
je 0x27960
movq 0x1c66d(%rip), %r15     # 0x43f60
movslq 0xd670(%r15), %rax
cmpq $0x30, %rax
jg 0x2795d
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%r15,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x12f4c(%rip), %rsi     # 0x3a866
movl $0x50, %edx
callq 0xa8a0
movq 0x20(%rbp), %r10
movq %r13, %r8
movq 0x30(%rbp), %rdi
movq 0x38(%rbp), %rsi
movslq 0xd670(%r15), %rax
leaq (%rax,%rax,4), %rcx
shlq $0x4, %rcx
xorl %edx, %edx
movb %dl, 0xc71f(%r15,%rcx)
incl %eax
movl %eax, 0xd670(%r15)
movb %dl, 0xc720(%r15,%rcx)
movl %r12d, %r15d
testl %r12d, %r12d
movq -0x30(%rbp), %rcx
jne 0x27db0
jmp 0x27979
movsd 0x20(%rbx), %xmm0
movsd %xmm0, (%r11)
cmpb $0x1, 0x20(%r14)
jne 0x27a40
cmpl $0x0, 0x1e6d4(%rbx)
movsd 0x28(%r14), %xmm0
je 0x27a45
movsd 0x38(%rbx), %xmm2
movq %rcx, %rdi
movq %r10, %rsi
movapd %xmm0, %xmm1
movl $0x43, %edx
movq %r8, %r13
callq 0xac90
movq %r13, %r8
movq 0x30(%rbp), %rdi
movq 0x38(%rbp), %rsi
movl %eax, %r12d
testl %eax, %eax
je 0x27a35
movq 0x1c594(%rip), %r15     # 0x43f60
movslq 0xd670(%r15), %rax
cmpq $0x30, %rax
jg 0x27a32
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%r15,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x12e73(%rip), %rsi     # 0x3a866
movl $0x50, %edx
callq 0xa8a0
movq %r13, %r8
movq 0x30(%rbp), %rdi
movq 0x38(%rbp), %rsi
movslq 0xd670(%r15), %rax
leaq (%rax,%rax,4), %rcx
shlq $0x4, %rcx
xorl %edx, %edx
movb %dl, 0xc71f(%r15,%rcx)
incl %eax
movl %eax, 0xd670(%r15)
movb %dl, 0xc720(%r15,%rcx)
movl %r12d, %r15d
testl %r12d, %r12d
jne 0x27db0
jmp 0x27a4a
movsd 0x38(%rbx), %xmm0
movsd %xmm0, (%r10)
leaq 0x248(%r14), %rax
cmpb $0x0, 0x244(%r14)
leaq 0x50(%rbx), %rcx
cmovneq %rax, %rcx
movsd (%rcx), %xmm0
movsd %xmm0, (%r8)
leaq 0x258(%r14), %rax
cmpb $0x0, 0x250(%r14)
leaq 0x68(%rbx), %rcx
cmovneq %rax, %rcx
movsd (%rcx), %xmm0
movsd %xmm0, (%rdi)
subq $-0x80, %rbx
cmpb $0x0, 0x260(%r14)
leaq 0x268(%r14), %rax
cmovneq %rax, %rbx
movsd (%rbx), %xmm0
jmp 0x27da9
movsd 0x20(%rbx), %xmm1
movsd %xmm1, (%rax)
cmpb $0x1, 0x20(%r14)
jne 0x27b88
cmpl $0x0, 0x1e6d4(%rbx)
movsd 0x28(%r14), %xmm0
movapd %xmm0, %xmm1
subsd 0x40(%rbx), %xmm1
subsd 0x30(%rbx), %xmm1
je 0x27b8d
subsd 0xd6a0(%rbx), %xmm1
movsd 0x38(%rbx), %xmm2
movq %r13, %rdi
movl $0x43, %edx
callq 0xac90
movq 0x28(%rbp), %r8
movq 0x30(%rbp), %rdi
movq 0x38(%rbp), %r9
movl %eax, %r12d
testl %eax, %eax
je 0x27b7c
movq 0x1c44e(%rip), %r15     # 0x43f60
movslq 0xd670(%r15), %rax
cmpq $0x30, %rax
jg 0x27b79
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%r15,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x12d2d(%rip), %rsi     # 0x3a866
movl $0x50, %edx
callq 0xa8a0
movq 0x28(%rbp), %r8
movq 0x30(%rbp), %rdi
movq 0x38(%rbp), %r9
movslq 0xd670(%r15), %rax
leaq (%rax,%rax,4), %rcx
shlq $0x4, %rcx
xorl %edx, %edx
movb %dl, 0xc71f(%r15,%rcx)
incl %eax
movl %eax, 0xd670(%r15)
movb %dl, 0xc720(%r15,%rcx)
movl %r12d, %r15d
testl %r12d, %r12d
je 0x27b91
xorl %eax, %eax
jmp 0x27c2b
movsd 0x38(%rbx), %xmm1
movsd %xmm1, (%rsi)
cmpb $0x1, 0x244(%r14)
jne 0x27bb8
movsd 0x248(%r14), %xmm0
subsd 0x58(%rbx), %xmm0
subsd 0x48(%rbx), %xmm0
subsd 0xd6a8(%rbx), %xmm0
jmp 0x27bbd
movsd 0x50(%rbx), %xmm0
movsd %xmm0, (%r8)
cmpb $0x1, 0x250(%r14)
jne 0x27be9
movsd 0x258(%r14), %xmm0
subsd 0x70(%rbx), %xmm0
subsd 0x60(%rbx), %xmm0
subsd 0xd6b0(%rbx), %xmm0
jmp 0x27bee
movsd 0x68(%rbx), %xmm0
movsd %xmm0, (%rdi)
cmpb $0x1, 0x260(%r14)
jne 0x27c1c
movsd 0x268(%r14), %xmm0
subsd 0x88(%rbx), %xmm0
subsd 0x78(%rbx), %xmm0
subsd 0xd6b8(%rbx), %xmm0
jmp 0x27c24
movsd 0x80(%rbx), %xmm0
movsd %xmm0, (%r9)
movb $0x1, %al
testb %al, %al
jne 0x27dad
jmp 0x27db0
movsd (%r12), %xmm1
callq 0xa100
movsd 0x2b8(%r14), %xmm1
mulsd 0xf27c(%rip), %xmm1     # 0x36ed0
divsd 0xf27c(%rip), %xmm1     # 0x36ed8
addsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movsd (%r15), %xmm0
movsd (%r12), %xmm1
callq 0xa290
movsd %xmm0, -0x38(%rbp)
movsd -0x30(%rbp), %xmm0
callq 0xb550
mulsd -0x38(%rbp), %xmm0
movsd %xmm0, (%r12)
movsd -0x30(%rbp), %xmm0
callq 0xa1d0
movq 0x10(%rbp), %rdx
movq 0x18(%rbp), %r11
movq 0x20(%rbp), %r10
movq 0x28(%rbp), %r8
movq 0x30(%rbp), %rdi
movq 0x38(%rbp), %rsi
mulsd -0x38(%rbp), %xmm0
movsd %xmm0, (%r15)
testb %r13b, %r13b
je 0x27cce
movl $0xc6a0, %eax           # imm = 0xC6A0
cmpl $0x3, 0xc67c(%rbx)
je 0x27cd3
movl $0x610, %eax            # imm = 0x610
movsd (%rbx,%rax), %xmm0
movq -0x48(%rbp), %rax
movsd %xmm0, (%rax)
cmpb $0x1, 0x290(%r14)
jne 0x27cf7
addsd 0x298(%r14), %xmm0
movsd %xmm0, (%rax)
movsd 0x8(%rbx), %xmm0
movsd %xmm0, (%rdx)
cmpb $0x1, (%r14)
jne 0x27d10
addsd 0x8(%r14), %xmm0
movsd %xmm0, (%rdx)
movsd 0x20(%rbx), %xmm0
movsd %xmm0, (%r11)
cmpb $0x1, 0x10(%r14)
jne 0x27d2c
addsd 0x18(%r14), %xmm0
movsd %xmm0, (%r11)
movsd 0x38(%rbx), %xmm0
movsd %xmm0, (%r10)
cmpb $0x1, 0x20(%r14)
jne 0x27d48
addsd 0x28(%r14), %xmm0
movsd %xmm0, (%r10)
movsd 0x50(%rbx), %xmm0
movsd %xmm0, (%r8)
cmpb $0x1, 0x244(%r14)
jne 0x27d6a
addsd 0x248(%r14), %xmm0
movsd %xmm0, (%r8)
movsd 0x68(%rbx), %xmm0
movsd %xmm0, (%rdi)
cmpb $0x1, 0x250(%r14)
jne 0x27d8a
addsd 0x258(%r14), %xmm0
movsd %xmm0, (%rdi)
movsd 0x80(%rbx), %xmm0
movsd %xmm0, (%rsi)
cmpb $0x1, 0x260(%r14)
jne 0x27dad
addsd 0x268(%r14), %xmm0
movsd %xmm0, (%rsi)
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x5, %r15d
movq %r13, %rsi
movq 0x30(%rbp), %rdi
movq 0x28(%rbp), %r8
movq 0x20(%rbp), %r10
movq 0x18(%rbp), %r11
testl %r12d, %r12d
movq -0x30(%rbp), %rcx
jne 0x27db0
jmp 0x2789c
movq 0x38(%rbp), %r9
movq 0x30(%rbp), %rdi
movq 0x28(%rbp), %r8
movq 0x20(%rbp), %rsi
movq 0x18(%rbp), %rax
jmp 0x2763f
movsd (%r12), %xmm1
callq 0xa100
movsd %xmm0, -0x40(%rbp)
movsd 0x2a8(%r14), %xmm1
movsd %xmm1, -0x38(%rbp)
callq 0xb550
mulsd -0x38(%rbp), %xmm0
movsd %xmm0, (%r12)
movsd -0x40(%rbp), %xmm0
movsd 0x2a8(%r14), %xmm1
movsd %xmm1, -0x38(%rbp)
jmp 0x27774