#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 */
double *malloc(int);
int printf(char *, double, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int i, n;
  double *a, s = 0;
  for (i = 0, scanf("%d", &n), a = malloc(n * sizeof(double)); i < n;
       scanf("%lf", a + i), s += a[i++])
    ;
  for (i = 0; i < n || 0 * printf("\n합계 : %.2lf\n평균 : %.2lf\n", s, s / n);
       printf("%.2lf ", a[i++]))
    ;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xeab(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11c7 <main+0x97>
jmp    1184 <main+0x54>
mov    -0x18(%rbp),%rsi
movslq -0x8(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x8(%rbp)
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1173 <main+0x43>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x1,%al
cmp    -0xc(%rbp),%ecx
mov    %al,-0x21(%rbp)
jl     120c <main+0xdc>
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
cvtsi2sdl -0xc(%rbp),%xmm2
divsd  %xmm2,%xmm1
lea    0xe0e(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
imul   $0x0,%eax,%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    121c <main+0xec>
jmp    124b <main+0x11b>
jmp    1221 <main+0xf1>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x8(%rbp)
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xde8(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    11ce <main+0x9e>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xebc(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x4(%rsp),%r12d
lea    0x0(,%r12,8),%edi
call   1040 <malloc@plt>
test   %r12d,%r12d
jle    11f6 <main+0xc6>
mov    %rax,%r14
xorpd  %xmm0,%xmm0
lea    0xe8a(%rip),%r15
mov    %rax,%rbx
xor    %r13d,%r13d
nop
movsd  %xmm0,0x8(%rsp)
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movsd  0x8(%rsp),%xmm0
addsd  (%rbx),%xmm0
add    $0x1,%r13
movslq 0x4(%rsp),%r12
add    $0x8,%rbx
cmp    %r12,%r13
jl     1180 <main+0x50>
test   %r12d,%r12d
jle    11fa <main+0xca>
movsd  %xmm0,0x8(%rsp)
xor    %ebx,%ebx
lea    0xe64(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  (%r14,%rbx,8),%xmm0
add    $0x1,%rbx
mov    %r15,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movslq 0x4(%rsp),%r12
cmp    %r12,%rbx
jl     11d0 <main+0xa0>
movsd  0x8(%rsp),%xmm0
jmp    11fa <main+0xca>
xorpd  %xmm0,%xmm0
cvtsi2sd %r12d,%xmm2
movapd %xmm0,%xmm1
divsd  %xmm2,%xmm1
lea    0xdf9(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [32 x i8] c"\0A\ED\95\A9\EA\B3\84 : %.2lf\0A\ED\8F\89\EA\B7\A0 : %.2lf\0A\00"
@.str.3 = [7 x i8] c"%.2lf \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double*
%5 = alloca double
store i32 0, i32* %1
store double 0.000000e+00, double* %5
store i32 0, i32* %2
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = mul i64 %8, 8
%10 = trunc i64 %9 to i32
%11 = call double* @malloc(i32 %10)
store double* %11, double** %4
br label %12
12: ; preds = %17, %0
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %31
16: ; preds = %12
br label %17
17: ; preds = %16
%18 = load double*, double** %4
%19 = load i32, i32* %2
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds double, double* %18, i64 %20
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %21)
%23 = load double*, double** %4
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 1
store i32 %25, i32* %2
%26 = sext i32 %24 to i64
%27 = getelementptr inbounds double, double* %23, i64 %26
%28 = load double, double* %27
%29 = load double, double* %5
%30 = fadd double %29, %28
store double %30, double* %5
br label %12
31: ; preds = %12
store i32 0, i32* %2
br label %32
32: ; preds = %48, %31
%33 = load i32, i32* %2
%34 = load i32, i32* %3
%35 = icmp slt i32 %33, %34
br i1 %35, label %45, label %36
36: ; preds = %32
%37 = load double, double* %5
%38 = load double, double* %5
%39 = load i32, i32* %3
%40 = sitofp i32 %39 to double
%41 = fdiv double %38, %40
%42 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), double %37, double %41)
%43 = mul nsw i32 0, %42
%44 = icmp ne i32 %43, 0
br label %45
45: ; preds = %36, %32
%46 = phi i1 [ true, %32 ], [ %44, %36 ]
br i1 %46, label %47, label %56
47: ; preds = %45
br label %48
48: ; preds = %47
%49 = load double*, double** %4
%50 = load i32, i32* %2
%51 = add nsw i32 %50, 1
store i32 %51, i32* %2
%52 = sext i32 %50 to i64
%53 = getelementptr inbounds double, double* %49, i64 %52
%54 = load double, double* %53
%55 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), double %54)
br label %32
56: ; preds = %45
%57 = load i32, i32* %1
ret i32 %57
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [32 x i8] c"\0A\ED\95\A9\EA\B3\84 : %.2lf\0A\ED\8F\89\EA\B7\A0 : %.2lf\0A\00"
@.str.3 = [7 x i8] c"%.2lf \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = shl i32 %4, 3
%6 = call double* @malloc(i32 %5)
%7 = icmp sgt i32 %4, 0
br i1 %7, label %10, label %21
8: ; preds = %10
%9 = icmp sgt i32 %18, 0
br i1 %9, label %27, label %21
10: ; preds = %0, %10
%11 = phi i64 [ %15, %10 ], [ 0, %0 ]
%12 = phi double [ %17, %10 ], [ 0.000000e+00, %0 ]
%13 = getelementptr inbounds double, double* %6, i64 %11
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %13)
%15 = add nuw nsw i64 %11, 1
%16 = load double, double* %13
%17 = fadd double %12, %16
%18 = load i32, i32* %1
%19 = sext i32 %18 to i64
%20 = icmp slt i64 %15, %19
br i1 %20, label %10, label %8
21: ; preds = %27, %0, %8
%22 = phi double [ %17, %8 ], [ 0.000000e+00, %0 ], [ %17, %27 ]
%23 = phi i32 [ %18, %8 ], [ %4, %0 ], [ %33, %27 ]
%24 = sitofp i32 %23 to double
%25 = fdiv double %22, %24
%26 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), double %22, double %25)
ret i32 0
27: ; preds = %8, %27
%28 = phi i64 [ %29, %27 ], [ 0, %8 ]
%29 = add nuw nsw i64 %28, 1
%30 = getelementptr inbounds double, double* %6, i64 %28
%31 = load double, double* %30
%32 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), double %31)
%33 = load i32, i32* %1
%34 = sext i32 %33 to i64
%35 = icmp slt i64 %29, %34
br i1 %35, label %27, label %21
}