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

; 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: nounwind uwtable
define dso_local double @phi0(double noundef %0, double noundef %1) #0 {
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca i32, align 4
  store double %0, ptr %3, align 8, !tbaa !5
  store double %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %9 = load double, ptr %3, align 8, !tbaa !5
  %10 = call double @log(double noundef %9) #4
  %11 = load double, ptr @coeff0, align 16, !tbaa !5
  %12 = fadd double %10, %11
  %13 = load double, ptr getelementptr inbounds ([8 x [2 x double]], ptr @coeff0, i64 0, i64 1), align 16, !tbaa !5
  %14 = load double, ptr %4, align 8, !tbaa !5
  %15 = call double @llvm.fmuladd.f64(double %13, double %14, double %12)
  %16 = load double, ptr getelementptr inbounds ([8 x [2 x double]], ptr @coeff0, i64 0, i64 2), align 16, !tbaa !5
  %17 = load double, ptr %4, align 8, !tbaa !5
  %18 = call double @log(double noundef %17) #4
  %19 = call double @llvm.fmuladd.f64(double %16, double %18, double %15)
  store double %19, ptr %5, align 8, !tbaa !5
  store i32 3, ptr %8, align 4, !tbaa !9
  br label %20

20:                                               ; preds = %44, %2
  %21 = load i32, ptr %8, align 4, !tbaa !9
  %22 = icmp slt i32 %21, 8
  br i1 %22, label %23, label %47

23:                                               ; preds = %20
  %24 = load i32, ptr %8, align 4, !tbaa !9
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [8 x [2 x double]], ptr @coeff0, i64 0, i64 %25
  %27 = getelementptr inbounds [2 x double], ptr %26, i64 0, i64 0
  %28 = load double, ptr %27, align 16, !tbaa !5
  store double %28, ptr %6, align 8, !tbaa !5
  %29 = load i32, ptr %8, align 4, !tbaa !9
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [8 x [2 x double]], ptr @coeff0, i64 0, i64 %30
  %32 = getelementptr inbounds [2 x double], ptr %31, i64 0, i64 1
  %33 = load double, ptr %32, align 8, !tbaa !5
  store double %33, ptr %7, align 8, !tbaa !5
  %34 = load double, ptr %6, align 8, !tbaa !5
  %35 = load double, ptr %7, align 8, !tbaa !5
  %36 = fneg double %35
  %37 = load double, ptr %4, align 8, !tbaa !5
  %38 = fmul double %36, %37
  %39 = call double @exp(double noundef %38) #4
  %40 = fsub double 1.000000e+00, %39
  %41 = call double @log(double noundef %40) #4
  %42 = load double, ptr %5, align 8, !tbaa !5
  %43 = call double @llvm.fmuladd.f64(double %34, double %41, double %42)
  store double %43, ptr %5, align 8, !tbaa !5
  br label %44

44:                                               ; preds = %23
  %45 = load i32, ptr %8, align 4, !tbaa !9
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %8, align 4, !tbaa !9
  br label %20, !llvm.loop !11

47:                                               ; preds = %20
  %48 = load double, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret double %48
}

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

; Function Attrs: nounwind
declare double @log(double noundef) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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) uwtable
define dso_local double @phi0(double noundef %0, double noundef %1) local_unnamed_addr #0 {
  %3 = tail call double @log(double noundef %0) #3
  %4 = load double, ptr @coeff0, align 16, !tbaa !5
  %5 = fadd double %3, %4
  %6 = load double, ptr getelementptr inbounds (i8, ptr @coeff0, i64 16), align 16, !tbaa !5
  %7 = tail call double @llvm.fmuladd.f64(double %6, double %1, double %5)
  %8 = load double, ptr getelementptr inbounds (i8, ptr @coeff0, i64 32), align 16, !tbaa !5
  %9 = tail call double @log(double noundef %1) #3
  %10 = tail call double @llvm.fmuladd.f64(double %8, double %9, double %7)
  %11 = load double, ptr getelementptr inbounds (i8, ptr @coeff0, i64 48), align 16, !tbaa !5
  %12 = load double, ptr getelementptr inbounds (i8, ptr @coeff0, i64 56), align 8, !tbaa !5
  %13 = fneg double %12
  %14 = fmul double %13, %1
  %15 = tail call double @exp(double noundef %14) #3
  %16 = fsub double 1.000000e+00, %15
  %17 = tail call double @log(double noundef %16) #3
  %18 = tail call double @llvm.fmuladd.f64(double %11, double %17, double %10)
  %19 = load double, ptr getelementptr inbounds (i8, ptr @coeff0, i64 64), align 16, !tbaa !5
  %20 = load double, ptr getelementptr inbounds (i8, ptr @coeff0, i64 72), align 8, !tbaa !5
  %21 = fneg double %20
  %22 = fmul double %21, %1
  %23 = tail call double @exp(double noundef %22) #3
  %24 = fsub double 1.000000e+00, %23
  %25 = tail call double @log(double noundef %24) #3
  %26 = tail call double @llvm.fmuladd.f64(double %19, double %25, double %18)
  %27 = load double, ptr getelementptr inbounds (i8, ptr @coeff0, i64 80), align 16, !tbaa !5
  %28 = load double, ptr getelementptr inbounds (i8, ptr @coeff0, i64 88), align 8, !tbaa !5
  %29 = fneg double %28
  %30 = fmul double %29, %1
  %31 = tail call double @exp(double noundef %30) #3
  %32 = fsub double 1.000000e+00, %31
  %33 = tail call double @log(double noundef %32) #3
  %34 = tail call double @llvm.fmuladd.f64(double %27, double %33, double %26)
  %35 = load double, ptr getelementptr inbounds (i8, ptr @coeff0, i64 96), align 16, !tbaa !5
  %36 = load double, ptr getelementptr inbounds (i8, ptr @coeff0, i64 104), align 8, !tbaa !5
  %37 = fneg double %36
  %38 = fmul double %37, %1
  %39 = tail call double @exp(double noundef %38) #3
  %40 = fsub double 1.000000e+00, %39
  %41 = tail call double @log(double noundef %40) #3
  %42 = tail call double @llvm.fmuladd.f64(double %35, double %41, double %34)
  %43 = load double, ptr getelementptr inbounds (i8, ptr @coeff0, i64 112), align 16, !tbaa !5
  %44 = load double, ptr getelementptr inbounds (i8, ptr @coeff0, i64 120), align 8, !tbaa !5
  %45 = fneg double %44
  %46 = fmul double %45, %1
  %47 = tail call double @exp(double noundef %46) #3
  %48 = fsub double 1.000000e+00, %47
  %49 = tail call double @log(double noundef %48) #3
  %50 = tail call double @llvm.fmuladd.f64(double %43, double %49, double %42)
  ret double %50
}

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

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

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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"}


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