#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 scanf(char *, double *);
void N_point(int N, double *p) {
  int i = 0;
  double sum = 0, ave, temp;
  for (i; i < N - 1; ++i) {
    sum += p[i + 1];
    p[i] = p[i + 1];
  }
  if (scanf("%lf", (p + (N - 1))) == 1) {
    sum += *(p + (N - 1));
    ave = sum / N;
    printf("\nAverage = %lf", ave);
    N_point(N, p);
  } else {
    printf("\n\nComputation Complete, Goodbye\n\n");
    return;
  }
}


x86 assembly (clang, -O0):
<N_point>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11a8 <N_point+0x78>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114e <N_point+0x1e>
mov    -0x10(%rbp),%rsi
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
cltq
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe49(%rip),%rdi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1223 <N_point+0xf3>
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
lea    0xdf5(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <N_point@plt>
jmp    1231 <N_point+0x101>
lea    0xde5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<N_point>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbx
mov    %edi,%r14d
lea    -0x1(%r14),%r13d
movslq %r13d,%rax
lea    (%rsi,%rax,8),%r15
cvtsi2sd %edi,%xmm0
movsd  %xmm0,0x18(%rsp)
lea    -0x1(%r13),%rax
mov    %rax,0x10(%rsp)
mov    %r13d,%ebp
and    $0x3,%ebp
and    $0xfffffffc,%r13d
lea    0x8(%rsi),%rax
mov    %rax,0x8(%rsp)
lea    0xe8f(%rip),%r12
nopl   0x0(%rax)
xorpd  %xmm2,%xmm2
cmp    $0x2,%r14d
jl     1228 <N_point+0xf8>
cmpq   $0x3,0x10(%rsp)
jae    11a0 <N_point+0x70>
xorpd  %xmm2,%xmm2
xor    %ecx,%ecx
jmp    11fb <N_point+0xcb>
xchg   %ax,%ax
xorpd  %xmm2,%xmm2
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
movsd  0x8(%rbx,%rax,8),%xmm0
movsd  0x10(%rbx,%rax,8),%xmm1
addsd  %xmm0,%xmm2
movsd  %xmm0,(%rbx,%rax,8)
addsd  %xmm1,%xmm2
movsd  %xmm1,0x8(%rbx,%rax,8)
movsd  0x18(%rbx,%rax,8),%xmm0
addsd  %xmm0,%xmm2
movsd  %xmm0,0x10(%rbx,%rax,8)
lea    0x4(%rax),%rcx
movsd  0x20(%rbx,%rax,8),%xmm0
addsd  %xmm0,%xmm2
movsd  %xmm0,0x18(%rbx,%rax,8)
mov    %rcx,%rax
cmp    %rcx,%r13
jne    11b0 <N_point+0x80>
test   %rbp,%rbp
je     1228 <N_point+0xf8>
mov    0x8(%rsp),%rax
lea    (%rax,%rcx,8),%rax
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
movsd  (%rax,%rcx,8),%xmm0
addsd  %xmm0,%xmm2
movsd  %xmm0,-0x8(%rax,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rbp
jne    1210 <N_point+0xe0>
movsd  %xmm2,0x20(%rsp)
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1262 <N_point+0x132>
movsd  0x20(%rsp),%xmm0
addsd  (%r15),%xmm0
divsd  0x18(%rsp),%xmm0
lea    0xdaa(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1180 <N_point+0x50>
lea    0xda6(%rip),%rdi
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [15 x i8] c"\0AAverage = %lf\00"
@.str.2 = [34 x i8] c"\0A\0AComputation Complete, Goodbye\0A\0A\00"
define void @N_point(i32 %0, double* %1) {
%3 = alloca i32
%4 = alloca double*
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca double
store i32 %0, i32* %3
store double* %1, double** %4
store i32 0, i32* %5
store double 0.000000e+00, double* %6
%9 = load i32, i32* %5
br label %10
10: ; preds = %34, %2
%11 = load i32, i32* %5
%12 = load i32, i32* %3
%13 = sub nsw i32 %12, 1
%14 = icmp slt i32 %11, %13
br i1 %14, label %15, label %37
15: ; preds = %10
%16 = load double*, double** %4
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %16, i64 %19
%21 = load double, double* %20
%22 = load double, double* %6
%23 = fadd double %22, %21
store double %23, double* %6
%24 = load double*, double** %4
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds double, double* %24, i64 %27
%29 = load double, double* %28
%30 = load double*, double** %4
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds double, double* %30, i64 %32
store double %29, double* %33
br label %34
34: ; preds = %15
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 1
store i32 %36, i32* %5
br label %10
37: ; preds = %10
%38 = load double*, double** %4
%39 = load i32, i32* %3
%40 = sub nsw i32 %39, 1
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double, double* %38, i64 %41
%43 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %42)
%44 = icmp eq i32 %43, 1
br i1 %44, label %45, label %62
45: ; preds = %37
%46 = load double*, double** %4
%47 = load i32, i32* %3
%48 = sub nsw i32 %47, 1
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds double, double* %46, i64 %49
%51 = load double, double* %50
%52 = load double, double* %6
%53 = fadd double %52, %51
store double %53, double* %6
%54 = load double, double* %6
%55 = load i32, i32* %3
%56 = sitofp i32 %55 to double
%57 = fdiv double %54, %56
store double %57, double* %7
%58 = load double, double* %7
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), double %58)
%60 = load i32, i32* %3
%61 = load double*, double** %4
br label %64
62: ; preds = %37
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
br label %64
64: ; preds = %62, %45
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [15 x i8] c"\0AAverage = %lf\00"
@str = [33 x i8] c"\0A\0AComputation Complete, Goodbye\0A\00"
define void @N_point(i32 %0, double* %1) {
%3 = add i32 %0, -1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds double, double* %1, i64 %4
%6 = icmp sgt i32 %0, 1
%7 = sitofp i32 %0 to double
%8 = zext i32 %3 to i64
%9 = add nsw i64 %8, -1
%10 = and i64 %8, 3
%11 = icmp ult i64 %9, 3
%12 = and i64 %8, 4294967292
%13 = icmp eq i64 %10, 0
br label %14
14: ; preds = %61, %2
br i1 %6, label %15, label %57
15: ; preds = %14
br i1 %11, label %42, label %16
16: ; preds = %15, %16
%17 = phi i64 [ %35, %16 ], [ 0, %15 ]
%18 = phi double [ %38, %16 ], [ 0.000000e+00, %15 ]
%19 = phi i64 [ %40, %16 ], [ 0, %15 ]
%20 = or i64 %17, 1
%21 = getelementptr inbounds double, double* %1, i64 %20
%22 = load double, double* %21
%23 = fadd double %18, %22
%24 = getelementptr inbounds double, double* %1, i64 %17
store double %22, double* %24
%25 = or i64 %17, 2
%26 = getelementptr inbounds double, double* %1, i64 %25
%27 = load double, double* %26
%28 = fadd double %23, %27
%29 = getelementptr inbounds double, double* %1, i64 %20
store double %27, double* %29
%30 = or i64 %17, 3
%31 = getelementptr inbounds double, double* %1, i64 %30
%32 = load double, double* %31
%33 = fadd double %28, %32
%34 = getelementptr inbounds double, double* %1, i64 %25
store double %32, double* %34
%35 = add nuw nsw i64 %17, 4
%36 = getelementptr inbounds double, double* %1, i64 %35
%37 = load double, double* %36
%38 = fadd double %33, %37
%39 = getelementptr inbounds double, double* %1, i64 %30
store double %37, double* %39
%40 = add i64 %19, 4
%41 = icmp eq i64 %40, %12
br i1 %41, label %42, label %16
42: ; preds = %16, %15
%43 = phi double [ undef, %15 ], [ %38, %16 ]
%44 = phi i64 [ 0, %15 ], [ %35, %16 ]
%45 = phi double [ 0.000000e+00, %15 ], [ %38, %16 ]
br i1 %13, label %57, label %46
46: ; preds = %42, %46
%47 = phi i64 [ %50, %46 ], [ %44, %42 ]
%48 = phi double [ %53, %46 ], [ %45, %42 ]
%49 = phi i64 [ %55, %46 ], [ 0, %42 ]
%50 = add nuw nsw i64 %47, 1
%51 = getelementptr inbounds double, double* %1, i64 %50
%52 = load double, double* %51
%53 = fadd double %48, %52
%54 = getelementptr inbounds double, double* %1, i64 %47
store double %52, double* %54
%55 = add i64 %49, 1
%56 = icmp eq i64 %55, %10
br i1 %56, label %57, label %46
57: ; preds = %42, %46, %14
%58 = phi double [ 0.000000e+00, %14 ], [ %43, %42 ], [ %53, %46 ]
%59 = tail call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %5)
%60 = icmp eq i32 %59, 1
br i1 %60, label %61, label %66
61: ; preds = %57
%62 = load double, double* %5
%63 = fadd double %58, %62
%64 = fdiv double %63, %7
%65 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), double %64)
br label %14
66: ; preds = %57
%67 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
ret void
}