// File: 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
movq %rsp, %rbp
subq $0x230, %rsp            # imm = 0x230
movq %rdi, -0x8(%rbp)
cmpl $0x0, 0x215ae(%rip)     # 0x4e624
je 0x2d0e8
movq -0x8(%rbp), %rdi
leaq 0x7192(%rip), %rsi      # 0x34215
callq 0x40e0
movq %rax, -0x208(%rbp)
cmpq $0x0, -0x208(%rbp)
je 0x2d0da
movq -0x208(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x208(%rbp)
leaq -0x200(%rbp), %rdi
movq -0x208(%rbp), %rsi
callq 0x4350
movq -0x8(%rbp), %rdi
leaq -0x200(%rbp), %rsi
callq 0x4350
movl $0x0, 0x2154c(%rip)     # 0x4e624
jmp 0x2d0e6
movq -0x8(%rbp), %rax
movb $0x0, (%rax)
jmp 0x2d3d9
jmp 0x2d0e8
movq -0x8(%rbp), %rax
movq %rax, -0x210(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x218(%rbp)
movq -0x210(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x2d2e5
movq -0x210(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x22, %eax
jne 0x2d19e
cmpl $0x0, 0x214fd(%rip)     # 0x4e624
jne 0x2d19e
movq -0x210(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x210(%rbp)
movq -0x210(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x22, %ecx
movb %al, -0x21d(%rbp)
je 0x2d168
movq -0x210(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x21d(%rbp)
movb -0x21d(%rbp), %al
testb $0x1, %al
jne 0x2d174
jmp 0x2d188
movq -0x210(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x210(%rbp)
jmp 0x2d13b
movq -0x210(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x2d19c
jmp 0x2d2e5
jmp 0x2d19e
movq -0x210(%rbp), %rdi
leaq 0x706c(%rip), %rsi      # 0x34218
movl $0x2, %edx
callq 0x4210
cmpl $0x0, %eax
jne 0x2d1d3
cmpl $0x0, 0x21462(%rip)     # 0x4e624
jne 0x2d1d3
movq -0x210(%rbp), %rax
movb $0x0, (%rax)
jmp 0x2d2e5
movq -0x210(%rbp), %rdi
leaq 0x703a(%rip), %rsi      # 0x3421b
movl $0x2, %edx
callq 0x4210
cmpl $0x0, %eax
jne 0x2d223
cmpl $0x0, 0x2142d(%rip)     # 0x4e624
jne 0x2d223
movl $0x1, 0x21421(%rip)     # 0x4e624
movq -0x210(%rbp), %rax
movq %rax, -0x218(%rbp)
movq -0x210(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x210(%rbp)
movq -0x210(%rbp), %rdi
leaq 0x6fe4(%rip), %rsi      # 0x34215
movl $0x2, %edx
callq 0x4210
cmpl $0x0, %eax
jne 0x2d2bd
cmpl $0x1, 0x213dd(%rip)     # 0x4e624
jne 0x2d2bd
movq -0x218(%rbp), %rax
movb $0x0, (%rax)
leaq -0x200(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x4350
leaq -0x200(%rbp), %rdi
callq 0x41d0
movl %eax, -0x21c(%rbp)
leaq -0x200(%rbp), %rdi
movq -0x210(%rbp), %rsi
addq $0x2, %rsi
callq 0x4690
movq -0x8(%rbp), %rdi
leaq -0x200(%rbp), %rsi
callq 0x4350
movq -0x8(%rbp), %rax
movslq -0x21c(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x210(%rbp)
movl $0x0, 0x21369(%rip)     # 0x4e624
jmp 0x2d2e0
movq -0x210(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x2d2de
movq -0x210(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x210(%rbp)
jmp 0x2d2e0
jmp 0x2d0fe
cmpl $0x0, 0x21338(%rip)     # 0x4e624
je 0x2d2f8
movq -0x218(%rbp), %rax
movb $0x0, (%rax)
movq -0x8(%rbp), %rax
movq %rax, -0x210(%rbp)
movq -0x210(%rbp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x20, %ecx
movb %al, -0x21e(%rbp)
je 0x2d330
movq -0x210(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x9, %eax
sete %al
movb %al, -0x21e(%rbp)
movb -0x21e(%rbp), %al
testb $0x1, %al
jne 0x2d33c
jmp 0x2d350
movq -0x210(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x210(%rbp)
jmp 0x2d303
leaq -0x200(%rbp), %rdi
movq -0x210(%rbp), %rsi
callq 0x4350
movq -0x8(%rbp), %rdi
leaq -0x200(%rbp), %rsi
callq 0x4350
movq -0x8(%rbp), %rdi
callq 0x41d0
cmpq $0x0, %rax
jbe 0x2d3d9
jmp 0x2d384
movq -0x8(%rbp), %rax
movq %rax, -0x228(%rbp)
movq -0x8(%rbp), %rdi
callq 0x41d0
movq %rax, %rcx
movq -0x228(%rbp), %rax
subq $0x1, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x20, %eax
jne 0x2d3d7
movq -0x8(%rbp), %rax
movq %rax, -0x230(%rbp)
movq -0x8(%rbp), %rdi
callq 0x41d0
movq %rax, %rcx
movq -0x230(%rbp), %rax
subq $0x1, %rcx
movb $0x0, (%rax,%rcx)
jmp 0x2d384
jmp 0x2d3d9
addq $0x230, %rsp            # imm = 0x230
popq %rbp
retq
nopw %cs:(%rax,%rax)