; LLVM IR from zhenrong-wang/co2 :: co2_property_calc_origeqns (phi0tt)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@coeff0 = external dso_local constant [8 x [2 x double]], align 16

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind
declare double @exp(double noundef) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
define dso_local double @phi0tt(double noundef %0) #2 {
  %2 = alloca double, align 8
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  %6 = alloca i32, align 4
  store double %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %7 = load double, ptr getelementptr inbounds ([8 x [2 x double]], ptr @coeff0, i64 0, i64 2), align 16, !tbaa !5
  %8 = fneg double %7
  %9 = load double, ptr %2, align 8, !tbaa !5
  %10 = load double, ptr %2, align 8, !tbaa !5
  %11 = fmul double %9, %10
  %12 = fdiv double %8, %11
  store double %12, ptr %3, align 8, !tbaa !5
  store i32 3, ptr %6, align 4, !tbaa !9
  br label %13

13:                                               ; preds = %54, %1
  %14 = load i32, ptr %6, align 4, !tbaa !9
  %15 = icmp slt i32 %14, 8
  br i1 %15, label %16, label %57

16:                                               ; preds = %13
  %17 = load i32, ptr %6, align 4, !tbaa !9
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [8 x [2 x double]], ptr @coeff0, i64 0, i64 %18
  %20 = getelementptr inbounds [2 x double], ptr %19, i64 0, i64 0
  %21 = load double, ptr %20, align 16, !tbaa !5
  store double %21, ptr %4, align 8, !tbaa !5
  %22 = load i32, ptr %6, align 4, !tbaa !9
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [8 x [2 x double]], ptr @coeff0, i64 0, i64 %23
  %25 = getelementptr inbounds [2 x double], ptr %24, i64 0, i64 1
  %26 = load double, ptr %25, align 8, !tbaa !5
  store double %26, ptr %5, align 8, !tbaa !5
  %27 = load double, ptr %4, align 8, !tbaa !5
  %28 = load double, ptr %5, align 8, !tbaa !5
  %29 = fmul double %27, %28
  %30 = load double, ptr %5, align 8, !tbaa !5
  %31 = fmul double %29, %30
  %32 = load double, ptr %5, align 8, !tbaa !5
  %33 = fneg double %32
  %34 = load double, ptr %2, align 8, !tbaa !5
  %35 = fmul double %33, %34
  %36 = call double @exp(double noundef %35) #3
  %37 = fmul double %31, %36
  %38 = load double, ptr %5, align 8, !tbaa !5
  %39 = fneg double %38
  %40 = load double, ptr %2, align 8, !tbaa !5
  %41 = fmul double %39, %40
  %42 = call double @exp(double noundef %41) #3
  %43 = fsub double 1.000000e+00, %42
  %44 = load double, ptr %5, align 8, !tbaa !5
  %45 = fneg double %44
  %46 = load double, ptr %2, align 8, !tbaa !5
  %47 = fmul double %45, %46
  %48 = call double @exp(double noundef %47) #3
  %49 = fsub double 1.000000e+00, %48
  %50 = fmul double %43, %49
  %51 = fdiv double %37, %50
  %52 = load double, ptr %3, align 8, !tbaa !5
  %53 = fsub double %52, %51
  store double %53, ptr %3, align 8, !tbaa !5
  br label %54

54:                                               ; preds = %16
  %55 = load i32, ptr %6, align 4, !tbaa !9
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %6, align 4, !tbaa !9
  br label %13, !llvm.loop !11

