#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 *cloneString(char *);
char *stripCommas(char *position) {
  char *newPos = cloneString(position);
  char *nPtr = newPos;
  if (position == NULL)
    return NULL;
  while ((*nPtr = *position++))
    if (*nPtr != ',')
      nPtr++;
  return newPos;
}


x86 assembly (clang, -O0):
<stripCommas>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <cloneString@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1149 <stripCommas+0x39>
movq   $0x0,-0x8(%rbp)
jmp    1196 <stripCommas+0x86>
jmp    114e <stripCommas+0x3e>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x20(%rbp),%rcx
mov    %al,(%rcx)
cmp    $0x0,%al
je     118e <stripCommas+0x7e>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2c,%eax
je     1189 <stripCommas+0x79>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    114e <stripCommas+0x3e>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stripCommas>:
push   %rbx
mov    %rdi,%rbx
call   1030 <cloneString@plt>
test   %rbx,%rbx
je     1148 <stripCommas+0x38>
mov    %rax,%rcx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl (%rbx),%edx
add    $0x1,%rbx
mov    %dl,(%rcx)
cmp    $0x2c,%dl
je     1130 <stripCommas+0x20>
test   %dl,%dl
je     114a <stripCommas+0x3a>
add    $0x1,%rcx
jmp    1130 <stripCommas+0x20>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @stripCommas(i8* %0) {
%2 = tail call i8* @cloneString(i8* %0)
%3 = icmp eq i8* %0, null
br i1 %3, label %13, label %4
4: ; preds = %1, %11
%5 = phi i8* [ %9, %11 ], [ %0, %1 ]
%6 = phi i8* [ %12, %11 ], [ %2, %1 ]
br label %7
7: ; preds = %4, %7
%8 = phi i8* [ %9, %7 ], [ %5, %4 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %8
store i8 %10, i8* %6
switch i8 %10, label %11 [
i8 0, label %13
i8 44, label %7
]
11: ; preds = %7
%12 = getelementptr inbounds i8, i8* %6, i64 1
br label %4
13: ; preds = %7, %1
%14 = phi i8* [ null, %1 ], [ %2, %7 ]
ret i8* %14
}