#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 const *);
int parserrsig(const char *str, char **errstrp) {
  const char *cp;
  cp = str + strlen(str) - 1;
  while (cp >= str)
    if (*cp-- == ')')
      return (1);
  return (0);
}


x86 assembly (clang, -O0):
<parserrsig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jb     117f <parserrsig+0x6f>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x20(%rbp)
movsbl (%rax),%eax
cmp    $0x29,%eax
jne    117a <parserrsig+0x6a>
movl   $0x1,-0x4(%rbp)
jmp    1186 <parserrsig+0x76>
jmp    1145 <parserrsig+0x35>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parserrsig>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
cltq
add    %rbx,%rax
add    $0xffffffffffffffff,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    %rbx,%rax
jb     1145 <parserrsig+0x35>
cmpb   $0x29,(%rax)
lea    -0x1(%rax),%rax
jne    1130 <parserrsig+0x20>
mov    $0x1,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @parserrsig(i8* %0, i8** nocapture readnone %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
br label %6
6: ; preds = %10, %2
%7 = phi i8* [ %5, %2 ], [ %8, %10 ]
%8 = getelementptr inbounds i8, i8* %7, i64 -1
%9 = icmp ult i8* %8, %0
br i1 %9, label %13, label %10
10: ; preds = %6
%11 = load i8, i8* %8
%12 = icmp eq i8 %11, 41
br i1 %12, label %13, label %6
13: ; preds = %6, %10
%14 = phi i32 [ 1, %10 ], [ 0, %6 ]
ret i32 %14
}