#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 strlen(char *);
void stripPs(char *str) {
  if (str[0] == '(' && strlen(str) >= 2) {
    int count;
    int slen = strlen(str);
    if (str[slen - 1] == ')') {
      for (count = 0; count < slen - 2; count++) {
        str[count] = str[count + 1];
      }
      str[slen - 2] = '\0';
    }
  }
}


x86 assembly (clang, -O0):
<stripPs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x28,%eax
jne    11bb <stripPs+0xab>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x2,%eax
jl     11bb <stripPs+0xab>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x29,%eax
jne    11b6 <stripPs+0xa6>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jge    11a5 <stripPs+0x95>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116b <stripPs+0x5b>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    11bb <stripPs+0xab>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stripPs>:
push   %rbp
push   %rbx
push   %rax
cmpb   $0x28,(%rdi)
jne    1164 <stripPs+0x44>
mov    %rdi,%rbx
call   1030 <strlen@plt>
cmp    $0x2,%eax
jl     1164 <stripPs+0x44>
mov    %rbx,%rdi
call   1030 <strlen@plt>
movslq %eax,%rcx
cmpb   $0x29,-0x1(%rcx,%rbx,1)
jne    1164 <stripPs+0x44>
lea    -0x2(%rax),%ebp
cmp    $0x3,%eax
jl     115d <stripPs+0x3d>
lea    0x1(%rbx),%rsi
mov    %ebp,%edx
mov    %rbx,%rdi
call   1040 <memmove@plt>
movslq %ebp,%rax
movb   $0x0,(%rbx,%rax,1)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @stripPs(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 40
br i1 %9, label %10, label %52
10: ; preds = %1
%11 = load i8*, i8** %2
%12 = call i32 @strlen(i8* %11)
%13 = icmp sge i32 %12, 2
br i1 %13, label %14, label %52
14: ; preds = %10
%15 = load i8*, i8** %2
%16 = call i32 @strlen(i8* %15)
store i32 %16, i32* %4
%17 = load i8*, i8** %2
%18 = load i32, i32* %4
%19 = sub nsw i32 %18, 1
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %17, i64 %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 41
br i1 %24, label %25, label %51
25: ; preds = %14
store i32 0, i32* %3
br label %26
26: ; preds = %42, %25
%27 = load i32, i32* %3
%28 = load i32, i32* %4
%29 = sub nsw i32 %28, 2
%30 = icmp slt i32 %27, %29
br i1 %30, label %31, label %45
31: ; preds = %26
%32 = load i8*, i8** %2
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %32, i64 %35
%37 = load i8, i8* %36
%38 = load i8*, i8** %2
%39 = load i32, i32* %3
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %38, i64 %40
store i8 %37, i8* %41
br label %42
42: ; preds = %31
%43 = load i32, i32* %3
%44 = add nsw i32 %43, 1
store i32 %44, i32* %3
br label %26
45: ; preds = %26
%46 = load i8*, i8** %2
%47 = load i32, i32* %4
%48 = sub nsw i32 %47, 2
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8, i8* %46, i64 %49
store i8 0, i8* %50
br label %51
51: ; preds = %45, %14
br label %52
52: ; preds = %51, %10, %1
ret void
}

LLVM IR (-O2):
define void @stripPs(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 40
br i1 %3, label %4, label %23
4: ; preds = %1
%5 = tail call i32 @strlen(i8* %0)
%6 = icmp sgt i32 %5, 1
br i1 %6, label %7, label %23
7: ; preds = %4
%8 = tail call i32 @strlen(i8* %0)
%9 = add nsw i32 %8, -1
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 41
br i1 %13, label %14, label %23
14: ; preds = %7
%15 = add i32 %8, -2
%16 = icmp sgt i32 %8, 2
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = getelementptr i8, i8* %0, i64 1
%19 = zext i32 %15 to i64
br label %20
20: ; preds = %17, %14
%21 = sext i32 %15 to i64
%22 = getelementptr inbounds i8, i8* %0, i64 %21
store i8 0, i8* %22
br label %23
23: ; preds = %7, %20, %4, %1
ret void
}