57:                                               ; preds = %13
  %58 = load double, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  ret double %58
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@coeff0 = external dso_local local_unnamed_addr constant [8 x [2 x double]], align 16

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @exp(double noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(write) uwtable
define dso_local double @phi0tt(double noundef %0) local_unnamed_addr #1 {
  %2 = load double, ptr getelementptr inbounds (i8, ptr @coeff0, i64 32), align 16, !tbaa !5
  %3 = fneg double %2
  %4 = load double, ptr getelementptr inbounds (i8, ptr @coeff0, i64 48), align 16, !tbaa !5
  %5 = load double, ptr getelementptr inbounds (i8, ptr @coeff0, i64 56), align 8, !tbaa !5
  %6 = fmul double %4, %5
  %7 = fmul double %5, %6
  %8 = fneg double %5
  %9 = fmul double %8, %0
  %10 = tail call double @exp(double noundef %9) #2
  %11 = fmul double %10, %7
  %12 = tail call double @exp(double noundef %9) #2
  %13 = fsub double 1.000000e+00, %12
  %14 = tail call double @exp(double noundef %9) #2
  %15 = fsub double 1.000000e+00, %14
  %16 = insertelement <2 x double> poison, double %0, i64 0
  %17 = insertelement <2 x double> %16, double %13, i64 1
  %18 = insertelement <2 x double> %17, double %15, i64 1
  %19 = fmul <2 x double> %17, %18
  %20 = insertelement <2 x double> poison, double %3, i64 0
  %21 = insertelement <2 x double> %20, double %11, i64 1
  %22 = fdiv <2 x double> %21, %19
  %shift = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
  %23 = fsub <2 x double> %22, %shift
  %24 = load <2 x double>, ptr getelementptr inbounds (i8, ptr @coeff0, i64 64), align 16
  %25 = load double, ptr getelementptr inbounds (i8, ptr @coeff0, i64 72), align 8, !tbaa !5
  %26 = fneg double %25
  %27 = fmul double %26, %0
  %28 = tail call double @exp(double noundef %27) #2
  %29 = tail call double @exp(double noundef %27) #2
  %30 = tail call double @exp(double noundef %27) #2
  %31 = load double, ptr getelementptr inbounds (i8, ptr @coeff0, i64 80), align 16, !tbaa !5
  %32 = load double, ptr getelementptr inbounds (i8, ptr @coeff0, i64 88), align 8, !tbaa !5
  %33 = insertelement <2 x double> poison, double %25, i64 0
  %34 = insertelement <2 x double> %33, double %31, i64 1
  %35 = insertelement <2 x double> %24, double %32, i64 1
  %36 = fmul <2 x double> %34, %35
  %37 = insertelement <2 x double> %33, double %32, i64 1
  %38 = fmul <2 x double> %37, %36
  %39 = fneg double %32
  %40 = fmul double %39, %0
  %41 = tail call double @exp(double noundef %40) #2
  %42 = insertelement <2 x double> poison, double %28, i64 0
  %43 = insertelement <2 x double> %42, double %41, i64 1
  %44 = fmul <2 x double> %43, %38
  %45 = tail call double @exp(double noundef %40) #2
  %46 = insertelement <2 x double> poison, double %29, i64 0
  %47 = insertelement <2 x double> %46, double %45, i64 1
  %48 = fsub <2 x double> <double 1.000000e+00, double 1.000000e+00>, %47
  %49 = tail call double @exp(double noundef %40) #2
  %50 = insertelement <2 x double> poison, double %30, i64 0
  %51 = insertelement <2 x double> %50, double %49, i64 1
  %52 = fsub <2 x double> <double 1.000000e+00, double 1.000000e+00>, %51
  %53 = fmul <2 x double> %48, %52
  %54 = fdiv <2 x double> %44, %53
  %55 = fsub <2 x double> %23, %54
  %shift20 = shufflevector <2 x double> %54, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
  %56 = fsub <2 x double> %55, %shift20
  %57 = load <2 x double>, ptr getelementptr inbounds (i8, ptr @coeff0, i64 96), align 16
  %58 = load double, ptr getelementptr inbounds (i8, ptr @coeff0, i64 104), align 8, !tbaa !5
  %59 = fneg double %58
  %60 = fmul double %59, %0
  %61 = tail call double @exp(double noundef %60) #2
  %62 = tail call double @exp(double noundef %60) #2
  %63 = tail call double @exp(double noundef %60) #2
  %64 = load double, ptr getelementptr inbounds (i8, ptr @coeff0, i64 112), align 16, !tbaa !5
  %65 = load double, ptr getelementptr inbounds (i8, ptr @coeff0, i64 120), align 8, !tbaa !5
  %66 = insertelement <2 x double> poison, double %58, i64 0
  %67 = insertelement <2 x double> %66, double %64, i64 1
  %68 = insertelement <2 x double> %57, double %65, i64 1
  %69 = fmul <2 x double> %67, %68
  %70 = insertelement <2 x double> %66, double %65, i64 1
  %71 = fmul <2 x double> %70, %69
  %72 = fneg double %65
  %73 = fmul double %72, %0
  %74 = tail call double @exp(double noundef %73) #2
  %75 = insertelement <2 x double> poison, double %61, i64 0
  %76 = insertelement <2 x double> %75, double %74, i64 1
  %77 = fmul <2 x double> %76, %71
  %78 = tail call double @exp(double noundef %73) #2
  %79 = insertelement <2 x double> poison, double %62, i64 0
  %80 = insertelement <2 x double> %79, double %78, i64 1
  %81 = fsub <2 x double> <double 1.000000e+00, double 1.000000e+00>, %80
  %82 = tail call double @exp(double noundef %73) #2
  %83 = insertelement <2 x double> poison, double %63, i64 0
  %84 = insertelement <2 x double> %83, double %82, i64 1
  %85 = fsub <2 x double> <double 1.000000e+00, double 1.000000e+00>, %84
  %86 = fmul <2 x double> %81, %85
  %87 = fdiv <2 x double> %77, %86
  %88 = fsub <2 x double> %56, %87
  %shift21 = shufflevector <2 x double> %87, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
  %89 = fsub <2 x double> %88, %shift21
  %90 = extractelement <2 x double> %89, i64 0
  ret double %90
}

attributes #0 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree nounwind willreturn memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LoopRotatePass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass,VectorCombinePass