; LLVM IR from zhenrong-wang/co2 :: co2_property_calc (temp_pr)

; 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"

%struct.co2_prop = type { double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double }

@__const.temp_pr.tau_ini = external hidden unnamed_addr constant [10 x double], align 16

; Function Attrs: nounwind uwtable
declare dso_local i32 @is_vld_prop(ptr noundef) #0

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i1 @llvm.is.fpclass.f64(double, i32 immarg) #1

; Function Attrs: nounwind uwtable
declare dso_local void @co2_prop_calc_tr(ptr noundef, double noundef, double noundef) #0

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: nounwind uwtable
declare dso_local void @calcfd_dfd_pr(ptr noundef, ptr noundef, double noundef, double noundef, double noundef) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @temp_pr(ptr noundef %0, double noundef %1, double noundef %2) #0 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca %struct.co2_prop, align 8
  %14 = alloca [10 x double], align 16
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store double %1, ptr %6, align 8, !tbaa !9
  store double %2, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %18 = load double, ptr %7, align 8, !tbaa !9
  %19 = fdiv double %18, 4.676000e+02
  store double %19, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 128, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 80, ptr %14) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %14, ptr align 16 @__const.temp_pr.tau_ini, i64 80, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  store i32 0, ptr %8, align 4, !tbaa !11
  br label %20

20:                                               ; preds = %89, %3
  %21 = load i32, ptr %8, align 4, !tbaa !11
  %22 = icmp slt i32 %21, 10
  br i1 %22, label %23, label %92

23:                                               ; preds = %20
  store i32 0, ptr %9, align 4, !tbaa !11
  %24 = load i32, ptr %8, align 4, !tbaa !11
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [10 x double], ptr %14, i64 0, i64 %25
  %27 = load double, ptr %26, align 8, !tbaa !9
  %28 = load double, ptr %6, align 8, !tbaa !9
  %29 = load double, ptr %10, align 8, !tbaa !9
  call void @calcfd_dfd_pr(ptr noundef %11, ptr noundef %12, double noundef %27, double noundef %28, double noundef %29)
  %30 = load i32, ptr %8, align 4, !tbaa !11
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [10 x double], ptr %14, i64 0, i64 %31
  %33 = load double, ptr %32, align 8, !tbaa !9
  %34 = load double, ptr %11, align 8, !tbaa !9
  %35 = load double, ptr %12, align 8, !tbaa !9
  %36 = fdiv double %34, %35
  %37 = fsub double %33, %36
  store double %37, ptr %16, align 8, !tbaa !9
  br label %38

38:                                               ; preds = %59, %23
  %39 = load double, ptr %16, align 8, !tbaa !9
  store double %39, ptr %15, align 8, !tbaa !9
  %40 = load double, ptr %15, align 8, !tbaa !9
  %41 = load double, ptr %6, align 8, !tbaa !9
  %42 = load double, ptr %10, align 8, !tbaa !9
  call void @calcfd_dfd_pr(ptr noundef %11, ptr noundef %12, double noundef %40, double noundef %41, double noundef %42)
  %43 = load double, ptr %15, align 8, !tbaa !9
  %44 = load double, ptr %11, align 8, !tbaa !9
  %45 = load double, ptr %12, align 8, !tbaa !9
  %46 = fdiv double %44, %45
  %47 = fsub double %43, %46
  store double %47, ptr %16, align 8, !tbaa !9
  %48 = load i32, ptr %9, align 4, !tbaa !11
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %9, align 4, !tbaa !11
  br label %50

50:                                               ; preds = %38
  %51 = load i32, ptr %9, align 4, !tbaa !11
  %52 = icmp slt i32 %51, 100
  br i1 %52, label %53, label %59

53:                                               ; preds = %50
  %54 = load double, ptr %16, align 8, !tbaa !9
  %55 = load double, ptr %15, align 8, !tbaa !9
  %56 = fsub double %54, %55
  %57 = call double @llvm.fabs.f64(double %56)
  %58 = fcmp ogt double %57, 0x3EB0C6F7A0B5ED8D
  br label %59

59:                                               ; preds = %53, %50
  %60 = phi i1 [ false, %50 ], [ %58, %53 ]
  br i1 %60, label %38, label %61, !llvm.loop !13

61:                                               ; preds = %59
  %62 = load i32, ptr %9, align 4, !tbaa !11
  %63 = icmp eq i32 %62, 100
  br i1 %63, label %64, label %65

64:                                               ; preds = %61
  br label %89

65:                                               ; preds = %61
  %66 = load double, ptr %16, align 8, !tbaa !9
  %67 = call i1 @llvm.is.fpclass.f64(double %66, i32 3)
  br i1 %67, label %88, label %68

68:                                               ; preds = %65
  %69 = load double, ptr %16, align 8, !tbaa !9
  %70 = fdiv double 0x4073020D1B71758E, %69
  %71 = load double, ptr %7, align 8, !tbaa !9
  call void @co2_prop_calc_tr(ptr noundef %13, double noundef %70, double noundef %71)
  %72 = call i32 @is_vld_prop(ptr noundef %13)
  %73 = icmp eq i32 %72, 0
  br i1 %73, label %74, label %87

74:                                               ; preds = %68
  %75 = load double, ptr %6, align 8, !tbaa !9
  %76 = getelementptr inbounds %struct.co2_prop, ptr %13, i32 0, i32 0
  %77 = load double, ptr %76, align 8, !tbaa !15
  %78 = fsub double %75, %77
  %79 = call double @llvm.fabs.f64(double %78)
  %80 = load double, ptr %6, align 8, !tbaa !9
  %81 = fdiv double %79, %80
  %82 = fcmp olt double %81, 1.000000e-04
  br i1 %82, label %83, label %87

