#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 fabs(double);
double sqrt(int);
int gamma_calc_g(double *pr, double gcov[(4)][(4)], double *gamma) {
  double utsq;
  int j, k;
  utsq = gcov[1][1] * pr[2] * pr[2] + gcov[2][2] * pr[3] * pr[3] +
         gcov[3][3] * pr[4] * pr[4] +
         2. * (gcov[1][2] * pr[2] * pr[3] + gcov[1][3] * pr[2] * pr[4] +
               gcov[2][3] * pr[3] * pr[4]);
  if (utsq < 0.0) {
    if (fabs(utsq) > 1.E-10) {
      return (1);
    } else
      utsq = fabs(utsq);
  }
  *gamma = sqrt(1. + utsq);
  return (0);
}


x86 assembly (clang, -O0):
<gamma_calc_g>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x28(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x18(%rbp),%rax
movsd  0x50(%rax),%xmm1
mov    -0x10(%rbp),%rax
mulsd  0x18(%rax),%xmm1
mov    -0x10(%rbp),%rax
mulsd  0x18(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  0x78(%rax),%xmm1
mov    -0x10(%rbp),%rax
mulsd  0x20(%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x20(%rax),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x18(%rbp),%rax
movsd  0x30(%rax),%xmm2
mov    -0x10(%rbp),%rax
mulsd  0x10(%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm3
mov    -0x18(%rbp),%rax
movsd  0x38(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x20(%rax),%xmm0
mulsd  %xmm3,%xmm2
addsd  %xmm0,%xmm2
mov    -0x18(%rbp),%rax
movsd  0x58(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x18(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x20(%rax),%xmm3
mulsd  %xmm3,%xmm0
addsd  %xmm2,%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    1249 <gamma_calc_g+0x139>
movsd  -0x28(%rbp),%xmm0
movaps 0xe03(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xde7(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    122f <gamma_calc_g+0x11f>
movl   $0x1,-0x4(%rbp)
jmp    126e <gamma_calc_g+0x15e>
movsd  -0x28(%rbp),%xmm0
movaps 0xdd5(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1249 <gamma_calc_g+0x139>
movsd  0xdb7(%rip),%xmm0
addsd  -0x28(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sqrt@plt>
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gamma_calc_g>:
push   %rbx
mov    %rdx,%rbx
movsd  0x10(%rdi),%xmm1
movsd  0x18(%rdi),%xmm0
movsd  0x28(%rsi),%xmm2
mulsd  %xmm1,%xmm2
movsd  0x50(%rsi),%xmm3
mulsd  %xmm0,%xmm3
mulsd  %xmm0,%xmm3
mulsd  %xmm1,%xmm2
addsd  %xmm3,%xmm2
movsd  0x20(%rdi),%xmm3
movsd  0x78(%rsi),%xmm4
mulsd  %xmm3,%xmm4
mulsd  %xmm3,%xmm4
addsd  %xmm2,%xmm4
movsd  0x30(%rsi),%xmm2
mulsd  %xmm1,%xmm2
mulsd  0x38(%rsi),%xmm1
mulsd  %xmm3,%xmm1
mulsd  %xmm0,%xmm2
mulsd  0x58(%rsi),%xmm0
addsd  %xmm1,%xmm2
mulsd  %xmm3,%xmm0
addsd  %xmm2,%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm4,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jbe    11a2 <gamma_calc_g+0x92>
andpd  0xe6d(%rip),%xmm0
mov    $0x1,%eax
ucomisd 0xe70(%rip),%xmm0
ja     11b9 <gamma_calc_g+0xa9>
addsd  0xe6e(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sqrt@plt>
movsd  %xmm0,(%rbx)
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @gamma_calc_g(double* nocapture %0, [4 x double]* nocapture %1, double* nocapture writeonly %2) {
%4 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 1, i64 1
%5 = load double, double* %4
%6 = getelementptr inbounds double, double* %0, i64 2
%7 = load double, double* %6
%8 = fmul double %5, %7
%9 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 2, i64 2
%10 = load double, double* %9
%11 = getelementptr inbounds double, double* %0, i64 3
%12 = load double, double* %11
%13 = fmul double %10, %12
%14 = fmul double %12, %13
%15 = tail call double @llvm.fmuladd.f64(double %8, double %7, double %14)
%16 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 3, i64 3
%17 = load double, double* %16
%18 = getelementptr inbounds double, double* %0, i64 4
%19 = load double, double* %18
%20 = fmul double %17, %19
%21 = tail call double @llvm.fmuladd.f64(double %20, double %19, double %15)
%22 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 1, i64 2
%23 = load double, double* %22
%24 = fmul double %7, %23
%25 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 1, i64 3
%26 = load double, double* %25
%27 = fmul double %7, %26
%28 = fmul double %19, %27
%29 = tail call double @llvm.fmuladd.f64(double %24, double %12, double %28)
%30 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 2, i64 3
%31 = load double, double* %30
%32 = fmul double %12, %31
%33 = tail call double @llvm.fmuladd.f64(double %32, double %19, double %29)
%34 = tail call double @llvm.fmuladd.f64(double %33, double 2.000000e+00, double %21)
%35 = fcmp olt double %34, 0.000000e+00
br i1 %35, label %36, label %39
36: ; preds = %3
%37 = tail call double @llvm.fabs.f64(double %34)
%38 = fcmp ogt double %37, 1.000000e-10
br i1 %38, label %44, label %39
39: ; preds = %36, %3
%40 = phi double [ %34, %3 ], [ %37, %36 ]
%41 = fadd double %40, 1.000000e+00
%42 = fptosi double %41 to i32
%43 = tail call double @sqrt(i32 %42)
store double %43, double* %2
br label %44
44: ; preds = %36, %39
%45 = phi i32 [ 0, %39 ], [ 1, %36 ]
ret i32 %45
}