#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*/ assert(int /*<<< orphan*/);
scalar_t__ is_startstring(unsigned char const *);
unsigned char *skipstring(unsigned char const *);
const unsigned char *skippgroup(const unsigned char *string) {
  int nest = 0;
  char open = *string;
  char close;
  switch (open) {
  case '(':
    close = ')';
    break;
  case '{':
    close = '}';
    break;
  case '[':
    close = ']';
    break;
  case '<':
    close = '>';
    break;
  default:
    assert(0);
    close = '\0';
  }
  string++;
  while (*string != close || nest > 0) {
    if (*string == open)
      nest++;
    else if (*string == close)
      nest--;
    else if (is_startstring(string))
      string = skipstring(string);
    if (*string == '\0')
      break;
    string++;
  }
  return string;
}


x86 assembly (clang, -O0):
<skippgroup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0xd(%rbp)
movsbl -0xd(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x28,%eax
je     1194 <skippgroup+0x64>
jmp    1161 <skippgroup+0x31>
mov    -0x14(%rbp),%eax
sub    $0x3c,%eax
je     11af <skippgroup+0x7f>
jmp    1172 <skippgroup+0x42>
mov    -0x14(%rbp),%eax
sub    $0x5b,%eax
je     11a6 <skippgroup+0x76>
jmp    1183 <skippgroup+0x53>
mov    -0x14(%rbp),%eax
sub    $0x7b,%eax
je     119d <skippgroup+0x6d>
jmp    11b8 <skippgroup+0x88>
movb   $0x29,-0xe(%rbp)
jmp    11c3 <skippgroup+0x93>
movb   $0x7d,-0xe(%rbp)
jmp    11c3 <skippgroup+0x93>
movb   $0x5d,-0xe(%rbp)
jmp    11c3 <skippgroup+0x93>
movb   $0x3e,-0xe(%rbp)
jmp    11c3 <skippgroup+0x93>
xor    %edi,%edi
call   1050 <assert@plt>
movb   $0x0,-0xe(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%ecx
movsbl -0xe(%rbp),%edx
mov    $0x1,%al
cmp    %edx,%ecx
mov    %al,-0x15(%rbp)
jne    11f1 <skippgroup+0xc1>
cmpl   $0x0,-0xc(%rbp)
setg   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1201 <skippgroup+0xd1>
jmp    1293 <skippgroup+0x163>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movsbl -0xd(%rbp),%ecx
cmp    %ecx,%eax
jne    1222 <skippgroup+0xf2>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    126d <skippgroup+0x13d>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movsbl -0xe(%rbp),%ecx
cmp    %ecx,%eax
jne    1243 <skippgroup+0x113>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1268 <skippgroup+0x138>
mov    -0x8(%rbp),%rdi
call   1040 <is_startstring@plt>
cmp    $0x0,%rax
je     1263 <skippgroup+0x133>
mov    -0x8(%rbp),%rdi
call   1030 <skipstring@plt>
mov    %rax,-0x8(%rbp)
jmp    1268 <skippgroup+0x138>
jmp    126d <skippgroup+0x13d>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x0,%eax
jne    1282 <skippgroup+0x152>
jmp    1293 <skippgroup+0x163>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    11cf <skippgroup+0x9f>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skippgroup>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movsbl (%rdi),%r14d
cmp    $0x5a,%r14d
jg     1158 <skippgroup+0x28>
cmp    $0x28,%r14d
je     1178 <skippgroup+0x48>
cmp    $0x3c,%r14d
jne    116c <skippgroup+0x3c>
mov    $0x3e,%r15d
jmp    1186 <skippgroup+0x56>
cmp    $0x5b,%r14d
je     1180 <skippgroup+0x50>
cmp    $0x7b,%r14d
jne    116c <skippgroup+0x3c>
mov    $0x7d,%r15d
jmp    1186 <skippgroup+0x56>
xor    %r15d,%r15d
xor    %edi,%edi
call   1050 <assert@plt>
jmp    1186 <skippgroup+0x56>
mov    $0x29,%r15d
jmp    1186 <skippgroup+0x56>
mov    $0x5d,%r15d
xor    %ebp,%ebp
jmp    1198 <skippgroup+0x68>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmpb   $0x0,(%rbx)
je     11da <skippgroup+0xaa>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
cmp    %eax,%r15d
jne    11a9 <skippgroup+0x79>
test   %ebp,%ebp
jle    11da <skippgroup+0xaa>
cmp    %r14d,%eax
je     1190 <skippgroup+0x60>
cmp    %eax,%r15d
jne    11c0 <skippgroup+0x90>
add    $0xffffffff,%ebp
jmp    1193 <skippgroup+0x63>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <is_startstring@plt>
test   %rax,%rax
je     1193 <skippgroup+0x63>
mov    %rbx,%rdi
call   1030 <skipstring@plt>
mov    %rax,%rbx
jmp    1193 <skippgroup+0x63>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i8* @skippgroup(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8
%5 = alloca i8
store i8* %0, i8** %2
store i32 0, i32* %3
%6 = load i8*, i8** %2
%7 = load i8, i8* %6
store i8 %7, i8* %4
%8 = load i8, i8* %4
%9 = sext i8 %8 to i32
switch i32 %9, label %14 [
i32 40, label %10
i32 123, label %11
i32 91, label %12
i32 60, label %13
]
10: ; preds = %1
store i8 41, i8* %5
br label %16
11: ; preds = %1
store i8 125, i8* %5
br label %16
12: ; preds = %1
store i8 93, i8* %5
br label %16
13: ; preds = %1
store i8 62, i8* %5
br label %16
14: ; preds = %1
%15 = call i32 @assert(i32 0)
store i8 0, i8* %5
br label %16
16: ; preds = %14, %13, %12, %11, %10
%17 = load i8*, i8** %2
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %2
br label %19
19: ; preds = %66, %16
%20 = load i8*, i8** %2
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = load i8, i8* %5
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %22, %24
br i1 %25, label %29, label %26
26: ; preds = %19
%27 = load i32, i32* %3
%28 = icmp sgt i32 %27, 0
br label %29
29: ; preds = %26, %19
%30 = phi i1 [ true, %19 ], [ %28, %26 ]
br i1 %30, label %31, label %69
31: ; preds = %29
%32 = load i8*, i8** %2
%33 = load i8, i8* %32
%34 = zext i8 %33 to i32
%35 = load i8, i8* %4
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %34, %36
br i1 %37, label %38, label %41
38: ; preds = %31
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 1
store i32 %40, i32* %3
br label %60
41: ; preds = %31
%42 = load i8*, i8** %2
%43 = load i8, i8* %42
%44 = zext i8 %43 to i32
%45 = load i8, i8* %5
%46 = sext i8 %45 to i32
%47 = icmp eq i32 %44, %46
br i1 %47, label %48, label %51
48: ; preds = %41
%49 = load i32, i32* %3
%50 = add nsw i32 %49, -1
store i32 %50, i32* %3
br label %59
51: ; preds = %41
%52 = load i8*, i8** %2
%53 = call i64 @is_startstring(i8* %52)
%54 = icmp ne i64 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %51
%56 = load i8*, i8** %2
%57 = call i8* @skipstring(i8* %56)
store i8* %57, i8** %2
br label %58
58: ; preds = %55, %51
br label %59
59: ; preds = %58, %48
br label %60
60: ; preds = %59, %38
%61 = load i8*, i8** %2
%62 = load i8, i8* %61
%63 = zext i8 %62 to i32
%64 = icmp eq i32 %63, 0
br i1 %64, label %65, label %66
65: ; preds = %60
br label %69
66: ; preds = %60
%67 = load i8*, i8** %2
%68 = getelementptr inbounds i8, i8* %67, i32 1
store i8* %68, i8** %2
br label %19
69: ; preds = %65, %29
%70 = load i8*, i8** %2
ret i8* %70
}

LLVM IR (-O2):
define i8* @skippgroup(i8* %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
switch i32 %3, label %7 [
i32 40, label %9
i32 123, label %4
i32 91, label %5
i32 60, label %6
]
4: ; preds = %1
br label %9
5: ; preds = %1
br label %9
6: ; preds = %1
br label %9
7: ; preds = %1
%8 = tail call i32 @assert(i32 0)
br label %9
9: ; preds = %1, %7, %6, %5, %4
%10 = phi i32 [ 0, %7 ], [ 62, %6 ], [ 93, %5 ], [ 125, %4 ], [ 41, %1 ]
br label %11
11: ; preds = %33, %9
%12 = phi i32 [ 0, %9 ], [ %34, %33 ]
%13 = phi i8* [ %0, %9 ], [ %35, %33 ]
%14 = getelementptr inbounds i8, i8* %13, i64 1
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = icmp ne i32 %10, %16
%18 = icmp sgt i32 %12, 0
%19 = select i1 %17, i1 true, i1 %18
br i1 %19, label %20, label %38
20: ; preds = %11
%21 = icmp eq i32 %16, %3
br i1 %21, label %22, label %24
22: ; preds = %20
%23 = add nsw i32 %12, 1
br label %33
24: ; preds = %20
%25 = icmp eq i32 %10, %16
br i1 %25, label %26, label %28
26: ; preds = %24
%27 = add nsw i32 %12, -1
br label %33
28: ; preds = %24
%29 = tail call i64 @is_startstring(i8* %14)
%30 = icmp eq i64 %29, 0
br i1 %30, label %33, label %31
31: ; preds = %28
%32 = tail call i8* @skipstring(i8* %14)
br label %33
33: ; preds = %26, %31, %28, %22
%34 = phi i32 [ %23, %22 ], [ %27, %26 ], [ %12, %31 ], [ %12, %28 ]
%35 = phi i8* [ %14, %22 ], [ %14, %26 ], [ %32, %31 ], [ %14, %28 ]
%36 = load i8, i8* %35
%37 = icmp eq i8 %36, 0
br i1 %37, label %38, label %11
38: ; preds = %33, %11
%39 = phi i8* [ %35, %33 ], [ %14, %11 ]
ret i8* %39
}