; LLVM IR from stan-dev/math :: lib/tbb_2020.3/src/perf/time_fibonacci_cutoff.ll (Z11find_cutoffilid)

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

%"class.tbb::task_scheduler_init" = type { ptr }
%"class.tbb::tick_count" = type { i64 }
%"class.tbb::tick_count::interval_t" = type { i64 }

@CutOff = external dso_local global i64, align 8
@.str = external hidden unnamed_addr constant [70 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [32 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z11ParallelFibl(i64 noundef) #0

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11find_cutoffilid(i32 noundef %0, i64 noundef %1, i32 noundef %2, double noundef %3) #0 personality ptr @__gxx_personality_v0 {
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca double, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca i64, align 8
  %15 = alloca %"class.tbb::task_scheduler_init", align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca i64, align 8
  %19 = alloca %"class.tbb::tick_count", align 8
  %20 = alloca i32, align 4
  %21 = alloca %"class.tbb::tick_count", align 8
  %22 = alloca %"class.tbb::tick_count::interval_t", align 8
  %23 = alloca %"class.tbb::tick_count", align 8
  %24 = alloca i32, align 4
  %25 = alloca double, align 8
  store i32 %0, ptr %5, align 4, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !5
  store double %3, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  store i64 1, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  %26 = load i64, ptr %6, align 8, !tbaa !9
  store i64 %26, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  store double 0.000000e+00, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  store double 0.000000e+00, ptr %12, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  store double 0.000000e+00, ptr %13, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  store i64 -1, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  %27 = load i32, ptr %5, align 4, !tbaa !5
  call void @_ZN3tbb19task_scheduler_initC2Eim(ptr noundef nonnull align 8 dereferenceable(8) %15, i32 noundef %27, i64 noundef 0)
  br label %28

28:                                               ; preds = %127, %4
  br label %29

29:                                               ; preds = %28
  %30 = load i64, ptr %9, align 8, !tbaa !9
  %31 = load i64, ptr %10, align 8, !tbaa !9
  %32 = invoke noundef i64 @_Z20calculate_new_cutoffll(i64 noundef %30, i64 noundef %31)
          to label %33 unwind label %40

33:                                               ; preds = %29
  store i64 %32, ptr @CutOff, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  store i64 0, ptr %18, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  invoke void @_ZN3tbb10tick_countC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %19)
          to label %34 unwind label %44

34:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #8
  store i32 -1, ptr %20, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %65, %34
  %36 = load i32, ptr %20, align 4, !tbaa !5
  %37 = load i32, ptr %7, align 4, !tbaa !5
  %38 = icmp slt i32 %36, %37
  br i1 %38, label %48, label %39

39:                                               ; preds = %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  br label %73

40:                                               ; preds = %29
  %41 = landingpad { ptr, i32 }
          cleanup
  %42 = extractvalue { ptr, i32 } %41, 0
  store ptr %42, ptr %16, align 8
  %43 = extractvalue { ptr, i32 } %41, 1
  store i32 %43, ptr %17, align 4
  br label %167

44:                                               ; preds = %81, %33
  %45 = landingpad { ptr, i32 }
          cleanup
  %46 = extractvalue { ptr, i32 } %45, 0
  store ptr %46, ptr %16, align 8
  %47 = extractvalue { ptr, i32 } %45, 1
  store i32 %47, ptr %17, align 4
  br label %128

48:                                               ; preds = %35
  %49 = load i32, ptr %20, align 4, !tbaa !5
  %50 = icmp eq i32 %49, 0
  br i1 %50, label %51, label %59

51:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #8
  %52 = invoke i64 @_ZN3tbb10tick_count3nowEv()
          to label %53 unwind label %55

53:                                               ; preds = %51
  %54 = getelementptr inbounds %"class.tbb::tick_count", ptr %21, i32 0, i32 0
  store i64 %52, ptr %54, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %19, ptr align 8 %21, i64 8, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  br label %59

55:                                               ; preds = %51
  %56 = landingpad { ptr, i32 }
          cleanup
  %57 = extractvalue { ptr, i32 } %56, 0
  store ptr %57, ptr %16, align 8
  %58 = extractvalue { ptr, i32 } %56, 1
  store i32 %58, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  br label %72

59:                                               ; preds = %53, %48
  %60 = load i64, ptr %6, align 8, !tbaa !9
  %61 = invoke noundef i64 @_Z11ParallelFibl(i64 noundef %60)
          to label %62 unwind label %68

62:                                               ; preds = %59
  %63 = load i64, ptr %18, align 8, !tbaa !9
  %64 = add nsw i64 %63, %61
  store i64 %64, ptr %18, align 8, !tbaa !9
  br label %65

65:                                               ; preds = %62
  %66 = load i32, ptr %20, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %20, align 4, !tbaa !5
  br label %35, !llvm.loop !16

68:                                               ; preds = %59
  %69 = landingpad { ptr, i32 }
          cleanup
  %70 = extractvalue { ptr, i32 } %69, 0
  store ptr %70, ptr %16, align 8
  %71 = extractvalue { ptr, i32 } %69, 1
  store i32 %71, ptr %17, align 4
  br label %72

72:                                               ; preds = %68, %55
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  br label %128

73:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #8
  %74 = invoke i64 @_ZN3tbb10tick_count3nowEv()
          to label %75 unwind label %107

75:                                               ; preds = %73
  %76 = getelementptr inbounds %"class.tbb::tick_count", ptr %23, i32 0, i32 0
  store i64 %74, ptr %76, align 8
  %77 = invoke i64 @_ZN3tbbmiERKNS_10tick_countES2_(ptr noundef nonnull align 8 dereferenceable(8) %23, ptr noundef nonnull align 8 dereferenceable(8) %19)
          to label %78 unwind label %107

78:                                               ; preds = %75
  %79 = getelementptr inbounds %"class.tbb::tick_count::interval_t", ptr %22, i32 0, i32 0
  store i64 %77, ptr %79, align 8
  %80 = invoke noundef double @_ZNK3tbb10tick_count10interval_t7secondsEv(ptr noundef nonnull align 8 dereferenceable(8) %22)
          to label %81 unwind label %107

81:                                               ; preds = %78
  store double %80, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  %82 = load i32, ptr %5, align 4, !tbaa !5
  %83 = load i64, ptr %6, align 8, !tbaa !9
  %84 = load i64, ptr @CutOff, align 8, !tbaa !9
  %85 = load i32, ptr %7, align 4, !tbaa !5
  %86 = load double, ptr %8, align 8, !tbaa !11
  %87 = load double, ptr %11, align 8, !tbaa !11
  %88 = load i64, ptr %18, align 8, !tbaa !9
  invoke void @_Z6outputilliddl(i32 noundef %82, i64 noundef %83, i64 noundef %84, i32 noundef %85, double noundef %86, double noundef %87, i64 noundef %88)
          to label %89 unwind label %44

89:                                               ; preds = %81
  %90 = load double, ptr %8, align 8, !tbaa !11
  %91 = load double, ptr %11, align 8, !tbaa !11
  %92 = fdiv double %90, %91
  %93 = load i32, ptr %5, align 4, !tbaa !5
  %94 = sitofp i32 %93 to double
  %95 = fdiv double %94, 2.000000e+00
  %96 = fcmp oge double %92, %95
  br i1 %96, label %97, label %116

97:                                               ; preds = %89
  %98 = load i64, ptr @CutOff, align 8, !tbaa !9
  store i64 %98, ptr %14, align 8, !tbaa !9
  %99 = load i64, ptr %10, align 8, !tbaa !9
  %100 = load i64, ptr @CutOff, align 8, !tbaa !9
  %101 = icmp eq i64 %99, %100
  br i1 %101, label %102, label %113

102:                                              ; preds = %97
  %103 = load i64, ptr %10, align 8, !tbaa !9
  %104 = load i64, ptr %9, align 8, !tbaa !9
  %105 = icmp eq i64 %103, %104
  br i1 %105, label %106, label %111

106:                                              ; preds = %102
  store i64 1, ptr %9, align 8, !tbaa !9
  store double 0.000000e+00, ptr %12, align 8, !tbaa !11
  br label %112

107:                                              ; preds = %78, %75, %73
  %108 = landingpad { ptr, i32 }
          cleanup
  %109 = extractvalue { ptr, i32 } %108, 0
  store ptr %109, ptr %16, align 8
  %110 = extractvalue { ptr, i32 } %108, 1
  store i32 %110, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  br label %128

111:                                              ; preds = %102
  store i32 3, ptr %24, align 4
  br label %125

112:                                              ; preds = %106
  br label %113

113:                                              ; preds = %112, %97
  %114 = load i64, ptr @CutOff, align 8, !tbaa !9
  store i64 %114, ptr %10, align 8, !tbaa !9
  %115 = load double, ptr %11, align 8, !tbaa !11
  store double %115, ptr %13, align 8, !tbaa !11
  br label %124

116:                                              ; preds = %89
  %117 = load i64, ptr %9, align 8, !tbaa !9
  %118 = load i64, ptr @CutOff, align 8, !tbaa !9
  %119 = icmp eq i64 %117, %118
  br i1 %119, label %120, label %121

120:                                              ; preds = %116
  store i32 3, ptr %24, align 4
  br label %125

121:                                              ; preds = %116
  %122 = load i64, ptr @CutOff, align 8, !tbaa !9
  store i64 %122, ptr %9, align 8, !tbaa !9
  %123 = load double, ptr %11, align 8, !tbaa !11
  store double %123, ptr %12, align 8, !tbaa !11
  br label %124

124:                                              ; preds = %121, %113
  store i32 0, ptr %24, align 4
  br label %125

125:                                              ; preds = %124, %120, %111
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  %126 = load i32, ptr %24, align 4
  switch i32 %126, label %173 [
    i32 0, label %127
    i32 3, label %129
  ]

127:                                              ; preds = %125
  br label %28, !llvm.loop !18

128:                                              ; preds = %107, %72, %44
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  br label %167

129:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #8
  %130 = load i64, ptr %9, align 8, !tbaa !9
  %131 = sitofp i64 %130 to double
  %132 = load i32, ptr %5, align 4, !tbaa !5
  %133 = sitofp i32 %132 to double
  %134 = fdiv double %133, 2.000000e+00
  %135 = load double, ptr %8, align 8, !tbaa !11
  %136 = load double, ptr %12, align 8, !tbaa !11
  %137 = fdiv double %135, %136
  %138 = fsub double %134, %137
  %139 = load i64, ptr %10, align 8, !tbaa !9
  %140 = load i64, ptr %9, align 8, !tbaa !9
  %141 = sub nsw i64 %139, %140
  %142 = sitofp i64 %141 to double
  %143 = load double, ptr %8, align 8, !tbaa !11
  %144 = load double, ptr %13, align 8, !tbaa !11
  %145 = fdiv double %143, %144
  %146 = load double, ptr %8, align 8, !tbaa !11
  %147 = load double, ptr %12, align 8, !tbaa !11
  %148 = fdiv double %146, %147
  %149 = fsub double %145, %148
  %150 = fdiv double %142, %149
  %151 = call double @llvm.fmuladd.f64(double %138, double %150, double %131)
  store double %151, ptr %25, align 8, !tbaa !11
  %152 = load i64, ptr %14, align 8, !tbaa !9
  %153 = icmp ne i64 %152, -1
  br i1 %153, label %154, label %163

154:                                              ; preds = %129
  %155 = load i64, ptr %14, align 8, !tbaa !9
  %156 = load double, ptr %25, align 8, !tbaa !11
  %157 = invoke i32 (ptr, ...) @printf(ptr noundef @.str, i64 noundef %155, double noundef %156)
          to label %158 unwind label %159

158:                                              ; preds = %154
  br label %166

159:                                              ; preds = %163, %154
  %160 = landingpad { ptr, i32 }
          cleanup
  %161 = extractvalue { ptr, i32 } %160, 0
  store ptr %161, ptr %16, align 8
  %162 = extractvalue { ptr, i32 } %160, 1
  store i32 %162, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #8
  br label %167

163:                                              ; preds = %129
  %164 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.1)
          to label %165 unwind label %159

