#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*/ memcpy(double *, double const *, int const);
int /*<<< orphan*/ memset(double *, int /*<<< orphan*/, int const);
void rotatingPulseVelEvaluate(const int nPoints, const int nSpace,
                              const double self_a, const double *x,
                              const double *u, double *m, double *dm, double *f,
                              double *df, double *a, double *da, double *phi,
                              double *dphi) {
  double vx, vy;
  int k, I;
  const int nSpace2 = nSpace * nSpace;
  memset(da, 0, nPoints * nSpace2 * sizeof(double));
  memcpy(m, u, nPoints * sizeof(double));
  memcpy(phi, u, nPoints * sizeof(double));
  for (k = 0; k < nPoints; k++) {
    dm[k] = dphi[k] = 1.0;
    vx = -4.0 * (x[k * 3 + 1] - 0.5);
    vy = 4.0 * (x[k * 3] - 0.5);
    f[k * nSpace] = vx * u[k];
    f[k * nSpace + 1] = vy * u[k];
    df[k * nSpace] = vx;
    df[k * nSpace + 1] = vy;
    for (I = 0; I < nSpace; I++) {
      a[k * nSpace2 + I * nSpace + I] = self_a;
    }
  }
}


x86 assembly (clang, -O0):
<rotatingPulseVelEvaluate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x38(%rbp),%rax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    0x28(%rbp),%rdi
mov    -0x4(%rbp),%eax
imul   -0x4c(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edx
call   1040 <memcpy@plt>
mov    0x30(%rbp),%rdi
mov    -0x20(%rbp),%rsi
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    131f <rotatingPulseVelEvaluate+0x1ff>
mov    0x38(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  0xe48(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  0xe33(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
imul   $0x3,-0x44(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  0xe03(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xdff(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x18(%rbp),%rax
imul   $0x3,-0x44(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  0xdd6(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xdc2(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x44(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    0x10(%rbp),%rax
mov    -0x44(%rbp),%ecx
imul   -0x8(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x40(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x44(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    0x10(%rbp),%rax
mov    -0x44(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x38(%rbp),%xmm0
mov    0x18(%rbp),%rax
mov    -0x44(%rbp),%ecx
imul   -0x8(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x40(%rbp),%xmm0
mov    0x18(%rbp),%rax
mov    -0x44(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    130c <rotatingPulseVelEvaluate+0x1ec>
movsd  -0x10(%rbp),%xmm0
mov    0x20(%rbp),%rax
mov    -0x44(%rbp),%ecx
imul   -0x4c(%rbp),%ecx
mov    -0x48(%rbp),%edx
imul   -0x8(%rbp),%edx
add    %edx,%ecx
add    -0x48(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    12ce <rotatingPulseVelEvaluate+0x1ae>
jmp    1311 <rotatingPulseVelEvaluate+0x1f1>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11b4 <rotatingPulseVelEvaluate+0x94>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotatingPulseVelEvaluate>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9,0x20(%rsp)
mov    %r8,(%rsp)
mov    %rcx,%r12
mov    %rdx,0x18(%rsp)
movsd  %xmm0,0x8(%rsp)
mov    %esi,%ebx
mov    %edi,%ebp
mov    0x78(%rsp),%rdi
mov    %esi,%r13d
imul   %esi,%r13d
lea    0x0(,%rbp,8),%r14d
mov    %r14d,%edx
imul   %r13d,%edx
xor    %r15d,%r15d
xor    %esi,%esi
call   1030 <memset@plt>
mov    (%rsp),%rdi
mov    %r12,%rsi
mov    %r14d,%edx
call   1040 <memcpy@plt>
mov    0x80(%rsp),%rdi
mov    %r12,%rsi
mov    %r14d,%edx
call   1040 <memcpy@plt>
test   %ebp,%ebp
jle    12ce <rotatingPulseVelEvaluate+0x1ae>
mov    0x70(%rsp),%rcx
movslq %ebx,%rax
mov    %rax,(%rsp)
mov    %ebp,%r11d
mov    %ebx,%edx
mov    %rdx,0x10(%rsp)
and    $0xfffffffe,%edx
lea    0x1(%rbx),%esi
lea    (%rbx,%rbx,1),%r8d
add    $0x2,%r8d
movabs $0x3ff0000000000000,%r9
movapd 0xe32(%rip),%xmm0
movapd 0xe3a(%rip),%xmm1
xor    %r10d,%r10d
jmp    11f0 <rotatingPulseVelEvaluate+0xd0>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r10
add    %r13d,%r15d
cmp    %r11,%r10
je     12ce <rotatingPulseVelEvaluate+0x1ae>
mov    %r10,%rbp
mov    0x88(%rsp),%rax
mov    %r9,(%rax,%r10,8)
mov    0x20(%rsp),%rdi
mov    %r9,(%rdi,%r10,8)
lea    (%r10,%r10,2),%rdi
mov    0x18(%rsp),%rax
movupd (%rax,%rdi,8),%xmm2
addpd  %xmm0,%xmm2
mulpd  %xmm1,%xmm2
movapd %xmm2,%xmm3
unpckhpd %xmm2,%xmm3
mulsd  (%r12,%r10,8),%xmm3
imul   (%rsp),%rbp
mov    0x60(%rsp),%rax
movsd  %xmm3,(%rax,%rbp,8)
movsd  (%r12,%r10,8),%xmm3
mulsd  %xmm2,%xmm3
movsd  %xmm3,0x8(%rax,%rbp,8)
shufpd $0x1,%xmm2,%xmm2
mov    0x68(%rsp),%rax
movupd %xmm2,(%rax,%rbp,8)
test   %ebx,%ebx
jle    11e0 <rotatingPulseVelEvaluate+0xc0>
cmp    $0x1,%ebx
jne    1270 <rotatingPulseVelEvaluate+0x150>
xor    %r14d,%r14d
jmp    129f <rotatingPulseVelEvaluate+0x17f>
nopl   0x0(%rax,%rax,1)
mov    %r15d,%ebp
xor    %r14d,%r14d
movsd  0x8(%rsp),%xmm2
nopl   0x0(%rax)
movslq %ebp,%rbp
movsd  %xmm2,(%rcx,%rbp,8)
lea    (%rsi,%rbp,1),%edi
movslq %edi,%rdi
movsd  %xmm2,(%rcx,%rdi,8)
add    $0x2,%r14
add    %r8d,%ebp
cmp    %r14,%rdx
jne    1280 <rotatingPulseVelEvaluate+0x160>
testb  $0x1,0x10(%rsp)
je     11e0 <rotatingPulseVelEvaluate+0xc0>
mov    %r13d,%edi
imul   %r10d,%edi
add    %r14d,%edi
imul   %ebx,%r14d
add    %edi,%r14d
movslq %r14d,%rdi
movsd  0x8(%rsp),%xmm2
movsd  %xmm2,(%rcx,%rdi,8)
jmp    11e0 <rotatingPulseVelEvaluate+0xc0>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @rotatingPulseVelEvaluate(i32 %0, i32 %1, double %2, double* nocapture %3, double* %4, double* %5, double* nocapture writeonly %6, double* nocapture writeonly %7, double* nocapture writeonly %8, double* nocapture writeonly %9, double* %10, double* %11, double* nocapture writeonly %12) {
%14 = mul nsw i32 %1, %1
%15 = shl i32 %0, 3
%16 = mul i32 %15, %14
%17 = tail call i32 @memset(double* %10, i32 0, i32 %16)
%18 = tail call i32 @memcpy(double* %5, double* %4, i32 %15)
%19 = tail call i32 @memcpy(double* %11, double* %4, i32 %15)
%20 = icmp sgt i32 %0, 0
br i1 %20, label %21, label %91
21: ; preds = %13
%22 = icmp sgt i32 %1, 0
%23 = sext i32 %1 to i64
%24 = zext i32 %0 to i64
%25 = zext i32 %1 to i64
%26 = and i64 %25, 1
%27 = icmp eq i32 %1, 1
%28 = and i64 %25, 4294967294
%29 = icmp eq i64 %26, 0
br label %30
30: ; preds = %21, %88
%31 = phi i64 [ 0, %21 ], [ %89, %88 ]
%32 = getelementptr inbounds double, double* %12, i64 %31
store double 1.000000e+00, double* %32
%33 = getelementptr inbounds double, double* %6, i64 %31
store double 1.000000e+00, double* %33
%34 = mul nuw nsw i64 %31, 3
%35 = getelementptr inbounds double, double* %3, i64 %34
%36 = bitcast double* %35 to <2 x double>*
%37 = load <2 x double>, <2 x double>* %36
%38 = fadd <2 x double> %37, <double -5.000000e-01, double -5.000000e-01>
%39 = fmul <2 x double> %38, <double 4.000000e+00, double -4.000000e+00>
%40 = getelementptr inbounds double, double* %4, i64 %31
%41 = load double, double* %40
%42 = extractelement <2 x double> %39, i64 1
%43 = fmul double %42, %41
%44 = mul nsw i64 %31, %23
%45 = getelementptr inbounds double, double* %7, i64 %44
store double %43, double* %45
%46 = load double, double* %40
%47 = extractelement <2 x double> %39, i64 0
%48 = fmul double %47, %46
%49 = add nsw i64 %44, 1
%50 = getelementptr inbounds double, double* %7, i64 %49
store double %48, double* %50
%51 = getelementptr inbounds double, double* %8, i64 %44
%52 = shufflevector <2 x double> %39, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%53 = bitcast double* %51 to <2 x double>*
store <2 x double> %52, <2 x double>* %53
br i1 %22, label %54, label %88
54: ; preds = %30
%55 = trunc i64 %31 to i32
%56 = mul i32 %14, %55
br i1 %27, label %78, label %57
57: ; preds = %54, %57
%58 = phi i64 [ %75, %57 ], [ 0, %54 ]
%59 = phi i64 [ %76, %57 ], [ 0, %54 ]
%60 = trunc i64 %58 to i32
%61 = mul nsw i32 %60, %1
%62 = trunc i64 %58 to i32
%63 = add i32 %56, %62
%64 = add i32 %63, %61
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds double, double* %9, i64 %65
store double %2, double* %66
%67 = or i64 %58, 1
%68 = trunc i64 %67 to i32
%69 = mul nsw i32 %68, %1
%70 = trunc i64 %67 to i32
%71 = add i32 %56, %70
%72 = add i32 %71, %69
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds double, double* %9, i64 %73
store double %2, double* %74
%75 = add nuw nsw i64 %58, 2
%76 = add i64 %59, 2
%77 = icmp eq i64 %76, %28
br i1 %77, label %78, label %57
78: ; preds = %57, %54
%79 = phi i64 [ 0, %54 ], [ %75, %57 ]
br i1 %29, label %88, label %80
80: ; preds = %78
%81 = trunc i64 %79 to i32
%82 = mul nsw i32 %81, %1
%83 = trunc i64 %79 to i32
%84 = add i32 %56, %83
%85 = add i32 %84, %82
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds double, double* %9, i64 %86
store double %2, double* %87
br label %88
88: ; preds = %80, %78, %30
%89 = add nuw nsw i64 %31, 1
%90 = icmp eq i64 %89, %24
br i1 %90, label %91, label %30
91: ; preds = %88, %13
ret void
}