83:                                               ; preds = %74
  %84 = load double, ptr %16, align 8, !tbaa !9
  %85 = fdiv double 0x4073020D1B71758E, %84
  %86 = load ptr, ptr %5, align 8, !tbaa !5
  store double %85, ptr %86, align 8, !tbaa !9
  store i32 0, ptr %4, align 4
  store i32 1, ptr %17, align 4
  br label %93

87:                                               ; preds = %74, %68
  br label %89

88:                                               ; preds = %65
  br label %89

89:                                               ; preds = %88, %87, %64
  %90 = load i32, ptr %8, align 4, !tbaa !11
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr %8, align 4, !tbaa !11
  br label %20, !llvm.loop !17

92:                                               ; preds = %20
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %17, align 4
  br label %93

93:                                               ; preds = %92, %83
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 128, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  %94 = load i32, ptr %4, align 4
  ret i32 %94
}

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 speculatable willreturn memory(none) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !10, i64 0}
!16 = !{!"", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120}
!17 = distinct !{!17, !14}


; 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"

%struct.co2_prop = type { double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double }

@__const.temp_pr.tau_ini = external hidden unnamed_addr constant [10 x double], align 16

; Function Attrs: nounwind uwtable
declare dso_local i32 @is_vld_prop(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @co2_prop_calc_tr(ptr noundef, double noundef, double noundef) local_unnamed_addr #0

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @calcfd_dfd_pr(ptr noundef, ptr noundef, double noundef, double noundef, double noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @temp_pr(ptr nocapture noundef writeonly %0, double noundef %1, double noundef %2) local_unnamed_addr #0 {
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  %6 = alloca %struct.co2_prop, align 8
  %7 = fdiv double %2, 4.676000e+02
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %6) #3
  br label %8

8:                                                ; preds = %3, %.critedge.thread
  %indvars.iv = phi i64 [ 0, %3 ], [ %indvars.iv.next, %.critedge.thread ]
  %9 = getelementptr inbounds [10 x double], ptr @__const.temp_pr.tau_ini, i64 0, i64 %indvars.iv
  %10 = load double, ptr %9, align 8, !tbaa !5
  call void @calcfd_dfd_pr(ptr noundef nonnull %4, ptr noundef nonnull %5, double noundef %10, double noundef %1, double noundef %7)
  %11 = load double, ptr %4, align 8, !tbaa !5
  %12 = load double, ptr %5, align 8, !tbaa !5
  %13 = fdiv double %11, %12
  %14 = fsub double %10, %13
  br label %15

15:                                               ; preds = %16, %8
  %.026 = phi i32 [ 0, %8 ], [ %21, %16 ]
  %.0 = phi double [ %14, %8 ], [ %20, %16 ]
  call void @calcfd_dfd_pr(ptr noundef nonnull %4, ptr noundef nonnull %5, double noundef %.0, double noundef %1, double noundef %7)
  %exitcond.not = icmp eq i32 %.026, 99
  br i1 %exitcond.not, label %.critedge.thread, label %16

16:                                               ; preds = %15
  %17 = load double, ptr %4, align 8, !tbaa !5
  %18 = load double, ptr %5, align 8, !tbaa !5
  %19 = fdiv double %17, %18
  %20 = fsub double %.0, %19
  %21 = add nuw nsw i32 %.026, 1
  %22 = fsub double %20, %.0
  %23 = call double @llvm.fabs.f64(double %22)
  %24 = fcmp ogt double %23, 0x3EB0C6F7A0B5ED8D
  br i1 %24, label %15, label %.critedge, !llvm.loop !9

.critedge:                                        ; preds = %16
  %25 = icmp eq i32 %21, 100
  %26 = fcmp uno double %20, 0.000000e+00
  %or.cond = select i1 %25, i1 true, i1 %26
  br i1 %or.cond, label %.critedge.thread, label %27

27:                                               ; preds = %.critedge
  %28 = fdiv double 0x4073020D1B71758E, %20
  call void @co2_prop_calc_tr(ptr noundef nonnull %6, double noundef %28, double noundef %2)
  %29 = call i32 @is_vld_prop(ptr noundef nonnull %6)
  %30 = icmp eq i32 %29, 0
  br i1 %30, label %31, label %.critedge.thread

31:                                               ; preds = %27
  %32 = load double, ptr %6, align 8, !tbaa !11
  %33 = fsub double %1, %32
  %34 = call double @llvm.fabs.f64(double %33)
  %35 = fdiv double %34, %1
  %36 = fcmp olt double %35, 1.000000e-04
  br i1 %36, label %37, label %.critedge.thread

37:                                               ; preds = %31
  store double %28, ptr %0, align 8, !tbaa !5
  br label %.loopexit

.critedge.thread:                                 ; preds = %15, %27, %31, %.critedge
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond34.not = icmp eq i64 %indvars.iv.next, 10
  br i1 %exitcond34.not, label %.loopexit, label %8, !llvm.loop !13

.loopexit:                                        ; preds = %.critedge.thread, %37
  %.024 = phi i32 [ 0, %37 ], [ -1, %.critedge.thread ]
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  ret i32 %.024
}

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !6, i64 0}
!12 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120}
!13 = distinct !{!13, !10}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass