#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 EOF;
int getc(int /*<<< orphan*/ *);
int treeFinishCom(int /*<<< orphan*/ *, char **);
scalar_t__ whitechar(int);
int treeGetCh(FILE *fp) {
  int ch;
  while ((ch = getc(fp)) != EOF) {
    if (whitechar(ch))
      ;
    else if (ch == '[') {
      if ((ch = treeFinishCom(fp, (char **)NULL)) == EOF)
        break;
    } else
      break;
  }
  return ch;
}


x86 assembly (clang, -O0):
<treeGetCh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <getc@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e99(%rip),%rcx
cmp    (%rcx),%eax
je     11b0 <treeGetCh+0x80>
mov    -0xc(%rbp),%edi
call   1040 <whitechar@plt>
cmp    $0x0,%rax
je     116e <treeGetCh+0x3e>
jmp    11ab <treeGetCh+0x7b>
cmpl   $0x5b,-0xc(%rbp)
jne    11a1 <treeGetCh+0x71>
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <treeFinishCom@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e59(%rip),%rcx
cmp    (%rcx),%eax
jne    119c <treeGetCh+0x6c>
jmp    11b0 <treeGetCh+0x80>
jmp    11a6 <treeGetCh+0x76>
jmp    11b0 <treeGetCh+0x80>
jmp    11ab <treeGetCh+0x7b>
jmp    113c <treeGetCh+0xc>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<treeGetCh>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1050 <getc@plt>
mov    %eax,%ebp
mov    0x2ea3(%rip),%r14
jmp    115a <treeGetCh+0x2a>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1050 <getc@plt>
mov    %eax,%ebp
cmp    (%r14),%eax
je     1181 <treeGetCh+0x51>
mov    %ebp,%edi
call   1040 <whitechar@plt>
test   %rax,%rax
jne    1150 <treeGetCh+0x20>
cmp    $0x5b,%ebp
jne    1181 <treeGetCh+0x51>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <treeFinishCom@plt>
cmp    (%r14),%eax
jne    1150 <treeGetCh+0x20>
mov    %eax,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @treeGetCh(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
br label %4
4: ; preds = %26, %1
%5 = load i32*, i32** %2
%6 = call i32 @getc(i32* %5)
store i32 %6, i32* %3
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %27
9: ; preds = %4
%10 = load i32, i32* %3
%11 = call i64 @whitechar(i32 %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %9
br label %26
14: ; preds = %9
%15 = load i32, i32* %3
%16 = icmp eq i32 %15, 91
br i1 %16, label %17, label %24
17: ; preds = %14
%18 = load i32*, i32** %2
%19 = call i32 @treeFinishCom(i32* %18, i8** null)
store i32 %19, i32* %3
%20 = load i32, i32* @EOF
%21 = icmp eq i32 %19, %20
br i1 %21, label %22, label %23
22: ; preds = %17
br label %27
23: ; preds = %17
br label %25
24: ; preds = %14
br label %27
25: ; preds = %23
br label %26
26: ; preds = %25, %13
br label %4
27: ; preds = %24, %22, %4
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @treeGetCh(i32* %0) {
%2 = tail call i32 @getc(i32* %0)
%3 = load i32, i32* @EOF
%4 = icmp eq i32 %2, %3
br i1 %4, label %19, label %5
5: ; preds = %1, %15
%6 = phi i32 [ %16, %15 ], [ %2, %1 ]
%7 = tail call i64 @whitechar(i32 %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %5
%10 = icmp eq i32 %6, 91
br i1 %10, label %11, label %19
11: ; preds = %9
%12 = tail call i32 @treeFinishCom(i32* %0, i8** null)
%13 = load i32, i32* @EOF
%14 = icmp eq i32 %12, %13
br i1 %14, label %19, label %15
15: ; preds = %11, %5
%16 = tail call i32 @getc(i32* %0)
%17 = load i32, i32* @EOF
%18 = icmp eq i32 %16, %17
br i1 %18, label %19, label %5
19: ; preds = %15, %11, %9, %1
%20 = phi i32 [ %2, %1 ], [ %6, %9 ], [ %12, %11 ], [ %16, %15 ]
ret i32 %20
}