#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 */
char *Com_Parse(char const **);
void Com_SkipBracedSection(const char *(*program)) {
  const char *token;
  int depth;
  depth = 0;
  do {
    token = Com_Parse(program);
    if (token[1] == 0) {
      if (token[0] == '{') {
        depth++;
      } else if (token[0] == '}') {
        depth--;
      }
    }
  } while (depth && *program);
}


x86 assembly (clang, -O0):
<Com_SkipBracedSection>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <Com_Parse@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
jne    1182 <Com_SkipBracedSection+0x72>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7b,%eax
jne    115f <Com_SkipBracedSection+0x4f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    117d <Com_SkipBracedSection+0x6d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7d,%eax
jne    1178 <Com_SkipBracedSection+0x68>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    117d <Com_SkipBracedSection+0x6d>
jmp    1182 <Com_SkipBracedSection+0x72>
jmp    1187 <Com_SkipBracedSection+0x77>
xor    %eax,%eax
cmpl   $0x0,-0x14(%rbp)
mov    %al,-0x15(%rbp)
je     11a4 <Com_SkipBracedSection+0x94>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1123 <Com_SkipBracedSection+0x13>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Com_SkipBracedSection>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <Com_Parse@plt>
cmpb   $0x0,0x1(%rax)
je     1140 <Com_SkipBracedSection+0x30>
test   %ebp,%ebp
je     1155 <Com_SkipBracedSection+0x45>
cmpq   $0x0,(%rbx)
jne    1120 <Com_SkipBracedSection+0x10>
jmp    1155 <Com_SkipBracedSection+0x45>
nopw   0x0(%rax,%rax,1)
movzbl (%rax),%eax
cmp    $0x7d,%al
je     1150 <Com_SkipBracedSection+0x40>
cmp    $0x7b,%al
jne    112e <Com_SkipBracedSection+0x1e>
add    $0x1,%ebp
jmp    112e <Com_SkipBracedSection+0x1e>
add    $0xffffffff,%ebp
jmp    112e <Com_SkipBracedSection+0x1e>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @Com_SkipBracedSection(i8** %0) {
br label %2
2: ; preds = %17, %1
%3 = phi i32 [ 0, %1 ], [ %15, %17 ]
%4 = tail call i8* @Com_Parse(i8** %0)
%5 = getelementptr inbounds i8, i8* %4, i64 1
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %2
%9 = load i8, i8* %4
switch i8 %9, label %14 [
i8 123, label %10
i8 125, label %12
]
10: ; preds = %8
%11 = add nsw i32 %3, 1
br label %14
12: ; preds = %8
%13 = add nsw i32 %3, -1
br label %14
14: ; preds = %8, %2, %12, %10
%15 = phi i32 [ %11, %10 ], [ %13, %12 ], [ %3, %2 ], [ %3, %8 ]
%16 = icmp eq i32 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = load i8*, i8** %0
%19 = icmp eq i8* %18, null
br i1 %19, label %20, label %2
20: ; preds = %14, %17
ret void
}