#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 atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int randA[argc + 2];
  if (argc < 2) {
    printf("\n %s Usage: Need filename and any number of following integer "
           "arguments from -100 and 100\n",
           argv[0]);
    exit(1);
  }
  int large;
  int small;
  int average;
  int count = 0;
  int sumTotal = 0;
  int i;
  for (i = 1; i < argc; ++i) {
    int inputInt = atoi(argv[i]);
    if (inputInt < -100 || inputInt > 100) {
      printf("/nSorry, only values from -100 to 100 are accepted. Continuing "
             "execution...\n");
    } else {
      randA[i - 1] = inputInt;
      ++count;
      sumTotal = sumTotal + inputInt;
      if (i == 1) {
        small = inputInt;
        large = inputInt;
        average = inputInt;
      } else {
        if (inputInt < small) {
          small = inputInt;
        } else if (inputInt > large) {
          large = inputInt;
        }
      }
    }
  }
  average = sumTotal / count;
  randA[count - 1] = large;
  randA[count] = small;
  randA[count + 1] = average;
  printf("\nLargest value is: %i, At randA index: %i\n", randA[count - 1],
         count - 1);
  printf("\nSmallest value is: %i, At randA index: %i\n", randA[count], count);
  printf("\nAverage of the values is: %i, At randA index: %i\n",
         randA[count + 1], count + 1);
  printf("\n");
  printf("\nThank you! Have a nice day!\n");
  printf("\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1199 <main+0x69>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x1,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1286 <main+0x156>
mov    -0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0xffffff9c,-0x3c(%rbp)
jl     11e2 <main+0xb2>
cmpl   $0x64,-0x3c(%rbp)
jle    11f5 <main+0xc5>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1273 <main+0x143>
mov    -0x48(%rbp),%rax
mov    -0x3c(%rbp),%edx
mov    -0x38(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x34(%rbp),%eax
add    -0x3c(%rbp),%eax
mov    %eax,-0x34(%rbp)
cmpl   $0x1,-0x38(%rbp)
jne    123b <main+0x10b>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    126e <main+0x13e>
mov    -0x3c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1252 <main+0x122>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    1269 <main+0x139>
mov    -0x3c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jle    1264 <main+0x134>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    1269 <main+0x139>
jmp    126e <main+0x13e>
jmp    1273 <main+0x143>
jmp    1278 <main+0x148>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11ae <main+0x7e>
mov    -0x34(%rbp),%eax
cltd
idivl  -0x30(%rbp)
mov    %eax,%ecx
mov    -0x48(%rbp),%rax
mov    %ecx,-0x2c(%rbp)
mov    -0x24(%rbp),%edx
mov    -0x30(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x28(%rbp),%edx
movslq -0x30(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x2c(%rbp),%edx
mov    -0x30(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x30(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x30(%rbp),%edx
sub    $0x1,%edx
lea    0xdd1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x30(%rbp),%edx
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%rax
mov    -0x30(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x30(%rbp),%edx
add    $0x1,%edx
lea    0xde8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbp
cmp    $0x2,%edi
jge    117f <main+0x2f>
mov    0x0(%rbp),%rsi
lea    0xe92(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    %edi,%r15d
mov    0x8(%rbp),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebx
add    $0xffffff9b,%eax
mov    $0x1,%r12d
mov    %ebx,0x4(%rsp)
cmp    $0xffffff36,%eax
ja     11b2 <main+0x62>
lea    0xf5a(%rip),%rdi
call   1040 <puts@plt>
xor    %r12d,%r12d
xor    %ebx,%ebx
cmp    $0x2,%r15d
jne    122e <main+0xde>
mov    0x4(%rsp),%r15d
mov    %ebx,%eax
cltd
idiv   %r12d
mov    %eax,%ebx
lea    -0x1(%r12),%edx
lea    0x1(%r12),%ebp
lea    0xe85(%rip),%rdi
mov    0x4(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe9e(%rip),%rdi
mov    %r15d,%esi
mov    %r12d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb6(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xecd(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   1070 <exit@plt>
mov    %r15d,%r13d
mov    $0x2,%r14d
mov    0x4(%rsp),%r15d
jmp    1259 <main+0x109>
xchg   %ax,%ax
lea    0xebb(%rip),%rdi
call   1040 <puts@plt>
add    $0x1,%r14
cmp    %r14,%r13
je     11bd <main+0x6d>
mov    0x0(%rbp,%r14,8),%rdi
call   1060 <atoi@plt>
lea    -0x65(%rax),%ecx
cmp    $0xffffff36,%ecx
jbe    1240 <main+0xf0>
add    $0x1,%r12d
add    %eax,%ebx
cmp    %r15d,%eax
jge    1280 <main+0x130>
mov    %eax,%r15d
jmp    124c <main+0xfc>
xchg   %ax,%ax
mov    0x4(%rsp),%ecx
cmp    %ecx,%eax
cmovg  %eax,%ecx
mov    %ecx,0x4(%rsp)
jmp    124c <main+0xfc>

LLVM IR (-O0):
@.str = [91 x i8] c"\0A %s Usage: Need filename and any number of following integer arguments from -100 and 100\0A\00"
@.str.1 = [77 x i8] c"/nSorry, only values from -100 to 100 are accepted. Continuing execution...\0A\00"
@.str.2 = [43 x i8] c"\0ALargest value is: %i, At randA index: %i\0A\00"
@.str.3 = [44 x i8] c"\0ASmallest value is: %i, At randA index: %i\0A\00"
@.str.4 = [51 x i8] c"\0AAverage of the values is: %i, At randA index: %i\0A\00"
@.str.5 = [2 x i8] c"\0A\00"
@.str.6 = [30 x i8] c"\0AThank you! Have a nice day!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 2
%17 = zext i32 %16 to i64
%18 = call i8* @llvm.stacksave()
store i8* %18, i8** %6
%19 = alloca i32, i64 %17
store i64 %17, i64* %7
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 2
br i1 %21, label %22, label %28
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str, i64 0, i64 0), i8* %25)
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %2
store i32 0, i32* %11
store i32 0, i32* %12
store i32 1, i32* %13
br label %29
29: ; preds = %80, %28
%30 = load i32, i32* %13
%31 = load i32, i32* %4
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %83
33: ; preds = %29
%34 = load i8**, i8*** %5
%35 = load i32, i32* %13
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8*, i8** %34, i64 %36
%38 = load i8*, i8** %37
%39 = call i32 @atoi(i8* %38)
store i32 %39, i32* %14
%40 = load i32, i32* %14
%41 = icmp slt i32 %40, -100
br i1 %41, label %45, label %42
42: ; preds = %33
%43 = load i32, i32* %14
%44 = icmp sgt i32 %43, 100
br i1 %44, label %45, label %47
45: ; preds = %42, %33
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.1, i64 0, i64 0))
br label %79
47: ; preds = %42
%48 = load i32, i32* %14
%49 = load i32, i32* %13
%50 = sub nsw i32 %49, 1
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i32, i32* %19, i64 %51
store i32 %48, i32* %52
%53 = load i32, i32* %11
%54 = add nsw i32 %53, 1
store i32 %54, i32* %11
%55 = load i32, i32* %12
%56 = load i32, i32* %14
%57 = add nsw i32 %55, %56
store i32 %57, i32* %12
%58 = load i32, i32* %13
%59 = icmp eq i32 %58, 1
br i1 %59, label %60, label %64
60: ; preds = %47
%61 = load i32, i32* %14
store i32 %61, i32* %9
%62 = load i32, i32* %14
store i32 %62, i32* %8
%63 = load i32, i32* %14
store i32 %63, i32* %10
br label %78
64: ; preds = %47
%65 = load i32, i32* %14
%66 = load i32, i32* %9
%67 = icmp slt i32 %65, %66
br i1 %67, label %68, label %70
68: ; preds = %64
%69 = load i32, i32* %14
store i32 %69, i32* %9
br label %77
70: ; preds = %64
%71 = load i32, i32* %14
%72 = load i32, i32* %8
%73 = icmp sgt i32 %71, %72
br i1 %73, label %74, label %76
74: ; preds = %70
%75 = load i32, i32* %14
store i32 %75, i32* %8
br label %76
76: ; preds = %74, %70
br label %77
77: ; preds = %76, %68
br label %78
78: ; preds = %77, %60
br label %79
79: ; preds = %78, %45
br label %80
80: ; preds = %79
%81 = load i32, i32* %13
%82 = add nsw i32 %81, 1
store i32 %82, i32* %13
br label %29
83: ; preds = %29
%84 = load i32, i32* %12
%85 = load i32, i32* %11
%86 = sdiv i32 %84, %85
store i32 %86, i32* %10
%87 = load i32, i32* %8
%88 = load i32, i32* %11
%89 = sub nsw i32 %88, 1
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds i32, i32* %19, i64 %90
store i32 %87, i32* %91
%92 = load i32, i32* %9
%93 = load i32, i32* %11
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds i32, i32* %19, i64 %94
store i32 %92, i32* %95
%96 = load i32, i32* %10
%97 = load i32, i32* %11
%98 = add nsw i32 %97, 1
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds i32, i32* %19, i64 %99
store i32 %96, i32* %100
%101 = load i32, i32* %11
%102 = sub nsw i32 %101, 1
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds i32, i32* %19, i64 %103
%105 = load i32, i32* %104
%106 = load i32, i32* %11
%107 = sub nsw i32 %106, 1
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i32 %105, i32 %107)
%109 = load i32, i32* %11
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds i32, i32* %19, i64 %110
%112 = load i32, i32* %111
%113 = load i32, i32* %11
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i32 %112, i32 %113)
%115 = load i32, i32* %11
%116 = add nsw i32 %115, 1
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds i32, i32* %19, i64 %117
%119 = load i32, i32* %118
%120 = load i32, i32* %11
%121 = add nsw i32 %120, 1
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0), i32 %119, i32 %121)
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%125 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%126 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [91 x i8] c"\0A %s Usage: Need filename and any number of following integer arguments from -100 and 100\0A\00"
@.str.2 = [43 x i8] c"\0ALargest value is: %i, At randA index: %i\0A\00"
@.str.3 = [44 x i8] c"\0ASmallest value is: %i, At randA index: %i\0A\00"
@.str.4 = [51 x i8] c"\0AAverage of the values is: %i, At randA index: %i\0A\00"
@str = [29 x i8] c"\0AThank you! Have a nice day!\00"
@str.7 = [76 x i8] c"/nSorry, only values from -100 to 100 are accepted. Continuing execution...\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %17, label %4
4: ; preds = %2
%5 = zext i32 %0 to i64
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i32 @atoi(i8* %7)
%9 = add i32 %8, -101
%10 = icmp ult i32 %9, -201
br i1 %10, label %11, label %13
11: ; preds = %4
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([76 x i8], [76 x i8]* @str.7, i64 0, i64 0))
br label %13
13: ; preds = %4, %11
%14 = phi i32 [ 0, %11 ], [ 1, %4 ]
%15 = phi i32 [ 0, %11 ], [ %8, %4 ]
%16 = icmp eq i32 %0, 2
br i1 %16, label %48, label %21
17: ; preds = %2
%18 = load i8*, i8** %1
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([91 x i8], [91 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = tail call i32 @exit(i32 1)
unreachable
21: ; preds = %13, %41
%22 = phi i64 [ %46, %41 ], [ 2, %13 ]
%23 = phi i32 [ %45, %41 ], [ %8, %13 ]
%24 = phi i32 [ %44, %41 ], [ %15, %13 ]
%25 = phi i32 [ %43, %41 ], [ %14, %13 ]
%26 = phi i32 [ %42, %41 ], [ %8, %13 ]
%27 = getelementptr inbounds i8*, i8** %1, i64 %22
%28 = load i8*, i8** %27
%29 = tail call i32 @atoi(i8* %28)
%30 = add i32 %29, -101
%31 = icmp ult i32 %30, -201
br i1 %31, label %32, label %34
32: ; preds = %21
%33 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([76 x i8], [76 x i8]* @str.7, i64 0, i64 0))
br label %41
34: ; preds = %21
%35 = add nsw i32 %25, 1
%36 = add nsw i32 %29, %24
%37 = icmp slt i32 %29, %26
br i1 %37, label %41, label %38
38: ; preds = %34
%39 = icmp sgt i32 %29, %23
%40 = select i1 %39, i32 %29, i32 %23
br label %41
41: ; preds = %38, %34, %32
%42 = phi i32 [ %26, %32 ], [ %29, %34 ], [ %26, %38 ]
%43 = phi i32 [ %25, %32 ], [ %35, %34 ], [ %35, %38 ]
%44 = phi i32 [ %24, %32 ], [ %36, %34 ], [ %36, %38 ]
%45 = phi i32 [ %23, %32 ], [ %23, %34 ], [ %40, %38 ]
%46 = add nuw nsw i64 %22, 1
%47 = icmp eq i64 %46, %5
br i1 %47, label %48, label %21
48: ; preds = %41, %13
%49 = phi i32 [ %8, %13 ], [ %42, %41 ]
%50 = phi i32 [ %14, %13 ], [ %43, %41 ]
%51 = phi i32 [ %15, %13 ], [ %44, %41 ]
%52 = phi i32 [ %8, %13 ], [ %45, %41 ]
%53 = sdiv i32 %51, %50
%54 = add nsw i32 %50, -1
%55 = add nsw i32 %50, 1
%56 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i32 %52, i32 %54)
%57 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i32 %49, i32 %50)
%58 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0), i32 %53, i32 %55)
%59 = tail call i32 @putchar(i32 10)
%60 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%61 = tail call i32 @putchar(i32 10)
%62 = tail call i32 @exit(i32 0)
unreachable
}