#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 LinearADR_Sine(int *, double *, int, double, double *, double *);
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(int);
int LinearADR_Sine_advectiveVelocity(int *iwork, double *rwork, int nPoints,
                                     double t, double *x, double *f) {
  int i, j, iret;
  double b[3] = {rwork[4], rwork[5], rwork[6]};
  double *u = (double *)malloc(nPoints * sizeof(double));
  iret = LinearADR_Sine(iwork, rwork, nPoints, t, x, u);
  for (i = 0; i < nPoints; i++) {
    for (j = 0; j < 3; j++) {
      f[i * 3 + j] = u[i] * b[j];
    }
  }
  free(u);
  return iret;
}


x86 assembly (clang, -O0):
<LinearADR_Sine_advectiveVelocity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x20(%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x28(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x30(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x68(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
movsd  -0x20(%rbp),%xmm0
mov    -0x28(%rbp),%rcx
mov    -0x68(%rbp),%r8
call   1040 <LinearADR_Sine@plt>
mov    %eax,-0x3c(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    121c <LinearADR_Sine_advectiveVelocity+0xec>
movl   $0x0,-0x38(%rbp)
cmpl   $0x3,-0x38(%rbp)
jge    1209 <LinearADR_Sine_advectiveVelocity+0xd9>
mov    -0x68(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movslq -0x38(%rbp),%rax
mulsd  -0x60(%rbp,%rax,8),%xmm0
mov    -0x30(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11c7 <LinearADR_Sine_advectiveVelocity+0x97>
jmp    120e <LinearADR_Sine_advectiveVelocity+0xde>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11b4 <LinearADR_Sine_advectiveVelocity+0x84>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
mov    -0x3c(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LinearADR_Sine_advectiveVelocity>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %r8,%r15
mov    %rcx,%r14
movsd  %xmm0,0x8(%rsp)
mov    %edx,%r12d
mov    %rsi,%rbp
mov    %rdi,%r13
movsd  0x20(%rsi),%xmm0
movaps %xmm0,0x30(%rsp)
movsd  0x28(%rsi),%xmm0
movaps %xmm0,0x20(%rsp)
movsd  0x30(%rsi),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x0(,%r12,8),%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %r12d,%edx
movsd  0x8(%rsp),%xmm0
mov    %r14,%rcx
mov    %rax,%r8
call   1040 <LinearADR_Sine@plt>
movapd 0x10(%rsp),%xmm2
movapd 0x20(%rsp),%xmm1
movapd 0x30(%rsp),%xmm7
mov    %eax,%r14d
test   %r12d,%r12d
jle    1226 <LinearADR_Sine_advectiveVelocity+0xf6>
mov    %r12d,%eax
cmp    $0x1,%r12d
je     11d4 <LinearADR_Sine_advectiveVelocity+0xa4>
lea    (%rbx,%rax,8),%rcx
cmp    %r15,%rcx
jbe    1240 <LinearADR_Sine_advectiveVelocity+0x110>
lea    (%rax,%rax,2),%rcx
lea    (%r15,%rcx,8),%rcx
cmp    %rcx,%rbx
jae    1240 <LinearADR_Sine_advectiveVelocity+0x110>
xor    %ecx,%ecx
lea    (%rcx,%rcx,2),%rdx
lea    (%r15,%rdx,8),%rdx
add    $0x10,%rdx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%rbx,%rcx,8),%xmm0
mulsd  %xmm7,%xmm0
movsd  %xmm0,-0x10(%rdx)
movsd  (%rbx,%rcx,8),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rdx)
movsd  (%rbx,%rcx,8),%xmm0
mulsd  %xmm2,%xmm0
movsd  %xmm0,(%rdx)
add    $0x1,%rcx
add    $0x18,%rdx
cmp    %rcx,%rax
jne    11f0 <LinearADR_Sine_advectiveVelocity+0xc0>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14d,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ecx
and    $0xfffffffe,%ecx
movapd %xmm7,%xmm8
unpcklpd %xmm7,%xmm8
movapd %xmm1,%xmm9
unpcklpd %xmm1,%xmm9
movapd %xmm2,%xmm0
unpcklpd %xmm2,%xmm0
lea    -0x2(%rcx),%rdx
mov    %rdx,%rsi
shr    %rsi
add    $0x1,%rsi
test   %rdx,%rdx
je     1360 <LinearADR_Sine_advectiveVelocity+0x230>
mov    %rsi,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %edx,%edx
mov    %r15,%rbp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movupd (%rbx,%rdx,8),%xmm3
movapd %xmm3,%xmm4
mulpd  %xmm8,%xmm4
movapd %xmm3,%xmm5
mulpd  %xmm9,%xmm5
mulpd  %xmm0,%xmm3
movapd %xmm4,%xmm6
unpcklpd %xmm5,%xmm6
movsd  %xmm3,%xmm4
movhlps %xmm5,%xmm3
movups %xmm3,0x20(%rbp)
movupd %xmm4,0x10(%rbp)
movupd %xmm6,0x0(%rbp)
movupd 0x10(%rbx,%rdx,8),%xmm3
movapd %xmm3,%xmm4
mulpd  %xmm8,%xmm4
movapd %xmm3,%xmm5
mulpd  %xmm9,%xmm5
mulpd  %xmm0,%xmm3
movapd %xmm4,%xmm6
unpcklpd %xmm5,%xmm6
movsd  %xmm3,%xmm4
movhlps %xmm5,%xmm3
movups %xmm3,0x50(%rbp)
movupd %xmm4,0x40(%rbp)
movupd %xmm6,0x30(%rbp)
add    $0x4,%rdx
add    $0x60,%rbp
add    $0xfffffffffffffffe,%rdi
jne    1290 <LinearADR_Sine_advectiveVelocity+0x160>
test   $0x1,%sil
je     1352 <LinearADR_Sine_advectiveVelocity+0x222>
movupd (%rbx,%rdx,8),%xmm3
mulpd  %xmm3,%xmm8
mulpd  %xmm3,%xmm9
mulpd  %xmm3,%xmm0
lea    (%rdx,%rdx,2),%rdx
movapd %xmm8,%xmm3
unpcklpd %xmm9,%xmm3
movsd  %xmm0,%xmm8
movhlps %xmm9,%xmm0
movups %xmm0,0x20(%r15,%rdx,8)
movupd %xmm8,0x10(%r15,%rdx,8)
movupd %xmm3,(%r15,%rdx,8)
cmp    %rax,%rcx
je     1226 <LinearADR_Sine_advectiveVelocity+0xf6>
jmp    11d6 <LinearADR_Sine_advectiveVelocity+0xa6>
xor    %edx,%edx
test   $0x1,%sil
jne    1315 <LinearADR_Sine_advectiveVelocity+0x1e5>
jmp    1352 <LinearADR_Sine_advectiveVelocity+0x222>

LLVM IR (-O0):
define i32 @LinearADR_Sine_advectiveVelocity(i32* %0, double* %1, i32 %2, double %3, double* %4, double* %5) {
%7 = alloca i32*
%8 = alloca double*
%9 = alloca i32
%10 = alloca double
%11 = alloca double*
%12 = alloca double*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca [3 x double]
%17 = alloca double*
store i32* %0, i32** %7
store double* %1, double** %8
store i32 %2, i32* %9
store double %3, double* %10
store double* %4, double** %11
store double* %5, double** %12
%18 = getelementptr inbounds [3 x double], [3 x double]* %16, i64 0, i64 0
%19 = load double*, double** %8
%20 = getelementptr inbounds double, double* %19, i64 4
%21 = load double, double* %20
store double %21, double* %18
%22 = getelementptr inbounds double, double* %18, i64 1
%23 = load double*, double** %8
%24 = getelementptr inbounds double, double* %23, i64 5
%25 = load double, double* %24
store double %25, double* %22
%26 = getelementptr inbounds double, double* %22, i64 1
%27 = load double*, double** %8
%28 = getelementptr inbounds double, double* %27, i64 6
%29 = load double, double* %28
store double %29, double* %26
%30 = load i32, i32* %9
%31 = sext i32 %30 to i64
%32 = mul i64 %31, 8
%33 = trunc i64 %32 to i32
%34 = call i64 @malloc(i32 %33)
%35 = inttoptr i64 %34 to double*
store double* %35, double** %17
%36 = load i32*, i32** %7
%37 = load double*, double** %8
%38 = load i32, i32* %9
%39 = load double, double* %10
%40 = load double*, double** %11
%41 = load double*, double** %17
%42 = call i32 @LinearADR_Sine(i32* %36, double* %37, i32 %38, double %39, double* %40, double* %41)
store i32 %42, i32* %15
store i32 0, i32* %13
br label %43
43: ; preds = %73, %6
%44 = load i32, i32* %13
%45 = load i32, i32* %9
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %76
47: ; preds = %43
store i32 0, i32* %14
br label %48
48: ; preds = %69, %47
%49 = load i32, i32* %14
%50 = icmp slt i32 %49, 3
br i1 %50, label %51, label %72
51: ; preds = %48
%52 = load double*, double** %17
%53 = load i32, i32* %13
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds double, double* %52, i64 %54
%56 = load double, double* %55
%57 = load i32, i32* %14
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [3 x double], [3 x double]* %16, i64 0, i64 %58
%60 = load double, double* %59
%61 = fmul double %56, %60
%62 = load double*, double** %12
%63 = load i32, i32* %13
%64 = mul nsw i32 %63, 3
%65 = load i32, i32* %14
%66 = add nsw i32 %64, %65
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds double, double* %62, i64 %67
store double %61, double* %68
br label %69
69: ; preds = %51
%70 = load i32, i32* %14
%71 = add nsw i32 %70, 1
store i32 %71, i32* %14
br label %48
72: ; preds = %48
br label %73
73: ; preds = %72
%74 = load i32, i32* %13
%75 = add nsw i32 %74, 1
store i32 %75, i32* %13
br label %43
76: ; preds = %43
%77 = load double*, double** %17
%78 = call i32 @free(double* %77)
%79 = load i32, i32* %15
ret i32 %79
}

LLVM IR (-O2):
define i32 @LinearADR_Sine_advectiveVelocity(i32* %0, double* %1, i32 %2, double %3, double* %4, double* nocapture writeonly %5) {
%7 = getelementptr inbounds double, double* %1, i64 4
%8 = load double, double* %7
%9 = getelementptr inbounds double, double* %1, i64 5
%10 = load double, double* %9
%11 = getelementptr inbounds double, double* %1, i64 6
%12 = load double, double* %11
%13 = shl i32 %2, 3
%14 = tail call i64 @malloc(i32 %13)
%15 = inttoptr i64 %14 to double*
%16 = inttoptr i64 %14 to i8*
%17 = tail call i32 @LinearADR_Sine(i32* %0, double* %1, i32 %2, double %3, double* %4, double* %15)
%18 = icmp sgt i32 %2, 0
br i1 %18, label %19, label %113
19: ; preds = %6
%20 = zext i32 %2 to i64
%21 = icmp eq i32 %2, 1
br i1 %21, label %94, label %22
22: ; preds = %19
%23 = mul nuw nsw i64 %20, 3
%24 = getelementptr double, double* %5, i64 %23
%25 = bitcast double* %24 to i8*
%26 = getelementptr double, double* %15, i64 %20
%27 = icmp ugt double* %26, %5
%28 = icmp ult i8* %16, %25
%29 = and i1 %27, %28
br i1 %29, label %94, label %30
30: ; preds = %22
%31 = and i64 %20, 4294967294
%32 = insertelement <2 x double> poison, double %8, i64 0
%33 = shufflevector <2 x double> %32, <2 x double> poison, <2 x i32> zeroinitializer
%34 = insertelement <2 x double> poison, double %10, i64 0
%35 = shufflevector <2 x double> %34, <2 x double> poison, <2 x i32> zeroinitializer
%36 = insertelement <2 x double> poison, double %12, i64 0
%37 = shufflevector <2 x double> %36, <2 x double> poison, <2 x i32> zeroinitializer
%38 = add nsw i64 %31, -2
%39 = lshr exact i64 %38, 1
%40 = add nuw i64 %39, 1
%41 = and i64 %40, 1
%42 = icmp eq i64 %38, 0
br i1 %42, label %76, label %43
43: ; preds = %30
%44 = and i64 %40, -2
br label %45
45: ; preds = %45, %43
%46 = phi i64 [ 0, %43 ], [ %73, %45 ]
%47 = phi i64 [ 0, %43 ], [ %74, %45 ]
%48 = getelementptr inbounds double, double* %15, i64 %46
%49 = mul nuw nsw i64 %46, 3
%50 = bitcast double* %48 to <2 x double>*
%51 = load <2 x double>, <2 x double>* %50
%52 = fmul <2 x double> %51, %33
%53 = fmul <2 x double> %51, %35
%54 = fmul <2 x double> %51, %37
%55 = getelementptr inbounds double, double* %5, i64 %49
%56 = bitcast double* %55 to <6 x double>*
%57 = shufflevector <2 x double> %52, <2 x double> %53, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
%58 = shufflevector <2 x double> %54, <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
%59 = shufflevector <4 x double> %57, <4 x double> %58, <6 x i32> <i32 0, i32 2, i32 4, i32 1, i32 3, i32 5>
store <6 x double> %59, <6 x double>* %56
%60 = or i64 %46, 2
%61 = getelementptr inbounds double, double* %15, i64 %60
%62 = mul nuw nsw i64 %60, 3
%63 = bitcast double* %61 to <2 x double>*
%64 = load <2 x double>, <2 x double>* %63
%65 = fmul <2 x double> %64, %33
%66 = fmul <2 x double> %64, %35
%67 = fmul <2 x double> %64, %37
%68 = getelementptr inbounds double, double* %5, i64 %62
%69 = bitcast double* %68 to <6 x double>*
%70 = shufflevector <2 x double> %65, <2 x double> %66, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
%71 = shufflevector <2 x double> %67, <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
%72 = shufflevector <4 x double> %70, <4 x double> %71, <6 x i32> <i32 0, i32 2, i32 4, i32 1, i32 3, i32 5>
store <6 x double> %72, <6 x double>* %69
%73 = add nuw i64 %46, 4
%74 = add nuw i64 %47, 2
%75 = icmp eq i64 %74, %44
br i1 %75, label %76, label %45
76: ; preds = %45, %30
%77 = phi i64 [ 0, %30 ], [ %73, %45 ]
%78 = icmp eq i64 %41, 0
br i1 %78, label %92, label %79
79: ; preds = %76
%80 = getelementptr inbounds double, double* %15, i64 %77
%81 = mul nuw nsw i64 %77, 3
%82 = bitcast double* %80 to <2 x double>*
%83 = load <2 x double>, <2 x double>* %82
%84 = fmul <2 x double> %83, %33
%85 = fmul <2 x double> %83, %35
%86 = fmul <2 x double> %83, %37
%87 = getelementptr inbounds double, double* %5, i64 %81
%88 = bitcast double* %87 to <6 x double>*
%89 = shufflevector <2 x double> %84, <2 x double> %85, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
%90 = shufflevector <2 x double> %86, <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
%91 = shufflevector <4 x double> %89, <4 x double> %90, <6 x i32> <i32 0, i32 2, i32 4, i32 1, i32 3, i32 5>
store <6 x double> %91, <6 x double>* %88
br label %92
92: ; preds = %76, %79
%93 = icmp eq i64 %31, %20
br i1 %93, label %113, label %94
94: ; preds = %22, %19, %92
%95 = phi i64 [ 0, %22 ], [ 0, %19 ], [ %31, %92 ]
br label %96
96: ; preds = %94, %96
%97 = phi i64 [ %111, %96 ], [ %95, %94 ]
%98 = getelementptr inbounds double, double* %15, i64 %97
%99 = mul nuw nsw i64 %97, 3
%100 = load double, double* %98
%101 = fmul double %100, %8
%102 = getelementptr inbounds double, double* %5, i64 %99
store double %101, double* %102
%103 = load double, double* %98
%104 = fmul double %103, %10
%105 = add nuw nsw i64 %99, 1
%106 = getelementptr inbounds double, double* %5, i64 %105
store double %104, double* %106
%107 = load double, double* %98
%108 = fmul double %107, %12
%109 = add nuw nsw i64 %99, 2
%110 = getelementptr inbounds double, double* %5, i64 %109
store double %108, double* %110
%111 = add nuw nsw i64 %97, 1
%112 = icmp eq i64 %111, %20
br i1 %112, label %113, label %96
113: ; preds = %96, %92, %6
%114 = tail call i32 @free(double* %15)
ret i32 %17
}