; LLVM IR from ronan-kerviche/glip-lib :: GLIP-Lib/src/Core (Pipeline)

; 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.Glip::CorePipeline::Pipeline::BuffersCell" = type { %"class.std::vector.37" }
%"class.std::vector.37" = type { %"struct.std::_Vector_base.38" }
%"struct.std::_Vector_base.38" = type { %"struct.std::_Vector_base<Glip::CoreGL::HdlFBO *, std::allocator<Glip::CoreGL::HdlFBO *>>::_Vector_impl" }
%"struct.std::_Vector_base<Glip::CoreGL::HdlFBO *, std::allocator<Glip::CoreGL::HdlFBO *>>::_Vector_impl" = type { %"struct.std::_Vector_base<Glip::CoreGL::HdlFBO *, std::allocator<Glip::CoreGL::HdlFBO *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Glip::CoreGL::HdlFBO *, std::allocator<Glip::CoreGL::HdlFBO *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.Glip::CorePipeline::Pipeline::BufferFormatsCell" = type { %"class.std::vector.32", %"class.std::vector.15" }
%"class.std::vector.32" = type { %"struct.std::_Vector_base.33" }
%"struct.std::_Vector_base.33" = type { %"struct.std::_Vector_base<Glip::CoreGL::HdlTextureFormat, std::allocator<Glip::CoreGL::HdlTextureFormat>>::_Vector_impl" }
%"struct.std::_Vector_base<Glip::CoreGL::HdlTextureFormat, std::allocator<Glip::CoreGL::HdlTextureFormat>>::_Vector_impl" = type { %"struct.std::_Vector_base<Glip::CoreGL::HdlTextureFormat, std::allocator<Glip::CoreGL::HdlTextureFormat>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Glip::CoreGL::HdlTextureFormat, std::allocator<Glip::CoreGL::HdlTextureFormat>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.15" = type { %"struct.std::_Vector_base.16" }
%"struct.std::_Vector_base.16" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #1

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #2

; 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 nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #3 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Glip12CorePipeline8Pipeline11BuffersCellC2ERKNS1_17BufferFormatsCellE(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(48) %1) unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %9 = load ptr, ptr %3, align 8
  %10 = getelementptr inbounds %"struct.Glip::CorePipeline::Pipeline::BuffersCell", ptr %9, i32 0, i32 0
  call void @_ZNSt6vectorIPN4Glip6CoreGL6HdlFBOESaIS3_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %11

11:                                               ; preds = %36, %2
  %12 = load i32, ptr %5, align 4, !tbaa !9
  %13 = zext i32 %12 to i64
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %"struct.Glip::CorePipeline::Pipeline::BufferFormatsCell", ptr %14, i32 0, i32 0
  %16 = call noundef i64 @_ZNKSt6vectorIN4Glip6CoreGL16HdlTextureFormatESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %15) #6
  %17 = icmp ult i64 %13, %16
  br i1 %17, label %19, label %18

18:                                               ; preds = %11
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %48

19:                                               ; preds = %11
  %20 = getelementptr inbounds %"struct.Glip::CorePipeline::Pipeline::BuffersCell", ptr %9, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %21 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 104) #7
          to label %22 unwind label %39

22:                                               ; preds = %19
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %"struct.Glip::CorePipeline::Pipeline::BufferFormatsCell", ptr %23, i32 0, i32 0
  %25 = load i32, ptr %5, align 4, !tbaa !9
  %26 = zext i32 %25 to i64
  %27 = call noundef nonnull align 8 dereferenceable(52) ptr @_ZNKSt6vectorIN4Glip6CoreGL16HdlTextureFormatESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %24, i64 noundef %26) #6
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %"struct.Glip::CorePipeline::Pipeline::BufferFormatsCell", ptr %28, i32 0, i32 1
  %30 = load i32, ptr %5, align 4, !tbaa !9
  %31 = zext i32 %30 to i64
  %32 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %29, i64 noundef %31) #6
  %33 = load i32, ptr %32, align 4, !tbaa !9
  invoke void @_ZN4Glip6CoreGL6HdlFBOC1ERKNS0_24HdlAbstractTextureFormatEi(ptr noundef nonnull align 8 dereferenceable(97) %21, ptr noundef nonnull align 8 dereferenceable(52) %27, i32 noundef %33)
          to label %34 unwind label %43

