#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 */
struct Num {
  int dummy;
};
struct Node {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
struct Node *newTree();
struct Node *num_load_file(struct Num *this, char *file_name) {
  char c, in_comment_line = 0, is_new_line = 1, last_char = 0, number_parts[3];
  struct Node *result = newTree();
  FILE *file = fopen(file_name, "r");
  while ((c = fgetc(file)) != EOF) {
    if (!in_comment_line) {
      if (c == ' ') {
        if (number_parts[0] != '\0') {
          number_parts[1] = last_char;
          number_parts[2] = '\0';
        } else {
          number_parts[0] = last_char;
          number_parts[1] = '\0';
        }
        number_parts[0] = '\0';
      } else {
      }
    }
    if (is_new_line) {
      if (c == '*') {
        in_comment_line = 1;
      }
      is_new_line = 0;
    } else {
      if (c == '\n') {
        in_comment_line = 0;
        is_new_line = 1;
      }
    }
    last_char = c;
  }
  fclose(file);
  return result;
}


x86 assembly (clang, -O0):
<num_load_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x0,-0x12(%rbp)
movb   $0x1,-0x13(%rbp)
movb   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1050 <newTree@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe8e(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x11(%rbp)
movsbl %al,%eax
mov    0x2e57(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1235 <num_load_file+0xf5>
cmpb   $0x0,-0x12(%rbp)
jne    11ec <num_load_file+0xac>
movsbl -0x11(%rbp),%eax
cmp    $0x20,%eax
jne    11e2 <num_load_file+0xa2>
movsbl -0x17(%rbp),%eax
cmp    $0x0,%eax
je     11cf <num_load_file+0x8f>
mov    -0x14(%rbp),%al
mov    %al,-0x16(%rbp)
movb   $0x0,-0x15(%rbp)
jmp    11d9 <num_load_file+0x99>
mov    -0x14(%rbp),%al
mov    %al,-0x17(%rbp)
movb   $0x0,-0x16(%rbp)
movb   $0x0,-0x17(%rbp)
jmp    11e7 <num_load_file+0xa7>
jmp    11e7 <num_load_file+0xa7>
jmp    11ec <num_load_file+0xac>
cmpb   $0x0,-0x13(%rbp)
je     1210 <num_load_file+0xd0>
movsbl -0x11(%rbp),%eax
cmp    $0x2a,%eax
jne    1207 <num_load_file+0xc7>
movb   $0x1,-0x12(%rbp)
movb   $0x0,-0x13(%rbp)
jmp    122a <num_load_file+0xea>
movsbl -0x11(%rbp),%eax
cmp    $0xa,%eax
jne    1225 <num_load_file+0xe5>
movb   $0x0,-0x12(%rbp)
movb   $0x1,-0x13(%rbp)
jmp    122a <num_load_file+0xea>
mov    -0x11(%rbp),%al
mov    %al,-0x14(%rbp)
jmp    117b <num_load_file+0x3b>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<num_load_file>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
xor    %eax,%eax
call   1050 <newTree@plt>
mov    %rax,%r14
lea    0xea7(%rip),%rsi
mov    %rbx,%rdi
call   1060 <fopen@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <fgetc@plt>
mov    0x2e75(%rip),%r15
cmp    (%r15),%al
je     118d <num_load_file+0x4d>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <fgetc@plt>
cmp    (%r15),%al
jne    1180 <num_load_file+0x40>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
%struct.Node = type { i32 }
%struct.Num = type { i32 }
@.str = [2 x i8] c"r\00"
@EOF = global i8 0
define %struct.Node* @num_load_file(%struct.Num* nocapture readnone %0, i8* nocapture %1) {
%3 = tail call %struct.Node* (...) @newTree()
%4 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = tail call signext i8 @fgetc(i32* %4)
%6 = load i8, i8* @EOF
%7 = icmp eq i8 %5, %6
br i1 %7, label %12, label %8
8: ; preds = %2, %8
%9 = tail call signext i8 @fgetc(i32* %4)
%10 = load i8, i8* @EOF
%11 = icmp eq i8 %9, %10
br i1 %11, label %12, label %8
12: ; preds = %8, %2
%13 = tail call i32 @fclose(i32* %4)
ret %struct.Node* %3
}