#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ findNode(char *, int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *, char *, int *,
                          char *, ...);
int /*<<< orphan*/ initializeTreeNode(char *, int);
int /*<<< orphan*/ insertToTree(int /*<<< orphan*/);
void getData() {
  FILE *fp;
  char token[100], foo[100], c;
  int id, n, i;
  fp = fopen("output/tree.txt", "r");
  while (!feof(fp)) {
    fscanf(fp, "%s %c%i%c\n%c\n", token, &foo[0], &id, &foo[1], &foo[2]);
    findNode(token, id);
    for (n = 0, c = fgetc(fp); c != '\n'; c = fgetc(fp)) {
      if (c == 'v')
        n++;
    }
    for (i = 0; n != 0; n--, i++) {
      fscanf(fp, "%s %c%i%c\n", token, &foo[0], &id, &foo[1]);
      insertToTree(initializeTreeNode(token, id));
    }
  }
  fclose(fp);
}


x86 assembly (clang, -O0):
<getData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
lea    0xe6e(%rip),%rdi
lea    0xe77(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11c0 <getData+0x40>
jmp    12f2 <getData+0x172>
mov    -0x8(%rbp),%rdi
lea    -0x70(%rbp),%rdx
lea    -0xe0(%rbp),%rcx
lea    -0xe0(%rbp),%r9
add    $0x1,%r9
lea    -0xe0(%rbp),%rax
add    $0x2,%rax
lea    0xe26(%rip),%rsi
lea    -0xe8(%rbp),%r8
mov    %rax,(%rsp)
mov    $0x0,%al
call   1040 <fscanf@plt>
lea    -0x70(%rbp),%rdi
mov    -0xe8(%rbp),%esi
call   10a0 <findNode@plt>
movl   $0x0,-0xec(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %al,-0xe1(%rbp)
movsbl -0xe1(%rbp),%eax
cmp    $0xa,%eax
je     126e <getData+0xee>
movsbl -0xe1(%rbp),%eax
cmp    $0x76,%eax
jne    1255 <getData+0xd5>
mov    -0xec(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xec(%rbp)
jmp    125a <getData+0xda>
mov    -0x8(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %al,-0xe1(%rbp)
jmp    1226 <getData+0xa6>
movl   $0x0,-0xf0(%rbp)
cmpl   $0x0,-0xec(%rbp)
je     12ed <getData+0x16d>
mov    -0x8(%rbp),%rdi
lea    -0x70(%rbp),%rdx
lea    -0xe0(%rbp),%rcx
lea    -0xe0(%rbp),%r9
add    $0x1,%r9
lea    0xd7a(%rip),%rsi
lea    -0xe8(%rbp),%r8
mov    $0x0,%al
call   1040 <fscanf@plt>
lea    -0x70(%rbp),%rdi
mov    -0xe8(%rbp),%esi
call   1080 <initializeTreeNode@plt>
mov    %eax,%edi
call   1090 <insertToTree@plt>
mov    -0xec(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xec(%rbp)
mov    -0xf0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf0(%rbp)
jmp    1278 <getData+0xf8>
jmp    11a2 <getData+0x22>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getData>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
lea    0xe68(%rip),%rdi
lea    0xe71(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <feof@plt>
test   %eax,%eax
je     11cd <getData+0x4d>
mov    %rbx,%rdi
call   1030 <fclose@plt>
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x11(%rsp),%r9
lea    0x80(%rsp),%r13
lea    0x10(%rsp),%rbp
lea    0xc(%rsp),%r8
jmp    1202 <getData+0x82>
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1060 <feof@plt>
test   %eax,%eax
mov    %r15,%r9
mov    %r12,%r8
jne    11b3 <getData+0x33>
lea    0x12(%rsp),%rax
mov    %rax,(%rsp)
mov    %rbx,%rdi
lea    0xdfd(%rip),%rsi
mov    %r13,%rdx
mov    %rbp,%rcx
mov    %r8,%r12
mov    %r9,%r15
xor    %eax,%eax
call   1040 <fscanf@plt>
mov    0xc(%rsp),%esi
mov    %r13,%rdi
call   10a0 <findNode@plt>
xor    %r14d,%r14d
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1050 <fgetc@plt>
cmp    $0x76,%al
je     1252 <getData+0xd2>
cmp    $0xa,%al
jne    1240 <getData+0xc0>
jmp    1260 <getData+0xe0>
add    $0x1,%ebp
add    $0xffffffff,%r14d
jmp    1240 <getData+0xc0>
nopl   0x0(%rax,%rax,1)
test   %ebp,%ebp
lea    0x10(%rsp),%rbp
lea    0x80(%rsp),%r13
je     11f0 <getData+0x70>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
lea    0xd96(%rip),%rsi
mov    %r13,%rdx
mov    %rbp,%rcx
mov    %r12,%r8
mov    %r15,%r9
xor    %eax,%eax
call   1040 <fscanf@plt>
mov    0xc(%rsp),%esi
mov    %r13,%rdi
call   1080 <initializeTreeNode@plt>
mov    %eax,%edi
call   1090 <insertToTree@plt>
inc    %r14d
jne    1280 <getData+0x100>
jmp    11f0 <getData+0x70>

LLVM IR (-O0):
@.str = [16 x i8] c"output/tree.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [14 x i8] c"%s %c%i%c\0A%c\0A\00"
@.str.3 = [11 x i8] c"%s %c%i%c\0A\00"
define void @getData() {
%1 = alloca i32*
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %8, i32** %1
br label %9
9: ; preds = %60, %0
%10 = load i32*, i32** %1
%11 = call i32 @feof(i32* %10)
%12 = icmp ne i32 %11, 0
%13 = xor i1 %12, true
br i1 %13, label %14, label %61
14: ; preds = %9
%15 = load i32*, i32** %1
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 1
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 2
%20 = call i32 (i32*, i8*, i8*, i8*, i32*, i8*, ...) @fscanf(i32* %15, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %16, i8* %17, i32* %5, i8* %18, i8* %19)
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%22 = load i32, i32* %5
%23 = call i32 @findNode(i8* %21, i32 %22)
store i32 0, i32* %6
%24 = load i32*, i32** %1
%25 = call signext i8 @fgetc(i32* %24)
store i8 %25, i8* %4
br label %26
26: ; preds = %38, %14
%27 = load i8, i8* %4
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %28, 10
br i1 %29, label %30, label %41
30: ; preds = %26
%31 = load i8, i8* %4
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 118
br i1 %33, label %34, label %37
34: ; preds = %30
%35 = load i32, i32* %6
%36 = add nsw i32 %35, 1
store i32 %36, i32* %6
br label %37
37: ; preds = %34, %30
br label %38
38: ; preds = %37
%39 = load i32*, i32** %1
%40 = call signext i8 @fgetc(i32* %39)
store i8 %40, i8* %4
br label %26
41: ; preds = %26
store i32 0, i32* %7
br label %42
42: ; preds = %55, %41
%43 = load i32, i32* %6
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %60
45: ; preds = %42
%46 = load i32*, i32** %1
%47 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%48 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%49 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 1
%50 = call i32 (i32*, i8*, i8*, i8*, i32*, i8*, ...) @fscanf(i32* %46, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %47, i8* %48, i32* %5, i8* %49)
%51 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%52 = load i32, i32* %5
%53 = call i32 @initializeTreeNode(i8* %51, i32 %52)
%54 = call i32 @insertToTree(i32 %53)
br label %55
55: ; preds = %45
%56 = load i32, i32* %6
%57 = add nsw i32 %56, -1
store i32 %57, i32* %6
%58 = load i32, i32* %7
%59 = add nsw i32 %58, 1
store i32 %59, i32* %7
br label %42
60: ; preds = %42
br label %9
61: ; preds = %9
%62 = load i32*, i32** %1
%63 = call i32 @fclose(i32* %62)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"output/tree.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [14 x i8] c"%s %c%i%c\0A%c\0A\00"
@.str.3 = [11 x i8] c"%s %c%i%c\0A\00"
define void @getData() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = alloca i32
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = bitcast i32* %3 to i8*
%7 = tail call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @feof(i32* %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %36
10: ; preds = %0
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 1
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 2
br label %16
13: ; preds = %28, %24
%14 = call i32 @feof(i32* %7)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %36
16: ; preds = %10, %13
%17 = call i32 (i32*, i8*, i8*, i8*, i32*, i8*, ...) @fscanf(i32* %7, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %4, i8* %5, i32* %3, i8* %11, i8* %12)
%18 = load i32, i32* %3
%19 = call i32 @findNode(i8* %4, i32 %18)
br label %20
20: ; preds = %26, %16
%21 = phi i32 [ %27, %26 ], [ 0, %16 ]
br label %22
22: ; preds = %20, %22
%23 = call signext i8 @fgetc(i32* %7)
switch i8 %23, label %22 [
i8 10, label %24
i8 118, label %26
]
24: ; preds = %22
%25 = icmp eq i32 %21, 0
br i1 %25, label %13, label %28
26: ; preds = %22
%27 = add nuw nsw i32 %21, 1
br label %20
28: ; preds = %24, %28
%29 = phi i32 [ %34, %28 ], [ %21, %24 ]
%30 = call i32 (i32*, i8*, i8*, i8*, i32*, i8*, ...) @fscanf(i32* %7, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %4, i8* %5, i32* %3, i8* %11)
%31 = load i32, i32* %3
%32 = call i32 @initializeTreeNode(i8* %4, i32 %31)
%33 = call i32 @insertToTree(i32 %32)
%34 = add nsw i32 %29, -1
%35 = icmp eq i32 %34, 0
br i1 %35, label %13, label %28
36: ; preds = %13, %0
%37 = call i32 @fclose(i32* %7)
ret void
}