#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 *, float);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  float n, a, i, sum = 0;
  float avg = 0;
  scanf("%f", &n);
  for (i = 0; i < n; i++) {
    scanf("%f", &a);
    sum += a;
  }
  avg = sum / n;
  printf("Sum: %.0f", sum);
  printf("\nAvg: %.2f", avg);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
lea    0xebe(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    11a0 <main+0x80>
lea    0xe93(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0xc(%rbp),%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xe6f(%rip),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1157 <main+0x37>
movss  -0x14(%rbp),%xmm0
divss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
lea    0xe4c(%rip),%rdi
call   1030 <printf@plt>
movss  -0x18(%rbp),%xmm0
lea    0xe45(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xed6(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm1
jbe    119c <main+0x7c>
xorps  %xmm0,%xmm0
lea    0xeb4(%rip),%r14
lea    0x14(%rsp),%rbx
xorps  %xmm2,%xmm2
nopl   0x0(%rax,%rax,1)
movss  %xmm2,0x10(%rsp)
movss  %xmm0,0x8(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
movss  0x10(%rsp),%xmm2
movss  0x8(%rsp),%xmm0
addss  0x14(%rsp),%xmm0
addss  0xe6f(%rip),%xmm2
movss  0xc(%rsp),%xmm1
ucomiss %xmm2,%xmm1
ja     1160 <main+0x40>
movaps %xmm0,%xmm2
divss  %xmm1,%xmm2
movss  %xmm2,0x8(%rsp)
lea    0xe57(%rip),%rdi
call   1030 <printf@plt>
lea    0xe55(%rip),%rdi
movss  0x8(%rsp),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
@.str.1 = [10 x i8] c"Sum: %.0f\00"
@.str.2 = [11 x i8] c"\0AAvg: %.2f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store i32 0, i32* %1
store float 0.000000e+00, float* %5
store float 0.000000e+00, float* %6
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %2)
store float 0.000000e+00, float* %4
br label %8
8: ; preds = %17, %0
%9 = load float, float* %4
%10 = load float, float* %2
%11 = fcmp olt float %9, %10
br i1 %11, label %12, label %20
12: ; preds = %8
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %3)
%14 = load float, float* %3
%15 = load float, float* %5
%16 = fadd float %15, %14
store float %16, float* %5
br label %17
17: ; preds = %12
%18 = load float, float* %4
%19 = fadd float %18, 1.000000e+00
store float %19, float* %4
br label %8
20: ; preds = %8
%21 = load float, float* %5
%22 = load float, float* %2
%23 = fdiv float %21, %22
store float %23, float* %6
%24 = load float, float* %5
%25 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), float %24)
%26 = load float, float* %6
%27 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), float %26)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
@.str.1 = [10 x i8] c"Sum: %.0f\00"
@.str.2 = [11 x i8] c"\0AAvg: %.2f\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = bitcast float* %1 to i8*
%4 = bitcast float* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%6 = load float, float* %1
%7 = fcmp ogt float %6, 0.000000e+00
br i1 %7, label %8, label %17
8: ; preds = %0, %8
%9 = phi float [ %13, %8 ], [ 0.000000e+00, %0 ]
%10 = phi float [ %14, %8 ], [ 0.000000e+00, %0 ]
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %2)
%12 = load float, float* %2
%13 = fadd float %9, %12
%14 = fadd float %10, 1.000000e+00
%15 = load float, float* %1
%16 = fcmp olt float %14, %15
br i1 %16, label %8, label %17
17: ; preds = %8, %0
%18 = phi float [ 0.000000e+00, %0 ], [ %13, %8 ]
%19 = phi float [ %6, %0 ], [ %15, %8 ]
%20 = fdiv float %18, %19
%21 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), float %18)
%22 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), float %20)
ret i32 0
}