#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
main() {
  int players, games;
  float totalScore = 0.0, score = 0.0, averageScore = 0.0, teamAverage = 0.0,
        playerAverage = 0.0, playerScore = 0.0;
  printf("\nPlease enter the number of players --> ");
  scanf("%d", &players);
  printf("\nPlease enter the number of games the players played --> ");
  scanf("%d", &games);
  for (int i = 1; i <= players; ++i) {
    score = 0.0;
    playerAverage = 0.0;
    playerScore = 0.0;
    for (int j = 1; j <= games; ++j) {
      printf("Enter player %d's score for game %d --> ", i, j);
      scanf("%f", &score);
      playerScore = playerScore + score;
      totalScore = totalScore + score;
    }
    playerAverage = playerScore / games;
    averageScore = averageScore + playerAverage;
    printf("\nPlayer %d's average is %.2f.\n", i, playerAverage);
  }
  teamAverage = averageScore / players;
  printf("\nThe team's average score was %.2f.\n", teamAverage);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb5(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe95(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x1,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1279 <main+0x159>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movl   $0x1,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     122f <main+0x10f>
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe97(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x24(%rbp),%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x10(%rbp),%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11d1 <main+0xb1>
movss  -0x24(%rbp),%xmm0
cvtsi2ssl -0xc(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x18(%rbp),%xmm0
addss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x28(%rbp),%esi
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe2e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11a6 <main+0x86>
movss  -0x18(%rbp),%xmm0
cvtsi2ssl -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe15(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x0,0x8(%rsp)
lea    0xec3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xede(%rip),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xecb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x10(%rsp),%eax
xorps  %xmm0,%xmm0
test   %eax,%eax
jle    124d <main+0x12d>
movss  %xmm0,0x4(%rsp)
mov    $0x1,%ebx
lea    0xefa(%rip),%r14
lea    0xec7(%rip),%r15
lea    0xee9(%rip),%r12
lea    0x8(%rsp),%r13
jmp    11eb <main+0xcb>
nopl   (%rax)
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  %xmm0,%xmm1
movss  0x4(%rsp),%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,0x4(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0x1(%rbx),%ecx
mov    0x10(%rsp),%eax
cmp    %eax,%ebx
mov    %ecx,%ebx
jge    1253 <main+0x133>
movl   $0x0,0x8(%rsp)
mov    0xc(%rsp),%eax
xorps  %xmm1,%xmm1
test   %eax,%eax
jle    11b0 <main+0x90>
xorps  %xmm1,%xmm1
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movss  %xmm1,0x14(%rsp)
add    $0x1,%ebp
mov    %r15,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movss  0x14(%rsp),%xmm1
addss  0x8(%rsp),%xmm1
mov    0xc(%rsp),%eax
cmp    %eax,%ebp
jl     1210 <main+0xf0>
jmp    11b0 <main+0x90>
movss  %xmm0,0x4(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  0x4(%rsp),%xmm1
divss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xe3f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [41 x i8] c"\0APlease enter the number of players --> \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [58 x i8] c"\0APlease enter the number of games the players played --> \00"
@.str.3 = [41 x i8] c"Enter player %d's score for game %d --> \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [31 x i8] c"\0APlayer %d's average is %.2f.\0A\00"
@.str.6 = [37 x i8] c"\0AThe team's average score was %.2f.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %1
store float 0.000000e+00, float* %4
store float 0.000000e+00, float* %5
store float 0.000000e+00, float* %6
store float 0.000000e+00, float* %7
store float 0.000000e+00, float* %8
store float 0.000000e+00, float* %9
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
store i32 1, i32* %10
br label %16
16: ; preds = %51, %0
%17 = load i32, i32* %10
%18 = load i32, i32* %2
%19 = icmp sle i32 %17, %18
br i1 %19, label %20, label %54
20: ; preds = %16
store float 0.000000e+00, float* %5
store float 0.000000e+00, float* %8
store float 0.000000e+00, float* %9
store i32 1, i32* %11
br label %21
21: ; preds = %36, %20
%22 = load i32, i32* %11
%23 = load i32, i32* %3
%24 = icmp sle i32 %22, %23
br i1 %24, label %25, label %39
25: ; preds = %21
%26 = load i32, i32* %10
%27 = load i32, i32* %11
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), i32 %26, i32 %27)
%29 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %5)
%30 = load float, float* %9
%31 = load float, float* %5
%32 = fadd float %30, %31
store float %32, float* %9
%33 = load float, float* %4
%34 = load float, float* %5
%35 = fadd float %33, %34
store float %35, float* %4
br label %36
36: ; preds = %25
%37 = load i32, i32* %11
%38 = add nsw i32 %37, 1
store i32 %38, i32* %11
br label %21
39: ; preds = %21
%40 = load float, float* %9
%41 = load i32, i32* %3
%42 = sitofp i32 %41 to float
%43 = fdiv float %40, %42
store float %43, float* %8
%44 = load float, float* %6
%45 = load float, float* %8
%46 = fadd float %44, %45
store float %46, float* %6
%47 = load i32, i32* %10
%48 = load float, float* %8
%49 = fpext float %48 to double
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i32 %47, double %49)
br label %51
51: ; preds = %39
%52 = load i32, i32* %10
%53 = add nsw i32 %52, 1
store i32 %53, i32* %10
br label %16
54: ; preds = %16
%55 = load float, float* %6
%56 = load i32, i32* %2
%57 = sitofp i32 %56 to float
%58 = fdiv float %55, %57
store float %58, float* %7
%59 = load float, float* %7
%60 = fpext float %59 to double
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0), double %60)
ret i32 0
}

LLVM IR (-O2):
@.str = [41 x i8] c"\0APlease enter the number of players --> \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [58 x i8] c"\0APlease enter the number of games the players played --> \00"
@.str.3 = [41 x i8] c"Enter player %d's score for game %d --> \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [31 x i8] c"\0APlayer %d's average is %.2f.\0A\00"
@.str.6 = [37 x i8] c"\0AThe team's average score was %.2f.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast float* %3 to i8*
store float 0.000000e+00, float* %3
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %1
%12 = icmp slt i32 %11, 1
br i1 %12, label %13, label %20
13: ; preds = %25, %0
%14 = phi float [ 0.000000e+00, %0 ], [ %30, %25 ]
%15 = phi i32 [ %11, %0 ], [ %34, %25 ]
%16 = sitofp i32 %15 to float
%17 = fdiv float %14, %16
%18 = fpext float %17 to double
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0), double %18)
ret i32 0
20: ; preds = %0, %25
%21 = phi i32 [ %33, %25 ], [ 1, %0 ]
%22 = phi float [ %30, %25 ], [ 0.000000e+00, %0 ]
store float 0.000000e+00, float* %3
%23 = load i32, i32* %2
%24 = icmp slt i32 %23, 1
br i1 %24, label %25, label %36
25: ; preds = %36, %20
%26 = phi float [ 0.000000e+00, %20 ], [ %42, %36 ]
%27 = phi i32 [ %23, %20 ], [ %44, %36 ]
%28 = sitofp i32 %27 to float
%29 = fdiv float %26, %28
%30 = fadd float %22, %29
%31 = fpext float %29 to double
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i32 %21, double %31)
%33 = add nuw nsw i32 %21, 1
%34 = load i32, i32* %1
%35 = icmp slt i32 %21, %34
br i1 %35, label %20, label %13
36: ; preds = %20, %36
%37 = phi i32 [ %43, %36 ], [ 1, %20 ]
%38 = phi float [ %42, %36 ], [ 0.000000e+00, %20 ]
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), i32 %21, i32 %37)
%40 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %3)
%41 = load float, float* %3
%42 = fadd float %38, %41
%43 = add nuw nsw i32 %37, 1
%44 = load i32, i32* %2
%45 = icmp slt i32 %37, %44
br i1 %45, label %36, label %25
}