; LLVM IR from sfu-dis/mosaicdb :: benchmarks/egen/bucketsimulator.ll (ZN4TPCE14BucketProgress6reportEd)

; 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.TPCE::Locker" = type { ptr }
%"class.TPCE::BucketProgress" = type { %"class.TPCE::ProgressMeter", double, double }
%"class.TPCE::ProgressMeter" = type { %"class.TPCE::ProgressMeterInterface", i32, i32, i32, %"class.TPCE::CDateTime", %"class.TPCE::CDateTime", ptr, i32, %"class.TPCE::CMutex" }
%"class.TPCE::ProgressMeterInterface" = type { ptr }
%"class.TPCE::CDateTime" = type { i32, i32, ptr }
%"class.TPCE::CMutex" = type { %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4TPCE14BucketProgress6reportEd(ptr noundef nonnull align 8 dereferenceable(128) %0, double noundef %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca double, align 8
  %5 = alloca %"class.TPCE::Locker", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store double %1, ptr %4, align 8, !tbaa !9
  %6 = load ptr, ptr %3, align 8
  %7 = load ptr, ptr %6, align 8, !tbaa !11
  %8 = getelementptr inbounds ptr, ptr %7, i64 3
  %9 = load ptr, ptr %8, align 8
  call void %9(ptr noundef nonnull align 8 dereferenceable(112) %6, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  call void @_ZN4TPCE6LockerINS_13ProgressMeterEEC2ERS1_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(112) %6)
  %10 = getelementptr inbounds %"class.TPCE::BucketProgress", ptr %6, i32 0, i32 2
  %11 = load double, ptr %10, align 8, !tbaa !13
  %12 = load double, ptr %4, align 8, !tbaa !9
  %13 = fcmp olt double %11, %12
  br i1 %13, label %14, label %17

14:                                               ; preds = %2
  %15 = load double, ptr %4, align 8, !tbaa !9
  %16 = getelementptr inbounds %"class.TPCE::BucketProgress", ptr %6, i32 0, i32 2
  store double %15, ptr %16, align 8, !tbaa !13
  br label %17

17:                                               ; preds = %14, %2
  %18 = getelementptr inbounds %"class.TPCE::BucketProgress", ptr %6, i32 0, i32 2
  %19 = load double, ptr %18, align 8, !tbaa !13
  %20 = getelementptr inbounds %"class.TPCE::BucketProgress", ptr %6, i32 0, i32 1
  %21 = load double, ptr %20, align 8, !tbaa !20
  %22 = fcmp olt double %19, %21
  call void @_ZN4TPCE6LockerINS_13ProgressMeterEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret i1 %22
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4TPCE6LockerINS_13ProgressMeterEEC2ERS1_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(112)) unnamed_addr #1 align 2

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"vtable pointer", !8, i64 0}
!13 = !{!14, !10, i64 120}
!14 = !{!"_ZTSN4TPCE14BucketProgressE", !15, i64 0, !10, i64 112, !10, i64 120}
!15 = !{!"_ZTSN4TPCE13ProgressMeterE", !16, i64 0, !17, i64 8, !17, i64 12, !17, i64 16, !18, i64 24, !18, i64 40, !6, i64 56, !17, i64 64, !19, i64 72}
!16 = !{!"_ZTSN4TPCE22ProgressMeterInterfaceE"}
!17 = !{!"int", !7, i64 0}
!18 = !{!"_ZTSN4TPCE9CDateTimeE", !17, i64 0, !17, i64 4, !6, i64 8}
!19 = !{!"_ZTSN4TPCE6CMutexE", !7, i64 0}
!20 = !{!14, !10, i64 112}


; 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.TPCE::Locker" = type { ptr }

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4TPCE14BucketProgress6reportEd(ptr noundef nonnull align 8 dereferenceable(128) %0, double noundef %1) local_unnamed_addr #1 align 2 {
  %3 = alloca %"class.TPCE::Locker", align 8
  %4 = load ptr, ptr %0, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %4, i64 24
  %6 = load ptr, ptr %5, align 8
  tail call void %6(ptr noundef nonnull align 8 dereferenceable(112) %0, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  call void @_ZN4TPCE6LockerINS_13ProgressMeterEEC2ERS1_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(112) %0)
  %7 = getelementptr inbounds i8, ptr %0, i64 120
  %8 = load double, ptr %7, align 8, !tbaa !8
  %9 = fcmp olt double %8, %1
  br i1 %9, label %10, label %11

10:                                               ; preds = %2
  store double %1, ptr %7, align 8, !tbaa !8
  br label %11

11:                                               ; preds = %10, %2
  %12 = phi double [ %1, %10 ], [ %8, %2 ]
  %13 = getelementptr inbounds i8, ptr %0, i64 112
  %14 = load double, ptr %13, align 8, !tbaa !18
  %15 = fcmp olt double %12, %14
  call void @_ZN4TPCE6LockerINS_13ProgressMeterEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  ret i1 %15
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4TPCE6LockerINS_13ProgressMeterEEC2ERS1_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(112)) unnamed_addr #1 align 2

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !17, i64 120}
!9 = !{!"_ZTSN4TPCE14BucketProgressE", !10, i64 0, !17, i64 112, !17, i64 120}
!10 = !{!"_ZTSN4TPCE13ProgressMeterE", !11, i64 0, !12, i64 8, !12, i64 12, !12, i64 16, !14, i64 24, !14, i64 40, !15, i64 56, !12, i64 64, !16, i64 72}
!11 = !{!"_ZTSN4TPCE22ProgressMeterInterfaceE"}
!12 = !{!"int", !13, i64 0}
!13 = !{!"omnipotent char", !7, i64 0}
!14 = !{!"_ZTSN4TPCE9CDateTimeE", !12, i64 0, !12, i64 4, !15, i64 8}
!15 = !{!"any pointer", !13, i64 0}
!16 = !{!"_ZTSN4TPCE6CMutexE", !13, i64 0}
!17 = !{!"double", !13, i64 0}
!18 = !{!9, !17, i64 112}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,TailCallElimPass