#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 exp(double);
double fabs(double);
double erfc(double x) {
  const double a1 = -1.26551223, a2 = 1.00002368, a3 = 0.37409196,
               a4 = 0.09678418, a5 = -0.18628806, a6 = 0.27886807,
               a7 = -1.13520398, a8 = 1.48851587, a9 = -0.82215223,
               a10 = 0.17087277;
  double v = 1;
  double z = fabs(x);
  double t;
  if (z == 0)
    return v;
  t = 1 / (1 + 0.5 * z);
  v = t *
      exp((-z * z) + a1 +
          t * (a2 +
               t * (a3 +
                    t * (a4 +
                         t * (a5 +
                              t * (a6 +
                                   t * (a7 +
                                        t * (a8 + t * (a9 + t * a10)))))))));
  if (x < 0)
    v = 2 - v;
  return v;
}


x86 assembly (clang, -O0):
<erfc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  0xf38(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xf23(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xf0e(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xef9(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xee4(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xecf(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xeba(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xea5(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xe90(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xe7b(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xe66(%rip),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x10(%rbp),%xmm0
movaps 0xe45(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11eb <erfc+0xdb>
jp     11eb <erfc+0xdb>
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    135d <erfc+0x24d>
movsd  -0x70(%rbp),%xmm1
movsd  0xe70(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe0c(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe00(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x70(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe10(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
movsd  -0x78(%rbp),%xmm2
movsd  -0x78(%rbp),%xmm3
movsd  -0x78(%rbp),%xmm4
movsd  -0x78(%rbp),%xmm5
movsd  -0x78(%rbp),%xmm6
movsd  -0x78(%rbp),%xmm7
movsd  -0x78(%rbp),%xmm8
movsd  -0x78(%rbp),%xmm9
movsd  0xd8c(%rip),%xmm10
mulsd  %xmm10,%xmm9
movsd  0xd86(%rip),%xmm10
addsd  %xmm10,%xmm9
mulsd  %xmm9,%xmm8
movsd  0xd7b(%rip),%xmm9
addsd  %xmm9,%xmm8
mulsd  %xmm8,%xmm7
movsd  0xd70(%rip),%xmm8
addsd  %xmm8,%xmm7
mulsd  %xmm7,%xmm6
movsd  0xd67(%rip),%xmm7
addsd  %xmm7,%xmm6
mulsd  %xmm6,%xmm5
movsd  0xd5f(%rip),%xmm6
addsd  %xmm6,%xmm5
mulsd  %xmm5,%xmm4
movsd  0xd57(%rip),%xmm5
addsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm3
movsd  0xd4f(%rip),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm2
movsd  0xd47(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1353 <erfc+0x243>
movsd  0xd27(%rip),%xmm0
subsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<erfc>:
sub    $0x18,%rsp
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    112d <erfc+0x1d>
jp     112d <erfc+0x1d>
movsd  0xee8(%rip),%xmm0
add    $0x18,%rsp
ret
movapd 0xecb(%rip),%xmm1
andpd  %xmm0,%xmm1
movapd %xmm0,(%rsp)
movsd  0xed2(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xebe(%rip),%xmm3
addsd  %xmm3,%xmm0
divsd  %xmm0,%xmm3
movsd  %xmm3,0x10(%rsp)
movsd  0xec0(%rip),%xmm0
mulsd  %xmm3,%xmm0
addsd  0xebc(%rip),%xmm0
mulsd  %xmm3,%xmm0
addsd  0xeb8(%rip),%xmm0
mulsd  %xmm3,%xmm0
addsd  0xeb4(%rip),%xmm0
mulsd  %xmm1,%xmm1
mulsd  %xmm3,%xmm0
addsd  0xeac(%rip),%xmm0
movsd  0xe7c(%rip),%xmm2
mulsd  %xmm3,%xmm0
addsd  0xea0(%rip),%xmm0
subsd  %xmm1,%xmm2
mulsd  %xmm3,%xmm0
addsd  0xe98(%rip),%xmm0
mulsd  %xmm3,%xmm0
addsd  0xe94(%rip),%xmm0
mulsd  %xmm3,%xmm0
addsd  0xe90(%rip),%xmm0
mulsd  %xmm3,%xmm0
addsd  %xmm2,%xmm0
call   1030 <exp@plt>
mulsd  0x10(%rsp),%xmm0
movsd  0xe7d(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd (%rsp),%xmm2
cmpltsd 0xe73(%rip),%xmm2
movapd %xmm2,(%rsp)
movapd (%rsp),%xmm2
andnpd %xmm0,%xmm2
movapd (%rsp),%xmm0
andpd  %xmm1,%xmm0
orpd   %xmm2,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @erfc(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
store double %0, double* %3
store double 0xBFF43F89C0889BC5, double* %4
store double 0x3FF00018D48D3588, double* %5
store double 0x3FD7F11F677960EA, double* %6
store double 0x3FB8C6D917DEC3F0, double* %7
store double 0xBFC7D84982AAEAA5, double* %8
store double 0x3FD1D8F976231CE6, double* %9
store double 0xBFF229CBA6063980, double* %10
store double 0x3FF7D0F60453A1BE, double* %11
store double 0xBFEA4F123185DEFD, double* %12
store double 0x3FC5DF28AF76A5A4, double* %13
store double 1.000000e+00, double* %14
%17 = load double, double* %3
%18 = call double @llvm.fabs.f64(double %17)
store double %18, double* %15
%19 = load double, double* %15
%20 = fcmp oeq double %19, 0.000000e+00
br i1 %20, label %21, label %23
21: ; preds = %1
%22 = load double, double* %14
store double %22, double* %2
br label %59
23: ; preds = %1
%24 = load double, double* %15
%25 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %24, double 1.000000e+00)
%26 = fdiv double 1.000000e+00, %25
store double %26, double* %16
%27 = load double, double* %16
%28 = load double, double* %15
%29 = fneg double %28
%30 = load double, double* %15
%31 = call double @llvm.fmuladd.f64(double %29, double %30, double 0xBFF43F89C0889BC5)
%32 = load double, double* %16
%33 = load double, double* %16
%34 = load double, double* %16
%35 = load double, double* %16
%36 = load double, double* %16
%37 = load double, double* %16
%38 = load double, double* %16
%39 = load double, double* %16
%40 = load double, double* %16
%41 = call double @llvm.fmuladd.f64(double %40, double 0x3FC5DF28AF76A5A4, double 0xBFEA4F123185DEFD)
%42 = call double @llvm.fmuladd.f64(double %39, double %41, double 0x3FF7D0F60453A1BE)
%43 = call double @llvm.fmuladd.f64(double %38, double %42, double 0xBFF229CBA6063980)
%44 = call double @llvm.fmuladd.f64(double %37, double %43, double 0x3FD1D8F976231CE6)
%45 = call double @llvm.fmuladd.f64(double %36, double %44, double 0xBFC7D84982AAEAA5)
%46 = call double @llvm.fmuladd.f64(double %35, double %45, double 0x3FB8C6D917DEC3F0)
%47 = call double @llvm.fmuladd.f64(double %34, double %46, double 0x3FD7F11F677960EA)
%48 = call double @llvm.fmuladd.f64(double %33, double %47, double 0x3FF00018D48D3588)
%49 = call double @llvm.fmuladd.f64(double %32, double %48, double %31)
%50 = call double @exp(double %49)
%51 = fmul double %27, %50
store double %51, double* %14
%52 = load double, double* %3
%53 = fcmp olt double %52, 0.000000e+00
br i1 %53, label %54, label %57
54: ; preds = %23
%55 = load double, double* %14
%56 = fsub double 2.000000e+00, %55
store double %56, double* %14
br label %57
57: ; preds = %54, %23
%58 = load double, double* %14
store double %58, double* %2
br label %59
59: ; preds = %57, %21
%60 = load double, double* %2
ret double %60
}

LLVM IR (-O2):
define double @erfc(double %0) {
%2 = tail call double @llvm.fabs.f64(double %0)
%3 = fcmp oeq double %0, 0.000000e+00
br i1 %3, label %23, label %4
4: ; preds = %1
%5 = tail call double @llvm.fmuladd.f64(double %2, double 5.000000e-01, double 1.000000e+00)
%6 = fdiv double 1.000000e+00, %5
%7 = fneg double %2
%8 = tail call double @llvm.fmuladd.f64(double %7, double %2, double 0xBFF43F89C0889BC5)
%9 = tail call double @llvm.fmuladd.f64(double %6, double 0x3FC5DF28AF76A5A4, double 0xBFEA4F123185DEFD)
%10 = tail call double @llvm.fmuladd.f64(double %6, double %9, double 0x3FF7D0F60453A1BE)
%11 = tail call double @llvm.fmuladd.f64(double %6, double %10, double 0xBFF229CBA6063980)
%12 = tail call double @llvm.fmuladd.f64(double %6, double %11, double 0x3FD1D8F976231CE6)
%13 = tail call double @llvm.fmuladd.f64(double %6, double %12, double 0xBFC7D84982AAEAA5)
%14 = tail call double @llvm.fmuladd.f64(double %6, double %13, double 0x3FB8C6D917DEC3F0)
%15 = tail call double @llvm.fmuladd.f64(double %6, double %14, double 0x3FD7F11F677960EA)
%16 = tail call double @llvm.fmuladd.f64(double %6, double %15, double 0x3FF00018D48D3588)
%17 = tail call double @llvm.fmuladd.f64(double %6, double %16, double %8)
%18 = tail call double @exp(double %17)
%19 = fmul double %6, %18
%20 = fcmp olt double %0, 0.000000e+00
%21 = fsub double 2.000000e+00, %19
%22 = select i1 %20, double %21, double %19
br label %23
23: ; preds = %1, %4
%24 = phi double [ %22, %4 ], [ 1.000000e+00, %1 ]
ret double %24
}