// File: /workspace/github_cpp_makefile_star2_O3/sundale[P]gcode/saicanon.cc
// Function: USE_LENGTH_UNITS(int)
void USE_LENGTH_UNITS(CANON_UNITS in_unit)
{
  if (in_unit == CANON_UNITS_INCHES)
    {
      PRINT0("USE_LENGTH_UNITS(CANON_UNITS_INCHES)\n");
      if (_length_unit_type == CANON_UNITS_MM)
        {
          _length_unit_type = CANON_UNITS_INCHES;
          _length_unit_factor = 25.4;
          _program_origin_x = (_program_origin_x / 25.4);
          _program_origin_y = (_program_origin_y / 25.4);
          _program_origin_z = (_program_origin_z / 25.4);
          _program_position_x = (_program_position_x / 25.4);
          _program_position_y = (_program_position_y / 25.4);
          _program_position_z = (_program_position_z / 25.4);
        }
    }
  else if (in_unit == CANON_UNITS_MM)
    {
      PRINT0("USE_LENGTH_UNITS(CANON_UNITS_MM)\n");
      if (_length_unit_type == CANON_UNITS_INCHES)
        {
          _length_unit_type = CANON_UNITS_MM;
          _length_unit_factor = 1.0;
          _program_origin_x = (_program_origin_x * 25.4);
          _program_origin_y = (_program_origin_y * 25.4);
          _program_origin_z = (_program_origin_z * 25.4);
          _program_position_x = (_program_position_x * 25.4);
          _program_position_y = (_program_position_y * 25.4);
          _program_position_z = (_program_position_z * 25.4);
        }
    }
  else
    PRINT0("USE_LENGTH_UNITS(UNKNOWN)\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, %eax
movq 0x8b12(%rip), %rdi      # 0xe2f0
cmpl $0x2, %eax
je 0x58ec
cmpl $0x1, %eax
jne 0x59e9
testq %rdi, %rdi
jne 0x5806
movq 0x77bc(%rip), %rax      # 0xcfb8
movq (%rax), %rdi
movq %rdi, 0x8aea(%rip)      # 0xe2f0
movl 0x7998(%rip), %edx      # 0xd1a4
leal 0x1(%rdx), %eax
movl %eax, 0x798f(%rip)      # 0xd1a4
leaq 0x39fc(%rip), %rsi      # 0x9218
xorl %eax, %eax
callq 0x4230
callq 0x54d0
movq 0x8ac1(%rip), %rcx      # 0xe2f0
testq %rcx, %rcx
jne 0x5845
movq 0x777d(%rip), %rax      # 0xcfb8
movq (%rax), %rcx
movq %rcx, 0x8aab(%rip)      # 0xe2f0
leaq 0x3a20(%rip), %rdi      # 0x926c
movl $0x25, %esi
movl $0x1, %edx
callq 0x42e0
cmpb $0x0, 0xa3ee(%rip)      # 0xfc50
jne 0x59e7
movb $0x1, 0xa3e1(%rip)      # 0xfc50
movsd 0xa381(%rip), %xmm0     # 0xfbf8
movsd 0x3969(%rip), %xmm1     # 0x91e8
divsd %xmm1, %xmm0
movsd %xmm0, 0xa36d(%rip)     # 0xfbf8
movsd 0xa375(%rip), %xmm0     # 0xfc08
divsd %xmm1, %xmm0
movsd %xmm0, 0xa369(%rip)     # 0xfc08
movsd 0xa371(%rip), %xmm0     # 0xfc18
divsd %xmm1, %xmm0
movsd %xmm0, 0xa365(%rip)     # 0xfc18
movsd 0xa335(%rip), %xmm0     # 0xfbf0
divsd %xmm1, %xmm0
movsd %xmm0, 0xa329(%rip)     # 0xfbf0
movsd 0xa331(%rip), %xmm0     # 0xfc00
divsd %xmm1, %xmm0
movsd %xmm0, 0xa325(%rip)     # 0xfc00
movsd 0xa32d(%rip), %xmm0     # 0xfc10
divsd %xmm1, %xmm0
jmp 0x59df
testq %rdi, %rdi
jne 0x5902
movq 0x76c0(%rip), %rax      # 0xcfb8
movq (%rax), %rdi
movq %rdi, 0x89ee(%rip)      # 0xe2f0
movl 0x789c(%rip), %edx      # 0xd1a4
leal 0x1(%rdx), %eax
movl %eax, 0x7893(%rip)      # 0xd1a4
leaq 0x3900(%rip), %rsi      # 0x9218
xorl %eax, %eax
callq 0x4230
callq 0x54d0
movq 0x89c5(%rip), %rcx      # 0xe2f0
testq %rcx, %rcx
jne 0x5941
movq 0x7681(%rip), %rax      # 0xcfb8
movq (%rax), %rcx
movq %rcx, 0x89af(%rip)      # 0xe2f0
leaq 0x394a(%rip), %rdi      # 0x9292
movl $0x21, %esi
movl $0x1, %edx
callq 0x42e0
cmpb $0x1, 0xa2f2(%rip)      # 0xfc50
jne 0x59e7
movb $0x0, 0xa2e5(%rip)      # 0xfc50
movsd 0x3875(%rip), %xmm0     # 0x91e8
movsd 0xa27d(%rip), %xmm1     # 0xfbf8
mulsd %xmm0, %xmm1
movsd %xmm1, 0xa271(%rip)     # 0xfbf8
movsd 0xa279(%rip), %xmm1     # 0xfc08
mulsd %xmm0, %xmm1
movsd %xmm1, 0xa26d(%rip)     # 0xfc08
movsd 0xa275(%rip), %xmm1     # 0xfc18
mulsd %xmm0, %xmm1
movsd %xmm1, 0xa269(%rip)     # 0xfc18
movsd 0xa239(%rip), %xmm1     # 0xfbf0
mulsd %xmm0, %xmm1
movsd %xmm1, 0xa22d(%rip)     # 0xfbf0
movsd 0xa235(%rip), %xmm1     # 0xfc00
mulsd %xmm0, %xmm1
movsd %xmm1, 0xa229(%rip)     # 0xfc00
mulsd 0xa231(%rip), %xmm0     # 0xfc10
movsd %xmm0, 0xa229(%rip)     # 0xfc10
popq %rbp
retq
testq %rdi, %rdi
jne 0x59ff
movq 0x75c3(%rip), %rax      # 0xcfb8
movq (%rax), %rdi
movq %rdi, 0x88f1(%rip)      # 0xe2f0
movl 0x779f(%rip), %edx      # 0xd1a4
leal 0x1(%rdx), %eax
movl %eax, 0x7796(%rip)      # 0xd1a4
leaq 0x3803(%rip), %rsi      # 0x9218
xorl %eax, %eax
callq 0x4230
callq 0x54d0
movq 0x88c8(%rip), %rcx      # 0xe2f0
testq %rcx, %rcx
jne 0x5a3e
movq 0x7584(%rip), %rax      # 0xcfb8
movq (%rax), %rcx
movq %rcx, 0x88b2(%rip)      # 0xe2f0
leaq 0x386f(%rip), %rdi      # 0x92b4
movl $0x1a, %esi
movl $0x1, %edx
popq %rbp
jmp 0x42e0