#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 */
typedef int /*<<< orphan*/ str;

/* Variables and functions */
scalar_t__ isspace(int);
scalar_t__ isupper(int);
int /*<<< orphan*/ memset(char **, int /*<<< orphan*/, int);
char tolower(int);
char *strip(char *name) {
  char *str1 = name;
  char *str2;
  static char str[128];
  int c;
  memset(&str, 0, sizeof(str));
  str2 = str;
  for (; (c = *((unsigned char *)str1)); str1++, str2++) {
    if (isspace(c)) {
      str2--;
      continue;
    }
    if (isupper(c)) {
      *str2 = tolower(c);
    } else {
      *str2 = c;
    }
  }
  *str2 = 0;
  return (str);
}


x86 assembly (clang, -O0):
<strip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    0x2ef5(%rip),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1030 <memset@plt>
lea    0x2ee2(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
je     11fc <strip+0xbc>
mov    -0x1c(%rbp),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
je     11a8 <strip+0x68>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
jmp    11df <strip+0x9f>
mov    -0x1c(%rbp),%edi
call   1060 <isupper@plt>
cmp    $0x0,%rax
je     11cf <strip+0x8f>
mov    -0x1c(%rbp),%edi
call   1050 <tolower@plt>
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
jmp    11da <strip+0x9a>
mov    -0x1c(%rbp),%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
jmp    11df <strip+0x9f>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1172 <strip+0x32>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
lea    0x2e46(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strip>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0x2eff(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1030 <memset@plt>
mov    (%r14),%r15b
test   %r15b,%r15b
je     11c1 <strip+0x81>
add    $0x1,%r14
lea    0x2edd(%rip),%rbx
jmp    1195 <strip+0x55>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0xffffffffffffffff,%rbx
add    $0x1,%rbx
movzbl (%r14),%r15d
add    $0x1,%r14
test   %r15b,%r15b
je     11c1 <strip+0x81>
movzbl %r15b,%ebp
mov    %ebp,%edi
call   1040 <isspace@plt>
test   %rax,%rax
jne    1180 <strip+0x40>
mov    %ebp,%edi
call   1060 <isupper@plt>
test   %rax,%rax
je     11bc <strip+0x7c>
mov    %ebp,%edi
call   1050 <tolower@plt>
mov    %al,(%rbx)
jmp    1184 <strip+0x44>
mov    %r15b,(%rbx)
jmp    1184 <strip+0x44>
movb   $0x0,(%rbx)
lea    0x2e85(%rip),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@strip.str = internal global [128 x i8] zeroinitializer
define i8* @strip(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %2
%6 = load i8*, i8** %2
store i8* %6, i8** %3
%7 = call i32 @memset(i8** bitcast ([128 x i8]* @strip.str to i8**), i32 0, i32 128)
store i8* getelementptr inbounds ([128 x i8], [128 x i8]* @strip.str, i64 0, i64 0), i8** %4
br label %8
8: ; preds = %33, %1
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
store i32 %11, i32* %5
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %38
13: ; preds = %8
%14 = load i32, i32* %5
%15 = call i64 @isspace(i32 %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %13
%18 = load i8*, i8** %4
%19 = getelementptr inbounds i8, i8* %18, i32 -1
store i8* %19, i8** %4
br label %33
20: ; preds = %13
%21 = load i32, i32* %5
%22 = call i64 @isupper(i32 %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %20
%25 = load i32, i32* %5
%26 = call signext i8 @tolower(i32 %25)
%27 = load i8*, i8** %4
store i8 %26, i8* %27
br label %32
28: ; preds = %20
%29 = load i32, i32* %5
%30 = trunc i32 %29 to i8
%31 = load i8*, i8** %4
store i8 %30, i8* %31
br label %32
32: ; preds = %28, %24
br label %33
33: ; preds = %32, %17
%34 = load i8*, i8** %3
%35 = getelementptr inbounds i8, i8* %34, i32 1
store i8* %35, i8** %3
%36 = load i8*, i8** %4
%37 = getelementptr inbounds i8, i8* %36, i32 1
store i8* %37, i8** %4
br label %8
38: ; preds = %8
%39 = load i8*, i8** %4
store i8 0, i8* %39
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @strip.str, i64 0, i64 0)
}

LLVM IR (-O2):
@strip.str = internal global [128 x i8] zeroinitializer
define i8* @strip(i8* nocapture %0) {
%2 = tail call i32 @memset(i8** bitcast ([128 x i8]* @strip.str to i8**), i32 0, i32 128)
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %26, label %5
5: ; preds = %1, %20
%6 = phi i8 [ %24, %20 ], [ %3, %1 ]
%7 = phi i8* [ %22, %20 ], [ %0, %1 ]
%8 = phi i8* [ %23, %20 ], [ getelementptr inbounds ([128 x i8], [128 x i8]* @strip.str, i64 0, i64 0), %1 ]
%9 = zext i8 %6 to i32
%10 = tail call i64 @isspace(i32 %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %5
%13 = getelementptr inbounds i8, i8* %8, i64 -1
br label %20
14: ; preds = %5
%15 = tail call i64 @isupper(i32 %9)
%16 = icmp eq i64 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %14
%18 = tail call signext i8 @tolower(i32 %9)
store i8 %18, i8* %8
br label %20
19: ; preds = %14
store i8 %6, i8* %8
br label %20
20: ; preds = %17, %19, %12
%21 = phi i8* [ %13, %12 ], [ %8, %17 ], [ %8, %19 ]
%22 = getelementptr inbounds i8, i8* %7, i64 1
%23 = getelementptr inbounds i8, i8* %21, i64 1
%24 = load i8, i8* %22
%25 = icmp eq i8 %24, 0
br i1 %25, label %26, label %5
26: ; preds = %20, %1
%27 = phi i8* [ getelementptr inbounds ([128 x i8], [128 x i8]* @strip.str, i64 0, i64 0), %1 ], [ %23, %20 ]
store i8 0, i8* %27
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @strip.str, i64 0, i64 0)
}