// File: sundale[P]gcode/rs274ngc/interp_internal.cc
// Function: Interp::close_and_downcase(char*)
int Interp::close_and_downcase(char *line)       //!< string: one line of NC code
{
  int m;
  int n;
  int comment;
  char item;
  comment = 0;
  for (n = 0, m = 0; (item = line[m]) != (char) NULL; m++) {
    if (comment) {
      line[n++] = item;
      if (item == ')') {
        comment = 0;
      } else if (item == '(')
        ERS(NCE_NESTED_COMMENT_FOUND);
    } else if ((item == ' ') || (item == '\t') || (item == '\r'));
    /* don't copy blank or tab or CR */
    else if (item == '\n') {    /* don't copy newline            *//* but check null follows        */
      CHKS((line[m + 1] != 0), NCE_NULL_MISSING_AFTER_NEWLINE);
    } else if ((64 < item) && (item < 91)) {    /* downcase upper case letters */
      line[n++] = (32 + item);
    } else if (item == '(') {   /* comment is starting */
      comment = 1;
      line[n++] = item;
    } else {
      line[n++] = item;         /* copy anything else */
    }
  }
  CHKS((comment), NCE_UNCLOSED_COMMENT_FOUND);
  line[n] = 0;
  return INTERP_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x25(%rbp)
movsbl %al, %eax
cmpl $0x0, %eax
je 0x5a3e9
cmpl $0x0, -0x24(%rbp)
je 0x5a237
movb -0x25(%rbp), %dl
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x20(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movsbl -0x25(%rbp), %eax
cmpl $0x29, %eax
jne 0x5a14e
movl $0x0, -0x24(%rbp)
jmp 0x5a232
movsbl -0x25(%rbp), %eax
cmpl $0x28, %eax
jne 0x5a230
jmp 0x5a15d
leaq 0x22c50(%rip), %rdi     # 0x7cdb4
callq 0x10380
movq -0x30(%rbp), %rdi
movq %rax, %rsi
movb $0x0, %al
callq 0x10df0
movq 0x2cde2(%rip), %rax     # 0x86f60
movl $0x0, 0xd670(%rax)
movq 0x2cdd1(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rax
movq 0x2cdc3(%rip), %rdi     # 0x86f60
addq $0xc6d0, %rdi           # imm = 0xC6D0
imulq $0x50, %rax, %rax
addq %rax, %rdi
leaq 0x22c17(%rip), %rsi     # 0x7cdc9
movl $0x50, %edx
callq 0x10840
movq 0x2cd9d(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x2cd8f(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4f(%rax)
movq 0x2cd77(%rip), %rax     # 0x86f60
movl 0xd670(%rax), %ecx
addl $0x1, %ecx
movq 0x2cd67(%rip), %rax     # 0x86f60
movl %ecx, 0xd670(%rax)
movq 0x2cd5a(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x2cd4c(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, (%rax)
movl $0x5, -0x4(%rbp)
jmp 0x5a4dc
jmp 0x5a232
jmp 0x5a3d9
movsbl -0x25(%rbp), %eax
cmpl $0x20, %eax
je 0x5a252
movsbl -0x25(%rbp), %eax
cmpl $0x9, %eax
je 0x5a252
movsbl -0x25(%rbp), %eax
cmpl $0xd, %eax
jne 0x5a257
jmp 0x5a3d7
movsbl -0x25(%rbp), %eax
cmpl $0xa, %eax
jne 0x5a359
jmp 0x5a266
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x5a355
jmp 0x5a282
leaq 0x22b67(%rip), %rdi     # 0x7cdf0
callq 0x10380
movq -0x30(%rbp), %rdi
movq %rax, %rsi
movb $0x0, %al
callq 0x10df0
movq 0x2ccbd(%rip), %rax     # 0x86f60
movl $0x0, 0xd670(%rax)
movq 0x2ccac(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rax
movq 0x2cc9e(%rip), %rdi     # 0x86f60
addq $0xc6d0, %rdi           # imm = 0xC6D0
imulq $0x50, %rax, %rax
addq %rax, %rdi
leaq 0x22af2(%rip), %rsi     # 0x7cdc9
movl $0x50, %edx
callq 0x10840
movq 0x2cc78(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x2cc6a(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4f(%rax)
movq 0x2cc52(%rip), %rax     # 0x86f60
movl 0xd670(%rax), %ecx
addl $0x1, %ecx
movq 0x2cc42(%rip), %rax     # 0x86f60
movl %ecx, 0xd670(%rax)
movq 0x2cc35(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x2cc27(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, (%rax)
movl $0x5, -0x4(%rbp)
jmp 0x5a4dc
jmp 0x5a357
jmp 0x5a3d5
movsbl -0x25(%rbp), %ecx
movl $0x40, %eax
cmpl %ecx, %eax
jge 0x5a38f
movsbl -0x25(%rbp), %eax
cmpl $0x5b, %eax
jge 0x5a38f
movsbl -0x25(%rbp), %eax
addl $0x20, %eax
movb %al, %dl
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x20(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
jmp 0x5a3d3
movsbl -0x25(%rbp), %eax
cmpl $0x28, %eax
jne 0x5a3b9
movl $0x1, -0x24(%rbp)
movb -0x25(%rbp), %dl
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x20(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
jmp 0x5a3d1
movb -0x25(%rbp), %dl
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x20(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
jmp 0x5a3d3
jmp 0x5a3d5
jmp 0x5a3d7
jmp 0x5a3d9
jmp 0x5a3db
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x5a0fd
jmp 0x5a3eb
cmpl $0x0, -0x24(%rbp)
je 0x5a4c7
jmp 0x5a3f7
leaq 0x22a0d(%rip), %rdi     # 0x7ce0b
callq 0x10380
movq -0x30(%rbp), %rdi
movq %rax, %rsi
movb $0x0, %al
callq 0x10df0
movq 0x2cb48(%rip), %rax     # 0x86f60
movl $0x0, 0xd670(%rax)
movq 0x2cb37(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rax
movq 0x2cb29(%rip), %rdi     # 0x86f60
addq $0xc6d0, %rdi           # imm = 0xC6D0
imulq $0x50, %rax, %rax
addq %rax, %rdi
leaq 0x2297d(%rip), %rsi     # 0x7cdc9
movl $0x50, %edx
callq 0x10840
movq 0x2cb03(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x2caf5(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4f(%rax)
movq 0x2cadd(%rip), %rax     # 0x86f60
movl 0xd670(%rax), %ecx
addl $0x1, %ecx
movq 0x2cacd(%rip), %rax     # 0x86f60
movl %ecx, 0xd670(%rax)
movq 0x2cac0(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x2cab2(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, (%rax)
movl $0x5, -0x4(%rbp)
jmp 0x5a4dc
jmp 0x5a4c9
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)