#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 abs(int);
int /*<<< orphan*/ hitenter();
int kickball();
int passball();
int /*<<< orphan*/ printf(char *, ...);
int shotball();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  printf("\n\n\nFIVE POINT SOCCER\n=================\n");
  printf("First team to five points wins!\n\n\n(Press enter to begin)");
  hitenter();
  srand(time(NULL));
  int score[2] = {0, 0};
  int team = 0;
  int nextmove = 1;
  printf("\n\n%s Team:\n", (team == 0) ? "Home" : "Away");
  do {
    if (nextmove < 0) {
      printf("\n\n%s Team:\n", (team == 0) ? "Home" : "Away");
    }
    switch (abs(nextmove)) {
    case 1:
      nextmove = passball();
      break;
    case 2:
      nextmove = shotball();
      break;
    case 3:
      nextmove = kickball();
      break;
    }
    if (nextmove < 0) {
      if (nextmove == -11) {
        score[team]++;
        nextmove = -1;
      }
      printf("\nScore - Home: %d, Away: %d\n", score[0], score[1]);
      printf("(%s player, press enter)", (team == 0) ? "Home" : "Away");
      hitenter();
      team = (team + 1) % 2;
    }
  } while (score[0] < 5 && score[1] < 5);
  printf("\n\nTHE %s TEAM ARE THE CHAMPIONS!!\n\n\n\n(Press enter to exit)",
         (score[0] > score[1]) ? "HOME" : "AWAY");
  hitenter();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   10a0 <hitenter@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1090 <time@plt>
