// File: /workspace/github_cpp_makefile_star2_O1/sundale[P]gcode/rs274ngc/interp_convert.cc
// Function: Interp::convert_m(block_struct*, setup_struct*)
int Interp::convert_m(block_pointer block,       //!< pointer to a block of RS274/NGC instructions
                     setup_pointer settings)    //!< pointer to machine settings                 
{
  int type;
  double timeout;               // timeout for M66
  double *pars;                 /* short name for settings->parameters            */

  pars = settings->parameters;

  /* The M62-65 commands are used for DIO */
  /* M62 sets a DIO synched with motion
     M63 clears a DIO synched with motion
     M64 sets a DIO imediately
     M65 clears a DIO imediately 
     M66 waits for an input
     M67 reads a digital input
     M68 reads an analog input*/

  if (block->m_modes[5] == 62) {
      CHKS((settings->cutter_comp_side != OFF),
           (_("Cannot set motion output with cutter radius compensation on")));  // XXX
      CHKS((block->p_flag == OFF), _("No valid P word with M62"));
      SET_MOTION_OUTPUT_BIT(round_to_int(block->p_number));
  } else if (block->m_modes[5] == 63) {
      CHKS((settings->cutter_comp_side != OFF),
           (_("Cannot set motion digital output with cutter radius compensation on")));  // XXX
      CHKS((block->p_flag == OFF), _("No valid P word with M63"));
      CLEAR_MOTION_OUTPUT_BIT(round_to_int(block->p_number));
  } else if (block->m_modes[5] == 64) {
      CHKS((settings->cutter_comp_side != OFF),
           (_("Cannot set auxiliary digital output with cutter radius compensation on")));  // XXX
      CHKS((block->p_flag == OFF), _("No valid P word with M64"));
      SET_AUX_OUTPUT_BIT(round_to_int(block->p_number));
  } else if (block->m_modes[5] == 65) {
      CHKS((settings->cutter_comp_side != OFF),
           (_("Cannot set auxiliary digital output with cutter radius compensation on")));  // XXX
      CHKS((block->p_flag == OFF), _("No valid P word with M65"));
      CLEAR_AUX_OUTPUT_BIT(round_to_int(block->p_number));
  } else if (block->m_modes[5] == 66) {
    //P-word = digital channel
    //E-word = analog channel
    //L-word = wait type (immediate, rise, fall, high, low)
    //Q-word = timeout
    // it is an error if:

    // P and E word are specified together
    CHKS(((block->p_flag == ON) && (block->e_flag == ON)),
	NCE_BOTH_DIGITAL_AND_ANALOG_INPUT_SELECTED);

    // L-word not 0, and timeout <= 0 
    CHKS(((block->q_number <= 0) && (block->l_flag == ON) && (round_to_int(block->l_number) > 0)),
	NCE_ZERO_TIMEOUT_WITH_WAIT_NOT_IMMEDIATE);
	
    // E-word specified (analog input) and wait type not immediate
    CHKS(((block->e_flag == ON) && (block->l_flag == ON) && (round_to_int(block->l_number) != 0)),
	NCE_ANALOG_INPUT_WITH_WAIT_NOT_IMMEDIATE);

    // missing P or E (or invalid = negative)
    CHKS( ((block->p_flag == ON) && (round_to_int(block->p_number) < 0)) || 
         ((block->e_flag == ON) && (round_to_int(block->e_number) < 0)) ||
	 ((block->p_flag == OFF) && (block->e_flag == OFF)) ,
	NCE_INVALID_OR_MISSING_P_AND_E_WORDS_FOR_WAIT_INPUT);

    if (block->p_flag == ON) { // got a digital input
	if (round_to_int(block->p_number) < 0) // safety check for negative words
	    ERS("invalid P-word with M66");
	    
	if (block->l_flag == ON) {
	    type = round_to_int(block->l_number);
	} else {
	    type = WAIT_MODE_IMMEDIATE;
        }
	    
	if (block->q_number > 0) {
	    timeout = block->q_number;
	} else {
	    timeout = 0;
        }

        CHKS((settings->cutter_comp_side != OFF),
             (_("Cannot wait for digital input with cutter radius compensation on")));

	int ret = WAIT(round_to_int(block->p_number), DIGITAL_INPUT, type, timeout);
	//WAIT returns 0 on success, -1 for out of bounds
	CHKS((ret == -1), NCE_DIGITAL_INPUT_INVALID_ON_M66);
	if (ret == 0) {
	    settings->input_flag = ON;
	    settings->input_index = round_to_int(block->p_number);
	    settings->input_digital = ON;
	}
    } else if (round_to_int(block->e_number) >= 0) { // got an analog input
        CHKS((settings->cutter_comp_side != OFF),
             (_("Cannot wait for analog input with cutter radius compensation on")));

	int ret = WAIT(round_to_int(block->e_number), ANALOG_INPUT, 0, 0); //WAIT returns 0 on success, -1 for out of bounds
	CHKS((ret == -1), NCE_ANALOG_INPUT_INVALID_ON_M66);
	if (ret == 0) {
	    settings->input_flag = ON;
	    settings->input_index = round_to_int(block->e_number);
	    settings->input_digital = OFF;
	}
    } 
  } else if (block->m_modes[5] == 67) {
    //E-word = analog channel
    //Q-word = analog value
      CHKS((settings->cutter_comp_side != OFF),
           (_("Cannot set motion analog output with cutter radius compensation on")));  // XXX
      CHKS((block->e_flag == OFF) || (round_to_int(block->e_number) < 0), (_("Invalid analog index with M67")));
      SET_MOTION_OUTPUT_VALUE(round_to_int(block->e_number), block->q_number);
  } else if (block->m_modes[5] == 68) {
    //E-word = analog channel
    //Q-word = analog value
      CHKS((settings->cutter_comp_side != OFF),
           (_("Cannot set auxiliary analog output with cutter radius compensation on")));  // XXX
      CHKS((block->e_flag == OFF) || (round_to_int(block->e_number) < 0), (_("Invalid analog index with M68")));
      SET_AUX_OUTPUT_VALUE(round_to_int(block->e_number), block->q_number);
  }    
  
  if (block->m_modes[6] != -1) {
    // when we have M6 do the actual toolchange
    if (block->m_modes[6] == 6)
	CHP(convert_tool_change(settings));
	
    // when we have M61 we only change the number of the loaded tool (for example on startup)
    if (block->m_modes[6] == 61) {
	CHKS((round_to_int(block->q_number) < 0), (_("Need positive Q-word to specify tool number with M61")));
	settings->current_pocket = round_to_int(block->q_number);
	CHANGE_TOOL_NUMBER(round_to_int(block->q_number));
    }    
#ifdef DEBATABLE
    // I would like this, but it's a big change.  It changes the
    // operation of legal ngc programs, but it could be argued that
    // those programs are buggy or likely to be not what the author
    // intended.

    // It would allow you to turn on G43 after loading the first tool,
    // and then not worry about it through the program.  When you
    // finally unload the last tool, G43 mode is canceled.

    if(settings->active_g_codes[9] == G_43) {
        if(settings->selected_tool_slot > 0) {
            struct block_struct g43;
            init_block(&g43);
            block->g_modes[_gees[G_43]] = G_43;
            CHP(convert_tool_length_offset(G_43, &g43, settings));
        } else {
            struct block_struct g49;
            init_block(&g49);
            block->g_modes[_gees[G_49]] = G_49;
            CHP(convert_tool_length_offset(G_49, &g49, settings));
        }
    }
#endif
  }

  if (block->m_modes[7] == 3) {
      enqueue_START_SPINDLE_CLOCKWISE();
      settings->spindle_turning = CANON_CLOCKWISE;
  } else if (block->m_modes[7] == 4) {
      enqueue_START_SPINDLE_COUNTERCLOCKWISE();
      settings->spindle_turning = CANON_COUNTERCLOCKWISE;
  } else if (block->m_modes[7] == 5) {
      enqueue_STOP_SPINDLE_TURNING();
      settings->spindle_turning = CANON_STOPPED;
  }

  if (block->m_modes[8] == 7) {
      enqueue_MIST_ON();
      settings->mist = ON;
  } else if (block->m_modes[8] == 8) {
      enqueue_FLOOD_ON();
      settings->flood = ON;
  } else if (block->m_modes[8] == 9) {
      enqueue_MIST_OFF();
      settings->mist = OFF;
      enqueue_FLOOD_OFF();
      settings->flood = OFF;
  }

/* No axis clamps in this version
  if (block->m_modes[2] == 26)
    {
#ifdef DEBUG_EMC
      COMMENT("interpreter: automatic A-axis clamping turned on");
#endif
      settings->a_axis_clamping = ON;
    }
  else if (block->m_modes[2] == 27)
    {
#ifdef DEBUG_EMC
      COMMENT("interpreter: automatic A-axis clamping turned off");
#endif
      settings->a_axis_clamping = OFF;
    }
*/

  if (block->m_modes[9] == 48) {
    CHKS((settings->cutter_comp_side != OFF),
         (_("Cannot enable overrides with cutter radius compensation on")));  // XXX
    ENABLE_FEED_OVERRIDE();
    ENABLE_SPEED_OVERRIDE();
    settings->feed_override = ON;
    settings->speed_override = ON;
  } else if (block->m_modes[9] == 49) {
    CHKS((settings->cutter_comp_side != OFF),
         (_("Cannot disable overrides with cutter radius compensation on")));  // XXX
    DISABLE_FEED_OVERRIDE();
    DISABLE_SPEED_OVERRIDE();
    settings->feed_override = OFF;
    settings->speed_override = OFF;
  }

  if (block->m_modes[9] == 50) {
    if (block->p_number != 0) {
        CHKS((settings->cutter_comp_side != OFF),
             (_("Cannot enable overrides with cutter radius compensation on")));  // XXX
	ENABLE_FEED_OVERRIDE();
	settings->feed_override = ON;
    } else {
        CHKS((settings->cutter_comp_side != OFF),
             (_("Cannot disable overrides with cutter radius compensation on")));  // XXX
        DISABLE_FEED_OVERRIDE();
	settings->feed_override = OFF;
    }
  }

  if (block->m_modes[9] == 51) {
    if (block->p_number != 0) {
        CHKS((settings->cutter_comp_side != OFF),
             (_("Cannot enable overrides with cutter radius compensation on")));  // XXX
	ENABLE_SPEED_OVERRIDE();
	settings->speed_override = ON;
    } else {
        CHKS((settings->cutter_comp_side != OFF),
             (_("Cannot disable overrides with cutter radius compensation on")));  // XXX
	DISABLE_SPEED_OVERRIDE();
	settings->speed_override = OFF;
    }
  }
  
  if (block->m_modes[9] == 52) {
    if (block->p_number != 0) {
        CHKS((settings->cutter_comp_side != OFF),
             (_("Cannot enable overrides with cutter radius compensation on")));  // XXX
	ENABLE_ADAPTIVE_FEED();
	settings->adaptive_feed = ON;
    } else {
        CHKS((settings->cutter_comp_side != OFF),
             (_("Cannot disable overrides with cutter radius compensation on")));  // XXX
	DISABLE_ADAPTIVE_FEED();
	settings->adaptive_feed = OFF;
    }
  }
  
  if (block->m_modes[9] == 53) {
    if (block->p_number != 0) {
        CHKS((settings->cutter_comp_side != OFF),
             (_("Cannot enable overrides with cutter radius compensation on")));  // XXX
	ENABLE_FEED_HOLD();
	settings->feed_hold = ON;
    } else {
        CHKS((settings->cutter_comp_side != OFF),
             (_("Cannot disable overrides with cutter radius compensation on")));  // XXX
	DISABLE_FEED_HOLD();
	settings->feed_hold = OFF;
    }
  }

  /* user-defined M codes */
  if (block->m_modes[10] != -1) {
    int index = block->m_modes[10];
    if (USER_DEFINED_FUNCTION[index - 100] == 0) {
      CHKS(1, NCE_UNKNOWN_M_CODE_USED);
    }
    enqueue_M_USER_COMMAND(index,block->p_number,block->q_number);
  }
  return INTERP_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movl 0x1f4(%rsi), %eax
addl $-0x3e, %eax
cmpl $0x6, %eax
ja 0x146b8
leaq 0x22f24(%rip), %rcx     # 0x36fe0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x0, 0x624(%r15)
je 0x14303
leaq 0x249c1(%rip), %rdi     # 0x38a9b
jmp 0x149ae
movb 0x218(%r14), %al
cmpb $0x1, %al
jne 0x141b8
cmpb $0x1, 0x139(%r14)
jne 0x141b8
leaq 0x24ac3(%rip), %rdi     # 0x38bc6
jmp 0x149ae
cmpl $0x0, 0x624(%r15)
jne 0x1415e
cmpb $0x0, 0x218(%r14)
je 0x144ab
movsd 0x210(%r14), %xmm0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x22e63(%rip), %rcx     # 0x36fa0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %edi
callq 0xb080
jmp 0x146b8
cmpl $0x0, 0x624(%r15)
je 0x142c5
leaq 0x249e8(%rip), %rdi     # 0x38b4d
jmp 0x149ae
cmpl $0x0, 0x624(%r15)
je 0x14341
leaq 0x24971(%rip), %rdi     # 0x38af0
jmp 0x149ae
cmpl $0x0, 0x624(%r15)
je 0x1437f
leaq 0x24bf3(%rip), %rdi     # 0x38d8c
jmp 0x149ae
cmpl $0x0, 0x624(%r15)
je 0x143ca
leaq 0x24c3a(%rip), %rdi     # 0x38ded
jmp 0x149ae
movsd 0x220(%r14), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jb 0x14206
cmpb $0x1, 0x1cc(%r14)
jne 0x14206
movl 0x1c8(%r14), %ecx
xorps %xmm1, %xmm1
cvtsi2sd %ecx, %xmm1
shrl $0x1f, %ecx
leaq 0x22db3(%rip), %rdx     # 0x36fa0
addsd (%rdx,%rcx,8), %xmm1
cvttsd2si %xmm1, %ecx
testl %ecx, %ecx
jle 0x14206
leaq 0x24a03(%rip), %rdi     # 0x38c04
jmp 0x149ae
movb 0x139(%r14), %cl
cmpb $0x1, %cl
jne 0x1424d
cmpb $0x1, 0x1cc(%r14)
jne 0x1424d
movl 0x1c8(%r14), %edx
xorps %xmm1, %xmm1
cvtsi2sd %edx, %xmm1
shrl $0x1f, %edx
leaq 0x22d6c(%rip), %rsi     # 0x36fa0
addsd (%rsi,%rdx,8), %xmm1
cvttsd2si %xmm1, %edx
testl %edx, %edx
je 0x1424d
leaq 0x249ec(%rip), %rdi     # 0x38c34
jmp 0x149ae
testb %al, %al
je 0x1427b
movsd 0x210(%r14), %xmm1
xorpd %xmm2, %xmm2
xorl %edx, %edx
ucomisd %xmm1, %xmm2
seta %dl
leaq 0x22d32(%rip), %rsi     # 0x36fa0
addsd (%rsi,%rdx,8), %xmm1
cvttsd2si %xmm1, %edx
testl %edx, %edx
js 0x142b9
testb %cl, %cl
je 0x14429
movsd 0x140(%r14), %xmm1
xorpd %xmm2, %xmm2
xorl %edx, %edx
ucomisd %xmm1, %xmm2
seta %sil
orb %al, %cl
je 0x142b9
movb %sil, %dl
leaq 0x22cf8(%rip), %rcx     # 0x36fa0
addsd (%rcx,%rdx,8), %xmm1
cvttsd2si %xmm1, %ecx
testl %ecx, %ecx
jns 0x14431
leaq 0x249b1(%rip), %rdi     # 0x38c71
jmp 0x149ae
cmpb $0x0, 0x218(%r14)
je 0x144b7
movsd 0x210(%r14), %xmm0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x22cb0(%rip), %rcx     # 0x36fa0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %edi
callq 0xab10
jmp 0x146b8
cmpb $0x0, 0x218(%r14)
je 0x144c3
movsd 0x210(%r14), %xmm0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x22c72(%rip), %rcx     # 0x36fa0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %edi
callq 0xb4f0
jmp 0x146b8
cmpb $0x0, 0x218(%r14)
je 0x144cf
movsd 0x210(%r14), %xmm0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x22c34(%rip), %rcx     # 0x36fa0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %edi
callq 0xa5d0
jmp 0x146b8
cmpb $0x0, 0x139(%r14)
je 0x14411
movsd 0x140(%r14), %xmm0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x22bf6(%rip), %rcx     # 0x36fa0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %edi
testl %edi, %edi
js 0x14411
movsd 0x220(%r14), %xmm0
callq 0xac20
jmp 0x146b8
cmpb $0x0, 0x139(%r14)
je 0x1441d
movsd 0x140(%r14), %xmm0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x22baf(%rip), %rcx     # 0x36fa0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %edi
testl %edi, %edi
js 0x1441d
movsd 0x220(%r14), %xmm0
callq 0xb2b0
jmp 0x146b8
leaq 0x249b7(%rip), %rdi     # 0x38dcf
jmp 0x149ae
leaq 0x24a0f(%rip), %rdi     # 0x38e33
jmp 0x149ae
orb %al, %cl
je 0x142b9
testb %al, %al
je 0x144db
movsd 0x210(%r14), %xmm1
xorpd %xmm2, %xmm2
xorl %eax, %eax
ucomisd %xmm1, %xmm2
seta %al
leaq 0x22b4a(%rip), %r13     # 0x36fa0
addsd (%r13,%rax,8), %xmm1
cvttsd2si %xmm1, %edi
testl %edi, %edi
js 0x14521
xorl %edx, %edx
cmpb $0x1, 0x1cc(%r14)
jne 0x14491
movl 0x1c8(%r14), %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
shrl $0x1f, %eax
addsd (%r13,%rax,8), %xmm1
cvttsd2si %xmm1, %edx
cmpl $0x0, 0x624(%r15)
je 0x14530
leaq 0x2481c(%rip), %rdi     # 0x38cc2
jmp 0x149ae
leaq 0x246e2(%rip), %rdi     # 0x38b94
jmp 0x149ae
leaq 0x246ef(%rip), %rdi     # 0x38bad
jmp 0x149ae
leaq 0x2460d(%rip), %rdi     # 0x38ad7
jmp 0x149ae
leaq 0x2465e(%rip), %rdi     # 0x38b34
jmp 0x149ae
movsd 0x140(%r14), %xmm0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x22aa8(%rip), %r13     # 0x36fa0
addsd (%r13,%rax,8), %xmm0
cvttsd2si %xmm0, %edi
testl %edi, %edi
js 0x146b8
cmpl $0x0, 0x624(%r15)
je 0x14594
leaq 0x2480c(%rip), %rdi     # 0x38d28
jmp 0x149ae
leaq 0x24782(%rip), %rsi     # 0x38caa
movq %rbx, %rdi
jmp 0x149b9
xorpd %xmm1, %xmm1
maxsd %xmm1, %xmm0
movl $0x1, %esi
callq 0xa680
movl %eax, %r12d
cmpl $-0x1, %eax
je 0x145f2
testl %r12d, %r12d
jne 0x146ae
movb $0x1, %al
movb %al, 0xc681(%r15)
movsd 0x210(%r14), %xmm0
xorpd %xmm1, %xmm1
xorl %ecx, %ecx
ucomisd %xmm0, %xmm1
seta %cl
addsd (%r13,%rcx,8), %xmm0
cvttsd2si %xmm0, %ecx
movl %ecx, 0xc684(%r15)
movb %al, 0xc688(%r15)
jmp 0x146ae
xorpd %xmm0, %xmm0
xorl %esi, %esi
xorl %edx, %edx
callq 0xa680
movl %eax, %r12d
cmpl $-0x1, %eax
je 0x1464c
testl %r12d, %r12d
jne 0x146ae
movb $0x1, 0xc681(%r15)
movsd 0x140(%r14), %xmm0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
addsd (%r13,%rax,8), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0xc684(%r15)
leaq 0xc688(%r15), %r13
jmp 0x146a9
leaq 0x2470a(%rip), %rdi     # 0x38d03
callq 0xa1f0
movq %rbx, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xa850
movq 0x2f94e(%rip), %r13     # 0x43f60
movl $0x0, 0xd670(%r13)
leaq 0xc6d0(%r13), %rdi
leaq 0x2325c(%rip), %rsi     # 0x37887
movl $0x50, %edx
callq 0xa8a0
movw $0x0, 0xc71f(%r13)
movl $0x1, 0xd670(%r13)
jmp 0x146ae
leaq 0x24715(%rip), %rdi     # 0x38d68
callq 0xa1f0
movq %rbx, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xa850
movq 0x2f8f4(%rip), %r13     # 0x43f60
movl $0x0, 0xd670(%r13)
leaq 0xc6d0(%r13), %rdi
leaq 0x23202(%rip), %rsi     # 0x37887
movl $0x50, %edx
callq 0xa8a0
movb $0x0, 0xc71f(%r13)
movl $0x1, 0xd670(%r13)
addq $0xc720, %r13           # imm = 0xC720
movb $0x0, (%r13)
cmpl $-0x1, %r12d
je 0x149fc
movl 0x1f8(%r14), %eax
movl $0x5, %r12d
cmpl $-0x1, %eax
je 0x1479e
cmpl $0x6, %eax
jne 0x1475a
movq %rbx, %rdi
movq %r15, %rsi
callq 0xb2a0
movl %eax, %r13d
testl %eax, %eax
je 0x14751
movq 0x2f870(%rip), %r12     # 0x43f60
movslq 0xd670(%r12), %rax
cmpq $0x30, %rax
jg 0x1474e
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%r12,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x2316f(%rip), %rsi     # 0x37887
movl $0x50, %edx
callq 0xa8a0
movslq 0xd670(%r12), %rax
leaq (%rax,%rax,4), %rcx
shlq $0x4, %rcx
xorl %edx, %edx
movb %dl, 0xc71f(%r12,%rcx)
incl %eax
movl %eax, 0xd670(%r12)
movb %dl, 0xc720(%r12,%rcx)
movl %r13d, %r12d
testl %r13d, %r13d
jne 0x14a02
cmpl $0x3d, 0x1f8(%r14)
jne 0x1479e
movsd 0x220(%r14), %xmm0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x2281f(%rip), %rcx     # 0x36fa0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %edi
testl %edi, %edi
js 0x148b8
movl %edi, 0x5fc(%r15)
callq 0xb340
movl 0x1fc(%r14), %eax
cmpl $0x5, %eax
je 0x147cc
cmpl $0x4, %eax
je 0x147c0
cmpl $0x3, %eax
jne 0x147dd
callq 0xb2e0
movl $0x2, %eax
jmp 0x147d6
callq 0xb650
movl $0x3, %eax
jmp 0x147d6
callq 0xb5d0
movl $0x1, %eax
movl %eax, 0xc6cc(%r15)
movl 0x200(%r14), %eax
cmpl $0x9, %eax
je 0x14811
cmpl $0x8, %eax
je 0x14802
cmpl $0x7, %eax
jne 0x1482c
callq 0xa3c0
movb $0x1, 0x1797(%r15)
jmp 0x1482c
callq 0xb480
movb $0x1, 0x1688(%r15)
jmp 0x1482c
callq 0xb560
xorl %r13d, %r13d
movb %r13b, 0x1797(%r15)
callq 0xae50
movb %r13b, 0x1688(%r15)
movl 0x204(%r14), %eax
cmpl $0x31, %eax
je 0x14859
cmpl $0x30, %eax
jne 0x14881
cmpl $0x0, 0x624(%r15)
jne 0x1499a
callq 0xa560
callq 0xb6c0
movb $0x1, %al
jmp 0x14873
cmpl $0x0, 0x624(%r15)
jne 0x149a7
callq 0xa320
callq 0xb020
xorl %eax, %eax
movb %al, 0x674(%r15)
movb %al, 0xc6c8(%r15)
cmpl $0x32, 0x204(%r14)
jne 0x148da
movsd 0x210(%r14), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
movl 0x624(%r15), %eax
jne 0x148a7
jnp 0x148c4
testl %eax, %eax
jne 0x1499a
callq 0xa560
movb $0x1, %al
jmp 0x148d3
leaq 0x24592(%rip), %rdi     # 0x38e51
jmp 0x149ae
testl %eax, %eax
jne 0x149a7
callq 0xa320
xorl %eax, %eax
movb %al, 0x674(%r15)
cmpl $0x33, 0x204(%r14)
jne 0x14927
movsd 0x210(%r14), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
movl 0x624(%r15), %eax
jne 0x14900
jnp 0x14911
testl %eax, %eax
jne 0x1499a
callq 0xb6c0
movb $0x1, %al
jmp 0x14920
testl %eax, %eax
jne 0x149a7
callq 0xb020
xorl %eax, %eax
movb %al, 0xc6c8(%r15)
cmpl $0x34, 0x204(%r14)
jne 0x1496c
movsd 0x210(%r14), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
movl 0x624(%r15), %eax
jne 0x1494d
jnp 0x1495a
testl %eax, %eax
jne 0x1499a
callq 0xb330
movb $0x1, %al
jmp 0x14965
testl %eax, %eax
jne 0x149a7
callq 0xb3a0
xorl %eax, %eax
movb %al, 0x1b6b0(%r15)
cmpl $0x35, 0x204(%r14)
jne 0x14a2b
movsd 0x210(%r14), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
movl 0x624(%r15), %eax
jne 0x14996
jnp 0x149a3
testl %eax, %eax
je 0x14a14
leaq 0x244e5(%rip), %rdi     # 0x38e86
jmp 0x149ae
testl %eax, %eax
je 0x14a1d
leaq 0x24513(%rip), %rdi     # 0x38ec1
callq 0xa1f0
movq %rbx, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xa850
movq 0x2f599(%rip), %rbx     # 0x43f60
movl $0x0, 0xd670(%rbx)
leaq 0xc6d0(%rbx), %rdi
leaq 0x22ea8(%rip), %rsi     # 0x37887
movl $0x50, %edx
callq 0xa8a0
movw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
movl $0x5, %r12d
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0xb530
movb $0x1, %al
jmp 0x14a24
callq 0xb200
xorl %eax, %eax
movb %al, 0x1b6b1(%r15)
movslq 0x208(%r14), %rdi
cmpq $-0x1, %rdi
je 0x14acd
movq 0x2f595(%rip), %rax     # 0x43fd8
movq -0x320(%rax,%rdi,8), %r15
testq %r15, %r15
je 0x14a69
movsd 0x210(%r14), %xmm0
movsd 0x220(%r14), %xmm1
callq 0xaa20
jmp 0x14ac4
leaq 0x2448d(%rip), %rdi     # 0x38efd
callq 0xa1f0
movq %rbx, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xa850
movq 0x2f4d7(%rip), %rbx     # 0x43f60
movl $0x0, 0xd670(%rbx)
leaq 0xc6d0(%rbx), %rdi
leaq 0x22de6(%rip), %rsi     # 0x37887
movl $0x50, %edx
callq 0xa8a0
movw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
movl $0x5, %r12d
testq %r15, %r15
je 0x14a02
xorl %r12d, %r12d
jmp 0x14a02
nop