// File: /workspace/github_cpp_makefile_star2_O1/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, 0x19e1b(%rip)     # 0x31494
je 0x176c4
leaq 0x5c0f(%rip), %rsi      # 0x1d291
movq %rbx, %rdi
callq 0x30e0
movq %rax, %r14
testq %rax, %rax
je 0x176b8
leaq 0x2(%r14), %rsi
movq %rsp, %r15
movq %r15, %rdi
callq 0x32d0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x32d0
movl $0x0, 0x19dde(%rip)     # 0x31494
jmp 0x176bb
movb $0x0, (%rbx)
testq %r14, %r14
je 0x17848
movb (%rbx), %al
movq %rbx, %r12
testb %al, %al
je 0x177da
leaq 0x5bbc(%rip), %r14      # 0x1d294
movq %rsp, %r13
movq %rbx, %r12
movq %rbx, %rbp
cmpb $0x22, %al
sete %al
movl 0x19da7(%rip), %r15d    # 0x31494
testl %r15d, %r15d
sete %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x1770e
movzbl 0x1(%rbp), %eax
testl %eax, %eax
je 0x177da
incq %rbp
cmpl $0x22, %eax
jne 0x176fa
movl $0x2, %edx
movq %rbp, %rdi
movq %r14, %rsi
callq 0x31d0
orl %r15d, %eax
je 0x177d6
movl $0x2, %edx
movq %rbp, %rdi
leaq 0x5b61(%rip), %rsi      # 0x1d297
callq 0x31d0
orl %r15d, %eax
jne 0x17753
movl $0x1, 0x19d4a(%rip)     # 0x31494
leaq 0x2(%rbp), %r15
movq %rbp, %r12
jmp 0x17756
movq %rbp, %r15
movl $0x2, %edx
movq %r15, %rdi
leaq 0x5b2c(%rip), %rsi      # 0x1d291
callq 0x31d0
testl %eax, %eax
jne 0x177be
cmpl $0x1, 0x19d1f(%rip)     # 0x31494
jne 0x177be
movb $0x0, (%r12)
movq %r13, %rdi
movq %rbx, %rsi
callq 0x32d0
movq %r13, %rdi
callq 0x31a0
movq %rax, %rbp
addq $0x2, %r15
movq %r13, %rdi
movq %r15, %rsi
callq 0x3570
movq %rbx, %rdi
movq %r13, %rsi
callq 0x32d0
movslq %ebp, %rbp
addq %rbx, %rbp
movl $0x0, 0x19cd8(%rip)     # 0x31494
jmp 0x177c9
cmpb $0x1, (%r15)
sbbq $-0x1, %r15
movq %r15, %rbp
movb (%rbp), %al
testb %al, %al
jne 0x176e1
jmp 0x177da
movb $0x0, (%rbp)
cmpl $0x0, 0x19cb3(%rip)     # 0x31494
je 0x177e8
movb $0x0, (%r12)
movq %rbx, %rsi
movzbl (%rsi), %eax
cmpl $0x20, %eax
je 0x177f8
cmpl $0x9, %eax
jne 0x177fd
incq %rsi
jmp 0x177eb
movq %rsp, %r14
movq %r14, %rdi
callq 0x32d0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x32d0
cmpb $0x0, (%rbx)
je 0x17848
movq %rbx, %rdi
callq 0x31a0
cmpb $0x20, -0x1(%rbx,%rax)
jne 0x17848
leaq -0x1(%rbx), %r14
leaq (%rbx,%rax), %rcx
decq %rcx
movb $0x0, (%rcx)
movq %rbx, %rdi
callq 0x31a0
leaq (%r14,%rax), %rcx
cmpb $0x20, -0x1(%rbx,%rax)
je 0x17832
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq