#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*/ EXIT_FAILURE;
int atoi(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ free(int *);
int give(int);
int *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  if (argc != 3) {
    printf("Error. Pls supply argument (name of file).\n");
    exit(EXIT_FAILURE);
  }
  int i, n = atoi(argv[1]), lambd = atoi(argv[2]);
  int *narr = malloc(n * sizeof(int));
  int k, sum = 0;
  for (i = 0; i < n; ++i) {
    narr[i] = give(lambd);
    sum += narr[i];
    printf("%i ", narr[i]);
  }
  printf("\nAvg=%4.4f\n", (float)sum / n);
  for (i = 0; i < n; ++i)
    printf("%4.4f ", 1. / narr[i]);
  printf("\n");
  free(narr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     119c <main+0x3c>
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e4b(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x1c(%rbp)
movslq -0x18(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1236 <main+0xd6>
mov    -0x1c(%rbp),%edi
call   1050 <give@plt>
mov    %eax,%edx
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
add    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11dd <main+0x7d>
cvtsi2ssl -0x30(%rbp),%xmm0
cvtsi2ssl -0x18(%rbp),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xde9(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    129e <main+0x13e>
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
cvtsi2sdl (%rax,%rcx,4),%xmm1
movsd  0xd82(%rip),%xmm0
divsd  %xmm1,%xmm0
lea    0xdbb(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    125d <main+0xfd>
lea    0xd8d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x3,%edi
jne    12ad <main+0x12d>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1090 <atoi@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rdi
call   1090 <atoi@plt>
mov    %eax,%r13d
lea    0x0(,%rbp,4),%edi
call   1080 <malloc@plt>
mov    %rax,%r12
test   %ebp,%ebp
jle    126a <main+0xea>
mov    %rbp,(%rsp)
mov    %ebp,%ebx
lea    0xe36(%rip),%r15
xor    %r14d,%r14d
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    %r13d,%edi
call   1070 <give@plt>
mov    %eax,(%r12,%r14,4)
add    %eax,%ebp
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%r14
cmp    %r14,%rbx
jne    11e0 <main+0x60>
cvtsi2ss %ebp,%xmm0
mov    (%rsp),%rbp
cvtsi2ss %ebp,%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdee(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
test   %ebp,%ebp
jle    128a <main+0x10a>
xor    %ebp,%ebp
lea    0xde6(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xorps  %xmm1,%xmm1
cvtsi2sdl (%r12,%rbp,4),%xmm1
movsd  0xdaf(%rip),%xmm0
divsd  %xmm1,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1240 <main+0xc0>
jmp    128a <main+0x10a>
cvtsi2ss %ebp,%xmm0
xorps  %xmm1,%xmm1
divss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xd89(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %r12,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd6b(%rip),%rdi
call   1050 <puts@plt>
mov    0x2d20(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [44 x i8] c"Error. Pls supply argument (name of file).\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [4 x i8] c"%i \00"
@.str.2 = [12 x i8] c"\0AAvg=%4.4f\0A\00"
@.str.3 = [7 x i8] c"%4.4f \00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 3
br i1 %13, label %14, label %18
14: ; preds = %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%16 = load i32, i32* @EXIT_FAILURE
%17 = call i32 @exit(i32 %16)
unreachable
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @atoi(i8* %21)
store i32 %22, i32* %7
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = call i32 @atoi(i8* %25)
store i32 %26, i32* %8
%27 = load i32, i32* %7
%28 = sext i32 %27 to i64
%29 = mul i64 %28, 4
%30 = trunc i64 %29 to i32
%31 = call i32* @malloc(i32 %30)
store i32* %31, i32** %9
store i32 0, i32* %11
store i32 0, i32* %6
br label %32
32: ; preds = %56, %18
%33 = load i32, i32* %6
%34 = load i32, i32* %7
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %59
36: ; preds = %32
%37 = load i32, i32* %8
%38 = call i32 @give(i32 %37)
%39 = load i32*, i32** %9
%40 = load i32, i32* %6
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i32, i32* %39, i64 %41
store i32 %38, i32* %42
%43 = load i32*, i32** %9
%44 = load i32, i32* %6
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i32, i32* %43, i64 %45
%47 = load i32, i32* %46
%48 = load i32, i32* %11
%49 = add nsw i32 %48, %47
store i32 %49, i32* %11
%50 = load i32*, i32** %9
%51 = load i32, i32* %6
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i32, i32* %50, i64 %52
%54 = load i32, i32* %53
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %54)
br label %56
56: ; preds = %36
%57 = load i32, i32* %6
%58 = add nsw i32 %57, 1
store i32 %58, i32* %6
br label %32
59: ; preds = %32
%60 = load i32, i32* %11
%61 = sitofp i32 %60 to float
%62 = load i32, i32* %7
%63 = sitofp i32 %62 to float
%64 = fdiv float %61, %63
%65 = fpext float %64 to double
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), double %65)
store i32 0, i32* %6
br label %67
67: ; preds = %80, %59
%68 = load i32, i32* %6
%69 = load i32, i32* %7
%70 = icmp slt i32 %68, %69
br i1 %70, label %71, label %83
71: ; preds = %67
%72 = load i32*, i32** %9
%73 = load i32, i32* %6
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i32, i32* %72, i64 %74
%76 = load i32, i32* %75
%77 = sitofp i32 %76 to double
%78 = fdiv double 1.000000e+00, %77
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), double %78)
br label %80
80: ; preds = %71
%81 = load i32, i32* %6
%82 = add nsw i32 %81, 1
store i32 %82, i32* %6
br label %67
83: ; preds = %67
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%85 = load i32*, i32** %9
%86 = call i32 @free(i32* %85)
ret i32 0
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str.1 = [4 x i8] c"%i \00"
@.str.2 = [12 x i8] c"\0AAvg=%4.4f\0A\00"
@.str.3 = [7 x i8] c"%4.4f \00"
@str = [43 x i8] c"Error. Pls supply argument (name of file).\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i32 @atoi(i8* %13)
%15 = shl i32 %11, 2
%16 = tail call i32* @malloc(i32 %15)
%17 = icmp sgt i32 %11, 0
br i1 %17, label %18, label %46
18: ; preds = %8
%19 = zext i32 %11 to i64
br label %20
20: ; preds = %18, %20
%21 = phi i64 [ 0, %18 ], [ %27, %20 ]
%22 = phi i32 [ 0, %18 ], [ %25, %20 ]
%23 = tail call i32 @give(i32 %14)
%24 = getelementptr inbounds i32, i32* %16, i64 %21
store i32 %23, i32* %24
%25 = add nsw i32 %23, %22
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%27 = add nuw nsw i64 %21, 1
%28 = icmp eq i64 %27, %19
br i1 %28, label %29, label %20
29: ; preds = %20
%30 = sitofp i32 %25 to float
%31 = sitofp i32 %11 to float
%32 = fdiv float %30, %31
%33 = fpext float %32 to double
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), double %33)
br i1 %17, label %35, label %51
35: ; preds = %29
%36 = zext i32 %11 to i64
br label %37
37: ; preds = %35, %37
%38 = phi i64 [ 0, %35 ], [ %44, %37 ]
%39 = getelementptr inbounds i32, i32* %16, i64 %38
%40 = load i32, i32* %39
%41 = sitofp i32 %40 to double
%42 = fdiv double 1.000000e+00, %41
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), double %42)
%44 = add nuw nsw i64 %38, 1
%45 = icmp eq i64 %44, %36
br i1 %45, label %51, label %37
46: ; preds = %8
%47 = sitofp i32 %11 to float
%48 = fdiv float 0.000000e+00, %47
%49 = fpext float %48 to double
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), double %49)
br label %51
51: ; preds = %37, %46, %29
%52 = tail call i32 @putchar(i32 10)
%53 = tail call i32 @free(i32* %16)
ret i32 0
}