#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 /*<<< orphan*/ exit(int);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
scalar_t__ isspace(int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/ *);
char *ReadTreeToken(FILE *fp) {
  static char buf[5000];
  int len = 0;
  int c;
  for (c = fgetc(fp); c != EOF; c = fgetc(fp)) {
    if (c == '(' || c == ')' || c == ':' || c == ';' || c == ',') {
      if (len == 0) {
        buf[len++] = c;
        buf[len] = '\0';
        return (buf);
      } else {
        ungetc(c, fp);
        buf[len] = '\0';
        return (buf);
      }
    } else if (isspace(c)) {
      if (len > 0) {
        buf[len] = '\0';
        return (buf);
      }
    } else {
      buf[len++] = c;
      if (len >= 5000) {
        buf[5000 - 1] = '\0';
        fprintf(stderr, "Token too long in tree file, token begins with\n%s\n",
                buf);
        exit(1);
      }
    }
  }
  if (len > 0) {
    buf[len] = '\0';
    return (buf);
  }
  return (NULL);
}


x86 assembly (clang, -O0):
<ReadTreeToken>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    0x2e6f(%rip),%rcx
cmp    (%rcx),%eax
je     12db <ReadTreeToken+0x18b>
cmpl   $0x28,-0x18(%rbp)
je     11b3 <ReadTreeToken+0x63>
cmpl   $0x29,-0x18(%rbp)
je     11b3 <ReadTreeToken+0x63>
cmpl   $0x3a,-0x18(%rbp)
je     11b3 <ReadTreeToken+0x63>
cmpl   $0x3b,-0x18(%rbp)
je     11b3 <ReadTreeToken+0x63>
cmpl   $0x2c,-0x18(%rbp)
jne    1224 <ReadTreeToken+0xd4>
cmpl   $0x0,-0x14(%rbp)
jne    11f9 <ReadTreeToken+0xa9>
mov    -0x18(%rbp),%eax
mov    %al,%dl
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
movslq %eax,%rcx
lea    0x2e89(%rip),%rax
mov    %dl,(%rax,%rcx,1)
movslq -0x14(%rbp),%rcx
lea    0x2e7b(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
lea    0x2e70(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130c <ReadTreeToken+0x1bc>
mov    -0x18(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <ungetc@plt>
movslq -0x14(%rbp),%rcx
lea    0x2e50(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
lea    0x2e45(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130c <ReadTreeToken+0x1bc>
mov    -0x18(%rbp),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
je     1264 <ReadTreeToken+0x114>
cmpl   $0x0,-0x14(%rbp)
jle    125f <ReadTreeToken+0x10f>
movslq -0x14(%rbp),%rcx
lea    0x2e15(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
lea    0x2e0a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130c <ReadTreeToken+0x1bc>
jmp    12c0 <ReadTreeToken+0x170>
mov    -0x18(%rbp),%eax
mov    %al,%dl
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
movslq %eax,%rcx
lea    0x2de2(%rip),%rax
mov    %dl,(%rax,%rcx,1)
cmpl   $0x1388,-0x14(%rbp)
jl     12bb <ReadTreeToken+0x16b>
movb   $0x0,0x4152(%rip)
mov    0x2d3c(%rip),%rax
mov    (%rax),%edi
lea    0xd5b(%rip),%rsi
lea    0x2db4(%rip),%rdx
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
jmp    12c0 <ReadTreeToken+0x170>
jmp    12c5 <ReadTreeToken+0x175>
jmp    12ca <ReadTreeToken+0x17a>
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0x18(%rbp)
jmp    116f <ReadTreeToken+0x1f>
cmpl   $0x0,-0x14(%rbp)
jle    1304 <ReadTreeToken+0x1b4>
movslq -0x14(%rbp),%rcx
lea    0x2d70(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
lea    0x2d65(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    130c <ReadTreeToken+0x1bc>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReadTreeToken>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r15
call   1030 <fgetc@plt>
mov    0x2e7e(%rip),%r12
xor    %ebx,%ebx
cmp    (%r12),%eax
jne    117a <ReadTreeToken+0x2a>
xor    %r14d,%r14d
jmp    1211 <ReadTreeToken+0xc1>
mov    %eax,%ebp
lea    0x2edd(%rip),%r14
movabs $0xc00130000000000,%r13
jmp    11b0 <ReadTreeToken+0x60>
nop
mov    %ebp,%edi
call   1040 <isspace@plt>
test   %rax,%rax
je     11c0 <ReadTreeToken+0x70>
test   %ebx,%ebx
jg     1202 <ReadTreeToken+0xb2>
mov    %r15,%rdi
call   1030 <fgetc@plt>
mov    %eax,%ebp
cmp    (%r12),%eax
je     11fa <ReadTreeToken+0xaa>
cmp    $0x3b,%ebp
ja     1190 <ReadTreeToken+0x40>
mov    %ebp,%eax
bt     %rax,%r13
jae    1190 <ReadTreeToken+0x40>
jmp    11d4 <ReadTreeToken+0x84>
nop
movslq %ebx,%rax
mov    %bpl,(%rax,%r14,1)
cmp    $0x1387,%ebx
jge    1223 <ReadTreeToken+0xd3>
add    $0x1,%ebx
jmp    11a0 <ReadTreeToken+0x50>
test   %ebx,%ebx
je     11ea <ReadTreeToken+0x9a>
mov    %ebp,%edi
mov    %r15,%rsi
call   1060 <ungetc@plt>
movslq %ebx,%rax
add    %r14,%rax
jmp    120e <ReadTreeToken+0xbe>
mov    %bpl,0x2e6f(%rip)
lea    0x2e69(%rip),%rax
jmp    120e <ReadTreeToken+0xbe>
test   %ebx,%ebx
jle    1172 <ReadTreeToken+0x22>
mov    %ebx,%ecx
lea    0x2e55(%rip),%rax
add    %rcx,%rax
movb   $0x0,(%rax)
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movb   $0x0,0x41bd(%rip)
lea    0x2e2f(%rip),%rdx
mov    0x2da0(%rip),%rax
mov    (%rax),%edi
lea    0xdbf(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@ReadTreeToken.buf = internal global [5000 x i8] zeroinitializer
@EOF = global i32 0
@stderr = global i32 0
@.str = [51 x i8] c"Token too long in tree file, token begins with\0A%s\0A\00"
define i8* @ReadTreeToken(i32* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 0, i32* %4
%6 = load i32*, i32** %3
%7 = call i32 @fgetc(i32* %6)
store i32 %7, i32* %5
br label %8
8: ; preds = %75, %1
%9 = load i32, i32* %5
%10 = load i32, i32* @EOF
%11 = icmp ne i32 %9, %10
br i1 %11, label %12, label %78
12: ; preds = %8
%13 = load i32, i32* %5
%14 = icmp eq i32 %13, 40
br i1 %14, label %27, label %15
15: ; preds = %12
%16 = load i32, i32* %5
%17 = icmp eq i32 %16, 41
br i1 %17, label %27, label %18
18: ; preds = %15
%19 = load i32, i32* %5
%20 = icmp eq i32 %19, 58
br i1 %20, label %27, label %21
21: ; preds = %18
%22 = load i32, i32* %5
%23 = icmp eq i32 %22, 59
br i1 %23, label %27, label %24
24: ; preds = %21
%25 = load i32, i32* %5
%26 = icmp eq i32 %25, 44
br i1 %26, label %27, label %47
27: ; preds = %24, %21, %18, %15, %12
%28 = load i32, i32* %4
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %40
30: ; preds = %27
%31 = load i32, i32* %5
%32 = trunc i32 %31 to i8
%33 = load i32, i32* %4
%34 = add nsw i32 %33, 1
store i32 %34, i32* %4
%35 = sext i32 %33 to i64
%36 = getelementptr inbounds [5000 x i8], [5000 x i8]* @ReadTreeToken.buf, i64 0, i64 %35
store i8 %32, i8* %36
%37 = load i32, i32* %4
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [5000 x i8], [5000 x i8]* @ReadTreeToken.buf, i64 0, i64 %38
store i8 0, i8* %39
store i8* getelementptr inbounds ([5000 x i8], [5000 x i8]* @ReadTreeToken.buf, i64 0, i64 0), i8** %2
br label %86
40: ; preds = %27
%41 = load i32, i32* %5
%42 = load i32*, i32** %3
%43 = call i32 @ungetc(i32 %41, i32* %42)
%44 = load i32, i32* %4
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [5000 x i8], [5000 x i8]* @ReadTreeToken.buf, i64 0, i64 %45
store i8 0, i8* %46
store i8* getelementptr inbounds ([5000 x i8], [5000 x i8]* @ReadTreeToken.buf, i64 0, i64 0), i8** %2
br label %86
47: ; preds = %24
%48 = load i32, i32* %5
%49 = call i64 @isspace(i32 %48)
%50 = icmp ne i64 %49, 0
br i1 %50, label %51, label %59
51: ; preds = %47
%52 = load i32, i32* %4
%53 = icmp sgt i32 %52, 0
br i1 %53, label %54, label %58
54: ; preds = %51
%55 = load i32, i32* %4
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [5000 x i8], [5000 x i8]* @ReadTreeToken.buf, i64 0, i64 %56
store i8 0, i8* %57
store i8* getelementptr inbounds ([5000 x i8], [5000 x i8]* @ReadTreeToken.buf, i64 0, i64 0), i8** %2
br label %86
58: ; preds = %51
br label %73
59: ; preds = %47
%60 = load i32, i32* %5
%61 = trunc i32 %60 to i8
%62 = load i32, i32* %4
%63 = add nsw i32 %62, 1
store i32 %63, i32* %4
%64 = sext i32 %62 to i64
%65 = getelementptr inbounds [5000 x i8], [5000 x i8]* @ReadTreeToken.buf, i64 0, i64 %64
store i8 %61, i8* %65
%66 = load i32, i32* %4
%67 = icmp sge i32 %66, 5000
br i1 %67, label %68, label %72
68: ; preds = %59
store i8 0, i8* getelementptr inbounds ([5000 x i8], [5000 x i8]* @ReadTreeToken.buf, i64 0, i64 4999)
%69 = load i32, i32* @stderr
%70 = call i32 @fprintf(i32 %69, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5000 x i8], [5000 x i8]* @ReadTreeToken.buf, i64 0, i64 0))
%71 = call i32 @exit(i32 1)
unreachable
72: ; preds = %59
br label %73
73: ; preds = %72, %58
br label %74
74: ; preds = %73
br label %75
75: ; preds = %74
%76 = load i32*, i32** %3
%77 = call i32 @fgetc(i32* %76)
store i32 %77, i32* %5
br label %8
78: ; preds = %8
%79 = load i32, i32* %4
%80 = icmp sgt i32 %79, 0
br i1 %80, label %81, label %85
81: ; preds = %78
%82 = load i32, i32* %4
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [5000 x i8], [5000 x i8]* @ReadTreeToken.buf, i64 0, i64 %83
store i8 0, i8* %84
store i8* getelementptr inbounds ([5000 x i8], [5000 x i8]* @ReadTreeToken.buf, i64 0, i64 0), i8** %2
br label %86
85: ; preds = %78
store i8* null, i8** %2
br label %86
86: ; preds = %85, %81, %54, %40, %30
%87 = load i8*, i8** %2
ret i8* %87
}

LLVM IR (-O2):
@ReadTreeToken.buf = internal global [5000 x i8] zeroinitializer
@EOF = global i32 0
@stderr = global i32 0
@.str = [51 x i8] c"Token too long in tree file, token begins with\0A%s\0A\00"
define i8* @ReadTreeToken(i32* nocapture %0) {
%2 = tail call i32 @fgetc(i32* %0)
%3 = load i32, i32* @EOF
%4 = icmp eq i32 %2, %3
br i1 %4, label %46, label %5
5: ; preds = %1, %34
%6 = phi i32 [ %36, %34 ], [ %2, %1 ]
%7 = phi i32 [ %35, %34 ], [ 0, %1 ]
switch i32 %6, label %16 [
i32 59, label %8
i32 58, label %8
i32 44, label %8
i32 41, label %8
i32 40, label %8
]
8: ; preds = %5, %5, %5, %5, %5
%9 = icmp eq i32 %7, 0
br i1 %9, label %10, label %12
10: ; preds = %8
%11 = trunc i32 %6 to i8
store i8 %11, i8* getelementptr inbounds ([5000 x i8], [5000 x i8]* @ReadTreeToken.buf, i64 0, i64 0)
br label %44
12: ; preds = %8
%13 = tail call i32 @ungetc(i32 %6, i32* %0)
%14 = sext i32 %7 to i64
%15 = getelementptr inbounds [5000 x i8], [5000 x i8]* @ReadTreeToken.buf, i64 0, i64 %14
br label %44
16: ; preds = %5
%17 = tail call i64 @isspace(i32 %6)
%18 = icmp eq i64 %17, 0
br i1 %18, label %24, label %19
19: ; preds = %16
%20 = icmp sgt i32 %7, 0
br i1 %20, label %21, label %34
21: ; preds = %19
%22 = zext i32 %7 to i64
%23 = getelementptr inbounds [5000 x i8], [5000 x i8]* @ReadTreeToken.buf, i64 0, i64 %22
br label %44
24: ; preds = %16
%25 = trunc i32 %6 to i8
%26 = add nsw i32 %7, 1
%27 = sext i32 %7 to i64
%28 = getelementptr inbounds [5000 x i8], [5000 x i8]* @ReadTreeToken.buf, i64 0, i64 %27
store i8 %25, i8* %28
%29 = icmp sgt i32 %7, 4998
br i1 %29, label %30, label %34
30: ; preds = %24
store i8 0, i8* getelementptr inbounds ([5000 x i8], [5000 x i8]* @ReadTreeToken.buf, i64 0, i64 4999)
%31 = load i32, i32* @stderr
%32 = tail call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5000 x i8], [5000 x i8]* @ReadTreeToken.buf, i64 0, i64 0))
%33 = tail call i32 @exit(i32 1)
unreachable
34: ; preds = %24, %19
%35 = phi i32 [ %7, %19 ], [ %26, %24 ]
%36 = tail call i32 @fgetc(i32* %0)
%37 = load i32, i32* @EOF
%38 = icmp eq i32 %36, %37
br i1 %38, label %39, label %5
39: ; preds = %34
%40 = icmp sgt i32 %35, 0
br i1 %40, label %41, label %46
41: ; preds = %39
%42 = zext i32 %35 to i64
%43 = getelementptr inbounds [5000 x i8], [5000 x i8]* @ReadTreeToken.buf, i64 0, i64 %42
br label %44
44: ; preds = %10, %12, %21, %41
%45 = phi i8* [ %43, %41 ], [ %23, %21 ], [ %15, %12 ], [ getelementptr inbounds ([5000 x i8], [5000 x i8]* @ReadTreeToken.buf, i64 0, i64 1), %10 ]
store i8 0, i8* %45
br label %46
46: ; preds = %44, %1, %39
%47 = phi i8* [ null, %39 ], [ null, %1 ], [ getelementptr inbounds ([5000 x i8], [5000 x i8]* @ReadTreeToken.buf, i64 0, i64 0), %44 ]
ret i8* %47
}