#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
char *strchr(char *, char);
void stripComment(char *moduleline) {
  char *pos;
  pos = strchr(moduleline, '#');
  if (pos) {
    *pos = ' ';
    while (pos >= moduleline && *pos == ' ' || *pos == '\t') {
      *pos = '\0';
      pos--;
    }
  }
}


x86 assembly (clang, -O0):
<stripComment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x23,%esi
call   1030 <strchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11a0 <stripComment+0x90>
mov    -0x10(%rbp),%rax
movb   $0x20,(%rax)
mov    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
jb     1163 <stripComment+0x53>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x11(%rbp)
je     1173 <stripComment+0x63>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1183 <stripComment+0x73>
jmp    119b <stripComment+0x8b>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    1140 <stripComment+0x30>
jmp    11a0 <stripComment+0x90>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stripComment>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x23,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1160 <stripComment+0x50>
movb   $0x20,(%rax)
cmp    %r14,%rax
jb     1160 <stripComment+0x50>
add    $0xffffffffffffffff,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movb   $0x0,0x1(%rax)
cmp    %r14,%rax
setae  %dl
movzbl (%rax),%ecx
cmp    $0x20,%cl
sete   %bl
add    $0xffffffffffffffff,%rax
test   %bl,%dl
jne    1140 <stripComment+0x30>
cmp    $0x9,%cl
je     1140 <stripComment+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @stripComment(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strchr(i8* %4, i8 signext 35)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %31
8: ; preds = %1
%9 = load i8*, i8** %3
store i8 32, i8* %9
br label %10
10: ; preds = %26, %8
%11 = load i8*, i8** %3
%12 = load i8*, i8** %2
%13 = icmp uge i8* %11, %12
br i1 %13, label %14, label %19
14: ; preds = %10
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 32
br i1 %18, label %24, label %19
19: ; preds = %14, %10
%20 = load i8*, i8** %3
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 9
br label %24
24: ; preds = %19, %14
%25 = phi i1 [ true, %14 ], [ %23, %19 ]
br i1 %25, label %26, label %30
26: ; preds = %24
%27 = load i8*, i8** %3
store i8 0, i8* %27
%28 = load i8*, i8** %3
%29 = getelementptr inbounds i8, i8* %28, i32 -1
store i8* %29, i8** %3
br label %10
30: ; preds = %24
br label %31
31: ; preds = %30, %1
ret void
}

LLVM IR (-O2):
define void @stripComment(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 35)
%3 = icmp eq i8* %2, null
br i1 %3, label %15, label %4
4: ; preds = %1
store i8 32, i8* %2
%5 = icmp ult i8* %2, %0
br i1 %5, label %15, label %6
6: ; preds = %4, %6
%7 = phi i8* [ %8, %6 ], [ %2, %4 ]
store i8 0, i8* %7
%8 = getelementptr inbounds i8, i8* %7, i64 -1
%9 = icmp uge i8* %8, %0
%10 = load i8, i8* %8
%11 = icmp eq i8 %10, 32
%12 = select i1 %9, i1 %11, i1 false
%13 = icmp eq i8 %10, 9
%14 = select i1 %12, i1 true, i1 %13
br i1 %14, label %6, label %15
15: ; preds = %6, %4, %1
ret void
}