#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ feof(int /*<<< orphan*/ *);
scalar_t__ ferror(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int recursive_skip(FILE *script) {
  char c;
  do {
    if (feof(script))
      return 11;
    c = fgetc(script);
    if (ferror(script))
      return 20;
    if (c == '[')
      recursive_skip(script);
  } while (c != ']');
  return 0;
}


x86 assembly (clang, -O0):
<recursive_skip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <feof@plt>
cmp    $0x0,%rax
je     116b <recursive_skip+0x2b>
movl   $0xb,-0x4(%rbp)
jmp    11c5 <recursive_skip+0x85>
mov    -0x10(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <ferror@plt>
cmp    $0x0,%rax
je     1196 <recursive_skip+0x56>
movl   $0x14,-0x4(%rbp)
jmp    11c5 <recursive_skip+0x85>
movsbl -0x11(%rbp),%eax
cmp    $0x5b,%eax
jne    11ac <recursive_skip+0x6c>
mov    -0x10(%rbp),%rdi
call   1040 <recursive_skip@plt>
jmp    11b1 <recursive_skip+0x71>
movsbl -0x11(%rbp),%eax
cmp    $0x5d,%eax
jne    114c <recursive_skip+0xc>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recursive_skip>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbp
call   1060 <feof@plt>
mov    $0xb,%r14d
jmp    1170 <recursive_skip+0x30>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbp,%rdi
call   1040 <recursive_skip@plt>
mov    %rbp,%rdi
call   1060 <feof@plt>
test   %rax,%rax
jne    11a1 <recursive_skip+0x61>
mov    %rbp,%rdi
call   1050 <fgetc@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
call   1030 <ferror@plt>
test   %rax,%rax
jne    119b <recursive_skip+0x5b>
cmp    $0x5b,%bl
je     1160 <recursive_skip+0x20>
cmp    $0x5d,%bl
jne    1168 <recursive_skip+0x28>
xor    %r14d,%r14d
jmp    11a1 <recursive_skip+0x61>
mov    $0x14,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @recursive_skip(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i8
store i32* %0, i32** %3
br label %5
5: ; preds = %25, %1
%6 = load i32*, i32** %3
%7 = call i64 @feof(i32* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %5
store i32 11, i32* %2
br label %30
10: ; preds = %5
%11 = load i32*, i32** %3
%12 = call signext i8 @fgetc(i32* %11)
store i8 %12, i8* %4
%13 = load i32*, i32** %3
%14 = call i64 @ferror(i32* %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %10
store i32 20, i32* %2
br label %30
17: ; preds = %10
%18 = load i8, i8* %4
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 91
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load i32*, i32** %3
%23 = call i32 @recursive_skip(i32* %22)
br label %24
24: ; preds = %21, %17
br label %25
25: ; preds = %24
%26 = load i8, i8* %4
%27 = sext i8 %26 to i32
%28 = icmp ne i32 %27, 93
br i1 %28, label %5, label %29
29: ; preds = %25
store i32 0, i32* %2
br label %30
30: ; preds = %29, %16, %9
%31 = load i32, i32* %2
ret i32 %31
}

LLVM IR (-O2):
define i32 @recursive_skip(i32* nocapture %0) {
%2 = tail call i64 @feof(i32* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %14
4: ; preds = %1, %9
%5 = tail call signext i8 @fgetc(i32* %0)
%6 = tail call i64 @ferror(i32* %0)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %4
switch i8 %5, label %9 [
i8 91, label %12
i8 93, label %14
]
9: ; preds = %8, %12
%10 = tail call i64 @feof(i32* %0)
%11 = icmp eq i64 %10, 0
br i1 %11, label %4, label %14
12: ; preds = %8
%13 = tail call i32 @recursive_skip(i32* %0)
br label %9
14: ; preds = %9, %4, %8, %1
%15 = phi i32 [ 11, %1 ], [ 0, %8 ], [ 20, %4 ], [ 11, %9 ]
ret i32 %15
}