; LLVM IR from Razakhel/RaZ :: src/RaZ/World.ll (ZN3Raz5World6updateERKNS_13FrameTimeInfoE)

; 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.Raz::World" = type { %"class.std::vector", %"class.Raz::Bitset", %"class.std::vector.4", i64, i64 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::unique_ptr<Raz::System>, std::allocator<std::unique_ptr<Raz::System>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::unique_ptr<Raz::System>, std::allocator<std::unique_ptr<Raz::System>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::unique_ptr<Raz::System>, std::allocator<std::unique_ptr<Raz::System>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::unique_ptr<Raz::System>, std::allocator<std::unique_ptr<Raz::System>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.Raz::Bitset" = type { %"class.std::vector.0" }
%"class.std::vector.0" = type { %"struct.std::_Bvector_base" }
%"struct.std::_Bvector_base" = type { %"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl" }
%"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl" = type { %"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl_data" }
%"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl_data" = type { %"struct.std::_Bit_iterator", %"struct.std::_Bit_iterator", ptr }
%"struct.std::_Bit_iterator" = type { %"struct.std::_Bit_iterator_base.base", [4 x i8] }
%"struct.std::_Bit_iterator_base.base" = type <{ ptr, i32 }>
%"class.std::vector.4" = type { %"struct.std::_Vector_base.5" }
%"struct.std::_Vector_base.5" = type { %"struct.std::_Vector_base<std::unique_ptr<Raz::Entity>, std::allocator<std::unique_ptr<Raz::Entity>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::unique_ptr<Raz::Entity>, std::allocator<std::unique_ptr<Raz::Entity>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::unique_ptr<Raz::Entity>, std::allocator<std::unique_ptr<Raz::Entity>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::unique_ptr<Raz::Entity>, std::allocator<std::unique_ptr<Raz::Entity>>>::_Vector_impl_data" = type { ptr, 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 nounwind uwtable
declare dso_local noundef ptr @_ZNKSt10unique_ptrIN3Raz6SystemESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN3Raz5World6updateERKNS_13FrameTimeInfoE(ptr noundef nonnull align 8 dereferenceable(104) %0, ptr noundef nonnull align 1 %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i8, align 1
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8
  call void @_ZN3Raz5World7refreshEv(ptr noundef nonnull align 8 dereferenceable(104) %7)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store i64 0, ptr %5, align 8, !tbaa !9
  br label %8

8:                                                ; preds = %36, %2
  %9 = load i64, ptr %5, align 8, !tbaa !9
  %10 = getelementptr inbounds %"class.Raz::World", ptr %7, i32 0, i32 0
  %11 = call noundef i64 @_ZNKSt6vectorISt10unique_ptrIN3Raz6SystemESt14default_deleteIS2_EESaIS5_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #4
  %12 = icmp ult i64 %9, %11
  br i1 %12, label %14, label %13

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

14:                                               ; preds = %8
  %15 = getelementptr inbounds %"class.Raz::World", ptr %7, i32 0, i32 1
  %16 = load i64, ptr %5, align 8, !tbaa !9
  %17 = call noundef zeroext i1 @_ZNK3Raz6BitsetixEm(ptr noundef nonnull align 8 dereferenceable(40) %15, i64 noundef %16) #4
  br i1 %17, label %19, label %18

18:                                               ; preds = %14
  br label %36

19:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #4
  %20 = getelementptr inbounds %"class.Raz::World", ptr %7, i32 0, i32 0
  %21 = load i64, ptr %5, align 8, !tbaa !9
  %22 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorISt10unique_ptrIN3Raz6SystemESt14default_deleteIS2_EESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %20, i64 noundef %21) #4
  %23 = call noundef ptr @_ZNKSt10unique_ptrIN3Raz6SystemESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %22) #4
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = load ptr, ptr %23, align 8, !tbaa !11
  %26 = getelementptr inbounds ptr, ptr %25, i64 0
  %27 = load ptr, ptr %26, align 8
  %28 = call noundef zeroext i1 %27(ptr noundef nonnull align 8 dereferenceable(72) %23, ptr noundef nonnull align 1 %24)
  %29 = zext i1 %28 to i8
  store i8 %29, ptr %6, align 1, !tbaa !13
  %30 = load i8, ptr %6, align 1, !tbaa !13, !range !15, !noundef !16
  %31 = trunc i8 %30 to i1
  br i1 %31, label %35, label %32

32:                                               ; preds = %19
  %33 = getelementptr inbounds %"class.Raz::World", ptr %7, i32 0, i32 1
  %34 = load i64, ptr %5, align 8, !tbaa !9
  call void @_ZN3Raz6Bitset6setBitEmb(ptr noundef nonnull align 8 dereferenceable(40) %33, i64 noundef %34, i1 noundef zeroext false)
  br label %35

35:                                               ; preds = %32, %19
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #4
  br label %36

36:                                               ; preds = %35, %18
  %37 = load i64, ptr %5, align 8, !tbaa !9
  %38 = add i64 %37, 1
  store i64 %38, ptr %5, align 8, !tbaa !9
  br label %8, !llvm.loop !17

39:                                               ; preds = %13
  %40 = getelementptr inbounds %"class.Raz::World", ptr %7, i32 0, i32 1
  %41 = call noundef zeroext i1 @_ZNK3Raz6Bitset7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(40) %40) #4
  %42 = xor i1 %41, true
  ret i1 %42
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorISt10unique_ptrIN3Raz6SystemESt14default_deleteIS2_EESaIS5_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3Raz6BitsetixEm(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorISt10unique_ptrIN3Raz6SystemESt14default_deleteIS2_EESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

declare void @_ZN3Raz6Bitset6setBitEmb(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef, i1 noundef zeroext) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3Raz6Bitset7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(40)) #1 align 2

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

