#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*/ assert(int /*<<< orphan*/);
double get_mean(const double *const values, const int count) {
  int i;
  double mean;
  assert(values && count);
  if (1 == count) {
    return values[0];
  }
  mean = 0.0;
  for (i = 0; i < count; i++) {
    if (((-9999 == (int)(values[i])))) {
      return -9999;
    }
    mean += values[i];
  }
  mean /= count;
  if (mean != mean) {
    mean = -9999;
  }
  return mean;
}


x86 assembly (clang, -O0):
<get_mean>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x21(%rbp)
je     1139 <get_mean+0x29>
cmpl   $0x0,-0x14(%rbp)
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x1,%eax
cmp    -0x14(%rbp),%eax
jne    1166 <get_mean+0x56>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1217 <get_mean+0x107>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11d2 <get_mean+0xc2>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
cvttsd2si (%rax,%rcx,8),%ecx
mov    $0xffffd8f1,%eax
cmp    %ecx,%eax
jne    11ad <get_mean+0x9d>
movsd  0xe5d(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1217 <get_mean+0x107>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1175 <get_mean+0x65>
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jne    1200 <get_mean+0xf0>
jp     1200 <get_mean+0xf0>
jmp    120d <get_mean+0xfd>
movsd  0xdf8(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_mean>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
test   %rdi,%rdi
setne  %al
test   %esi,%esi
setne  %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
cmp    $0x1,%ebp
jne    1138 <get_mean+0x28>
movsd  (%rbx),%xmm0
jmp    119c <get_mean+0x8c>
jl     1170 <get_mean+0x60>
mov    %ebp,%eax
xorpd  %xmm1,%xmm1
xor    %ecx,%ecx
movsd  0xeb6(%rip),%xmm0
nopw   0x0(%rax,%rax,1)
movsd  (%rbx,%rcx,8),%xmm2
cvttsd2si %xmm2,%edx
cmp    $0xffffd8f1,%edx
je     119c <get_mean+0x8c>
addsd  %xmm2,%xmm1
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1150 <get_mean+0x40>
jmp    1174 <get_mean+0x64>
xorpd  %xmm1,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm2
cmpunordsd %xmm1,%xmm2
movsd  0xe70(%rip),%xmm0
andpd  %xmm2,%xmm0
andnpd %xmm1,%xmm2
orpd   %xmm2,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @get_mean(double* %0, i32 %1) {
%3 = alloca double
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
store double* %0, double** %4
store i32 %1, i32* %5
%8 = load double*, double** %4
%9 = icmp ne double* %8, null
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i32, i32* %5
%12 = icmp ne i32 %11, 0
br label %13
13: ; preds = %10, %2
%14 = phi i1 [ false, %2 ], [ %12, %10 ]
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = load i32, i32* %5
%18 = icmp eq i32 1, %17
br i1 %18, label %19, label %23
19: ; preds = %13
%20 = load double*, double** %4
%21 = getelementptr inbounds double, double* %20, i64 0
%22 = load double, double* %21
store double %22, double* %3
br label %59
23: ; preds = %13
store double 0.000000e+00, double* %7
store i32 0, i32* %6
br label %24
24: ; preds = %45, %23
%25 = load i32, i32* %6
%26 = load i32, i32* %5
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %48
28: ; preds = %24
%29 = load double*, double** %4
%30 = load i32, i32* %6
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds double, double* %29, i64 %31
%33 = load double, double* %32
%34 = fptosi double %33 to i32
%35 = icmp eq i32 -9999, %34
br i1 %35, label %36, label %37
36: ; preds = %28
store double -9.999000e+03, double* %3
br label %59
37: ; preds = %28
%38 = load double*, double** %4
%39 = load i32, i32* %6
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds double, double* %38, i64 %40
%42 = load double, double* %41
%43 = load double, double* %7
%44 = fadd double %43, %42
store double %44, double* %7
br label %45
45: ; preds = %37
%46 = load i32, i32* %6
%47 = add nsw i32 %46, 1
store i32 %47, i32* %6
br label %24
48: ; preds = %24
%49 = load i32, i32* %5
%50 = sitofp i32 %49 to double
%51 = load double, double* %7
%52 = fdiv double %51, %50
store double %52, double* %7
%53 = load double, double* %7
%54 = load double, double* %7
%55 = fcmp une double %53, %54
br i1 %55, label %56, label %57
56: ; preds = %48
store double -9.999000e+03, double* %7
br label %57
57: ; preds = %56, %48
%58 = load double, double* %7
store double %58, double* %3
br label %59
59: ; preds = %57, %36, %19
%60 = load double, double* %3
ret double %60
}

LLVM IR (-O2):
define double @get_mean(double* %0, i32 %1) {
%3 = icmp ne double* %0, null
%4 = icmp ne i32 %1, 0
%5 = and i1 %3, %4
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = icmp eq i32 %1, 1
br i1 %8, label %13, label %9
9: ; preds = %2
%10 = icmp sgt i32 %1, 0
br i1 %10, label %11, label %26
11: ; preds = %9
%12 = zext i32 %1 to i64
br label %15
13: ; preds = %2
%14 = load double, double* %0
br label %32
15: ; preds = %11, %22
%16 = phi i64 [ 0, %11 ], [ %24, %22 ]
%17 = phi double [ 0.000000e+00, %11 ], [ %23, %22 ]
%18 = getelementptr inbounds double, double* %0, i64 %16
%19 = load double, double* %18
%20 = fptosi double %19 to i32
%21 = icmp eq i32 %20, -9999
br i1 %21, label %32, label %22
22: ; preds = %15
%23 = fadd double %17, %19
%24 = add nuw nsw i64 %16, 1
%25 = icmp eq i64 %24, %12
br i1 %25, label %26, label %15
26: ; preds = %22, %9
%27 = phi double [ 0.000000e+00, %9 ], [ %23, %22 ]
%28 = sitofp i32 %1 to double
%29 = fdiv double %27, %28
%30 = fcmp uno double %29, 0.000000e+00
%31 = select i1 %30, double -9.999000e+03, double %29
br label %32
32: ; preds = %15, %26, %13
%33 = phi double [ %14, %13 ], [ %31, %26 ], [ -9.999000e+03, %15 ]
ret double %33
}