165:                                              ; preds = %163
  br label %166

166:                                              ; preds = %165, %158
  store i32 1, ptr %24, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #8
  call void @_ZN3tbb19task_scheduler_initD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  ret void

167:                                              ; preds = %159, %128, %40
  call void @_ZN3tbb19task_scheduler_initD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  br label %168

168:                                              ; preds = %167
  %169 = load ptr, ptr %16, align 8
  %170 = load i32, ptr %17, align 4
  %171 = insertvalue { ptr, i32 } poison, ptr %169, 0
  %172 = insertvalue { ptr, i32 } %171, i32 %170, 1
  resume { ptr, i32 } %172

173:                                              ; preds = %125
  unreachable
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3tbb19task_scheduler_initC2Eim(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef, i64 noundef) unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z20calculate_new_cutoffll(i64 noundef, i64 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3tbb10tick_countC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i64 @_ZN3tbb10tick_count3nowEv() #4 align 2

; 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) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i64 @_ZN3tbbmiERKNS_10tick_countES2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK3tbb10tick_count10interval_t7secondsEv(ptr noundef nonnull align 8 dereferenceable(8)) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z6outputilliddl(i32 noundef, i64 noundef, i64 noundef, i32 noundef, double noundef, double noundef, i64 noundef) #4

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

