#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 cmod(double, double);
double errev(int nn, double *qr, double *qi, double ms, double mp, double are,
             double mre) {
  double e;
  int i;
  e = cmod(qr[0], qi[0]) * mre / (are + mre);
  for (i = 0; i < nn; i++)
    e = e * ms + cmod(qr[i], qi[i]);
  return e * (are + mre) - mp * mre;
}


x86 assembly (clang, -O0):
<errev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
movsd  %xmm2,-0x30(%rbp)
movsd  %xmm3,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
call   1030 <cmod@plt>
mulsd  -0x38(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
addsd  -0x38(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11d2 <errev+0xc2>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
call   1030 <cmod@plt>
movsd  -0x58(%rbp),%xmm2
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    116b <errev+0x5b>
movsd  -0x40(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
addsd  -0x38(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<errev>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
movsd  %xmm3,0x8(%rsp)
movsd  %xmm2,(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x18(%rsp)
mov    %rdx,%r14
mov    %rsi,%r15
mov    %edi,%ebp
movsd  (%rsi),%xmm0
movsd  (%rdx),%xmm1
call   1030 <cmod@plt>
movapd %xmm0,%xmm1
movsd  0x8(%rsp),%xmm2
mulsd  %xmm2,%xmm1
movsd  (%rsp),%xmm0
addsd  %xmm2,%xmm0
movsd  %xmm0,(%rsp)
divsd  %xmm0,%xmm1
test   %ebp,%ebp
jle    11a0 <errev+0x90>
mov    %ebp,%ebp
xor    %ebx,%ebx
xchg   %ax,%ax
movsd  %xmm1,0x20(%rsp)
movsd  (%r15,%rbx,8),%xmm0
movsd  (%r14,%rbx,8),%xmm1
call   1030 <cmod@plt>
movsd  0x20(%rsp),%xmm1
mulsd  0x18(%rsp),%xmm1
addsd  %xmm0,%xmm1
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1170 <errev+0x60>
movsd  0x10(%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
mulsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @errev(i32 %0, double* %1, double* %2, double %3, double %4, double %5, double %6) {
%8 = alloca i32
%9 = alloca double*
%10 = alloca double*
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca i32
store i32 %0, i32* %8
store double* %1, double** %9
store double* %2, double** %10
store double %3, double* %11
store double %4, double* %12
store double %5, double* %13
store double %6, double* %14
%17 = load double*, double** %9
%18 = getelementptr inbounds double, double* %17, i64 0
%19 = load double, double* %18
%20 = load double*, double** %10
%21 = getelementptr inbounds double, double* %20, i64 0
%22 = load double, double* %21
%23 = call double @cmod(double %19, double %22)
%24 = load double, double* %14
%25 = fmul double %23, %24
%26 = load double, double* %13
%27 = load double, double* %14
%28 = fadd double %26, %27
%29 = fdiv double %25, %28
store double %29, double* %15
store i32 0, i32* %16
br label %30
30: ; preds = %49, %7
%31 = load i32, i32* %16
%32 = load i32, i32* %8
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %52
34: ; preds = %30
%35 = load double, double* %15
%36 = load double, double* %11
%37 = load double*, double** %9
%38 = load i32, i32* %16
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %37, i64 %39
%41 = load double, double* %40
%42 = load double*, double** %10
%43 = load i32, i32* %16
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds double, double* %42, i64 %44
%46 = load double, double* %45
%47 = call double @cmod(double %41, double %46)
%48 = call double @llvm.fmuladd.f64(double %35, double %36, double %47)
store double %48, double* %15
br label %49
49: ; preds = %34
%50 = load i32, i32* %16
%51 = add nsw i32 %50, 1
store i32 %51, i32* %16
br label %30
52: ; preds = %30
%53 = load double, double* %15
%54 = load double, double* %13
%55 = load double, double* %14
%56 = fadd double %54, %55
%57 = load double, double* %12
%58 = load double, double* %14
%59 = fmul double %57, %58
%60 = fneg double %59
%61 = call double @llvm.fmuladd.f64(double %53, double %56, double %60)
ret double %61
}

LLVM IR (-O2):
define double @errev(i32 %0, double* nocapture %1, double* nocapture %2, double %3, double %4, double %5, double %6) {
%8 = load double, double* %1
%9 = load double, double* %2
%10 = tail call double @cmod(double %8, double %9)
%11 = fmul double %10, %6
%12 = fadd double %5, %6
%13 = fdiv double %11, %12
%14 = icmp sgt i32 %0, 0
br i1 %14, label %15, label %28
15: ; preds = %7
%16 = zext i32 %0 to i64
br label %17
17: ; preds = %15, %17
%18 = phi i64 [ 0, %15 ], [ %26, %17 ]
%19 = phi double [ %13, %15 ], [ %25, %17 ]
%20 = getelementptr inbounds double, double* %1, i64 %18
%21 = load double, double* %20
%22 = getelementptr inbounds double, double* %2, i64 %18
%23 = load double, double* %22
%24 = tail call double @cmod(double %21, double %23)
%25 = tail call double @llvm.fmuladd.f64(double %19, double %3, double %24)
%26 = add nuw nsw i64 %18, 1
%27 = icmp eq i64 %26, %16
br i1 %27, label %28, label %17
28: ; preds = %17, %7
%29 = phi double [ %13, %7 ], [ %25, %17 ]
%30 = fneg double %4
%31 = fmul double %30, %6
%32 = tail call double @llvm.fmuladd.f64(double %29, double %12, double %31)
ret double %32
}