#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 */
int /*<<< orphan*/ add_projections_to_stats(char *);
int /*<<< orphan*/ display_min_stats();
int /*<<< orphan*/ display_stats();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ read_stats_from_file(char *);
int /*<<< orphan*/ scanf(char *, char **);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ write_stats_to_file(char *);
int main(int argc, char *argv[]) {
  if (argc < 4) {
    printf(
        "%s program requires: stats.txt, projections.txt, and new_stats.txt\n",
        argv[0]);
    return -1;
  }
  if (strcmp(argv[1], "stats.txt") != 0 &&
      strcmp(argv[2], "projections.txt") != 0 &&
      strcmp(argv[3], "new_stats.txt") != 0) {
    printf("Wrong files, please use stats.txt projections.txt new_stats.txt in "
           "that order");
    return -1;
  }
  read_stats_from_file(argv[1]);
  display_stats();
  char buffer[50];
  printf("\nWould you like to import the 2014 Cardinals Projections? (yes or "
         "no): ");
  scanf("%s", &buffer);
  if (strcmp(buffer, "yes") == 0) {
    add_projections_to_stats(argv[2]);
  }
  display_min_stats();
  write_stats_to_file(argv[3]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    11c1 <main+0x41>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    12a9 <main+0x129>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe88(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     1235 <main+0xb5>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe56(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     1235 <main+0xb5>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xe48(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     1235 <main+0xb5>
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    12a9 <main+0x129>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10a0 <read_stats_from_file@plt>
mov    $0x0,%al
call   1070 <display_stats@plt>
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x50(%rbp),%rsi
lea    0xe96(%rip),%rdi
call   1090 <scanf@plt>
lea    -0x50(%rbp),%rdi
lea    0xe89(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    128e <main+0x10e>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <add_projections_to_stats@plt>
mov    $0x0,%al
call   1030 <display_min_stats@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1080 <write_stats_to_file@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %rsi,%rbx
cmp    $0x3,%edi
jg     11ab <main+0x2b>
mov    (%rbx),%rsi
lea    0xe66(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffff,%ebp
jmp    125e <main+0xde>
mov    0x8(%rbx),%rdi
lea    0xea2(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11ff <main+0x7f>
mov    0x10(%rbx),%rdi
lea    0xe79(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11ff <main+0x7f>
mov    0x18(%rbx),%rdi
lea    0xe74(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11ff <main+0x7f>
lea    0xe71(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffff,%ebp
jmp    125e <main+0xde>
mov    0x8(%rbx),%rdi
call   10a0 <read_stats_from_file@plt>
xor    %ebp,%ebp
xor    %eax,%eax
call   1070 <display_stats@plt>
lea    0xe98(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xed2(%rip),%rdi
mov    %rsp,%r14
mov    %r14,%rsi
call   1090 <scanf@plt>
lea    0xec3(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    124e <main+0xce>
mov    0x10(%rbx),%rdi
call   1040 <add_projections_to_stats@plt>
xor    %eax,%eax
call   1030 <display_min_stats@plt>
mov    0x18(%rbx),%rdi
call   1080 <write_stats_to_file@plt>
mov    %ebp,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [68 x i8] c"%s program requires: stats.txt, projections.txt, and new_stats.txt\0A\00"
@.str.1 = [10 x i8] c"stats.txt\00"
@.str.2 = [16 x i8] c"projections.txt\00"
@.str.3 = [14 x i8] c"new_stats.txt\00"
@.str.4 = [78 x i8] c"Wrong files, please use stats.txt projections.txt new_stats.txt in that order\00"
@.str.5 = [72 x i8] c"\0AWould you like to import the 2014 Cardinals Projections? (yes or no): \00"
@.str.6 = [3 x i8] c"%s\00"
@.str.7 = [4 x i8] c"yes\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [50 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 4
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0), i8* %12)
store i32 -1, i32* %3
br label %57
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %34
20: ; preds = %14
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 2
%23 = load i8*, i8** %22
%24 = call i64 @strcmp(i8* %23, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %34
26: ; preds = %20
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 3
%29 = load i8*, i8** %28
%30 = call i64 @strcmp(i8* %29, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %26
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %3
br label %57
34: ; preds = %26, %20, %14
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 1
%37 = load i8*, i8** %36
%38 = call i32 @read_stats_from_file(i8* %37)
%39 = call i32 (...) @display_stats()
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.5, i64 0, i64 0))
%41 = bitcast [50 x i8]* %6 to i8**
%42 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8** %41)
%43 = getelementptr inbounds [50 x i8], [50 x i8]* %6, i64 0, i64 0
%44 = call i64 @strcmp(i8* %43, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %51
46: ; preds = %34
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 2
%49 = load i8*, i8** %48
%50 = call i32 @add_projections_to_stats(i8* %49)
br label %51
51: ; preds = %46, %34
%52 = call i32 (...) @display_min_stats()
%53 = load i8**, i8*** %5
%54 = getelementptr inbounds i8*, i8** %53, i64 3
%55 = load i8*, i8** %54
%56 = call i32 @write_stats_to_file(i8* %55)
store i32 0, i32* %3
br label %57
57: ; preds = %51, %32, %9
%58 = load i32, i32* %3
ret i32 %58
}

LLVM IR (-O2):
@.str = [68 x i8] c"%s program requires: stats.txt, projections.txt, and new_stats.txt\0A\00"
@.str.1 = [10 x i8] c"stats.txt\00"
@.str.2 = [16 x i8] c"projections.txt\00"
@.str.3 = [14 x i8] c"new_stats.txt\00"
@.str.4 = [78 x i8] c"Wrong files, please use stats.txt projections.txt new_stats.txt in that order\00"
@.str.5 = [72 x i8] c"\0AWould you like to import the 2014 Cardinals Projections? (yes or no): \00"
@.str.6 = [3 x i8] c"%s\00"
@.str.7 = [4 x i8] c"yes\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [50 x i8]
%4 = icmp slt i32 %0, 4
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i8*, i8** %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %44
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %25, label %13
13: ; preds = %8
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = tail call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %25, label %18
18: ; preds = %13
%19 = getelementptr inbounds i8*, i8** %1, i64 3
%20 = load i8*, i8** %19
%21 = tail call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %18
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @.str.4, i64 0, i64 0))
br label %44
25: ; preds = %18, %13, %8
%26 = load i8*, i8** %9
%27 = tail call i32 @read_stats_from_file(i8* %26)
%28 = tail call i32 (...) @display_stats()
%29 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @.str.5, i64 0, i64 0))
%31 = bitcast [50 x i8]* %3 to i8**
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8** %31)
%33 = call i64 @strcmp(i8* %29, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %39
35: ; preds = %25
%36 = getelementptr inbounds i8*, i8** %1, i64 2
%37 = load i8*, i8** %36
%38 = call i32 @add_projections_to_stats(i8* %37)
br label %39
39: ; preds = %35, %25
%40 = call i32 (...) @display_min_stats()
%41 = getelementptr inbounds i8*, i8** %1, i64 3
%42 = load i8*, i8** %41
%43 = call i32 @write_stats_to_file(i8* %42)
br label %44
44: ; preds = %39, %23, %5
%45 = phi i32 [ -1, %5 ], [ -1, %23 ], [ 0, %39 ]
ret i32 %45
}