#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_run(int, int, int);
int class_number(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char **, int *, int *);
int /*<<< orphan*/ system(char *);
void new_arena() {
  int a = 0, win = 0, lost = 0, i = 0, choice = 0;
  char class[10];
  printf("\n __________________________________ \n"
         ": Class then Win then Loss         :\n"
         ": -------------------------------- :\n"
         ": Druid 12 2                       :\n"
         ":__________________________________:\n\n");
  scanf("%s %d %d", &class, &win, &lost);
  system("cls");
  a = class_number(class);
  if (a && win == 12 && lost < 3) {
    add_run(a, win, lost);
    printf("\n __________________________________ \n"
           ": Run added successfully!          :\n"
           ":__________________________________:\n");
  } else if (a && win < 12 && lost == 3) {
    add_run(a, win, lost);
    printf("\n __________________________________ \n"
           ": Run added successfully!          :\n"
           ":__________________________________:\n");
  } else
    printf("\n __________________________________ \n"
           ": Wrong inputs(Name, wins or loss) :\n"
           ":__________________________________:\n");
}


x86 assembly (clang, -O0):
<new_arena>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xe7e(%rip),%rdi
call   1050 <printf@plt>
lea    -0x1e(%rbp),%rsi
lea    0xf2a(%rip),%rdi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1070 <scanf@plt>
lea    0xf1f(%rip),%rdi
call   1040 <system@plt>
lea    -0x1e(%rbp),%rdi
call   1030 <class_number@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     11f4 <new_arena+0xa4>
cmpl   $0xc,-0x8(%rbp)
jne    11f4 <new_arena+0xa4>
cmpl   $0x3,-0xc(%rbp)
jge    11f4 <new_arena+0xa4>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1060 <add_run@plt>
lea    0xedf(%rip),%rdi
call   1050 <printf@plt>
jmp    1242 <new_arena+0xf2>
cmpl   $0x0,-0x4(%rbp)
je     1231 <new_arena+0xe1>
cmpl   $0xc,-0x8(%rbp)
jge    1231 <new_arena+0xe1>
cmpl   $0x3,-0xc(%rbp)
jne    1231 <new_arena+0xe1>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1060 <add_run@plt>
lea    0xea2(%rip),%rdi
call   1050 <printf@plt>
jmp    123d <new_arena+0xed>
lea    0xf02(%rip),%rdi
call   1050 <printf@plt>
jmp    1242 <new_arena+0xf2>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<new_arena>:
push   %rbx
sub    $0x20,%rsp
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
lea    0xea1(%rip),%rdi
call   1030 <puts@plt>
lea    0xe88(%rip),%rdi
lea    0x16(%rsp),%rbx
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
mov    %rbx,%rsi
call   1070 <scanf@plt>
lea    0xe73(%rip),%rdi
call   1050 <system@plt>
mov    %rbx,%rdi
call   1040 <class_number@plt>
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
test   %eax,%eax
je     11c2 <new_arena+0x72>
cmp    $0xc,%esi
jne    11c2 <new_arena+0x72>
cmp    $0x2,%edx
jg     11c2 <new_arena+0x72>
mov    %eax,%edi
mov    $0xc,%esi
jmp    11de <new_arena+0x8e>
lea    0xeff(%rip),%rdi
test   %eax,%eax
je     11ea <new_arena+0x9a>
cmp    $0xb,%esi
jg     11ea <new_arena+0x9a>
cmp    $0x3,%edx
jne    11ea <new_arena+0x9a>
mov    %eax,%edi
mov    $0x3,%edx
call   1060 <add_run@plt>
lea    0xf4e(%rip),%rdi
call   1030 <puts@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [188 x i8] c"\0A __________________________________ \0A: Class then Win then Loss :\0A: -------------------------------- :\0A: Druid 12 2 :\0A:__________________________________:\0A\0A\00"
@.str.1 = [9 x i8] c"%s %d %d\00"
@.str.2 = [4 x i8] c"cls\00"
@.str.3 = [113 x i8] c"\0A __________________________________ \0A: Run added successfully! :\0A:__________________________________:\0A\00"
@.str.4 = [113 x i8] c"\0A __________________________________ \0A: Wrong inputs(Name, wins or loss) :\0A:__________________________________:\0A\00"
define void @new_arena() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [10 x i8]
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
%7 = call i32 @printf(i8* getelementptr inbounds ([188 x i8], [188 x i8]* @.str, i64 0, i64 0))
%8 = bitcast [10 x i8]* %6 to i8**
%9 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8** %8, i32* %2, i32* %3)
%10 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%12 = call i32 @class_number(i8* %11)
store i32 %12, i32* %1
%13 = load i32, i32* %1
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %27
15: ; preds = %0
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, 12
br i1 %17, label %18, label %27
18: ; preds = %15
%19 = load i32, i32* %3
%20 = icmp slt i32 %19, 3
br i1 %20, label %21, label %27
21: ; preds = %18
%22 = load i32, i32* %1
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = call i32 @add_run(i32 %22, i32 %23, i32 %24)
%26 = call i32 @printf(i8* getelementptr inbounds ([113 x i8], [113 x i8]* @.str.3, i64 0, i64 0))
br label %45
27: ; preds = %18, %15, %0
%28 = load i32, i32* %1
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %42
30: ; preds = %27
%31 = load i32, i32* %2
%32 = icmp slt i32 %31, 12
br i1 %32, label %33, label %42
33: ; preds = %30
%34 = load i32, i32* %3
%35 = icmp eq i32 %34, 3
br i1 %35, label %36, label %42
36: ; preds = %33
%37 = load i32, i32* %1
%38 = load i32, i32* %2
%39 = load i32, i32* %3
%40 = call i32 @add_run(i32 %37, i32 %38, i32 %39)
%41 = call i32 @printf(i8* getelementptr inbounds ([113 x i8], [113 x i8]* @.str.3, i64 0, i64 0))
br label %44
42: ; preds = %33, %30, %27
%43 = call i32 @printf(i8* getelementptr inbounds ([113 x i8], [113 x i8]* @.str.4, i64 0, i64 0))
br label %44
44: ; preds = %42, %36
br label %45
45: ; preds = %44, %21
ret void
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"%s %d %d\00"
@.str.2 = [4 x i8] c"cls\00"
@str = [187 x i8] c"\0A __________________________________ \0A: Class then Win then Loss :\0A: -------------------------------- :\0A: Druid 12 2 :\0A:__________________________________:\0A\00"
@str.5 = [112 x i8] c"\0A __________________________________ \0A: Wrong inputs(Name, wins or loss) :\0A:__________________________________:\00"
@str.7 = [112 x i8] c"\0A __________________________________ \0A: Run added successfully! :\0A:__________________________________:\00"
define void @new_arena() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i8]
%4 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([187 x i8], [187 x i8]* @str, i64 0, i64 0))
%8 = bitcast [10 x i8]* %3 to i8**
%9 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8** %8, i32* %1, i32* %2)
%10 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @class_number(i8* %6)
%12 = icmp ne i32 %11, 0
%13 = load i32, i32* %1
%14 = icmp eq i32 %13, 12
%15 = select i1 %12, i1 %14, i1 false
%16 = load i32, i32* %2
%17 = icmp slt i32 %16, 3
%18 = select i1 %15, i1 %17, i1 false
br i1 %18, label %19, label %21
19: ; preds = %0
%20 = call i32 @add_run(i32 %11, i32 12, i32 %16)
br label %28
21: ; preds = %0
%22 = icmp slt i32 %13, 12
%23 = select i1 %12, i1 %22, i1 false
%24 = icmp eq i32 %16, 3
%25 = select i1 %23, i1 %24, i1 false
br i1 %25, label %26, label %28
26: ; preds = %21
%27 = call i32 @add_run(i32 %11, i32 %13, i32 3)
br label %28
28: ; preds = %21, %26, %19
%29 = phi i8* [ getelementptr inbounds ([112 x i8], [112 x i8]* @str.7, i64 0, i64 0), %26 ], [ getelementptr inbounds ([112 x i8], [112 x i8]* @str.7, i64 0, i64 0), %19 ], [ getelementptr inbounds ([112 x i8], [112 x i8]* @str.5, i64 0, i64 0), %21 ]
%30 = call i32 @puts(i8* dereferenceable(1) %29)
ret void
}