#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 EOF;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char);
scalar_t__ isspace(char);
int /*<<< orphan*/ stderr;
char GetTreeElt(const char **tree_str) {
  char c;
  while (isspace(c = *(*tree_str)++))
    ;
  if (c == ')' || c == '(' || c == EOF || c == ':')
    return c;
  if (',' == c) {
    while (isspace(c = *(*tree_str)++))
      ;
    switch (c) {
    case '(':
      return '(';
    case ':':
    case ',':
      fprintf(stderr, "Error reading tree. Found \",%c\".\n", c);
      exit(EXIT_FAILURE);
    default:
      *(*tree_str)--;
      return ',';
    }
  }
  (*tree_str)--;
  c = ',';
  return c;
}


x86 assembly (clang, -O0):
<GetTreeElt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,(%rcx)
mov    (%rax),%al
mov    %al,-0x11(%rbp)
movsbl %al,%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     1169 <GetTreeElt+0x39>
jmp    113c <GetTreeElt+0xc>
movsbl -0x11(%rbp),%eax
cmp    $0x29,%eax
je     11a6 <GetTreeElt+0x76>
movsbl -0x11(%rbp),%eax
cmp    $0x28,%eax
je     11a6 <GetTreeElt+0x76>
movsbl -0x11(%rbp),%eax
mov    0x2e5a(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11a6 <GetTreeElt+0x76>
movsbl -0x11(%rbp),%eax
cmp    $0x3a,%eax
jne    11b1 <GetTreeElt+0x81>
mov    -0x11(%rbp),%al
mov    %al,-0x1(%rbp)
jmp    128a <GetTreeElt+0x15a>
movsbl -0x11(%rbp),%ecx
mov    $0x2c,%eax
cmp    %ecx,%eax
jne    1272 <GetTreeElt+0x142>
jmp    11c7 <GetTreeElt+0x97>
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,(%rcx)
mov    (%rax),%al
mov    %al,-0x11(%rbp)
movsbl %al,%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     11f4 <GetTreeElt+0xc4>
jmp    11c7 <GetTreeElt+0x97>
movsbl -0x11(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x28,%eax
je     122b <GetTreeElt+0xfb>
jmp    1209 <GetTreeElt+0xd9>
mov    -0x18(%rbp),%eax
sub    $0x2c,%eax
je     1234 <GetTreeElt+0x104>
jmp    121a <GetTreeElt+0xea>
mov    -0x18(%rbp),%eax
sub    $0x3a,%eax
je     1234 <GetTreeElt+0x104>
jmp    125b <GetTreeElt+0x12b>
movb   $0x28,-0x1(%rbp)
jmp    128a <GetTreeElt+0x15a>
mov    0x2d9d(%rip),%rax
mov    (%rax),%edi
lea    0xdbc(%rip),%rsi
movsbl -0x11(%rbp),%edx
call   1040 <fprintf@plt>
mov    0x2d7c(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,(%rax)
movb   $0x2c,-0x1(%rbp)
jmp    128a <GetTreeElt+0x15a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,(%rax)
movb   $0x2c,-0x11(%rbp)
mov    -0x11(%rbp),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetTreeElt>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
nopw   0x0(%rax,%rax,1)
mov    (%r14),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%r14)
movzbl (%rax),%ebx
movsbl %bl,%edi
call   1030 <isspace@plt>
test   %rax,%rax
jne    1140 <GetTreeElt+0x10>
mov    %ebx,%eax
and    $0xfe,%al
cmp    $0x28,%al
je     11b0 <GetTreeElt+0x80>
cmp    $0x3a,%bl
je     11b0 <GetTreeElt+0x80>
mov    0x2e7a(%rip),%rax
cmp    (%rax),%bl
je     11b0 <GetTreeElt+0x80>
cmp    $0x2c,%bl
jne    11aa <GetTreeElt+0x7a>
nopw   0x0(%rax,%rax,1)
mov    (%r14),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%r14)
movsbl (%rax),%ebp
mov    %ebp,%edi
call   1030 <isspace@plt>
test   %rax,%rax
jne    1180 <GetTreeElt+0x50>
mov    $0x28,%bl
cmp    $0x28,%ebp
je     11b0 <GetTreeElt+0x80>
cmp    $0x3a,%ebp
je     11b7 <GetTreeElt+0x87>
cmp    $0x2c,%ebp
je     11b7 <GetTreeElt+0x87>
addq   $0xffffffffffffffff,(%r14)
mov    $0x2c,%bl
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x2e1a(%rip),%rax
mov    (%rax),%edi
lea    0xe39(%rip),%rsi
mov    %ebp,%edx
call   1040 <fprintf@plt>
mov    0x2dfb(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@EOF = global i8 0
@stderr = global i32 0
@.str = [34 x i8] c"Error reading tree. Found \22,%c\22.\0A\00"
@EXIT_FAILURE = global i32 0
define signext i8 @GetTreeElt(i8** %0) {
%2 = alloca i8
%3 = alloca i8**
%4 = alloca i8
store i8** %0, i8*** %3
br label %5
5: ; preds = %12, %1
%6 = load i8**, i8*** %3
%7 = load i8*, i8** %6
%8 = getelementptr inbounds i8, i8* %7, i32 1
store i8* %8, i8** %6
%9 = load i8, i8* %7
store i8 %9, i8* %4
%10 = call i64 @isspace(i8 signext %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %5
br label %5
13: ; preds = %5
%14 = load i8, i8* %4
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 41
br i1 %16, label %31, label %17
17: ; preds = %13
%18 = load i8, i8* %4
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 40
br i1 %20, label %31, label %21
21: ; preds = %17
%22 = load i8, i8* %4
%23 = sext i8 %22 to i32
%24 = load i8, i8* @EOF
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %23, %25
br i1 %26, label %31, label %27
27: ; preds = %21
%28 = load i8, i8* %4
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 58
br i1 %30, label %31, label %33
31: ; preds = %27, %21, %17, %13
%32 = load i8, i8* %4
store i8 %32, i8* %2
br label %66
33: ; preds = %27
%34 = load i8, i8* %4
%35 = sext i8 %34 to i32
%36 = icmp eq i32 44, %35
br i1 %36, label %37, label %61
37: ; preds = %33
br label %38
38: ; preds = %45, %37
%39 = load i8**, i8*** %3
%40 = load i8*, i8** %39
%41 = getelementptr inbounds i8, i8* %40, i32 1
store i8* %41, i8** %39
%42 = load i8, i8* %40
store i8 %42, i8* %4
%43 = call i64 @isspace(i8 signext %42)
%44 = icmp ne i64 %43, 0
br i1 %44, label %45, label %46
45: ; preds = %38
br label %38
46: ; preds = %38
%47 = load i8, i8* %4
%48 = sext i8 %47 to i32
switch i32 %48, label %56 [
i32 40, label %49
i32 58, label %50
i32 44, label %50
]
49: ; preds = %46
store i8 40, i8* %2
br label %66
50: ; preds = %46, %46
%51 = load i32, i32* @stderr
%52 = load i8, i8* %4
%53 = call i32 @fprintf(i32 %51, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8 signext %52)
%54 = load i32, i32* @EXIT_FAILURE
%55 = call i32 @exit(i32 %54)
unreachable
56: ; preds = %46
%57 = load i8**, i8*** %3
%58 = load i8*, i8** %57
%59 = getelementptr inbounds i8, i8* %58, i32 -1
store i8* %59, i8** %57
%60 = load i8, i8* %58
store i8 44, i8* %2
br label %66
61: ; preds = %33
%62 = load i8**, i8*** %3
%63 = load i8*, i8** %62
%64 = getelementptr inbounds i8, i8* %63, i32 -1
store i8* %64, i8** %62
store i8 44, i8* %4
%65 = load i8, i8* %4
store i8 %65, i8* %2
br label %66
66: ; preds = %61, %56, %49, %31
%67 = load i8, i8* %2
ret i8 %67
}

LLVM IR (-O2):
@EOF = global i8 0
@stderr = global i32 0
@.str = [34 x i8] c"Error reading tree. Found \22,%c\22.\0A\00"
@EXIT_FAILURE = global i32 0
define signext i8 @GetTreeElt(i8** nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = load i8*, i8** %0
%4 = getelementptr inbounds i8, i8* %3, i64 1
store i8* %4, i8** %0
%5 = load i8, i8* %3
%6 = tail call i64 @isspace(i8 signext %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %2
8: ; preds = %2
%9 = and i8 %5, -2
%10 = icmp eq i8 %9, 40
br i1 %10, label %34, label %11
11: ; preds = %8
%12 = load i8, i8* @EOF
%13 = icmp eq i8 %5, %12
%14 = icmp eq i8 %5, 58
%15 = or i1 %14, %13
br i1 %15, label %34, label %16
16: ; preds = %11
%17 = icmp eq i8 %5, 44
br i1 %17, label %18, label %31
18: ; preds = %16, %18
%19 = load i8*, i8** %0
%20 = getelementptr inbounds i8, i8* %19, i64 1
store i8* %20, i8** %0
%21 = load i8, i8* %19
%22 = tail call i64 @isspace(i8 signext %21)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %18
24: ; preds = %18
%25 = sext i8 %21 to i32
switch i32 %25, label %31 [
i32 40, label %34
i32 58, label %26
i32 44, label %26
]
26: ; preds = %24, %24
%27 = load i32, i32* @stderr
%28 = tail call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8 signext %21)
%29 = load i32, i32* @EXIT_FAILURE
%30 = tail call i32 @exit(i32 %29)
unreachable
31: ; preds = %16, %24
%32 = load i8*, i8** %0
%33 = getelementptr inbounds i8, i8* %32, i64 -1
store i8* %33, i8** %0
br label %34
34: ; preds = %31, %24, %8, %11
%35 = phi i8 [ %5, %11 ], [ %5, %8 ], [ 40, %24 ], [ 44, %31 ]
ret i8 %35
}