#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 *, int *);
int main(void) {
  int arr[100] = {0};
  int num = 0;
  float sum = 0;
  printf("Введите кол-во элементов: ");
  scanf("%d", &num);
  while (num < 1 || num > 100) {
    printf("Кол-во должно быть от 1 до 100\n");
    printf("Введите кол-во элементов: ");
    scanf("%d", &num);
  }
  for (int i = 0; i < num; i++) {
    printf("Введите arr[%d] = ", i);
    scanf("%d", &arr[i]);
    sum += arr[i];
  }
  int greatest = arr[1];
  for (int i = 0; i < num - 1; i++) {
    if (arr[i] < arr[i + 1]) {
      greatest = arr[i + 1];
    }
  }
  printf("Avg = %.2f\n", (sum / num));
  printf("greatest = %d\n", greatest);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x1a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x190,%edx
call   1040 <memset@plt>
movl   $0x0,-0x1a4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1a8(%rbp)
ff
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb1(%rip),%rdi
lea    -0x1a4(%rbp),%rsi
call   1050 <scanf@plt>
mov    $0x1,%al
cmpl   $0x1,-0x1a4(%rbp)
mov    %al,-0x1b5(%rbp)
jl     11b0 <main+0x80>
cmpl   $0x64,-0x1a4(%rbp)
setg   %al
mov    %al,-0x1b5(%rbp)
mov    -0x1b5(%rbp),%al
test   $0x1,%al
jne    11c3 <main+0x93>
jmp    11f7 <main+0xc7>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe4a(%rip),%rdi
lea    -0x1a4(%rbp),%rsi
call   1050 <scanf@plt>
jmp    118b <main+0x5b>
movl   $0x0,-0x1ac(%rbp)
mov    -0x1ac(%rbp),%eax
cmp    -0x1a4(%rbp),%eax
jge    127c <main+0x14c>
mov    -0x1ac(%rbp),%esi
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x1ac(%rbp),%rax
lea    -0x1a0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xded(%rip),%rdi
call   1050 <scanf@plt>
movslq -0x1ac(%rbp),%rax
cvtsi2ssl -0x1a0(%rbp,%rax,4),%xmm0
ff ff
addss  -0x1a8(%rbp),%xmm0
ff
movss  %xmm0,-0x1a8(%rbp)
ff
mov    -0x1ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1ac(%rbp)
jmp    1201 <main+0xd1>
mov    -0x19c(%rbp),%eax
mov    %eax,-0x1b0(%rbp)
movl   $0x0,-0x1b4(%rbp)
mov    -0x1b4(%rbp),%eax
mov    -0x1a4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1301 <main+0x1d1>
movslq -0x1b4(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%eax
mov    -0x1b4(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
cmp    -0x1a0(%rbp,%rcx,4),%eax
jge    12e8 <main+0x1b8>
mov    -0x1b4(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x1a0(%rbp,%rax,4),%eax
mov    %eax,-0x1b0(%rbp)
jmp    12ed <main+0x1bd>
mov    -0x1b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b4(%rbp)
jmp    1292 <main+0x162>
movss  -0x1a8(%rbp),%xmm0
ff
cvtsi2ssl -0x1a4(%rbp),%xmm1
ff
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd60(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x1b0(%rbp),%esi
lea    0xd58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x1a8,%rsp
lea    0x10(%rsp),%rdi
mov    $0x190,%edx
xor    %esi,%esi
call   1050 <memset@plt>
movl   $0x0,0x8(%rsp)
lea    0xe92(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb4(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x8(%rsp),%eax
add    $0xffffff9b,%eax
cmp    $0xffffff9b,%eax
ja     11d9 <main+0x99>
lea    0xecf(%rip),%r14
lea    0xe60(%rip),%r15
lea    0xe89(%rip),%r12
lea    0x8(%rsp),%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    0x8(%rsp),%eax
add    $0xffffff9b,%eax
cmp    $0xffffff9c,%eax
jb     11b0 <main+0x70>
xorps  %xmm1,%xmm1
lea    0xe50(%rip),%r14
lea    0xe46(%rip),%r15
xor    %r12d,%r12d
xor    %ebx,%ebx
nop
movss  %xmm1,0xc(%rsp)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    (%rsp,%r12,1),%rsi
add    $0x10,%rsi
mov    %r15,%rdi
call   1060 <scanf@plt>
movss  0xc(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsi2ssl 0x10(%rsp,%rbx,4),%xmm0
addss  %xmm0,%xmm1
add    $0x1,%rbx
movslq 0x8(%rsp),%rax
add    $0x4,%r12
cmp    %rax,%rbx
jl     11f0 <main+0xb0>
mov    0x14(%rsp),%ebx
cmp    $0x2,%eax
jl     12c3 <main+0x183>
lea    -0x1(%rax),%r9d
mov    0x10(%rsp),%ecx
lea    -0x1(%r9),%rsi
mov    %r9d,%r8d
and    $0x3,%r8d
cmp    $0x3,%rsi
jae    1261 <main+0x121>
xor    %esi,%esi
jmp    129d <main+0x15d>
and    $0xfffffffc,%r9d
xor    %esi,%esi
nopw   0x0(%rax,%rax,1)
mov    0x14(%rsp,%rsi,4),%edx
mov    0x18(%rsp,%rsi,4),%edi
cmp    %edx,%ecx
cmovl  %edx,%ebx
cmp    %edi,%edx
cmovl  %edi,%ebx
mov    0x1c(%rsp,%rsi,4),%edx
cmp    %edx,%edi
cmovl  %edx,%ebx
mov    0x20(%rsp,%rsi,4),%ecx
add    $0x4,%rsi
cmp    %ecx,%edx
cmovl  %ecx,%ebx
cmp    %rsi,%r9
jne    1270 <main+0x130>
test   %r8,%r8
je     12c3 <main+0x183>
lea    (%rsp,%rsi,4),%rsi
add    $0x14,%rsi
xor    %edi,%edi
nopl   0x0(%rax)
mov    (%rsi,%rdi,4),%edx
cmp    %edx,%ecx
cmovl  %edx,%ebx
add    $0x1,%rdi
mov    %edx,%ecx
cmp    %rdi,%r8
jne    12b0 <main+0x170>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xd71(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xd6f(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x1a8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [48 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D0\BA\D0\BE\D0\BB-\D0\B2\D0\BE \D1\8D\D0\BB\D0\B5\D0\BC\D0\B5\D0\BD\D1\82\D0\BE\D0\B2: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [51 x i8] c"\D0\9A\D0\BE\D0\BB-\D0\B2\D0\BE \D0\B4\D0\BE\D0\BB\D0\B6\D0\BD\D0\BE \D0\B1\D1\8B\D1\82\D1\8C \D0\BE\D1\82 1 \D0\B4\D0\BE 100\0A\00"
@.str.3 = [26 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 arr[%d] = \00"
@.str.4 = [12 x i8] c"Avg = %.2f\0A\00"
@.str.5 = [15 x i8] c"greatest = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i32]
%3 = alloca i32
%4 = alloca float
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = bitcast [100 x i32]* %2 to i8*
store i32 0, i32* %3
store float 0.000000e+00, float* %4
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
br label %11
11: ; preds = %19, %0
%12 = load i32, i32* %3
%13 = icmp slt i32 %12, 1
br i1 %13, label %17, label %14
14: ; preds = %11
%15 = load i32, i32* %3
%16 = icmp sgt i32 %15, 100
br label %17
17: ; preds = %14, %11
%18 = phi i1 [ true, %11 ], [ %16, %14 ]
br i1 %18, label %19, label %23
19: ; preds = %17
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0))
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
br label %11
23: ; preds = %17
store i32 0, i32* %5
br label %24
24: ; preds = %42, %23
%25 = load i32, i32* %5
%26 = load i32, i32* %3
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %45
28: ; preds = %24
%29 = load i32, i32* %5
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %29)
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %32
%34 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %33)
%35 = load i32, i32* %5
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %36
%38 = load i32, i32* %37
%39 = sitofp i32 %38 to float
%40 = load float, float* %4
%41 = fadd float %40, %39
store float %41, float* %4
br label %42
42: ; preds = %28
%43 = load i32, i32* %5
%44 = add nsw i32 %43, 1
store i32 %44, i32* %5
br label %24
45: ; preds = %24
%46 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 1
%47 = load i32, i32* %46
store i32 %47, i32* %6
store i32 0, i32* %7
br label %48
48: ; preds = %71, %45
%49 = load i32, i32* %7
%50 = load i32, i32* %3
%51 = sub nsw i32 %50, 1
%52 = icmp slt i32 %49, %51
br i1 %52, label %53, label %74
53: ; preds = %48
%54 = load i32, i32* %7
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %55
%57 = load i32, i32* %56
%58 = load i32, i32* %7
%59 = add nsw i32 %58, 1
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %60
%62 = load i32, i32* %61
%63 = icmp slt i32 %57, %62
br i1 %63, label %64, label %70
64: ; preds = %53
%65 = load i32, i32* %7
%66 = add nsw i32 %65, 1
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %67
%69 = load i32, i32* %68
store i32 %69, i32* %6
br label %70
70: ; preds = %64, %53
br label %71
71: ; preds = %70
%72 = load i32, i32* %7
%73 = add nsw i32 %72, 1
store i32 %73, i32* %7
br label %48
74: ; preds = %48
%75 = load float, float* %4
%76 = load i32, i32* %3
%77 = sitofp i32 %76 to float
%78 = fdiv float %75, %77
%79 = fpext float %78 to double
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %79)
%81 = load i32, i32* %6
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 %81)
ret i32 0
}

LLVM IR (-O2):
@.str = [48 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D0\BA\D0\BE\D0\BB-\D0\B2\D0\BE \D1\8D\D0\BB\D0\B5\D0\BC\D0\B5\D0\BD\D1\82\D0\BE\D0\B2: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [26 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 arr[%d] = \00"
@.str.4 = [12 x i8] c"Avg = %.2f\0A\00"
@.str.5 = [15 x i8] c"greatest = %d\0A\00"
@str = [50 x i8] c"\D0\9A\D0\BE\D0\BB-\D0\B2\D0\BE \D0\B4\D0\BE\D0\BB\D0\B6\D0\BD\D0\BE \D0\B1\D1\8B\D1\82\D1\8C \D0\BE\D1\82 1 \D0\B4\D0\BE 100\00"
define i32 @main() {
%1 = alloca [100 x i32]
%2 = alloca i32
%3 = bitcast [100 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = add i32 %7, -101
%9 = icmp ult i32 %8, -100
br i1 %9, label %11, label %10
10: ; preds = %11, %0
br label %32
11: ; preds = %0, %11
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%15 = load i32, i32* %2
%16 = add i32 %15, -101
%17 = icmp ult i32 %16, -100
br i1 %17, label %11, label %10
18: ; preds = %32
%19 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 1
%20 = load i32, i32* %19
%21 = icmp sgt i32 %43, 1
br i1 %21, label %22, label %64
22: ; preds = %18
%23 = add nsw i32 %43, -1
%24 = zext i32 %23 to i64
%25 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
%26 = load i32, i32* %25
%27 = add nsw i64 %24, -1
%28 = and i64 %24, 3
%29 = icmp ult i64 %27, 3
br i1 %29, label %46, label %30
30: ; preds = %22
%31 = and i64 %24, 4294967292
br label %71
32: ; preds = %10, %32
%33 = phi i64 [ %42, %32 ], [ 0, %10 ]
%34 = phi float [ %41, %32 ], [ 0.000000e+00, %10 ]
%35 = trunc i64 %33 to i32
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %35)
%37 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %33
%38 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %37)
%39 = load i32, i32* %37
%40 = sitofp i32 %39 to float
%41 = fadd float %34, %40
%42 = add nuw nsw i64 %33, 1
%43 = load i32, i32* %2
%44 = sext i32 %43 to i64
%45 = icmp slt i64 %42, %44
br i1 %45, label %32, label %18
46: ; preds = %71, %22
%47 = phi i32 [ undef, %22 ], [ %95, %71 ]
%48 = phi i32 [ %26, %22 ], [ %93, %71 ]
%49 = phi i64 [ 0, %22 ], [ %91, %71 ]
%50 = phi i32 [ %20, %22 ], [ %95, %71 ]
%51 = icmp eq i64 %28, 0
br i1 %51, label %64, label %52
52: ; preds = %46, %52
%53 = phi i32 [ %59, %52 ], [ %48, %46 ]
%54 = phi i64 [ %57, %52 ], [ %49, %46 ]
%55 = phi i32 [ %61, %52 ], [ %50, %46 ]
%56 = phi i64 [ %62, %52 ], [ 0, %46 ]
%57 = add nuw nsw i64 %54, 1
%58 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %57
%59 = load i32, i32* %58
%60 = icmp slt i32 %53, %59
%61 = select i1 %60, i32 %59, i32 %55
%62 = add i64 %56, 1
%63 = icmp eq i64 %62, %28
br i1 %63, label %64, label %52
64: ; preds = %46, %52, %18
%65 = phi i32 [ %20, %18 ], [ %47, %46 ], [ %61, %52 ]
%66 = sitofp i32 %43 to float
%67 = fdiv float %41, %66
%68 = fpext float %67 to double
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %68)
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 %65)
ret i32 0
71: ; preds = %71, %30
%72 = phi i32 [ %26, %30 ], [ %93, %71 ]
%73 = phi i64 [ 0, %30 ], [ %91, %71 ]
%74 = phi i32 [ %20, %30 ], [ %95, %71 ]
%75 = phi i64 [ 0, %30 ], [ %96, %71 ]
%76 = or i64 %73, 1
%77 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %76
%78 = load i32, i32* %77
%79 = icmp slt i32 %72, %78
%80 = select i1 %79, i32 %78, i32 %74
%81 = or i64 %73, 2
%82 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %81
%83 = load i32, i32* %82
%84 = icmp slt i32 %78, %83
%85 = select i1 %84, i32 %83, i32 %80
%86 = or i64 %73, 3
%87 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %86
%88 = load i32, i32* %87
%89 = icmp slt i32 %83, %88
%90 = select i1 %89, i32 %88, i32 %85
%91 = add nuw nsw i64 %73, 4
%92 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %91
%93 = load i32, i32* %92
%94 = icmp slt i32 %88, %93
%95 = select i1 %94, i32 %93, i32 %90
%96 = add i64 %75, 4
%97 = icmp eq i64 %96, %31
br i1 %97, label %46, label %71
}