#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*/ isspace(char);
int followingParen(char *p, char ch) {
  if (ch == '(') {
    return 1;
  }
  while (*p != '\0')
    p++;
  p++;
  for (; *p != '\0'; p++) {
    if (!isspace(*p)) {
      break;
    }
  }
  return (int)(*p == '(');
}


x86 assembly (clang, -O0):
<followingParen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x28,%eax
jne    113b <followingParen+0x2b>
movl   $0x1,-0x4(%rbp)
jmp    11c2 <followingParen+0xb2>
jmp    1140 <followingParen+0x30>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1161 <followingParen+0x51>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1140 <followingParen+0x30>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11ad <followingParen+0x9d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%eax
jne    1197 <followingParen+0x87>
jmp    11ad <followingParen+0x9d>
jmp    119c <followingParen+0x8c>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    116d <followingParen+0x5d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x28,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<followingParen>:
push   %rbx
mov    $0x1,%eax
cmp    $0x28,%sil
je     1154 <followingParen+0x44>
mov    %rdi,%rbx
nop
cmpb   $0x0,(%rbx)
lea    0x1(%rbx),%rbx
jne    1120 <followingParen+0x10>
jmp    1140 <followingParen+0x30>
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <isspace@plt>
add    $0x1,%rbx
test   %eax,%eax
je     114b <followingParen+0x3b>
movzbl (%rbx),%eax
test   %al,%al
jne    1130 <followingParen+0x20>
xor    %eax,%eax
pop    %rbx
ret
xor    %eax,%eax
cmpb   $0x28,-0x1(%rbx)
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @followingParen(i8* %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 40
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 1, i32* %3
br label %43
10: ; preds = %2
br label %11
11: ; preds = %16, %10
%12 = load i8*, i8** %4
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %4
br label %11
19: ; preds = %11
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %4
br label %22
22: ; preds = %34, %19
%23 = load i8*, i8** %4
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %37
27: ; preds = %22
%28 = load i8*, i8** %4
%29 = load i8, i8* %28
%30 = call i32 @isspace(i8 signext %29)
%31 = icmp ne i32 %30, 0
br i1 %31, label %33, label %32
32: ; preds = %27
br label %37
33: ; preds = %27
br label %34
34: ; preds = %33
%35 = load i8*, i8** %4
%36 = getelementptr inbounds i8, i8* %35, i32 1
store i8* %36, i8** %4
br label %22
37: ; preds = %32, %22
%38 = load i8*, i8** %4
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 40
%42 = zext i1 %41 to i32
store i32 %42, i32* %3
br label %43
43: ; preds = %37, %9
%44 = load i32, i32* %3
ret i32 %44
}

LLVM IR (-O2):
define i32 @followingParen(i8* nocapture %0, i8 signext %1) {
%3 = icmp eq i8 %1, 40
br i1 %3, label %21, label %4
4: ; preds = %2, %4
%5 = phi i8* [ %8, %4 ], [ %0, %2 ]
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
%8 = getelementptr inbounds i8, i8* %5, i64 1
br i1 %7, label %9, label %4
9: ; preds = %4, %14
%10 = phi i8* [ %11, %14 ], [ %5, %4 ]
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %21, label %14
14: ; preds = %9
%15 = tail call i32 @isspace(i8 signext %12)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %9
17: ; preds = %14
%18 = load i8, i8* %11
%19 = icmp eq i8 %18, 40
%20 = zext i1 %19 to i32
br label %21
21: ; preds = %9, %17, %2
%22 = phi i32 [ 1, %2 ], [ %20, %17 ], [ 0, %9 ]
ret i32 %22
}