// File: /workspace/github_cpp_makefile_star2_O2/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 0x8cf6(%rip), %rdi      # 0xe2f0
cmpl $0x2, %eax
je 0x5704
cmpl $0x1, %eax
jne 0x57fd
testq %rdi, %rdi
jne 0x5622
movq 0x79a0(%rip), %rax      # 0xcfb8
movq (%rax), %rdi
movq %rdi, 0x8cce(%rip)      # 0xe2f0
movl 0x7b84(%rip), %edx      # 0xd1ac
leal 0x1(%rdx), %eax
movl %eax, 0x7b7b(%rip)      # 0xd1ac
leaq 0x3be0(%rip), %rsi      # 0x9218
xorl %eax, %eax
callq 0x4240
callq 0x5320
movq 0x8ca5(%rip), %rcx      # 0xe2f0
testq %rcx, %rcx
jne 0x5661
movq 0x7961(%rip), %rax      # 0xcfb8
movq (%rax), %rcx
movq %rcx, 0x8c8f(%rip)      # 0xe2f0
leaq 0x3c04(%rip), %rdi      # 0x926c
pushq $0x25
popq %rsi
pushq $0x1
popq %rdx
callq 0x42f0
cmpb $0x0, 0xa5d6(%rip)      # 0xfc50
jne 0x57fb
movb $0x1, 0xa5c9(%rip)      # 0xfc50
movsd 0xa569(%rip), %xmm0     # 0xfbf8
movsd 0x3b51(%rip), %xmm1     # 0x91e8
divsd %xmm1, %xmm0
movsd %xmm0, 0xa555(%rip)     # 0xfbf8
movsd 0xa55d(%rip), %xmm0     # 0xfc08
divsd %xmm1, %xmm0
movsd %xmm0, 0xa551(%rip)     # 0xfc08
movsd 0xa559(%rip), %xmm0     # 0xfc18
divsd %xmm1, %xmm0
movsd %xmm0, 0xa54d(%rip)     # 0xfc18
movsd 0xa51d(%rip), %xmm0     # 0xfbf0
divsd %xmm1, %xmm0
movsd %xmm0, 0xa511(%rip)     # 0xfbf0
movsd 0xa519(%rip), %xmm0     # 0xfc00
divsd %xmm1, %xmm0
movsd %xmm0, 0xa50d(%rip)     # 0xfc00
movsd 0xa515(%rip), %xmm0     # 0xfc10
divsd %xmm1, %xmm0
jmp 0x57f3
testq %rdi, %rdi
jne 0x571a
movq 0x78a8(%rip), %rax      # 0xcfb8
movq (%rax), %rdi
movq %rdi, 0x8bd6(%rip)      # 0xe2f0
movl 0x7a8c(%rip), %edx      # 0xd1ac
leal 0x1(%rdx), %eax
movl %eax, 0x7a83(%rip)      # 0xd1ac
leaq 0x3ae8(%rip), %rsi      # 0x9218
xorl %eax, %eax
callq 0x4240
callq 0x5320
movq 0x8bad(%rip), %rcx      # 0xe2f0
testq %rcx, %rcx
jne 0x5759
movq 0x7869(%rip), %rax      # 0xcfb8
movq (%rax), %rcx
movq %rcx, 0x8b97(%rip)      # 0xe2f0
leaq 0x3b32(%rip), %rdi      # 0x9292
pushq $0x21
popq %rsi
pushq $0x1
popq %rdx
callq 0x42f0
cmpb $0x1, 0xa4de(%rip)      # 0xfc50
jne 0x57fb
movb $0x0, 0xa4d1(%rip)      # 0xfc50
movsd 0x3a61(%rip), %xmm0     # 0x91e8
movsd 0xa469(%rip), %xmm1     # 0xfbf8
mulsd %xmm0, %xmm1
movsd %xmm1, 0xa45d(%rip)     # 0xfbf8
movsd 0xa465(%rip), %xmm1     # 0xfc08
mulsd %xmm0, %xmm1
movsd %xmm1, 0xa459(%rip)     # 0xfc08
movsd 0xa461(%rip), %xmm1     # 0xfc18
mulsd %xmm0, %xmm1
movsd %xmm1, 0xa455(%rip)     # 0xfc18
movsd 0xa425(%rip), %xmm1     # 0xfbf0
mulsd %xmm0, %xmm1
movsd %xmm1, 0xa419(%rip)     # 0xfbf0
movsd 0xa421(%rip), %xmm1     # 0xfc00
mulsd %xmm0, %xmm1
movsd %xmm1, 0xa415(%rip)     # 0xfc00
mulsd 0xa41d(%rip), %xmm0     # 0xfc10
movsd %xmm0, 0xa415(%rip)     # 0xfc10
popq %rbp
retq
testq %rdi, %rdi
jne 0x5813
movq 0x77af(%rip), %rax      # 0xcfb8
movq (%rax), %rdi
movq %rdi, 0x8add(%rip)      # 0xe2f0
movl 0x7993(%rip), %edx      # 0xd1ac
leal 0x1(%rdx), %eax
movl %eax, 0x798a(%rip)      # 0xd1ac
leaq 0x39ef(%rip), %rsi      # 0x9218
xorl %eax, %eax
callq 0x4240
callq 0x5320
movq 0x8ab4(%rip), %rcx      # 0xe2f0
testq %rcx, %rcx
jne 0x5852
movq 0x7770(%rip), %rax      # 0xcfb8
movq (%rax), %rcx
movq %rcx, 0x8a9e(%rip)      # 0xe2f0
leaq 0x3a5b(%rip), %rdi      # 0x92b4
pushq $0x1a
popq %rsi
pushq $0x1
popq %rdx
popq %rbp
jmp 0x42f0