#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 proizv(int *, int);
int read_array(int *);
int /*<<< orphan*/ setbuf(int /*<<< orphan*/, int /*<<< orphan*/ *);
float srednee(int *, int);
int /*<<< orphan*/ stdout;
int sum(int *, int);
int main(void) {
  setbuf(stdout, NULL);
  int size;
  int summa;
  float sredn;
  int proizved;
  int array[10];
  size = read_array(array);
  summa = sum(array, size);
  printf("\nSumma = %d", summa);
  sredn = srednee(array, size);
  printf("\nSrednee = %f", sredn);
  proizved = proizv(array, size);
  if (size != 0) {
    printf("\nProizv = %d", proizved);
  } else {
    printf("\nThe length of the array is zero");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e6a(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <setbuf@plt>
lea    -0x40(%rbp),%rdi
call   1080 <read_array@plt>
mov    %eax,-0x8(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1070 <sum@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1060 <srednee@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe3e(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1050 <proizv@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1204 <main+0xa4>
mov    -0x14(%rbp),%esi
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1212 <main+0xb2>
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1030 <setbuf@plt>
mov    %rsp,%r14
mov    %r14,%rdi
call   1080 <read_array@plt>
mov    %eax,%ebx
mov    %r14,%rdi
mov    %eax,%esi
call   1070 <sum@plt>
lea    0xe6b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1060 <srednee@plt>
cvtss2sd %xmm0,%xmm0
lea    0xe59(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1050 <proizv@plt>
test   %ebx,%ebx
je     11da <main+0x7a>
lea    0xe4b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11e8 <main+0x88>
lea    0xe46(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [12 x i8] c"\0ASumma = %d\00"
@.str.1 = [14 x i8] c"\0ASrednee = %f\00"
@.str.2 = [13 x i8] c"\0AProizv = %d\00"
@.str.3 = [33 x i8] c"\0AThe length of the array is zero\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = alloca i32
%6 = alloca [10 x i32]
store i32 0, i32* %1
%7 = load i32, i32* @stdout
%8 = call i32 @setbuf(i32 %7, i32* null)
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%10 = call i32 @read_array(i32* %9)
store i32 %10, i32* %2
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%12 = load i32, i32* %2
%13 = call i32 @sum(i32* %11, i32 %12)
store i32 %13, i32* %3
%14 = load i32, i32* %3
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%17 = load i32, i32* %2
%18 = call float @srednee(i32* %16, i32 %17)
store float %18, float* %4
%19 = load float, float* %4
%20 = fpext float %19 to double
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), double %20)
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%23 = load i32, i32* %2
%24 = call i32 @proizv(i32* %22, i32 %23)
store i32 %24, i32* %5
%25 = load i32, i32* %2
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %0
%28 = load i32, i32* %5
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %28)
br label %32
30: ; preds = %0
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
br label %32
32: ; preds = %30, %27
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [12 x i8] c"\0ASumma = %d\00"
@.str.1 = [14 x i8] c"\0ASrednee = %f\00"
@.str.2 = [13 x i8] c"\0AProizv = %d\00"
@.str.3 = [33 x i8] c"\0AThe length of the array is zero\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = load i32, i32* @stdout
%3 = tail call i32 @setbuf(i32 %2, i32* null)
%4 = bitcast [10 x i32]* %1 to i8*
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%6 = call i32 @read_array(i32* %5)
%7 = call i32 @sum(i32* %5, i32 %6)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = call float @srednee(i32* %5, i32 %6)
%10 = fpext float %9 to double
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), double %10)
%12 = call i32 @proizv(i32* %5, i32 %6)
%13 = icmp eq i32 %6, 0
br i1 %13, label %16, label %14
14: ; preds = %0
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %12)
br label %18
16: ; preds = %0
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
br label %18
18: ; preds = %16, %14
ret i32 0
}