#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 copysign(double, double);
double fabs(double);
double fmin(double, double);
void construct_ppi_A(int i, double *q, double *qL, double *qR, double *dq,
                     double *dqVL, double *qh, int n) {
  double qi = *q;
  double qimo = *(q - 1);
  double qipo = *(q + 1);
  double dqi;
  double dqip = qipo - qi;
  double dqim = qi - qimo;
  double dqiVL;
  int ipo = i + 1;
  int imo = i - 1;
  double ba, bb, bc;
  double osix = 1. / 6.;
  dq[i] = 0.5 * (q[ipo] - q[imo]);
  dqVL[i] = 0;
  if ((q[ipo] - q[i]) * (q[i] - q[imo]) > 0) {
    ba = 2 * fabs(q[ipo] - q[i]);
    bb = 2 * fabs(q[i] - q[imo]);
    dqVL[i] = fmin(fabs(dq[i]), fmin(ba, bb));
    dqVL[i] = copysign(dqVL[i], dq[i]);
  }
}


x86 assembly (clang, -O0):
<construct_ppi_A>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movsd  -0x8(%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x38(%rbp),%xmm0
subsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x70(%rbp)
movsd  0xe81(%rip),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x10(%rbp),%rax
movslq -0x6c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x70(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm1
movsd  0xe4f(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
movslq -0x4(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x6c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x70(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    132f <construct_ppi_A+0x22f>
mov    -0x10(%rbp),%rax
movslq -0x6c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm1
movaps 0xdf8(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xdcc(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x70(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm1
movaps 0xdc2(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xd96(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm3
movaps 0xd99(%rip),%xmm0
pand   %xmm0,%xmm3
movsd  -0x78(%rbp),%xmm4
movsd  -0x80(%rbp),%xmm1
movaps %xmm1,%xmm5
movaps %xmm4,%xmm2
cmpunordsd %xmm2,%xmm2
movaps %xmm2,%xmm0
pand   %xmm5,%xmm0
minsd  %xmm4,%xmm1
pandn  %xmm1,%xmm2
por    %xmm0,%xmm2
movaps %xmm2,%xmm4
movaps %xmm3,%xmm0
cmpunordsd %xmm0,%xmm0
movaps %xmm0,%xmm1
pand   %xmm4,%xmm1
minsd  %xmm3,%xmm2
pandn  %xmm2,%xmm0
por    %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movaps 0xd11(%rip),%xmm2
pand   %xmm2,%xmm1
movaps 0xd16(%rip),%xmm2
pand   %xmm2,%xmm0
por    %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<construct_ppi_A>:
movslq %edi,%rax
movsd  0x8(%rsi,%rax,8),%xmm0
subsd  -0x8(%rsi,%rax,8),%xmm0
mulsd  0xee9(%rip),%xmm0
movsd  %xmm0,(%r8,%rax,8)
movq   $0x0,(%r9,%rax,8)
movsd  (%rsi,%rax,8),%xmm1
movsd  0x8(%rsi,%rax,8),%xmm2
subsd  %xmm1,%xmm2
subsd  -0x8(%rsi,%rax,8),%xmm1
movapd %xmm2,%xmm0
mulsd  %xmm1,%xmm0
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm0
jbe    11c6 <construct_ppi_A+0xc6>
movapd 0xebc(%rip),%xmm0
andpd  %xmm0,%xmm2
addsd  %xmm2,%xmm2
andpd  %xmm0,%xmm1
addsd  %xmm1,%xmm1
movsd  (%r8,%rax,8),%xmm3
andpd  %xmm0,%xmm3
movapd %xmm2,%xmm4
cmpunordsd %xmm2,%xmm4
movapd %xmm4,%xmm5
andpd  %xmm1,%xmm5
minsd  %xmm2,%xmm1
andnpd %xmm1,%xmm4
orpd   %xmm5,%xmm4
movapd %xmm4,%xmm1
minsd  %xmm3,%xmm1
cmpunordsd %xmm3,%xmm3
movapd %xmm3,%xmm2
andpd  %xmm4,%xmm2
andnpd %xmm1,%xmm3
orpd   %xmm2,%xmm3
movlpd %xmm3,(%r9,%rax,8)
andpd  %xmm0,%xmm3
movsd  (%r8,%rax,8),%xmm1
andnpd %xmm1,%xmm0
orpd   %xmm3,%xmm0
movlpd %xmm0,(%r9,%rax,8)
ret

LLVM IR (-O0):
define void @construct_ppi_A(i32 %0, double* %1, double* %2, double* %3, double* %4, double* %5, double* %6, i32 %7) {
%9 = alloca i32
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca double*
%15 = alloca double*
%16 = alloca i32
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca i32
%25 = alloca i32
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca double
store i32 %0, i32* %9
store double* %1, double** %10
store double* %2, double** %11
store double* %3, double** %12
store double* %4, double** %13
store double* %5, double** %14
store double* %6, double** %15
store i32 %7, i32* %16
%30 = load double*, double** %10
%31 = load double, double* %30
store double %31, double* %17
%32 = load double*, double** %10
%33 = getelementptr inbounds double, double* %32, i64 -1
%34 = load double, double* %33
store double %34, double* %18
%35 = load double*, double** %10
%36 = getelementptr inbounds double, double* %35, i64 1
%37 = load double, double* %36
store double %37, double* %19
%38 = load double, double* %19
%39 = load double, double* %17
%40 = fsub double %38, %39
store double %40, double* %21
%41 = load double, double* %17
%42 = load double, double* %18
%43 = fsub double %41, %42
store double %43, double* %22
%44 = load i32, i32* %9
%45 = add nsw i32 %44, 1
store i32 %45, i32* %24
%46 = load i32, i32* %9
%47 = sub nsw i32 %46, 1
store i32 %47, i32* %25
store double 0x3FC5555555555555, double* %29
%48 = load double*, double** %10
%49 = load i32, i32* %24
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds double, double* %48, i64 %50
%52 = load double, double* %51
%53 = load double*, double** %10
%54 = load i32, i32* %25
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds double, double* %53, i64 %55
%57 = load double, double* %56
%58 = fsub double %52, %57
%59 = fmul double 5.000000e-01, %58
%60 = load double*, double** %13
%61 = load i32, i32* %9
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds double, double* %60, i64 %62
store double %59, double* %63
%64 = load double*, double** %14
%65 = load i32, i32* %9
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds double, double* %64, i64 %66
store double 0.000000e+00, double* %67
%68 = load double*, double** %10
%69 = load i32, i32* %24
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds double, double* %68, i64 %70
%72 = load double, double* %71
%73 = load double*, double** %10
%74 = load i32, i32* %9
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds double, double* %73, i64 %75
%77 = load double, double* %76
%78 = fsub double %72, %77
%79 = load double*, double** %10
%80 = load i32, i32* %9
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds double, double* %79, i64 %81
%83 = load double, double* %82
%84 = load double*, double** %10
%85 = load i32, i32* %25
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds double, double* %84, i64 %86
%88 = load double, double* %87
%89 = fsub double %83, %88
%90 = fmul double %78, %89
%91 = fcmp ogt double %90, 0.000000e+00
br i1 %91, label %92, label %148
92: ; preds = %8
%93 = load double*, double** %10
%94 = load i32, i32* %24
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds double, double* %93, i64 %95
%97 = load double, double* %96
%98 = load double*, double** %10
%99 = load i32, i32* %9
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds double, double* %98, i64 %100
%102 = load double, double* %101
%103 = fsub double %97, %102
%104 = call double @llvm.fabs.f64(double %103)
%105 = fmul double 2.000000e+00, %104
store double %105, double* %26
%106 = load double*, double** %10
%107 = load i32, i32* %9
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds double, double* %106, i64 %108
%110 = load double, double* %109
%111 = load double*, double** %10
%112 = load i32, i32* %25
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds double, double* %111, i64 %113
%115 = load double, double* %114
%116 = fsub double %110, %115
%117 = call double @llvm.fabs.f64(double %116)
%118 = fmul double 2.000000e+00, %117
store double %118, double* %27
%119 = load double*, double** %13
%120 = load i32, i32* %9
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds double, double* %119, i64 %121
%123 = load double, double* %122
%124 = call double @llvm.fabs.f64(double %123)
%125 = load double, double* %26
%126 = load double, double* %27
%127 = call double @llvm.minnum.f64(double %125, double %126)
%128 = call double @llvm.minnum.f64(double %124, double %127)
%129 = load double*, double** %14
%130 = load i32, i32* %9
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds double, double* %129, i64 %131
store double %128, double* %132
%133 = load double*, double** %14
%134 = load i32, i32* %9
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds double, double* %133, i64 %135
%137 = load double, double* %136
%138 = load double*, double** %13
%139 = load i32, i32* %9
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds double, double* %138, i64 %140
%142 = load double, double* %141
%143 = call double @llvm.copysign.f64(double %137, double %142)
%144 = load double*, double** %14
%145 = load i32, i32* %9
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds double, double* %144, i64 %146
store double %143, double* %147
br label %148
148: ; preds = %92, %8
ret void
}

LLVM IR (-O2):
define void @construct_ppi_A(i32 %0, double* nocapture %1, double* nocapture readnone %2, double* nocapture readnone %3, double* nocapture %4, double* nocapture writeonly %5, double* nocapture readnone %6, i32 %7) {
%9 = add nsw i32 %0, 1
%10 = add nsw i32 %0, -1
%11 = sext i32 %9 to i64
%12 = getelementptr inbounds double, double* %1, i64 %11
%13 = load double, double* %12
%14 = sext i32 %10 to i64
%15 = getelementptr inbounds double, double* %1, i64 %14
%16 = load double, double* %15
%17 = fsub double %13, %16
%18 = fmul double %17, 5.000000e-01
%19 = sext i32 %0 to i64
%20 = getelementptr inbounds double, double* %4, i64 %19
store double %18, double* %20
%21 = getelementptr inbounds double, double* %5, i64 %19
store double 0.000000e+00, double* %21
%22 = load double, double* %12
%23 = getelementptr inbounds double, double* %1, i64 %19
%24 = load double, double* %23
%25 = fsub double %22, %24
%26 = load double, double* %15
%27 = fsub double %24, %26
%28 = fmul double %25, %27
%29 = fcmp ogt double %28, 0.000000e+00
br i1 %29, label %30, label %41
30: ; preds = %8
%31 = tail call double @llvm.fabs.f64(double %25)
%32 = fmul double %31, 2.000000e+00
%33 = tail call double @llvm.fabs.f64(double %27)
%34 = fmul double %33, 2.000000e+00
%35 = load double, double* %20
%36 = tail call double @llvm.fabs.f64(double %35)
%37 = tail call double @llvm.minnum.f64(double %32, double %34)
%38 = tail call double @llvm.minnum.f64(double %36, double %37)
store double %38, double* %21
%39 = load double, double* %20
%40 = tail call double @llvm.copysign.f64(double %38, double %39)
store double %40, double* %21
br label %41
41: ; preds = %30, %8
ret void
}