#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*/ metric_der_lapse(double const *, double *);
int /*<<< orphan*/ metric_der_shift(double const *, double *);
scalar_t__ metric_killing(int);
double metric_lapse(double const *);
int /*<<< orphan*/ metric_shift(double const *, double *);
void frame_der_U(const double x[3], double dU[16]) {
  int i, j;
  double ia, da[4], b[3], db[12];
  ia = 1.0 / metric_lapse(x);
  metric_der_lapse(x, da);
  metric_shift(x, b);
  metric_der_shift(x, db);
  for (i = 0; i < 16; i++)
    dU[i] = 0.0;
  for (i = 0; i < 4; i++) {
    if (metric_killing(i))
      continue;
    dU[4 * i] = -ia * ia * da[i];
    for (j = 0; j < 3; j++)
      dU[4 * i + j + 1] = b[j] * ia * ia * da[i] - db[3 * i + j] * ia;
  }
}


x86 assembly (clang, -O0):
<frame_der_U>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <metric_lapse@plt>
movaps %xmm0,%xmm1
movsd  0xe89(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1030 <metric_der_lapse@plt>
mov    -0x8(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1040 <metric_shift@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
call   1050 <metric_der_shift@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jge    11d9 <frame_der_U+0x89>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11b1 <frame_der_U+0x61>
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    12dc <frame_der_U+0x18c>
mov    -0x14(%rbp),%edi
call   1070 <metric_killing@plt>
cmp    $0x0,%rax
je     1201 <frame_der_U+0xb1>
jmp    12ce <frame_der_U+0x17e>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x20(%rbp),%xmm0
movslq -0x14(%rbp),%rax
mulsd  -0x40(%rbp,%rax,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    12c9 <frame_der_U+0x179>
movslq -0x18(%rbp),%rax
movsd  -0x60(%rbp,%rax,8),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movslq -0x14(%rbp),%rax
movsd  -0x40(%rbp,%rax,8),%xmm2
imul   $0x3,-0x14(%rbp),%eax
add    -0x18(%rbp),%eax
cltq
movsd  -0xc0(%rbp,%rax,8),%xmm1
ff ff
mulsd  -0x20(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
shl    $0x2,%ecx
add    -0x18(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1245 <frame_der_U+0xf5>
jmp    12ce <frame_der_U+0x17e>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11e0 <frame_der_U+0x90>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<frame_der_U>:
push   %r14
push   %rbx
sub    $0xd8,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
call   1060 <metric_lapse@plt>
movsd  %xmm0,(%rsp)
lea    0x50(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <metric_der_lapse@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <metric_shift@plt>
lea    0x70(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <metric_der_shift@plt>
xorps  %xmm0,%xmm0
movups %xmm0,(%r14)
movups %xmm0,0x10(%r14)
movups %xmm0,0x20(%r14)
movups %xmm0,0x30(%r14)
movups %xmm0,0x40(%r14)
movups %xmm0,0x50(%r14)
movups %xmm0,0x60(%r14)
movups %xmm0,0x70(%r14)
movsd  0xe3d(%rip),%xmm0
divsd  (%rsp),%xmm0
movapd 0xe40(%rip),%xmm1
xorpd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,0x30(%rsp)
movapd %xmm0,(%rsp)
unpcklpd %xmm0,%xmm0
movapd %xmm0,0x40(%rsp)
xor    %edi,%edi
call   1070 <metric_killing@plt>
test   %rax,%rax
jne    1270 <frame_der_U+0x120>
movsd  0x50(%rsp),%xmm0
movapd 0x30(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%r14)
movapd 0x10(%rsp),%xmm1
movapd 0x40(%rsp),%xmm3
mulpd  %xmm3,%xmm1
mulpd  %xmm3,%xmm1
movapd 0x70(%rsp),%xmm2
mulpd  %xmm3,%xmm2
movapd %xmm0,%xmm3
unpcklpd %xmm0,%xmm3
mulpd  %xmm1,%xmm3
subpd  %xmm2,%xmm3
movupd %xmm3,0x8(%r14)
movsd  0x20(%rsp),%xmm1
movapd (%rsp),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm3,%xmm1
movsd  0x80(%rsp),%xmm2
mulsd  %xmm3,%xmm2
mulsd  %xmm0,%xmm1
subsd  %xmm2,%xmm1
movsd  %xmm1,0x18(%r14)
mov    $0x1,%edi
call   1070 <metric_killing@plt>
test   %rax,%rax
jne    12fa <frame_der_U+0x1aa>
movsd  0x58(%rsp),%xmm0
movapd 0x30(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%r14)
movapd 0x10(%rsp),%xmm1
movapd 0x40(%rsp),%xmm3
mulpd  %xmm3,%xmm1
mulpd  %xmm3,%xmm1
movupd 0x88(%rsp),%xmm2
mulpd  %xmm3,%xmm2
movapd %xmm0,%xmm3
unpcklpd %xmm0,%xmm3
mulpd  %xmm1,%xmm3
subpd  %xmm2,%xmm3
movupd %xmm3,0x28(%r14)
movsd  0x20(%rsp),%xmm1
movapd (%rsp),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm3,%xmm1
movsd  0x98(%rsp),%xmm2
mulsd  %xmm3,%xmm2
mulsd  %xmm0,%xmm1
subsd  %xmm2,%xmm1
movsd  %xmm1,0x38(%r14)
mov    $0x2,%edi
call   1070 <metric_killing@plt>
test   %rax,%rax
jne    1384 <frame_der_U+0x234>
movsd  0x60(%rsp),%xmm0
movapd 0x30(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x40(%r14)
movapd 0x10(%rsp),%xmm1
movapd 0x40(%rsp),%xmm3
mulpd  %xmm3,%xmm1
mulpd  %xmm3,%xmm1
movapd 0xa0(%rsp),%xmm2
mulpd  %xmm3,%xmm2
movapd %xmm0,%xmm3
unpcklpd %xmm0,%xmm3
mulpd  %xmm1,%xmm3
subpd  %xmm2,%xmm3
movupd %xmm3,0x48(%r14)
movsd  0x20(%rsp),%xmm1
movapd (%rsp),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm3,%xmm1
movsd  0xb0(%rsp),%xmm2
mulsd  %xmm3,%xmm2
mulsd  %xmm0,%xmm1
subsd  %xmm2,%xmm1
movsd  %xmm1,0x58(%r14)
mov    $0x3,%edi
call   1070 <metric_killing@plt>
test   %rax,%rax
jne    140a <frame_der_U+0x2ba>
movsd  0x68(%rsp),%xmm0
movapd 0x30(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x60(%r14)
movapd 0x10(%rsp),%xmm1
movapd 0x40(%rsp),%xmm3
mulpd  %xmm3,%xmm1
mulpd  %xmm3,%xmm1
movupd 0xb8(%rsp),%xmm2
mulpd  %xmm3,%xmm2
movapd %xmm0,%xmm3
unpcklpd %xmm0,%xmm3
mulpd  %xmm1,%xmm3
subpd  %xmm2,%xmm3
movupd %xmm3,0x68(%r14)
movsd  0x20(%rsp),%xmm1
movapd (%rsp),%xmm2
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
mulsd  0xc8(%rsp),%xmm2
mulsd  %xmm0,%xmm1
subsd  %xmm2,%xmm1
movsd  %xmm1,0x78(%r14)
add    $0xd8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @frame_der_U(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca [4 x double]
%9 = alloca [3 x double]
%10 = alloca [12 x double]
store double* %0, double** %3
store double* %1, double** %4
%11 = load double*, double** %3
%12 = call double @metric_lapse(double* %11)
%13 = fdiv double 1.000000e+00, %12
store double %13, double* %7
%14 = load double*, double** %3
%15 = getelementptr inbounds [4 x double], [4 x double]* %8, i64 0, i64 0
%16 = call i32 @metric_der_lapse(double* %14, double* %15)
%17 = load double*, double** %3
%18 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
%19 = call i32 @metric_shift(double* %17, double* %18)
%20 = load double*, double** %3
%21 = getelementptr inbounds [12 x double], [12 x double]* %10, i64 0, i64 0
%22 = call i32 @metric_der_shift(double* %20, double* %21)
store i32 0, i32* %5
br label %23
23: ; preds = %31, %2
%24 = load i32, i32* %5
%25 = icmp slt i32 %24, 16
br i1 %25, label %26, label %34
26: ; preds = %23
%27 = load double*, double** %4
%28 = load i32, i32* %5
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double, double* %27, i64 %29
store double 0.000000e+00, double* %30
br label %31
31: ; preds = %26
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 1
store i32 %33, i32* %5
br label %23
34: ; preds = %23
store i32 0, i32* %5
br label %35
35: ; preds = %97, %34
%36 = load i32, i32* %5
%37 = icmp slt i32 %36, 4
br i1 %37, label %38, label %100
38: ; preds = %35
%39 = load i32, i32* %5
%40 = call i64 @metric_killing(i32 %39)
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %38
br label %97
43: ; preds = %38
%44 = load double, double* %7
%45 = fneg double %44
%46 = load double, double* %7
%47 = fmul double %45, %46
%48 = load i32, i32* %5
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [4 x double], [4 x double]* %8, i64 0, i64 %49
%51 = load double, double* %50
%52 = fmul double %47, %51
%53 = load double*, double** %4
%54 = load i32, i32* %5
%55 = mul nsw i32 4, %54
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds double, double* %53, i64 %56
store double %52, double* %57
store i32 0, i32* %6
br label %58
58: ; preds = %93, %43
%59 = load i32, i32* %6
%60 = icmp slt i32 %59, 3
br i1 %60, label %61, label %96
61: ; preds = %58
%62 = load i32, i32* %6
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 %63
%65 = load double, double* %64
%66 = load double, double* %7
%67 = fmul double %65, %66
%68 = load double, double* %7
%69 = fmul double %67, %68
%70 = load i32, i32* %5
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [4 x double], [4 x double]* %8, i64 0, i64 %71
%73 = load double, double* %72
%74 = load i32, i32* %5
%75 = mul nsw i32 3, %74
%76 = load i32, i32* %6
%77 = add nsw i32 %75, %76
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [12 x double], [12 x double]* %10, i64 0, i64 %78
%80 = load double, double* %79
%81 = load double, double* %7
%82 = fmul double %80, %81
%83 = fneg double %82
%84 = call double @llvm.fmuladd.f64(double %69, double %73, double %83)
%85 = load double*, double** %4
%86 = load i32, i32* %5
%87 = mul nsw i32 4, %86
%88 = load i32, i32* %6
%89 = add nsw i32 %87, %88
%90 = add nsw i32 %89, 1
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds double, double* %85, i64 %91
store double %84, double* %92
br label %93
93: ; preds = %61
%94 = load i32, i32* %6
%95 = add nsw i32 %94, 1
store i32 %95, i32* %6
br label %58
96: ; preds = %58
br label %97
97: ; preds = %96, %42
%98 = load i32, i32* %5
%99 = add nsw i32 %98, 1
store i32 %99, i32* %5
br label %35
100: ; preds = %35
ret void
}

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