#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*/ error(char *);
char *skipParens(char *arg) {
  int nest = 0;
  for (;;) {
    int c = *arg++;
    if (c == 0) {
      if (nest > 0)
        error("mismatched parentheses");
      return arg - 1;
    }
    if ((c == '(') || (c == '['))
      ++nest;
    else if ((c == ')') || (c == ']')) {
      if (nest == 0)
        return arg - 1;
      else if (--nest == 0)
        return arg;
    }
  }
  return arg;
}


x86 assembly (clang, -O0):
<skipParens>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    1169 <skipParens+0x59>
cmpl   $0x0,-0x14(%rbp)
jle    1158 <skipParens+0x48>
lea    0xead(%rip),%rdi
call   1030 <error@plt>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
jmp    11ed <skipParens+0xdd>
cmpl   $0x28,-0x18(%rbp)
je     117d <skipParens+0x6d>
cmpl   $0x5b,-0x18(%rbp)
jne    118b <skipParens+0x7b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11e8 <skipParens+0xd8>
cmpl   $0x29,-0x18(%rbp)
je     119f <skipParens+0x8f>
cmpl   $0x5d,-0x18(%rbp)
jne    11e3 <skipParens+0xd3>
cmpl   $0x0,-0x14(%rbp)
jne    11ba <skipParens+0xaa>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
jmp    11ed <skipParens+0xdd>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jne    11d9 <skipParens+0xc9>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11ed <skipParens+0xdd>
jmp    11de <skipParens+0xce>
jmp    11e3 <skipParens+0xd3>
jmp    11e8 <skipParens+0xd8>
jmp    1123 <skipParens+0x13>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipParens>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
jmp    1120 <skipParens+0x10>
add    $0x1,%eax
nopl   0x0(%rax,%rax,1)
movzbl (%rbx),%ecx
add    $0x1,%rbx
cmp    $0x28,%cl
jle    1150 <skipParens+0x40>
cmp    $0x29,%cl
je     113b <skipParens+0x2b>
cmp    $0x5b,%cl
je     1118 <skipParens+0x8>
cmp    $0x5d,%cl
jne    1120 <skipParens+0x10>
test   %eax,%eax
je     1174 <skipParens+0x64>
add    $0xffffffff,%eax
jne    1120 <skipParens+0x10>
jmp    116f <skipParens+0x5f>
cs nopw 0x0(%rax,%rax,1)
test   %cl,%cl
je     115b <skipParens+0x4b>
cmp    $0x28,%cl
jne    1120 <skipParens+0x10>
jmp    1118 <skipParens+0x8>
add    $0xffffffffffffffff,%rbx
test   %eax,%eax
jle    116f <skipParens+0x5f>
lea    0xe96(%rip),%rdi
call   1030 <error@plt>
mov    %rbx,%rax
pop    %rbx
ret
add    $0xffffffffffffffff,%rbx
jmp    116f <skipParens+0x5f>

LLVM IR (-O0):
@.str = [23 x i8] c"mismatched parentheses\00"
define i8* @skipParens(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
br label %6
6: ; preds = %51, %1
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i32 1
store i8* %8, i8** %3
%9 = load i8, i8* %7
%10 = sext i8 %9 to i32
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %21
13: ; preds = %6
%14 = load i32, i32* %4
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 @error(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16, %13
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i64 -1
store i8* %20, i8** %2
br label %52
21: ; preds = %6
%22 = load i32, i32* %5
%23 = icmp eq i32 %22, 40
br i1 %23, label %27, label %24
24: ; preds = %21
%25 = load i32, i32* %5
%26 = icmp eq i32 %25, 91
br i1 %26, label %27, label %30
27: ; preds = %24, %21
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
br label %51
30: ; preds = %24
%31 = load i32, i32* %5
%32 = icmp eq i32 %31, 41
br i1 %32, label %36, label %33
33: ; preds = %30
%34 = load i32, i32* %5
%35 = icmp eq i32 %34, 93
br i1 %35, label %36, label %50
36: ; preds = %33, %30
%37 = load i32, i32* %4
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %42
39: ; preds = %36
%40 = load i8*, i8** %3
%41 = getelementptr inbounds i8, i8* %40, i64 -1
store i8* %41, i8** %2
br label %52
42: ; preds = %36
%43 = load i32, i32* %4
%44 = add nsw i32 %43, -1
store i32 %44, i32* %4
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %42
%47 = load i8*, i8** %3
store i8* %47, i8** %2
br label %52
48: ; preds = %42
br label %49
49: ; preds = %48
br label %50
50: ; preds = %49, %33
br label %51
51: ; preds = %50, %27
br label %6
52: ; preds = %46, %39, %18
%53 = load i8*, i8** %2
ret i8* %53
}

LLVM IR (-O2):
@.str = [23 x i8] c"mismatched parentheses\00"
define i8* @skipParens(i8* %0) {
br label %2
2: ; preds = %15, %1
%3 = phi i8* [ %0, %1 ], [ %7, %15 ]
%4 = phi i32 [ 0, %1 ], [ %16, %15 ]
br label %5
5: ; preds = %2, %5
%6 = phi i8* [ %7, %5 ], [ %3, %2 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = load i8, i8* %6
switch i8 %8, label %5 [
i8 0, label %9
i8 91, label %13
i8 40, label %13
i8 93, label %17
i8 41, label %17
]
9: ; preds = %5
%10 = icmp sgt i32 %4, 0
br i1 %10, label %11, label %22
11: ; preds = %9
%12 = tail call i32 @error(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %22
13: ; preds = %5, %5
%14 = add nsw i32 %4, 1
br label %15
15: ; preds = %13, %19
%16 = phi i32 [ %20, %19 ], [ %14, %13 ]
br label %2
17: ; preds = %5, %5
%18 = icmp eq i32 %4, 0
br i1 %18, label %22, label %19
19: ; preds = %17
%20 = add nsw i32 %4, -1
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %15
22: ; preds = %17, %19, %11, %9
%23 = phi i8* [ %6, %9 ], [ %6, %11 ], [ %6, %17 ], [ %7, %19 ]
ret i8* %23
}