; LLVM IR from stan-dev/math :: lib/boost_1.84.0/libs/coroutine/src/posix (stack_traits)

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

@.str = external hidden unnamed_addr constant [33 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [106 x i8], align 1
@__PRETTY_FUNCTION__._ZN5boost10coroutines12stack_traits12default_sizeEv = external hidden unnamed_addr constant [67 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN5boost10coroutines12stack_traits12is_unboundedEv() #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i64 @_ZN5boost10coroutines12stack_traits12default_sizeEv() #0 align 2 personality ptr @__gxx_personality_v0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  %5 = call noundef i64 @_ZN5boost10coroutines12stack_traits12minimum_sizeEv() #5
  %6 = mul i64 8, %5
  store i64 %6, ptr %2, align 8, !tbaa !5
  %7 = call noundef zeroext i1 @_ZN5boost10coroutines12stack_traits12is_unboundedEv() #5
  br i1 %7, label %8, label %10

8:                                                ; preds = %0
  %9 = load i64, ptr %2, align 8, !tbaa !5
  store i64 %9, ptr %1, align 8
  store i32 1, ptr %3, align 4
  br label %30

10:                                               ; preds = %0
  %11 = call noundef i64 @_ZN5boost10coroutines12stack_traits12maximum_sizeEv() #5
  %12 = call noundef i64 @_ZN5boost10coroutines12stack_traits12minimum_sizeEv() #5
  %13 = icmp uge i64 %11, %12
  br i1 %13, label %14, label %15

14:                                               ; preds = %10
  br label %17

15:                                               ; preds = %10
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 81, ptr noundef @__PRETTY_FUNCTION__._ZN5boost10coroutines12stack_traits12default_sizeEv) #6
  unreachable

16:                                               ; No predecessors!
  br label %17

17:                                               ; preds = %16, %14
  %18 = call noundef i64 @_ZN5boost10coroutines12stack_traits12maximum_sizeEv() #5
  %19 = load i64, ptr %2, align 8, !tbaa !5
  %20 = icmp eq i64 %18, %19
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  br i1 %20, label %21, label %23

21:                                               ; preds = %17
  %22 = load i64, ptr %2, align 8, !tbaa !5
  br label %28

23:                                               ; preds = %17
  %24 = call noundef i64 @_ZN5boost10coroutines12stack_traits12maximum_sizeEv() #5
  store i64 %24, ptr %4, align 8, !tbaa !5
  %25 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %26 unwind label %32

26:                                               ; preds = %23
  %27 = load i64, ptr %25, align 8, !tbaa !5
  br label %28

28:                                               ; preds = %26, %21
  %29 = phi i64 [ %22, %21 ], [ %27, %26 ]
  store i64 %29, ptr %1, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  store i32 1, ptr %3, align 4
  br label %30

30:                                               ; preds = %28, %8
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  %31 = load i64, ptr %1, align 8
  ret i64 %31

32:                                               ; preds = %23
  %33 = landingpad { ptr, i32 }
          catch ptr null
  %34 = extractvalue { ptr, i32 } %33, 0
  call void @__clang_call_terminate(ptr %34) #6
  unreachable
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN5boost10coroutines12stack_traits12minimum_sizeEv() #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN5boost10coroutines12stack_traits12maximum_sizeEv() #0 align 2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

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

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

attributes #0 = { 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 #1 = { noinline noreturn nounwind uwtable "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { noreturn 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 #4 = { 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 #5 = { nounwind }
attributes #6 = { noreturn 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"}


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

@.str = external hidden unnamed_addr constant [33 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [106 x i8], align 1
@__PRETTY_FUNCTION__._ZN5boost10coroutines12stack_traits12default_sizeEv = external hidden unnamed_addr constant [67 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN5boost10coroutines12stack_traits12is_unboundedEv() local_unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i64 @_ZN5boost10coroutines12stack_traits12default_sizeEv() local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #4
  %3 = tail call noundef i64 @_ZN5boost10coroutines12stack_traits12minimum_sizeEv() #4
  %4 = shl i64 %3, 3
  store i64 %4, ptr %1, align 8, !tbaa !5
  %5 = tail call noundef zeroext i1 @_ZN5boost10coroutines12stack_traits12is_unboundedEv() #4
  br i1 %5, label %18, label %6

6:                                                ; preds = %0
  %7 = tail call noundef i64 @_ZN5boost10coroutines12stack_traits12maximum_sizeEv() #4
  %8 = tail call noundef i64 @_ZN5boost10coroutines12stack_traits12minimum_sizeEv() #4
  %.not = icmp ult i64 %7, %8
  br i1 %.not, label %9, label %10

9:                                                ; preds = %6
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 81, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN5boost10coroutines12stack_traits12default_sizeEv) #5
  unreachable

10:                                               ; preds = %6
  %11 = tail call noundef i64 @_ZN5boost10coroutines12stack_traits12maximum_sizeEv() #4
  %12 = icmp eq i64 %11, %4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  br i1 %12, label %16, label %13

13:                                               ; preds = %10
  %14 = tail call noundef i64 @_ZN5boost10coroutines12stack_traits12maximum_sizeEv() #4
  store i64 %14, ptr %2, align 8, !tbaa !5
  %15 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %.pre = load i64, ptr %15, align 8, !tbaa !5
  br label %16

16:                                               ; preds = %10, %13
  %17 = phi i64 [ %.pre, %13 ], [ %4, %10 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  br label %18

18:                                               ; preds = %0, %16
  %.0 = phi i64 [ %17, %16 ], [ %4, %0 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #4
  ret i64 %.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 nounwind uwtable
declare dso_local noundef i64 @_ZN5boost10coroutines12stack_traits12minimum_sizeEv() local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN5boost10coroutines12stack_traits12maximum_sizeEv() local_unnamed_addr #0 align 2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { noreturn 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 = { 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 #4 = { nounwind }
attributes #5 = { noreturn 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"}


; Effective O3 passes: BDCEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass,TailCallElimPass