#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 */
int /*<<< orphan*/ isalnum(char);
scalar_t__ isspace(char);
int strlen(char *);
char tolower(char);
void StripPunctuation(char *Buffer) {
  char c;
  int i, j;
  for (i = 0; i < strlen(Buffer); i++) {
    c = Buffer[i];
    if ((c == '.') || (c == ',') || (isspace(c))) {
      Buffer[i] = 0;
      break;
    } else if (!isalnum(c)) {
      for (j = i + 1; j <= strlen(Buffer); j++)
        Buffer[j - 1] = Buffer[j];
      i--;
    } else
      Buffer[i] = tolower(c);
  }
}


x86 assembly (clang, -O0):
<StripPunctuation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jge    1257 <StripPunctuation+0x117>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x2e,%eax
je     11aa <StripPunctuation+0x6a>
movsbl -0x9(%rbp),%eax
cmp    $0x2c,%eax
je     11aa <StripPunctuation+0x6a>
movsbl -0x9(%rbp),%edi
call   1050 <isspace@plt>
cmp    $0x0,%rax
je     11bb <StripPunctuation+0x7b>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1257 <StripPunctuation+0x117>
movsbl -0x9(%rbp),%edi
call   1040 <isalnum@plt>
cmp    $0x0,%eax
jne    1229 <StripPunctuation+0xe9>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
jg     121b <StripPunctuation+0xdb>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11d6 <StripPunctuation+0x96>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    123f <StripPunctuation+0xff>
movsbl -0x9(%rbp),%edi
call   1060 <tolower@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1244 <StripPunctuation+0x104>
jmp    1249 <StripPunctuation+0x109>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1153 <StripPunctuation+0x13>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StripPunctuation>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r12
call   1030 <strlen@plt>
test   %eax,%eax
jle    11eb <StripPunctuation+0xab>
xor    %r14d,%r14d
jmp    117d <StripPunctuation+0x3d>
nopl   (%rax)
mov    %r15d,%edi
call   1060 <tolower@plt>
mov    %al,(%r12,%rbp,1)
add    $0x1,%r14d
mov    %r12,%rdi
call   1030 <strlen@plt>
cmp    %eax,%r14d
jge    11eb <StripPunctuation+0xab>
movslq %r14d,%rbp
mov    (%r12,%rbp,1),%al
mov    %eax,%ecx
and    $0xfd,%cl
cmp    $0x2c,%cl
je     11e6 <StripPunctuation+0xa6>
movsbl %al,%r15d
mov    %r15d,%edi
call   1050 <isspace@plt>
test   %rax,%rax
jne    11e6 <StripPunctuation+0xa6>
mov    %r15d,%edi
call   1040 <isalnum@plt>
test   %eax,%eax
jne    1160 <StripPunctuation+0x20>
mov    %r12,%rdi
call   1030 <strlen@plt>
cmp    %eax,%r14d
jge    11e0 <StripPunctuation+0xa0>
nopl   0x0(%rax,%rax,1)
lea    0x1(%rbp),%rbx
movzbl 0x1(%r12,%rbp,1),%eax
mov    %al,(%r12,%rbp,1)
mov    %r12,%rdi
call   1030 <strlen@plt>
cltq
mov    %rbx,%rbp
cmp    %rax,%rbx
jl     11c0 <StripPunctuation+0x80>
add    $0xffffffff,%r14d
jmp    116c <StripPunctuation+0x2c>
movb   $0x0,(%r12,%rbp,1)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @StripPunctuation(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %4
br label %6
6: ; preds = %71, %1
%7 = load i32, i32* %4
%8 = load i8*, i8** %2
%9 = call i32 @strlen(i8* %8)
%10 = icmp slt i32 %7, %9
br i1 %10, label %11, label %74
11: ; preds = %6
%12 = load i8*, i8** %2
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
store i8 %16, i8* %3
%17 = load i8, i8* %3
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 46
br i1 %19, label %28, label %20
20: ; preds = %11
%21 = load i8, i8* %3
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 44
br i1 %23, label %28, label %24
24: ; preds = %20
%25 = load i8, i8* %3
%26 = call i64 @isspace(i8 signext %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %33
28: ; preds = %24, %20, %11
%29 = load i8*, i8** %2
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
store i8 0, i8* %32
br label %74
33: ; preds = %24
%34 = load i8, i8* %3
%35 = call i32 @isalnum(i8 signext %34)
%36 = icmp ne i32 %35, 0
br i1 %36, label %62, label %37
37: ; preds = %33
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 1
store i32 %39, i32* %5
br label %40
40: ; preds = %56, %37
%41 = load i32, i32* %5
%42 = load i8*, i8** %2
%43 = call i32 @strlen(i8* %42)
%44 = icmp sle i32 %41, %43
br i1 %44, label %45, label %59
45: ; preds = %40
%46 = load i8*, i8** %2
%47 = load i32, i32* %5
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %46, i64 %48
%50 = load i8, i8* %49
%51 = load i8*, i8** %2
%52 = load i32, i32* %5
%53 = sub nsw i32 %52, 1
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8, i8* %51, i64 %54
store i8 %50, i8* %55
br label %56
56: ; preds = %45
%57 = load i32, i32* %5
%58 = add nsw i32 %57, 1
store i32 %58, i32* %5
br label %40
59: ; preds = %40
%60 = load i32, i32* %4
%61 = add nsw i32 %60, -1
store i32 %61, i32* %4
br label %69
62: ; preds = %33
%63 = load i8, i8* %3
%64 = call signext i8 @tolower(i8 signext %63)
%65 = load i8*, i8** %2
%66 = load i32, i32* %4
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i8, i8* %65, i64 %67
store i8 %64, i8* %68
br label %69
69: ; preds = %62, %59
br label %70
70: ; preds = %69
br label %71
71: ; preds = %70
%72 = load i32, i32* %4
%73 = add nsw i32 %72, 1
store i32 %73, i32* %4
br label %6
74: ; preds = %28, %6
ret void
}

LLVM IR (-O2):
define void @StripPunctuation(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %39
4: ; preds = %1, %34
%5 = phi i32 [ %36, %34 ], [ 0, %1 ]
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = and i8 %8, -3
%10 = icmp eq i8 %9, 44
br i1 %10, label %14, label %11
11: ; preds = %4
%12 = tail call i64 @isspace(i8 signext %8)
%13 = icmp eq i64 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %11, %4
store i8 0, i8* %7
br label %39
15: ; preds = %11
%16 = tail call i32 @isalnum(i8 signext %8)
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %32
18: ; preds = %15
%19 = tail call i32 @strlen(i8* %0)
%20 = icmp slt i32 %5, %19
br i1 %20, label %21, label %30
21: ; preds = %18, %21
%22 = phi i64 [ %23, %21 ], [ %6, %18 ]
%23 = add nsw i64 %22, 1
%24 = getelementptr inbounds i8, i8* %0, i64 %23
%25 = load i8, i8* %24
%26 = getelementptr inbounds i8, i8* %0, i64 %22
store i8 %25, i8* %26
%27 = tail call i32 @strlen(i8* %0)
%28 = sext i32 %27 to i64
%29 = icmp slt i64 %23, %28
br i1 %29, label %21, label %30
30: ; preds = %21, %18
%31 = add nsw i32 %5, -1
br label %34
32: ; preds = %15
%33 = tail call signext i8 @tolower(i8 signext %8)
store i8 %33, i8* %7
br label %34
34: ; preds = %32, %30
%35 = phi i32 [ %5, %32 ], [ %31, %30 ]
%36 = add nsw i32 %35, 1
%37 = tail call i32 @strlen(i8* %0)
%38 = icmp slt i32 %36, %37
br i1 %38, label %4, label %39
39: ; preds = %34, %1, %14
ret void
}