!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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"vtable pointer", !8, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = distinct !{!17, !18}
!18 = !{!"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"

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt10unique_ptrIN3Raz6SystemESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN3Raz5World6updateERKNS_13FrameTimeInfoE(ptr noundef nonnull align 8 dereferenceable(104) %0, ptr noundef nonnull align 1 %1) local_unnamed_addr #1 align 2 {
  tail call void @_ZN3Raz5World7refreshEv(ptr noundef nonnull align 8 dereferenceable(104) %0)
  %3 = tail call noundef i64 @_ZNKSt6vectorISt10unique_ptrIN3Raz6SystemESt14default_deleteIS2_EESaIS5_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  %.not = icmp eq i64 %3, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2
  %4 = getelementptr inbounds i8, ptr %0, i64 24
  br label %8

._crit_edge:                                      ; preds = %17, %2
  %5 = getelementptr inbounds i8, ptr %0, i64 24
  %6 = tail call noundef zeroext i1 @_ZNK3Raz6Bitset7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(40) %5) #3
  %7 = xor i1 %6, true
  ret i1 %7

8:                                                ; preds = %.lr.ph, %17
  %.07 = phi i64 [ 0, %.lr.ph ], [ %18, %17 ]
  %9 = tail call noundef zeroext i1 @_ZNK3Raz6BitsetixEm(ptr noundef nonnull align 8 dereferenceable(40) %4, i64 noundef %.07) #3
  br i1 %9, label %10, label %17

10:                                               ; preds = %8
  %11 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorISt10unique_ptrIN3Raz6SystemESt14default_deleteIS2_EESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.07) #3
  %12 = tail call noundef ptr @_ZNKSt10unique_ptrIN3Raz6SystemESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %11) #3
  %13 = load ptr, ptr %12, align 8, !tbaa !5
  %14 = load ptr, ptr %13, align 8
  %15 = tail call noundef zeroext i1 %14(ptr noundef nonnull align 8 dereferenceable(72) %12, ptr noundef nonnull align 1 %1)
  br i1 %15, label %17, label %16

16:                                               ; preds = %10
  tail call void @_ZN3Raz6Bitset6setBitEmb(ptr noundef nonnull align 8 dereferenceable(40) %4, i64 noundef %.07, i1 noundef zeroext false)
  br label %17

17:                                               ; preds = %10, %16, %8
  %18 = add nuw i64 %.07, 1
  %19 = tail call noundef i64 @_ZNKSt6vectorISt10unique_ptrIN3Raz6SystemESt14default_deleteIS2_EESaIS5_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  %20 = icmp ult i64 %18, %19
  br i1 %20, label %8, label %._crit_edge, !llvm.loop !8
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3Raz5World7refreshEv(ptr noundef nonnull align 8 dereferenceable(104)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorISt10unique_ptrIN3Raz6SystemESt14default_deleteIS2_EESaIS5_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3Raz6BitsetixEm(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorISt10unique_ptrIN3Raz6SystemESt14default_deleteIS2_EESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

declare void @_ZN3Raz6Bitset6setBitEmb(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef, i1 noundef zeroext) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3Raz6Bitset7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #0 align 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 = { 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 = { "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 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass