#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 */
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
char getc(int /*<<< orphan*/ *);
int comment(FILE *file) {
  char c;
  c = getc(file);
  while (c != ']' && !feof(file)) {
    if (c == '[')
      comment(file);
    c = getc(file);
  }
  if (!feof(file))
    return (0);
  else
    return (1);
}


x86 assembly (clang, -O0):
<comment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <getc@plt>
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%ecx
xor    %eax,%eax
cmp    $0x5d,%ecx
mov    %al,-0x12(%rbp)
je     116e <comment+0x3e>
mov    -0x10(%rbp),%rdi
call   1040 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
test   $0x1,%al
jne    117e <comment+0x4e>
jmp    11a5 <comment+0x75>
movsbl -0x11(%rbp),%eax
cmp    $0x5b,%eax
jne    1194 <comment+0x64>
mov    -0x10(%rbp),%rdi
call   1030 <comment@plt>
mov    -0x10(%rbp),%rdi
call   1050 <getc@plt>
mov    %al,-0x11(%rbp)
jmp    1148 <comment+0x18>
mov    -0x10(%rbp),%rdi
call   1040 <feof@plt>
cmp    $0x0,%eax
jne    11c3 <comment+0x93>
movl   $0x0,-0x4(%rbp)
jmp    11ca <comment+0x9a>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<comment>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <getc@plt>
cmp    $0x5d,%al
jne    1159 <comment+0x29>
mov    %r14,%rdi
call   1040 <feof@plt>
xor    %ecx,%ecx
test   %eax,%eax
setne  %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %eax,%ebx
jmp    116e <comment+0x3e>
nopl   (%rax)
mov    %r14,%rdi
call   1050 <getc@plt>
mov    %eax,%ebx
cmp    $0x5d,%al
je     1140 <comment+0x10>
mov    %r14,%rdi
call   1040 <feof@plt>
test   %eax,%eax
jne    1140 <comment+0x10>
cmp    $0x5b,%bl
jne    1160 <comment+0x30>
mov    %r14,%rdi
call   1030 <comment@plt>
jmp    1160 <comment+0x30>

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

LLVM IR (-O2):
define i32 @comment(i32* nocapture %0) {
%2 = tail call signext i8 @getc(i32* %0)
%3 = icmp eq i8 %2, 93
br i1 %3, label %15, label %4
4: ; preds = %1, %12
%5 = phi i8 [ %13, %12 ], [ %2, %1 ]
%6 = tail call i32 @feof(i32* %0)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %4
%9 = icmp eq i8 %5, 91
br i1 %9, label %10, label %12
10: ; preds = %8
%11 = tail call i32 @comment(i32* %0)
br label %12
12: ; preds = %10, %8
%13 = tail call signext i8 @getc(i32* %0)
%14 = icmp eq i8 %13, 93
br i1 %14, label %15, label %4
15: ; preds = %4, %12, %1
%16 = tail call i32 @feof(i32* %0)
%17 = icmp ne i32 %16, 0
%18 = zext i1 %17 to i32
ret i32 %18
}