34:                                               ; preds = %22
  store ptr %21, ptr %6, align 8, !tbaa !5
  invoke void @_ZNSt6vectorIPN4Glip6CoreGL6HdlFBOESaIS3_EE9push_backEOS3_(ptr noundef nonnull align 8 dereferenceable(24) %20, ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %35 unwind label %39

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

36:                                               ; preds = %35
  %37 = load i32, ptr %5, align 4, !tbaa !9
  %38 = add i32 %37, 1
  store i32 %38, ptr %5, align 4, !tbaa !9
  br label %11, !llvm.loop !11

39:                                               ; preds = %34, %19
  %40 = landingpad { ptr, i32 }
          cleanup
  %41 = extractvalue { ptr, i32 } %40, 0
  store ptr %41, ptr %7, align 8
  %42 = extractvalue { ptr, i32 } %40, 1
  store i32 %42, ptr %8, align 4
  br label %47

43:                                               ; preds = %22
  %44 = landingpad { ptr, i32 }
          cleanup
  %45 = extractvalue { ptr, i32 } %44, 0
  store ptr %45, ptr %7, align 8
  %46 = extractvalue { ptr, i32 } %44, 1
  store i32 %46, ptr %8, align 4
  call void @_ZdlPvm(ptr noundef %21, i64 noundef 104) #8
  br label %47

47:                                               ; preds = %43, %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @_ZNSt6vectorIPN4Glip6CoreGL6HdlFBOESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #6
  br label %49

48:                                               ; preds = %18
  ret void

49:                                               ; preds = %47
  %50 = load ptr, ptr %7, align 8
  %51 = load i32, ptr %8, align 4
  %52 = insertvalue { ptr, i32 } poison, ptr %50, 0
  %53 = insertvalue { ptr, i32 } %52, i32 %51, 1
  resume { ptr, i32 } %53
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIPN4Glip6CoreGL6HdlFBOESaIS3_EE9push_backEOS3_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) #4 align 2

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

declare void @_ZN4Glip6CoreGL6HdlFBOC1ERKNS0_24HdlAbstractTextureFormatEi(ptr noundef nonnull align 8 dereferenceable(97), ptr noundef nonnull align 8 dereferenceable(52), i32 noundef) unnamed_addr #5

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nobuiltin allocsize(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 = { nobuiltin 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 = { 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 = { 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 = { "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 #6 = { nounwind }
attributes #7 = { builtin allocsize(0) }
attributes #8 = { builtin 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 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"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"

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #1

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #2

; 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 nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Glip12CorePipeline8Pipeline11BuffersCellC2ERKNS1_17BufferFormatsCellE(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(48) %1) unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  tail call void @_ZNSt6vectorIPN4Glip6CoreGL6HdlFBOESaIS3_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  %4 = tail call noundef i64 @_ZNKSt6vectorIN4Glip6CoreGL16HdlTextureFormatESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #6
  %.not = icmp eq i64 %4, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2
  %5 = getelementptr inbounds i8, ptr %1, i64 24
  br label %6

._crit_edge:                                      ; preds = %14, %2
  ret void

6:                                                ; preds = %.lr.ph, %14
  %7 = phi i64 [ 0, %.lr.ph ], [ %16, %14 ]
  %.01013 = phi i32 [ 0, %.lr.ph ], [ %15, %14 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %8 = invoke noalias noundef nonnull dereferenceable(104) ptr @_Znwm(i64 noundef 104) #7
          to label %9 unwind label %19

9:                                                ; preds = %6
  %10 = call noundef nonnull align 8 dereferenceable(52) ptr @_ZNKSt6vectorIN4Glip6CoreGL16HdlTextureFormatESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %7) #6
  %11 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %7) #6
  %12 = load i32, ptr %11, align 4, !tbaa !5
  invoke void @_ZN4Glip6CoreGL6HdlFBOC1ERKNS0_24HdlAbstractTextureFormatEi(ptr noundef nonnull align 8 dereferenceable(97) %8, ptr noundef nonnull align 8 dereferenceable(52) %10, i32 noundef %12)
          to label %13 unwind label %21

13:                                               ; preds = %9
  store ptr %8, ptr %3, align 8, !tbaa !9
  invoke void @_ZNSt6vectorIPN4Glip6CoreGL6HdlFBOESaIS3_EE9push_backEOS3_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %14 unwind label %19

14:                                               ; preds = %13
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  %15 = add i32 %.01013, 1
  %16 = zext i32 %15 to i64
  %17 = call noundef i64 @_ZNKSt6vectorIN4Glip6CoreGL16HdlTextureFormatESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #6
  %18 = icmp ugt i64 %17, %16
  br i1 %18, label %6, label %._crit_edge, !llvm.loop !11

19:                                               ; preds = %13, %6
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %23

21:                                               ; preds = %9
  %22 = landingpad { ptr, i32 }
          cleanup
  call void @_ZdlPvm(ptr noundef nonnull %8, i64 noundef 104) #8
  br label %23

23:                                               ; preds = %21, %19
  %.pn = phi { ptr, i32 } [ %20, %19 ], [ %22, %21 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  call void @_ZNSt6vectorIPN4Glip6CoreGL6HdlFBOESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  resume { ptr, i32 } %.pn
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIPN4Glip6CoreGL6HdlFBOESaIS3_EE9push_backEOS3_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4 align 2

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

declare void @_ZN4Glip6CoreGL6HdlFBOC1ERKNS0_24HdlAbstractTextureFormatEi(ptr noundef nonnull align 8 dereferenceable(97), ptr noundef nonnull align 8 dereferenceable(52), i32 noundef) unnamed_addr #5

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nobuiltin allocsize(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 = { nobuiltin 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 = { 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 = { 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 = { "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 #6 = { nounwind }
attributes #7 = { builtin allocsize(0) }
attributes #8 = { builtin 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 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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