mov    %eax,%edi
call   1080 <srand@plt>
lea    -0xc(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1060 <memset@plt>
movl   $0x0,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%ecx
lea    0xe78(%rip),%rsi
lea    0xe6c(%rip),%rax
cmp    $0x0,%ecx
cmove  %rax,%rsi
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x0,-0x14(%rbp)
jge    1246 <main+0xb6>
mov    -0x10(%rbp),%ecx
lea    0xe48(%rip),%rsi
lea    0xe3c(%rip),%rax
cmp    $0x0,%ecx
cmove  %rax,%rsi
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,%ecx
mov    %ecx,-0x18(%rbp)
sub    $0x1,%eax
je     1283 <main+0xf3>
jmp    1261 <main+0xd1>
mov    -0x18(%rbp),%eax
sub    $0x2,%eax
je     1292 <main+0x102>
jmp    1272 <main+0xe2>
mov    -0x18(%rbp),%eax
sub    $0x3,%eax
je     12a1 <main+0x111>
jmp    12ab <main+0x11b>
mov    $0x0,%al
call   1040 <passball@plt>
mov    %eax,-0x14(%rbp)
jmp    12ab <main+0x11b>
mov    $0x0,%al
call   1070 <shotball@plt>
mov    %eax,-0x14(%rbp)
jmp    12ab <main+0x11b>
mov    $0x0,%al
call   10b0 <kickball@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1327 <main+0x197>
cmpl   $0xfffffff5,-0x14(%rbp)
jne    12d5 <main+0x145>
movslq -0x10(%rbp),%rax
mov    -0xc(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp,%rax,4)
movl   $0xffffffff,-0x14(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xd95(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%ecx
lea    0xd7f(%rip),%rsi
lea    0xd73(%rip),%rax
cmp    $0x0,%ecx
cmove  %rax,%rsi
lea    0xd8c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   10a0 <hitenter@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
jmp    132c <main+0x19c>
xor    %eax,%eax
cmpl   $0x5,-0xc(%rbp)
mov    %al,-0x19(%rbp)
jge    1345 <main+0x1b5>
cmpl   $0x5,-0x8(%rbp)
setl   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1216 <main+0x86>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%edx
lea    0xd90(%rip),%rsi
lea    0xd84(%rip),%rax
cmp    %edx,%ecx
cmovg  %rax,%rsi
lea    0xd3c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   10a0 <hitenter@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xf38(%rip),%rdi
call   1030 <puts@plt>
lea    0xe62(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1090 <hitenter@plt>
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
movq   $0x0,(%rsp)
lea    0xe70(%rip),%rdi
lea    0xe75(%rip),%r13
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%r15d
lea    0xe63(%rip),%r12
xor    %ebp,%ebp
xor    %ebx,%ebx
xor    %r14d,%r14d
xchg   %ax,%ax
test   %r15d,%r15d
jns    120d <main+0x8d>
test   %r14d,%r14d
mov    %r12,%rsi
cmove  %r13,%rsi
lea    0xe33(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15d,%eax
neg    %eax
cmovs  %r15d,%eax
cmp    $0x3,%eax
je     1240 <main+0xc0>
cmp    $0x2,%eax
je     1250 <main+0xd0>
cmp    $0x1,%eax
je     1260 <main+0xe0>
test   %r15d,%r15d
js     126f <main+0xef>
cmp    $0x4,%ebx
jle    12da <main+0x15a>
jmp    12e3 <main+0x163>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10a0 <kickball@plt>
jmp    1267 <main+0xe7>
nopl   0x0(%rax)
xor    %eax,%eax
call   1060 <shotball@plt>
jmp    1267 <main+0xe7>
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <passball@plt>
mov    %eax,%r15d
test   %r15d,%r15d
jns    122a <main+0xaa>
cmp    $0xfffffff5,%r15d
jne    1289 <main+0x109>
mov    %r14d,%eax
addl   $0x1,(%rsp,%rax,4)
mov    (%rsp),%ebx
mov    0x4(%rsp),%ebp
mov    $0xffffffff,%r15d
lea    0xdbf(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <printf@plt>
test   %r14d,%r14d
mov    %r12,%rsi
cmove  %r13,%rsi
lea    0xdc0(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1090 <hitenter@plt>
mov    %r14d,%eax
add    $0x1,%eax
shr    $0x1f,%eax
add    %r14d,%eax
add    $0x1,%eax
and    $0xfffffffe,%eax
neg    %eax
add    %eax,%r14d
add    $0x1,%r14d
cmp    $0x4,%ebx
jg     12e3 <main+0x163>
cmp    $0x5,%ebp
jl     11f0 <main+0x70>
cmp    %ebp,%ebx
lea    0xdd4(%rip),%rax
lea    0xdd2(%rip),%rsi
cmovg  %rax,%rsi
lea    0xd87(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1090 <hitenter@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [40 x i8] c"\0A\0A\0AFIVE POINT SOCCER\0A=================\0A\00"
@.str.1 = [57 x i8] c"First team to five points wins!\0A\0A\0A(Press enter to begin)\00"
@.str.2 = [12 x i8] c"\0A\0A%s Team:\0A\00"
@.str.3 = [5 x i8] c"Home\00"
@.str.4 = [5 x i8] c"Away\00"
@.str.5 = [29 x i8] c"\0AScore - Home: %d, Away: %d\0A\00"
@.str.6 = [25 x i8] c"(%s player, press enter)\00"
@.str.7 = [59 x i8] c"\0A\0ATHE %s TEAM ARE THE CHAMPIONS!!\0A\0A\0A\0A(Press enter to exit)\00"
@.str.8 = [5 x i8] c"HOME\00"
@.str.9 = [5 x i8] c"AWAY\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (...) @hitenter()
%8 = call i32 @time(i32* null)
%9 = call i32 @srand(i32 %8)
%10 = bitcast [2 x i32]* %2 to i8*
store i32 0, i32* %3
store i32 1, i32* %4
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 0
%13 = zext i1 %12 to i64
%14 = select i1 %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %14)
br label %16
16: ; preds = %70, %0
%17 = load i32, i32* %4
%18 = icmp slt i32 %17, 0
br i1 %18, label %19, label %25
19: ; preds = %16
%20 = load i32, i32* %3
%21 = icmp eq i32 %20, 0
%22 = zext i1 %21 to i64
%23 = select i1 %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %23)
br label %25
25: ; preds = %19, %16
%26 = load i32, i32* %4
%27 = call i32 @abs(i32 %26)
switch i32 %27, label %34 [
i32 1, label %28
i32 2, label %30
i32 3, label %32
]
28: ; preds = %25
%29 = call i32 (...) @passball()
store i32 %29, i32* %4
br label %34
30: ; preds = %25
%31 = call i32 (...) @shotball()
store i32 %31, i32* %4
br label %34
32: ; preds = %25
%33 = call i32 (...) @kickball()
store i32 %33, i32* %4
br label %34
34: ; preds = %25, %32, %30, %28
%35 = load i32, i32* %4
%36 = icmp slt i32 %35, 0
br i1 %36, label %37, label %61
37: ; preds = %34
%38 = load i32, i32* %4
%39 = icmp eq i32 %38, -11
br i1 %39, label %40, label %46
40: ; preds = %37
%41 = load i32, i32* %3
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 %42
%44 = load i32, i32* %43
%45 = add nsw i32 %44, 1
store i32 %45, i32* %43
store i32 -1, i32* %4
br label %46
46: ; preds = %40, %37
%47 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%48 = load i32, i32* %47
%49 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%50 = load i32, i32* %49
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), i32 %48, i32 %50)
%52 = load i32, i32* %3
%53 = icmp eq i32 %52, 0
%54 = zext i1 %53 to i64
%55 = select i1 %53, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0)
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i8* %55)
%57 = call i32 (...) @hitenter()
%58 = load i32, i32* %3
%59 = add nsw i32 %58, 1
%60 = srem i32 %59, 2
store i32 %60, i32* %3
br label %61
61: ; preds = %46, %34
br label %62
62: ; preds = %61
%63 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%64 = load i32, i32* %63
%65 = icmp slt i32 %64, 5
br i1 %65, label %66, label %70
66: ; preds = %62
%67 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%68 = load i32, i32* %67
%69 = icmp slt i32 %68, 5
br label %70
70: ; preds = %66, %62
%71 = phi i1 [ false, %62 ], [ %69, %66 ]
br i1 %71, label %16, label %72
72: ; preds = %70
%73 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%74 = load i32, i32* %73
%75 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%76 = load i32, i32* %75
%77 = icmp sgt i32 %74, %76
%78 = zext i1 %77 to i64
%79 = select i1 %77, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0)
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.7, i64 0, i64 0), i8* %79)
%81 = call i32 (...) @hitenter()
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [57 x i8] c"First team to five points wins!\0A\0A\0A(Press enter to begin)\00"
@.str.2 = [12 x i8] c"\0A\0A%s Team:\0A\00"
@.str.3 = [5 x i8] c"Home\00"
@.str.4 = [5 x i8] c"Away\00"
@.str.5 = [29 x i8] c"\0AScore - Home: %d, Away: %d\0A\00"
@.str.6 = [25 x i8] c"(%s player, press enter)\00"
@.str.7 = [59 x i8] c"\0A\0ATHE %s TEAM ARE THE CHAMPIONS!!\0A\0A\0A\0A(Press enter to exit)\00"
@.str.8 = [5 x i8] c"HOME\00"
@.str.9 = [5 x i8] c"AWAY\00"
@str = [39 x i8] c"\0A\0A\0AFIVE POINT SOCCER\0A=================\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to [2 x i32]*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 (...) @hitenter()
%6 = tail call i32 @time(i32* null)
%7 = tail call i32 @srand(i32 %6)
%8 = bitcast i64* %1 to i8*
store i64 0, i64* %1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%10 = bitcast i64* %1 to i32*
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
br label %12
12: ; preds = %53, %0
%13 = phi i32 [ 0, %0 ], [ %54, %53 ]
%14 = phi i32 [ 0, %0 ], [ %55, %53 ]
%15 = phi i32 [ 0, %0 ], [ %56, %53 ]
%16 = phi i32 [ 1, %0 ], [ %57, %53 ]
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %12
%19 = icmp eq i32 %15, 0
%20 = select i1 %19, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %20)
br label %22
22: ; preds = %18, %12
%23 = tail call i32 @llvm.abs.i32(i32 %16, i1 true)
switch i32 %23, label %30 [
i32 1, label %24
i32 2, label %26
i32 3, label %28
]
24: ; preds = %22
%25 = tail call i32 (...) @passball()
br label %30
26: ; preds = %22
%27 = tail call i32 (...) @shotball()
br label %30
28: ; preds = %22
%29 = tail call i32 (...) @kickball()
br label %30
30: ; preds = %22, %28, %26, %24
%31 = phi i32 [ %16, %22 ], [ %29, %28 ], [ %27, %26 ], [ %25, %24 ]
%32 = icmp slt i32 %31, 0
br i1 %32, label %33, label %53
33: ; preds = %30
%34 = icmp eq i32 %31, -11
br i1 %34, label %35, label %42
35: ; preds = %33
%36 = zext i32 %15 to i64
%37 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 %36
%38 = load i32, i32* %37
%39 = add nsw i32 %38, 1
store i32 %39, i32* %37
%40 = load i32, i32* %10
%41 = load i32, i32* %11
br label %42
42: ; preds = %35, %33
%43 = phi i32 [ %41, %35 ], [ %13, %33 ]
%44 = phi i32 [ %40, %35 ], [ %14, %33 ]
%45 = phi i32 [ -1, %35 ], [ %31, %33 ]
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), i32 %44, i32 %43)
%47 = icmp eq i32 %15, 0
%48 = select i1 %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0)
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i8* %48)
%50 = tail call i32 (...) @hitenter()
%51 = add nsw i32 %15, 1
%52 = srem i32 %51, 2
br label %53
53: ; preds = %30, %42
%54 = phi i32 [ %43, %42 ], [ %13, %30 ]
%55 = phi i32 [ %44, %42 ], [ %14, %30 ]
%56 = phi i32 [ %52, %42 ], [ %15, %30 ]
%57 = phi i32 [ %45, %42 ], [ %31, %30 ]
%58 = icmp slt i32 %55, 5
%59 = icmp slt i32 %54, 5
%60 = select i1 %58, i1 %59, i1 false
br i1 %60, label %12, label %61
61: ; preds = %53
%62 = icmp sgt i32 %55, %54
%63 = select i1 %62, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0)
%64 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.7, i64 0, i64 0), i8* %63)
%65 = tail call i32 (...) @hitenter()
ret i32 0
}