#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 */
double M_SQRT1_2;
double erf(double);
int prob4bit(double *param, double *prob) {
  int index;
  double volt[] = {-7.0, -6.0, -5.0, -4.0, -3.0, -2.0, -1.0, 0.0,
                   1.0,  2.0,  3.0,  4.0,  5.0,  6.0,  7.0};
  for (index = 0; index < 15; index++) {
    volt[index] *= param[0];
  }
  prob[0] = 0.5 * (erf(M_SQRT1_2 * (volt[0] - param[1])) + 1.0);
  for (index = 1; index < 14; index++) {
    prob[index] = 0.5 * (erf(M_SQRT1_2 * (volt[index] - param[1])) -
                         erf(M_SQRT1_2 * (volt[index - 1] - param[1])));
  }
  prob[15] = 0.5 * (1.0 - erf(M_SQRT1_2 * (volt[14] - param[1])));
  return (0);
}


x86 assembly (clang, -O0):
<prob4bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x90(%rbp),%rdi
lea    0xecf(%rip),%rsi
mov    $0x78,%edx
call   1030 <memcpy@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0xf,-0x14(%rbp)
jge    1188 <prob4bit+0x68>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movslq -0x14(%rbp),%rax
mulsd  -0x90(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0x90(%rbp,%rax,8)
ff ff
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1152 <prob4bit+0x32>
mov    0x2e51(%rip),%rax
movsd  (%rax),%xmm0
movsd  -0x90(%rbp),%xmm1
ff
mov    -0x8(%rbp),%rax
subsd  0x8(%rax),%xmm1
mulsd  %xmm1,%xmm0
call   1040 <erf@plt>
movaps %xmm0,%xmm1
movsd  0xe50(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe3c(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x14(%rbp)
cmpl   $0xe,-0x14(%rbp)
jge    1274 <prob4bit+0x154>
mov    0x2df8(%rip),%rax
movsd  (%rax),%xmm0
movslq -0x14(%rbp),%rax
movsd  -0x90(%rbp,%rax,8),%xmm1
ff ff
mov    -0x8(%rbp),%rax
subsd  0x8(%rax),%xmm1
mulsd  %xmm1,%xmm0
call   1040 <erf@plt>
movsd  %xmm0,-0x98(%rbp)
ff
mov    0x2dc6(%rip),%rax
movsd  (%rax),%xmm0
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cltq
movsd  -0x90(%rbp,%rax,8),%xmm1
ff ff
mov    -0x8(%rbp),%rax
subsd  0x8(%rax),%xmm1
mulsd  %xmm1,%xmm0
call   1040 <erf@plt>
movsd  -0x98(%rbp),%xmm1
ff
subsd  %xmm0,%xmm1
movsd  0xdab(%rip),%xmm0
mulsd  %xmm1,%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    11d7 <prob4bit+0xb7>
mov    0x2d65(%rip),%rax
movsd  (%rax),%xmm0
movsd  -0x20(%rbp),%xmm1
mov    -0x8(%rbp),%rax
subsd  0x8(%rax),%xmm1
mulsd  %xmm1,%xmm0
call   1040 <erf@plt>
movsd  0xd6a(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0xd56(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x78(%rax)
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prob4bit>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %rsi,%r14
mov    %rdi,%r12
movsd  (%rdi),%xmm0
movapd %xmm0,%xmm2
unpcklpd %xmm0,%xmm2
movapd 0xec8(%rip),%xmm1
mulpd  %xmm2,%xmm1
movapd %xmm1,0x20(%rsp)
movapd %xmm1,%xmm3
movapd %xmm1,(%rsp)
movapd 0xebd(%rip),%xmm1
mulpd  %xmm2,%xmm1
movapd %xmm1,0x30(%rsp)
movapd 0xebb(%rip),%xmm1
mulpd  %xmm2,%xmm1
movapd %xmm1,0x40(%rsp)
movapd 0xeb9(%rip),%xmm1
xorpd  %xmm0,%xmm1
movlpd %xmm1,0x50(%rsp)
xorpd  %xmm1,%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x58(%rsp)
movsd  %xmm0,0x60(%rsp)
movapd 0xea3(%rip),%xmm0
mulpd  %xmm2,%xmm0
movupd %xmm0,0x68(%rsp)
movapd 0xea1(%rip),%xmm0
mulpd  %xmm2,%xmm0
movupd %xmm0,0x78(%rsp)
mulpd  0xe9f(%rip),%xmm2
movapd %xmm2,0x10(%rsp)
movupd %xmm2,0x88(%rsp)
mov    0x2e09(%rip),%r15
movsd  0x8(%rdi),%xmm1
movapd %xmm3,%xmm0
subsd  %xmm1,%xmm0
mulsd  (%r15),%xmm0
call   1030 <erf@plt>
addsd  0xe7a(%rip),%xmm0
mulsd  0xe7a(%rip),%xmm0
movsd  %xmm0,(%r14)
movapd (%rsp),%xmm0
unpckhpd %xmm0,%xmm0
xor    %ebx,%ebx
xchg   %ax,%ax
subsd  0x8(%r12),%xmm0
mulsd  (%r15),%xmm0
call   1030 <erf@plt>
movsd  %xmm0,(%rsp)
movsd  0x20(%rsp,%rbx,8),%xmm0
subsd  0x8(%r12),%xmm0
mulsd  (%r15),%xmm0
call   1030 <erf@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xe2a(%rip),%xmm1
movsd  %xmm1,0x8(%r14,%rbx,8)
cmp    $0xc,%rbx
je     1267 <prob4bit+0x157>
movsd  0x30(%rsp,%rbx,8),%xmm0
add    $0x1,%rbx
jmp    1210 <prob4bit+0x100>
movapd 0x10(%rsp),%xmm0
unpckhpd %xmm0,%xmm0
subsd  0x8(%r12),%xmm0
mulsd  (%r15),%xmm0
call   1030 <erf@plt>
movsd  0xde6(%rip),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xde2(%rip),%xmm1
movsd  %xmm1,0x78(%r14)
xor    %eax,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.prob4bit.volt = [15 x double] [double -7.000000e+00, double -6.000000e+00, double -5.000000e+00, double -4.000000e+00, double -3.000000e+00, double -2.000000e+00, double -1.000000e+00, double 0.000000e+00, double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 5.000000e+00, double 6.000000e+00, double 7.000000e+00]
@M_SQRT1_2 = global double 0.000000e+00
define i32 @prob4bit(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca i32
%6 = alloca [15 x double]
store double* %0, double** %3
store double* %1, double** %4
%7 = bitcast [15 x double]* %6 to i8*
store i32 0, i32* %5
br label %8
8: ; preds = %20, %2
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 15
br i1 %10, label %11, label %23
11: ; preds = %8
%12 = load double*, double** %3
%13 = getelementptr inbounds double, double* %12, i64 0
%14 = load double, double* %13
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [15 x double], [15 x double]* %6, i64 0, i64 %16
%18 = load double, double* %17
%19 = fmul double %18, %14
store double %19, double* %17
br label %20
20: ; preds = %11
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
br label %8
23: ; preds = %8
%24 = load double, double* @M_SQRT1_2
%25 = getelementptr inbounds [15 x double], [15 x double]* %6, i64 0, i64 0
%26 = load double, double* %25
%27 = load double*, double** %3
%28 = getelementptr inbounds double, double* %27, i64 1
%29 = load double, double* %28
%30 = fsub double %26, %29
%31 = fmul double %24, %30
%32 = call double @erf(double %31)
%33 = fadd double %32, 1.000000e+00
%34 = fmul double 5.000000e-01, %33
%35 = load double*, double** %4
%36 = getelementptr inbounds double, double* %35, i64 0
store double %34, double* %36
store i32 1, i32* %5
br label %37
37: ; preds = %70, %23
%38 = load i32, i32* %5
%39 = icmp slt i32 %38, 14
br i1 %39, label %40, label %73
40: ; preds = %37
%41 = load double, double* @M_SQRT1_2
%42 = load i32, i32* %5
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [15 x double], [15 x double]* %6, i64 0, i64 %43
%45 = load double, double* %44
%46 = load double*, double** %3
%47 = getelementptr inbounds double, double* %46, i64 1
%48 = load double, double* %47
%49 = fsub double %45, %48
%50 = fmul double %41, %49
%51 = call double @erf(double %50)
%52 = load double, double* @M_SQRT1_2
%53 = load i32, i32* %5
%54 = sub nsw i32 %53, 1
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [15 x double], [15 x double]* %6, i64 0, i64 %55
%57 = load double, double* %56
%58 = load double*, double** %3
%59 = getelementptr inbounds double, double* %58, i64 1
%60 = load double, double* %59
%61 = fsub double %57, %60
%62 = fmul double %52, %61
%63 = call double @erf(double %62)
%64 = fsub double %51, %63
%65 = fmul double 5.000000e-01, %64
%66 = load double*, double** %4
%67 = load i32, i32* %5
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds double, double* %66, i64 %68
store double %65, double* %69
br label %70
70: ; preds = %40
%71 = load i32, i32* %5
%72 = add nsw i32 %71, 1
store i32 %72, i32* %5
br label %37
73: ; preds = %37
%74 = load double, double* @M_SQRT1_2
%75 = getelementptr inbounds [15 x double], [15 x double]* %6, i64 0, i64 14
%76 = load double, double* %75
%77 = load double*, double** %3
%78 = getelementptr inbounds double, double* %77, i64 1
%79 = load double, double* %78
%80 = fsub double %76, %79
%81 = fmul double %74, %80
%82 = call double @erf(double %81)
%83 = fsub double 1.000000e+00, %82
%84 = fmul double 5.000000e-01, %83
%85 = load double*, double** %4
%86 = getelementptr inbounds double, double* %85, i64 15
store double %84, double* %86
ret i32 0
}

LLVM IR (-O2):
@M_SQRT1_2 = global double 0.000000e+00
define i32 @prob4bit(double* nocapture %0, double* nocapture writeonly %1) {
%3 = alloca [15 x double]
%4 = bitcast [15 x double]* %3 to i8*
%5 = load double, double* %0
%6 = insertelement <2 x double> poison, double %5, i64 0
%7 = shufflevector <2 x double> %6, <2 x double> poison, <2 x i32> zeroinitializer
%8 = fmul <2 x double> %7, <double -7.000000e+00, double -6.000000e+00>
%9 = bitcast [15 x double]* %3 to <2 x double>*
store <2 x double> %8, <2 x double>* %9
%10 = getelementptr inbounds [15 x double], [15 x double]* %3, i64 0, i64 2
%11 = fmul <2 x double> %7, <double -5.000000e+00, double -4.000000e+00>
%12 = bitcast double* %10 to <2 x double>*
store <2 x double> %11, <2 x double>* %12
%13 = getelementptr inbounds [15 x double], [15 x double]* %3, i64 0, i64 4
%14 = fmul <2 x double> %7, <double -3.000000e+00, double -2.000000e+00>
%15 = bitcast double* %13 to <2 x double>*
store <2 x double> %14, <2 x double>* %15
%16 = getelementptr inbounds [15 x double], [15 x double]* %3, i64 0, i64 6
%17 = fneg double %5
store double %17, double* %16
%18 = getelementptr inbounds [15 x double], [15 x double]* %3, i64 0, i64 7
%19 = fmul double %5, 0.000000e+00
store double %19, double* %18
%20 = getelementptr inbounds [15 x double], [15 x double]* %3, i64 0, i64 8
store double %5, double* %20
%21 = getelementptr inbounds [15 x double], [15 x double]* %3, i64 0, i64 9
%22 = fmul <2 x double> %7, <double 2.000000e+00, double 3.000000e+00>
%23 = bitcast double* %21 to <2 x double>*
store <2 x double> %22, <2 x double>* %23
%24 = getelementptr inbounds [15 x double], [15 x double]* %3, i64 0, i64 11
%25 = fmul <2 x double> %7, <double 4.000000e+00, double 5.000000e+00>
%26 = bitcast double* %24 to <2 x double>*
store <2 x double> %25, <2 x double>* %26
%27 = getelementptr inbounds [15 x double], [15 x double]* %3, i64 0, i64 13
%28 = fmul <2 x double> %7, <double 6.000000e+00, double 7.000000e+00>
%29 = bitcast double* %27 to <2 x double>*
store <2 x double> %28, <2 x double>* %29
%30 = load double, double* @M_SQRT1_2
%31 = getelementptr inbounds double, double* %0, i64 1
%32 = load double, double* %31
%33 = extractelement <2 x double> %8, i64 0
%34 = fsub double %33, %32
%35 = fmul double %30, %34
%36 = tail call double @erf(double %35)
%37 = fadd double %36, 1.000000e+00
%38 = fmul double %37, 5.000000e-01
store double %38, double* %1
%39 = extractelement <2 x double> %8, i64 1
br label %40
40: ; preds = %61, %2
%41 = phi double [ %39, %2 ], [ %63, %61 ]
%42 = phi i64 [ 1, %2 ], [ %59, %61 ]
%43 = load double, double* @M_SQRT1_2
%44 = load double, double* %31
%45 = fsub double %41, %44
%46 = fmul double %43, %45
%47 = tail call double @erf(double %46)
%48 = load double, double* @M_SQRT1_2
%49 = add nsw i64 %42, -1
%50 = getelementptr inbounds [15 x double], [15 x double]* %3, i64 0, i64 %49
%51 = load double, double* %50
%52 = load double, double* %31
%53 = fsub double %51, %52
%54 = fmul double %48, %53
%55 = tail call double @erf(double %54)
%56 = fsub double %47, %55
%57 = fmul double %56, 5.000000e-01
%58 = getelementptr inbounds double, double* %1, i64 %42
store double %57, double* %58
%59 = add nuw nsw i64 %42, 1
%60 = icmp eq i64 %59, 14
br i1 %60, label %64, label %61
61: ; preds = %40
%62 = getelementptr inbounds [15 x double], [15 x double]* %3, i64 0, i64 %59
%63 = load double, double* %62
br label %40
64: ; preds = %40
%65 = load double, double* @M_SQRT1_2
%66 = load double, double* %31
%67 = extractelement <2 x double> %28, i64 1
%68 = fsub double %67, %66
%69 = fmul double %65, %68
%70 = tail call double @erf(double %69)
%71 = fsub double 1.000000e+00, %70
%72 = fmul double %71, 5.000000e-01
%73 = getelementptr inbounds double, double* %1, i64 15
store double %72, double* %73
ret i32 0
}