#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*/ conservativeToPrimitive(double *, double *);
void F(double U[], double *F) {
  double primVar[3];
  conservativeToPrimitive(U, primVar);
  double rho = primVar[0];
  double u = primVar[1];
  double p = primVar[2];
  double E = U[2];
  double flux[] = {rho * u, rho * u * u + p, (E + p) * u};
  int var;
  for (var = 0; var < 3; var++) {
    F[var] = flux[var];
  }
}


x86 assembly (clang, -O0):
<F>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <conservativeToPrimitive@plt>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x38(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x50(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movl   $0x0,-0x74(%rbp)
cmpl   $0x3,-0x74(%rbp)
jge    11d6 <F+0xc6>
movslq -0x74(%rbp),%rax
movsd  -0x70(%rbp,%rax,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    11a7 <F+0x97>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<F>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsp,%rsi
call   1030 <conservativeToPrimitive@plt>
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  (%rsp),%xmm2
mulsd  %xmm0,%xmm2
movapd %xmm2,%xmm3
mulsd  %xmm0,%xmm3
addsd  %xmm1,%xmm3
addsd  0x10(%r14),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm2,(%rbx)
movsd  %xmm3,0x8(%rbx)
movsd  %xmm1,0x10(%rbx)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @F(double* %0, double* nocapture writeonly %1) {
%3 = alloca [3 x double]
%4 = bitcast [3 x double]* %3 to i8*
%5 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 0
%6 = call i32 @conservativeToPrimitive(double* %0, double* %5)
%7 = load double, double* %5
%8 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 1
%9 = load double, double* %8
%10 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 2
%11 = load double, double* %10
%12 = getelementptr inbounds double, double* %0, i64 2
%13 = load double, double* %12
%14 = fmul double %7, %9
%15 = call double @llvm.fmuladd.f64(double %14, double %9, double %11)
%16 = fadd double %11, %13
%17 = fmul double %9, %16
store double %14, double* %1
%18 = getelementptr inbounds double, double* %1, i64 1
store double %15, double* %18
%19 = getelementptr inbounds double, double* %1, i64 2
store double %17, double* %19
ret void
}