declare i32 @printf(ptr noundef, ...) #7

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3tbb19task_scheduler_initD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3 align 2

attributes #0 = { mustprogress 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 = { inlinehint mustprogress 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 = { mustprogress 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 #4 = { inlinehint mustprogress 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { "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 #8 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{i64 0, i64 8, !14}
!14 = !{!15, !15, i64 0}
!15 = !{!"long long", !7, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}


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

%"class.tbb::task_scheduler_init" = type { ptr }
%"class.tbb::tick_count" = type { i64 }
%"class.tbb::tick_count::interval_t" = type { i64 }

@CutOff = external dso_local local_unnamed_addr global i64, align 8
@.str = external hidden unnamed_addr constant [70 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [32 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z11ParallelFibl(i64 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

declare i32 @__gxx_personality_v0(...)

; 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 uwtable
define dso_local void @_Z11find_cutoffilid(i32 noundef %0, i64 noundef %1, i32 noundef %2, double noundef %3) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %5 = alloca %"class.tbb::task_scheduler_init", align 8
  %6 = alloca %"class.tbb::tick_count", align 8
  %7 = alloca %"class.tbb::tick_count::interval_t", align 8
  %8 = alloca %"class.tbb::tick_count", align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  call void @_ZN3tbb19task_scheduler_initC2Eim(ptr noundef nonnull align 8 dereferenceable(8) %5, i32 noundef %0, i64 noundef 0)
  %9 = icmp sgt i32 %2, -1
  %10 = sitofp i32 %0 to double
  %11 = fmul double %10, 5.000000e-01
  br i1 %9, label %.lr.ph.us.preheader, label %.split

.lr.ph.us.preheader:                              ; preds = %4
  %exitcond.peel.not = icmp eq i32 %2, 0
  %exitcond.peel143.not = icmp eq i32 %2, 1
  br label %12

12:                                               ; preds = %40, %.lr.ph.us.preheader
  %.050.us = phi i64 [ %.252.us, %40 ], [ -1, %.lr.ph.us.preheader ]
  %.041.us = phi i64 [ %.243.us, %40 ], [ %1, %.lr.ph.us.preheader ]
  %.0.us = phi i64 [ %.3.us, %40 ], [ 1, %.lr.ph.us.preheader ]
  %13 = phi <2 x double> [ %42, %40 ], [ zeroinitializer, %.lr.ph.us.preheader ]
  %14 = call noundef i64 @_Z20calculate_new_cutoffll(i64 noundef %.0.us, i64 noundef %.041.us)
  store i64 %14, ptr @CutOff, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  call void @_ZN3tbb10tick_countC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6)
  %15 = invoke noundef i64 @_Z11ParallelFibl(i64 noundef %1)
          to label %16 unwind label %.split114.us.loopexit.split-lp

16:                                               ; preds = %12
  br i1 %exitcond.peel.not, label %._crit_edge.us, label %.peel.next

.peel.next:                                       ; preds = %16
  %17 = invoke i64 @_ZN3tbb10tick_count3nowEv()
          to label %18 unwind label %.split111.us

18:                                               ; preds = %.peel.next
  store i64 %17, ptr %6, align 8, !tbaa !9
  %19 = invoke noundef i64 @_Z11ParallelFibl(i64 noundef %1)
          to label %20 unwind label %.split114.us.loopexit.split-lp

20:                                               ; preds = %18
  %21 = add nsw i64 %19, %15
  br i1 %exitcond.peel143.not, label %._crit_edge.us, label %.peel.next142

22:                                               ; preds = %._crit_edge.us
  store i64 %47, ptr %8, align 8
  %23 = invoke i64 @_ZN3tbbmiERKNS_10tick_countES2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %24 unwind label %.split98.us

24:                                               ; preds = %22
  store i64 %23, ptr %7, align 8
  %25 = invoke noundef double @_ZNK3tbb10tick_count10interval_t7secondsEv(ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %26 unwind label %.split98.us

26:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  %27 = load i64, ptr @CutOff, align 8, !tbaa !5
  invoke void @_Z6outputilliddl(i32 noundef %0, i64 noundef %1, i64 noundef %27, i32 noundef %2, double noundef %3, double noundef %25, i64 noundef %.lcssa)
          to label %28 unwind label %.split100.us

28:                                               ; preds = %26
  %29 = fdiv double %3, %25
  %30 = fcmp ult double %29, %11
  %31 = load i64, ptr @CutOff, align 8, !tbaa !5
  br i1 %30, label %37, label %32

32:                                               ; preds = %28
  %33 = icmp eq i64 %.041.us, %31
  %34 = extractelement <2 x double> %13, i64 1
  br i1 %33, label %35, label %40

35:                                               ; preds = %32
  %36 = icmp eq i64 %.041.us, %.0.us
  br i1 %36, label %40, label %.split103.us

37:                                               ; preds = %28
  %38 = icmp eq i64 %.0.us, %31
  %39 = extractelement <2 x double> %13, i64 0
  br i1 %38, label %.split103.us, label %40

40:                                               ; preds = %37, %35, %32
  %.359.us = phi double [ %34, %32 ], [ 0.000000e+00, %35 ], [ %25, %37 ]
  %.255.us = phi double [ %25, %32 ], [ %25, %35 ], [ %39, %37 ]
  %.252.us = phi i64 [ %31, %32 ], [ %.041.us, %35 ], [ %.050.us, %37 ]
  %.243.us = phi i64 [ %31, %32 ], [ %.041.us, %35 ], [ %.041.us, %37 ]
  %.3.us = phi i64 [ %.0.us, %32 ], [ 1, %35 ], [ %31, %37 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  %41 = insertelement <2 x double> poison, double %.255.us, i64 0
  %42 = insertelement <2 x double> %41, double %.359.us, i64 1
  br label %12

.peel.next142:                                    ; preds = %20, %44
  %.04496.us = phi i32 [ %46, %44 ], [ 1, %20 ]
  %.04595.us = phi i64 [ %45, %44 ], [ %21, %20 ]
  %43 = invoke noundef i64 @_Z11ParallelFibl(i64 noundef %1)
          to label %44 unwind label %.split114.us.loopexit

44:                                               ; preds = %.peel.next142
  %45 = add nsw i64 %43, %.04595.us
  %46 = add nuw nsw i32 %.04496.us, 1
  %exitcond.not = icmp eq i32 %46, %2
  br i1 %exitcond.not, label %._crit_edge.us, label %.peel.next142, !llvm.loop !11

._crit_edge.us:                                   ; preds = %44, %20, %16
  %.lcssa = phi i64 [ %15, %16 ], [ %21, %20 ], [ %45, %44 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #7
  %47 = invoke i64 @_ZN3tbb10tick_count3nowEv()
          to label %22 unwind label %.split98.us

.split98.us:                                      ; preds = %24, %22, %._crit_edge.us
  %48 = landingpad { ptr, i32 }
          cleanup
  br label %70

.split100.us:                                     ; preds = %26
  %49 = landingpad { ptr, i32 }
          cleanup
  br label %.split114.us

.split111.us:                                     ; preds = %.peel.next
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %.split114.us

.split114.us.loopexit:                            ; preds = %.peel.next142
  %lpad.loopexit145 = landingpad { ptr, i32 }
          cleanup
  br label %.split114.us

.split114.us.loopexit.split-lp:                   ; preds = %12, %18
  %lpad.loopexit.split-lp146 = landingpad { ptr, i32 }
          cleanup
  br label %.split114.us

.split:                                           ; preds = %4, %74
  %.050 = phi i64 [ %.252, %74 ], [ -1, %4 ]
  %.041 = phi i64 [ %.243, %74 ], [ %1, %4 ]
  %.0 = phi i64 [ %.3, %74 ], [ 1, %4 ]
  %50 = phi <2 x double> [ %76, %74 ], [ zeroinitializer, %4 ]
  %51 = call noundef i64 @_Z20calculate_new_cutoffll(i64 noundef %.0, i64 noundef %.041)
  store i64 %51, ptr @CutOff, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  call void @_ZN3tbb10tick_countC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #7
  %52 = invoke i64 @_ZN3tbb10tick_count3nowEv()
          to label %54 unwind label %.split98

.split100:                                        ; preds = %58
  %53 = landingpad { ptr, i32 }
          cleanup
  br label %.split114.us

54:                                               ; preds = %.split
  store i64 %52, ptr %8, align 8
  %55 = invoke i64 @_ZN3tbbmiERKNS_10tick_countES2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %56 unwind label %.split98

56:                                               ; preds = %54
  store i64 %55, ptr %7, align 8
  %57 = invoke noundef double @_ZNK3tbb10tick_count10interval_t7secondsEv(ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %58 unwind label %.split98

58:                                               ; preds = %56
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  %59 = load i64, ptr @CutOff, align 8, !tbaa !5
  invoke void @_Z6outputilliddl(i32 noundef %0, i64 noundef %1, i64 noundef %59, i32 noundef %2, double noundef %3, double noundef %57, i64 noundef 0)
          to label %60 unwind label %.split100

60:                                               ; preds = %58
  %61 = fdiv double %3, %57
  %62 = fcmp ult double %61, %11
  %63 = load i64, ptr @CutOff, align 8, !tbaa !5
  br i1 %62, label %71, label %64

64:                                               ; preds = %60
  %65 = icmp eq i64 %.041, %63
  %66 = extractelement <2 x double> %50, i64 1
  br i1 %65, label %67, label %74

67:                                               ; preds = %64
  %68 = icmp eq i64 %.041, %.0
  br i1 %68, label %74, label %.split103.us

.split98:                                         ; preds = %56, %54, %.split
  %69 = landingpad { ptr, i32 }
          cleanup
  br label %70

70:                                               ; preds = %.split98.us, %.split98
  %.us-phi = phi { ptr, i32 } [ %69, %.split98 ], [ %48, %.split98.us ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  br label %.split114.us

71:                                               ; preds = %60
  %72 = icmp eq i64 %.0, %63
  %73 = extractelement <2 x double> %50, i64 0
  br i1 %72, label %.split103.us, label %74

74:                                               ; preds = %71, %67, %64
  %.359 = phi double [ %66, %64 ], [ 0.000000e+00, %67 ], [ %57, %71 ]
  %.255 = phi double [ %57, %64 ], [ %57, %67 ], [ %73, %71 ]
  %.252 = phi i64 [ %63, %64 ], [ %.041, %67 ], [ %.050, %71 ]
  %.243 = phi i64 [ %63, %64 ], [ %.041, %67 ], [ %.041, %71 ]
  %.3 = phi i64 [ %.0, %64 ], [ 1, %67 ], [ %63, %71 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  %75 = insertelement <2 x double> poison, double %.255, i64 0
  %76 = insertelement <2 x double> %75, double %.359, i64 1
  br label %.split

.split114.us:                                     ; preds = %.split114.us.loopexit, %.split114.us.loopexit.split-lp, %.split100, %.split100.us, %.split111.us, %70
  %.pn.pn = phi { ptr, i32 } [ %.us-phi, %70 ], [ %lpad.loopexit.split-lp, %.split111.us ], [ %53, %.split100 ], [ %49, %.split100.us ], [ %lpad.loopexit145, %.split114.us.loopexit ], [ %lpad.loopexit.split-lp146, %.split114.us.loopexit.split-lp ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  call void @_ZN3tbb19task_scheduler_initD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  resume { ptr, i32 } %.pn.pn

.split103.us:                                     ; preds = %71, %67, %35, %37
  %.us-phi106 = phi i64 [ %.041.us, %37 ], [ %.041.us, %35 ], [ %.041, %67 ], [ %.041, %71 ]
  %.us-phi107 = phi i64 [ %.0.us, %37 ], [ %.0.us, %35 ], [ %.0, %67 ], [ %.0, %71 ]
  %.us-phi109 = phi i64 [ %.041.us, %35 ], [ %.050.us, %37 ], [ %.050, %71 ], [ %.041, %67 ]
  %77 = phi <2 x double> [ %13, %37 ], [ %13, %35 ], [ %50, %67 ], [ %50, %71 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  %.not = icmp eq i64 %.us-phi109, -1
  br i1 %.not, label %92, label %78

78:                                               ; preds = %.split103.us
  %79 = insertelement <2 x double> poison, double %3, i64 0
  %80 = shufflevector <2 x double> %79, <2 x double> poison, <2 x i32> zeroinitializer
  %81 = fdiv <2 x double> %80, %77
  %82 = extractelement <2 x double> %81, i64 1
  %83 = fsub double %11, %82
  %84 = sub nsw i64 %.us-phi106, %.us-phi107
  %85 = sitofp i64 %84 to double
  %86 = extractelement <2 x double> %81, i64 0
  %87 = fsub double %86, %82
  %88 = fdiv double %85, %87
  %89 = sitofp i64 %.us-phi107 to double
  %90 = call double @llvm.fmuladd.f64(double %83, double %88, double %89)
  %91 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %.us-phi109, double noundef %90)
  br label %94

92:                                               ; preds = %.split103.us
  %93 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %94

94:                                               ; preds = %92, %78
  call void @_ZN3tbb19task_scheduler_initD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3tbb19task_scheduler_initC2Eim(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef, i64 noundef) unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z20calculate_new_cutoffll(i64 noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3tbb10tick_countC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i64 @_ZN3tbb10tick_count3nowEv() local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i64 @_ZN3tbbmiERKNS_10tick_countES2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK3tbb10tick_count10interval_t7secondsEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z6outputilliddl(i32 noundef, i64 noundef, i64 noundef, i32 noundef, double noundef, double noundef, i64 noundef) local_unnamed_addr #4

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3tbb19task_scheduler_initD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3 align 2

attributes #0 = { mustprogress 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 = { inlinehint mustprogress 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 = { mustprogress 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 #4 = { inlinehint mustprogress 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 #5 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nofree 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 #7 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12, !13}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.peeled.count", i32 2}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopFullUnrollPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass