// File: /workspace/github_cpp_makefile_star2_O3/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 %r12
pushq %rbx
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movl 0x1f4(%rsi), %eax
addl $-0x3e, %eax
cmpl $0x6, %eax
ja 0x13c01
leaq 0x208f7(%rip), %rcx     # 0x33fe0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x0, 0x624(%r15)
je 0x1399a
leaq 0x22394(%rip), %rdi     # 0x35a9b
jmp 0x13ef0
movb 0x218(%r14), %al
cmpb $0x1, %al
jne 0x137e5
cmpb $0x1, 0x139(%r14)
jne 0x137e5
leaq 0x22496(%rip), %rdi     # 0x35bc6
jmp 0x13ef0
cmpl $0x0, 0x624(%r15)
jne 0x1378b
cmpb $0x0, 0x218(%r14)
je 0x13ac0
movsd 0x210(%r14), %xmm0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x20836(%rip), %rcx     # 0x33fa0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %edi
callq 0xb080
jmp 0x13c01
cmpl $0x0, 0x624(%r15)
je 0x1395c
leaq 0x223bb(%rip), %rdi     # 0x35b4d
jmp 0x13ef0
cmpl $0x0, 0x624(%r15)
je 0x139d8
leaq 0x22344(%rip), %rdi     # 0x35af0
jmp 0x13ef0
cmpl $0x0, 0x624(%r15)
je 0x13a16
leaq 0x225c6(%rip), %rdi     # 0x35d8c
jmp 0x13ef0
cmpl $0x0, 0x624(%r15)
je 0x13a61
leaq 0x2260d(%rip), %rdi     # 0x35ded
jmp 0x13ef0
movsd 0x220(%r14), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jb 0x13833
cmpb $0x1, 0x1cc(%r14)
jne 0x13833
movl 0x1c8(%r14), %ecx
xorps %xmm1, %xmm1
cvtsi2sd %ecx, %xmm1
shrl $0x1f, %ecx
leaq 0x20786(%rip), %rdx     # 0x33fa0
addsd (%rdx,%rcx,8), %xmm1
cvttsd2si %xmm1, %ecx
testl %ecx, %ecx
jle 0x13833
leaq 0x223d6(%rip), %rdi     # 0x35c04
jmp 0x13ef0
movb 0x139(%r14), %cl
cmpb $0x1, %cl
jne 0x1387a
cmpb $0x1, 0x1cc(%r14)
jne 0x1387a
movl 0x1c8(%r14), %edx
xorps %xmm1, %xmm1
cvtsi2sd %edx, %xmm1
shrl $0x1f, %edx
leaq 0x2073f(%rip), %rsi     # 0x33fa0
addsd (%rsi,%rdx,8), %xmm1
cvttsd2si %xmm1, %edx
testl %edx, %edx
je 0x1387a
leaq 0x223bf(%rip), %rdi     # 0x35c34
jmp 0x13ef0
testb %al, %al
je 0x138ac
movsd 0x210(%r14), %xmm1
xorpd %xmm2, %xmm2
xorl %edx, %edx
ucomisd %xmm1, %xmm2
seta %dl
leaq 0x20705(%rip), %rsi     # 0x33fa0
addsd (%rsi,%rdx,8), %xmm1
cvttsd2si %xmm1, %edx
testl %edx, %edx
js 0x13b39
testb %cl, %cl
je 0x138de
movsd 0x140(%r14), %xmm1
xorpd %xmm2, %xmm2
xorl %edx, %edx
ucomisd %xmm1, %xmm2
seta %dl
leaq 0x206d3(%rip), %rsi     # 0x33fa0
addsd (%rsi,%rdx,8), %xmm1
cvttsd2si %xmm1, %edx
testl %edx, %edx
js 0x13b39
testb %al, %al
je 0x13af0
je 0x13af4
movsd 0x210(%r14), %xmm1
xorpd %xmm2, %xmm2
xorl %eax, %eax
ucomisd %xmm1, %xmm2
seta %al
leaq 0x20697(%rip), %r12     # 0x33fa0
addsd (%r12,%rax,8), %xmm1
cvttsd2si %xmm1, %edi
testl %edi, %edi
js 0x13b9c
xorl %edx, %edx
cmpb $0x1, 0x1cc(%r14)
jne 0x13942
movl 0x1c8(%r14), %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
shrl $0x1f, %eax
addsd (%r12,%rax,8), %xmm1
cvttsd2si %xmm1, %edx
cmpl $0x0, 0x624(%r15)
je 0x13bab
leaq 0x2236b(%rip), %rdi     # 0x35cc2
jmp 0x13ef0
cmpb $0x0, 0x218(%r14)
je 0x13acc
movsd 0x210(%r14), %xmm0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x20619(%rip), %rcx     # 0x33fa0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %edi
callq 0xab10
jmp 0x13c01
cmpb $0x0, 0x218(%r14)
je 0x13ad8
movsd 0x210(%r14), %xmm0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x205db(%rip), %rcx     # 0x33fa0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %edi
callq 0xb4f0
jmp 0x13c01
cmpb $0x0, 0x218(%r14)
je 0x13ae4
movsd 0x210(%r14), %xmm0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x2059d(%rip), %rcx     # 0x33fa0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %edi
callq 0xa5d0
jmp 0x13c01
cmpb $0x0, 0x139(%r14)
je 0x13aa8
movsd 0x140(%r14), %xmm0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x2055f(%rip), %rcx     # 0x33fa0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %edi
testl %edi, %edi
js 0x13aa8
movsd 0x220(%r14), %xmm0
callq 0xac20
jmp 0x13c01
cmpb $0x0, 0x139(%r14)
je 0x13ab4
movsd 0x140(%r14), %xmm0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x20518(%rip), %rcx     # 0x33fa0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %edi
testl %edi, %edi
js 0x13ab4
movsd 0x220(%r14), %xmm0
callq 0xb2b0
jmp 0x13c01
leaq 0x22320(%rip), %rdi     # 0x35dcf
jmp 0x13ef0
leaq 0x22378(%rip), %rdi     # 0x35e33
jmp 0x13ef0
leaq 0x220cd(%rip), %rdi     # 0x35b94
jmp 0x13ef0
leaq 0x220da(%rip), %rdi     # 0x35bad
jmp 0x13ef0
leaq 0x21ff8(%rip), %rdi     # 0x35ad7
jmp 0x13ef0
leaq 0x22049(%rip), %rdi     # 0x35b34
jmp 0x13ef0
testb %cl, %cl
je 0x13b39
movsd 0x140(%r14), %xmm0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x2048f(%rip), %r12     # 0x33fa0
addsd (%r12,%rax,8), %xmm0
cvttsd2si %xmm0, %edi
testl %edi, %edi
js 0x13c01
cmpl $0x0, 0x624(%r15)
je 0x13b45
leaq 0x221f4(%rip), %rdi     # 0x35d28
jmp 0x13ef0
leaq 0x22131(%rip), %rdi     # 0x35c71
jmp 0x13ef0
xorpd %xmm0, %xmm0
xorl %esi, %esi
xorl %edx, %edx
callq 0xa680
cmpl $-0x1, %eax
je 0x13fa4
testl %eax, %eax
jne 0x13c01
movb $0x1, 0xc681(%r15)
movsd 0x140(%r14), %xmm0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
addsd (%r12,%rax,8), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0xc684(%r15)
movb $0x0, 0xc688(%r15)
jmp 0x13c01
leaq 0x22107(%rip), %rsi     # 0x35caa
movq %rbx, %rdi
jmp 0x13efb
xorpd %xmm1, %xmm1
maxsd %xmm1, %xmm0
movl $0x1, %esi
callq 0xa680
cmpl $-0x1, %eax
je 0x13fb0
testl %eax, %eax
jne 0x13c01
movb $0x1, %al
movb %al, 0xc681(%r15)
movsd 0x210(%r14), %xmm0
xorpd %xmm1, %xmm1
xorl %ecx, %ecx
ucomisd %xmm0, %xmm1
seta %cl
addsd (%r12,%rcx,8), %xmm0
cvttsd2si %xmm0, %ecx
movl %ecx, 0xc684(%r15)
movb %al, 0xc688(%r15)
movl 0x1f8(%r14), %eax
cmpl $-0x1, %eax
je 0x13cda
cmpl $0x6, %eax
jne 0x13c9b
movq %rbx, %rdi
movq %r15, %rsi
callq 0xb2a0
testl %eax, %eax
je 0x13c94
movl %eax, %r12d
movq 0x2d32d(%rip), %rbx     # 0x40f60
movslq 0xd670(%rbx), %rax
cmpq $0x30, %rax
jg 0x13f3a
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%rbx,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x20c29(%rip), %rsi     # 0x34887
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 0x13f3a
movl 0x1f8(%r14), %eax
cmpl $0x3d, %eax
jne 0x13cda
movsd 0x220(%r14), %xmm0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x202e3(%rip), %rcx     # 0x33fa0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %edi
testl %edi, %edi
js 0x13df6
movl %edi, 0x5fc(%r15)
callq 0xb340
movl 0x1fc(%r14), %eax
cmpl $0x5, %eax
je 0x13d08
cmpl $0x4, %eax
je 0x13cfc
cmpl $0x3, %eax
jne 0x13d19
callq 0xb2e0
movl $0x2, %eax
jmp 0x13d12
callq 0xb650
movl $0x3, %eax
jmp 0x13d12
callq 0xb5d0
movl $0x1, %eax
movl %eax, 0xc6cc(%r15)
movl 0x200(%r14), %eax
cmpl $0x9, %eax
je 0x13d4d
cmpl $0x8, %eax
je 0x13d3e
cmpl $0x7, %eax
jne 0x13d68
callq 0xa3c0
movb $0x1, 0x1797(%r15)
jmp 0x13d68
callq 0xb480
movb $0x1, 0x1688(%r15)
jmp 0x13d68
callq 0xb560
xorl %r12d, %r12d
movb %r12b, 0x1797(%r15)
callq 0xae50
movb %r12b, 0x1688(%r15)
movl 0x204(%r14), %eax
cmpl $0x31, %eax
je 0x13d95
cmpl $0x30, %eax
jne 0x13dc4
cmpl $0x0, 0x624(%r15)
jne 0x13edc
callq 0xa560
callq 0xb6c0
movb $0x1, %al
jmp 0x13daf
cmpl $0x0, 0x624(%r15)
jne 0x13ee9
callq 0xa320
callq 0xb020
xorl %eax, %eax
movb %al, 0x674(%r15)
movb %al, 0xc6c8(%r15)
movl 0x204(%r14), %eax
cmpl $0x32, %eax
jne 0x13e18
movsd 0x210(%r14), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
movl 0x624(%r15), %eax
jne 0x13de5
jnp 0x13e02
testl %eax, %eax
jne 0x13edc
callq 0xa560
movb $0x1, %al
jmp 0x13e11
leaq 0x22054(%rip), %rdi     # 0x35e51
jmp 0x13ef0
testl %eax, %eax
jne 0x13ee9
callq 0xa320
xorl %eax, %eax
movb %al, 0x674(%r15)
movl 0x204(%r14), %eax
cmpl $0x33, %eax
jne 0x13e6e
movsd 0x210(%r14), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
movl 0x624(%r15), %eax
jne 0x13e40
jnp 0x13e51
testl %eax, %eax
jne 0x13edc
callq 0xb6c0
movb $0x1, %al
jmp 0x13e60
testl %eax, %eax
jne 0x13ee9
callq 0xb020
xorl %eax, %eax
movb %al, 0xc6c8(%r15)
movl 0x204(%r14), %eax
cmpl $0x34, %eax
jne 0x13eae
movsd 0x210(%r14), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
movl 0x624(%r15), %eax
jne 0x13e8f
jnp 0x13e9c
testl %eax, %eax
jne 0x13edc
callq 0xb330
movb $0x1, %al
jmp 0x13ea7
testl %eax, %eax
jne 0x13ee9
callq 0xb3a0
xorl %eax, %eax
movb %al, 0x1b6b0(%r15)
cmpl $0x35, 0x204(%r14)
jne 0x13f5d
movsd 0x210(%r14), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
movl 0x624(%r15), %eax
jne 0x13ed8
jnp 0x13ee5
testl %eax, %eax
je 0x13f46
leaq 0x21fa3(%rip), %rdi     # 0x35e86
jmp 0x13ef0
testl %eax, %eax
je 0x13f4f
leaq 0x21fd1(%rip), %rdi     # 0x35ec1
callq 0xa1f0
movq %rbx, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xa850
movq 0x2d057(%rip), %rbx     # 0x40f60
leaq 0xc6d0(%rbx), %rdi
leaq 0x20970(%rip), %rsi     # 0x34887
movl $0x50, %edx
callq 0xa8a0
movw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
movl $0x5, %r12d
movl %r12d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
callq 0xb530
movb $0x1, %al
jmp 0x13f56
callq 0xb200
xorl %eax, %eax
movb %al, 0x1b6b1(%r15)
movslq 0x208(%r14), %rdi
xorl %r12d, %r12d
cmpq $-0x1, %rdi
je 0x13f3a
movq 0x2d064(%rip), %rax     # 0x40fd8
cmpq $0x0, -0x320(%rax,%rdi,8)
je 0x13f98
movsd 0x210(%r14), %xmm0
movsd 0x220(%r14), %xmm1
callq 0xaa20
jmp 0x13f3a
leaq 0x21f5e(%rip), %rdi     # 0x35efd
jmp 0x13ef0
leaq 0x21dbd(%rip), %rdi     # 0x35d68
jmp 0x13ef0
leaq 0x21d4c(%rip), %rdi     # 0x35d03
jmp 0x13ef0