// File: /workspace/github_cpp_makefile_star2_O2/rofl0r[P]ascc/cs_prepro.cpp
// Function: remove_comments(char*)
void remove_comments(char*trf) {
  char tbuffer[MAX_LINE_LENGTH];
  if (in_comment) {  // already in a multi-line comment
    char*cmend=strstr(trf,"*/");
    if (cmend!=NULL) {
      cmend+=2;
      strcpy(tbuffer,cmend);
      strcpy(trf,tbuffer);
      in_comment=0;
      }
    else {
      trf[0]=0;
      return;   // still in the comment
      }
    }
  char*strpt = trf;
  char*comment_start = trf;
  while (strpt[0]!=0) {
    if ((strpt[0] == '\"') && (in_comment == 0)) {
      strpt++;
      while ((strpt[0] != '\"') && (strpt[0]!=0)) strpt++;
      if (strpt[0]==0) break;
      }

    if ((strncmp(strpt,"//",2)==0) && (in_comment == 0)) {
      strpt[0]=0;  // chop off the end of the line
      break;
      }
    if ((strncmp(strpt,"/*",2)==0) && (in_comment == 0)) {
      in_comment = 1;
      comment_start = strpt;
      strpt += 2;
    }
    if ((strncmp(strpt,"*/",2)==0) && (in_comment == 1)) {
      comment_start[0]=0;
      strcpy(tbuffer,trf);
      int carryonat = strlen(tbuffer);
      strcat(tbuffer,&strpt[2]);
      strcpy(trf,tbuffer);
      strpt = &trf[carryonat];
      in_comment = 0;
    }
    else if (strpt[0] != 0)
      strpt++;
  }
  if (in_comment) comment_start[0] = 0;

  // remove leading spaces and tabs on line
  strpt = trf;
  while ((strpt[0] == ' ') || (strpt[0] == '\t'))
    strpt++;
  strcpy(tbuffer,strpt);
  strcpy(trf,tbuffer);

  // remove trailing spaces on line
  if (strlen(trf) > 0) {
    while (trf[strlen(trf)-1]==' ') trf[strlen(trf)-1]=0;
    }
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f8, %rsp            # imm = 0x1F8
movq %rdi, %rbx
cmpl $0x0, 0x1bb68(%rip)     # 0x314a4
je 0x1597a
leaq 0x595c(%rip), %rsi      # 0x1b2a1
movq %rbx, %rdi
callq 0x30d0
testq %rax, %rax
je 0x15a90
addq $0x2, %rax
movq %rsp, %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x32c0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x32c0
andl $0x0, 0x1bb2a(%rip)     # 0x314a4
xorl %eax, %eax
pushq $0x1
popq %rbp
movq %rsp, %r14
movq %rbx, %rcx
movq %rbx, %r13
movb (%rcx), %dl
testb %dl, %dl
je 0x15a9e
cmpb $0x22, %dl
sete %sil
testl %eax, %eax
sete %dil
andb %sil, %dil
cmpb $0x1, %dil
jne 0x159c3
movzbl 0x1(%rcx), %edx
testl %edx, %edx
je 0x15aa7
incq %rcx
cmpl $0x22, %edx
jne 0x159a8
movb $0x2a, %dl
jmp 0x15a84
cmpb $0x2f, %dl
jne 0x15a16
testl %eax, %eax
sete %dl
cmpb $0x2f, 0x1(%rcx)
sete %sil
andb %dl, %sil
cmpb $0x1, %sil
je 0x15a95
testl %eax, %eax
sete %dl
cmpb $0x2a, 0x1(%rcx)
sete %sil
andb %dl, %sil
movb $0x2a, %dl
cmpb $0x1, %sil
jne 0x15a84
movl $0x1, 0x1ba9c(%rip)     # 0x314a4
leaq 0x2(%rcx), %r15
movb 0x2(%rcx), %dl
movl %ebp, %eax
movq %rcx, %r13
jmp 0x15a19
movq %rcx, %r15
cmpb $0x2a, %dl
jne 0x15a81
cmpb $0x2f, 0x1(%r15)
sete %cl
cmpl $0x1, %eax
sete %sil
andb %cl, %sil
movb $0x2a, %dl
cmpb $0x1, %sil
jne 0x15a81
movb $0x0, (%r13)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x32c0
movq %r14, %rdi
callq 0x3190
movq %rax, %r12
addq $0x2, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x3570
movq %rbx, %rdi
movq %r14, %rsi
callq 0x32c0
movslq %r12d, %rcx
addq %rbx, %rcx
andl $0x0, 0x1ba2a(%rip)     # 0x314a4
xorl %eax, %eax
jmp 0x15988
movq %r15, %rcx
cmpb $0x1, %dl
sbbq $-0x1, %rcx
jmp 0x15988
movb $0x0, (%rbx)
jmp 0x15aed
movb $0x0, (%rcx)
movl 0x1ba06(%rip), %eax     # 0x314a4
testl %eax, %eax
je 0x15aa7
movb $0x0, (%r13)
movq %rbx, %rsi
movzbl (%rsi), %eax
cmpl $0x20, %eax
je 0x15ab7
cmpl $0x9, %eax
jne 0x15abc
incq %rsi
jmp 0x15aaa
movq %rsp, %r14
movq %r14, %rdi
callq 0x32c0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x32c0
cmpb $0x0, (%rbx)
je 0x15aed
movq %rbx, %rdi
callq 0x3190
cmpb $0x20, -0x1(%rbx,%rax)
jne 0x15aed
movb $0x0, -0x1(%rbx,%rax)
jmp 0x15ad7
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq