; LLVM IR from ronan-kerviche/glip-lib :: GLIP-Lib/src/Core/HdlFBO.ll (ZN4Glip6CoreGL6HdlFBO14addDepthBufferEv)

; 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.Glip::CoreGL::HdlFBO" = type <{ %"class.Glip::CoreGL::HdlAbstractTextureFormat.base", [4 x i8], %"class.std::vector", i32, i8, [3 x i8], ptr, i8, [7 x i8] }>
%"class.Glip::CoreGL::HdlAbstractTextureFormat.base" = type <{ ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<Glip::CoreGL::HdlTexture *, std::allocator<Glip::CoreGL::HdlTexture *>>::_Vector_impl" }
%"struct.std::_Vector_base<Glip::CoreGL::HdlTexture *, std::allocator<Glip::CoreGL::HdlTexture *>>::_Vector_impl" = type { %"struct.std::_Vector_base<Glip::CoreGL::HdlTexture *, std::allocator<Glip::CoreGL::HdlTexture *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Glip::CoreGL::HdlTexture *, std::allocator<Glip::CoreGL::HdlTexture *>>::_Vector_impl_data" = type { ptr, ptr, ptr }

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Glip6CoreGL6HdlFBO14addDepthBufferEv(ptr noundef nonnull align 8 dereferenceable(97) %0) #3 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i1, align 1
  store ptr %0, ptr %2, align 8, !tbaa !5
  %7 = load ptr, ptr %2, align 8
  %8 = getelementptr inbounds %"class.Glip::CoreGL::HdlFBO", ptr %7, i32 0, i32 6
  %9 = load ptr, ptr %8, align 8, !tbaa !9
  %10 = icmp eq ptr %9, null
  br i1 %10, label %11, label %26

11:                                               ; preds = %1
  %12 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 24) #5
  store i1 true, ptr %6, align 1
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 6402, ptr %3, align 4, !tbaa !18
  %13 = invoke noundef i32 @_ZNK4Glip6CoreGL24HdlAbstractTextureFormat8getWidthEv(ptr noundef nonnull align 8 dereferenceable(52) %7)
          to label %14 unwind label %19

14:                                               ; preds = %11
  %15 = invoke noundef i32 @_ZNK4Glip6CoreGL24HdlAbstractTextureFormat9getHeightEv(ptr noundef nonnull align 8 dereferenceable(52) %7)
          to label %16 unwind label %19

16:                                               ; preds = %14
  invoke void @_ZN4Glip6CoreGL15HdlRenderBufferC1ERKjii(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 4 dereferenceable(4) %3, i32 noundef %13, i32 noundef %15)
          to label %17 unwind label %19

17:                                               ; preds = %16
  store i1 false, ptr %6, align 1
  %18 = getelementptr inbounds %"class.Glip::CoreGL::HdlFBO", ptr %7, i32 0, i32 6
  store ptr %12, ptr %18, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %26

19:                                               ; preds = %16, %14, %11
  %20 = landingpad { ptr, i32 }
          cleanup
  %21 = extractvalue { ptr, i32 } %20, 0
  store ptr %21, ptr %4, align 8
  %22 = extractvalue { ptr, i32 } %20, 1
  store i32 %22, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  %23 = load i1, ptr %6, align 1
  br i1 %23, label %24, label %25

24:                                               ; preds = %19
  call void @_ZdlPvm(ptr noundef %12, i64 noundef 24) #7
  br label %25

25:                                               ; preds = %24, %19
  br label %27

26:                                               ; preds = %17, %1
  ret void

27:                                               ; preds = %25
  %28 = load ptr, ptr %4, align 8
  %29 = load i32, ptr %5, align 4
  %30 = insertvalue { ptr, i32 } poison, ptr %28, 0
  %31 = insertvalue { ptr, i32 } %30, i32 %29, 1
  resume { ptr, i32 } %31
}

declare noundef i32 @_ZNK4Glip6CoreGL24HdlAbstractTextureFormat8getWidthEv(ptr noundef nonnull align 8 dereferenceable(52)) #4

declare noundef i32 @_ZNK4Glip6CoreGL24HdlAbstractTextureFormat9getHeightEv(ptr noundef nonnull align 8 dereferenceable(52)) #4

declare void @_ZN4Glip6CoreGL15HdlRenderBufferC1ERKjii(ptr, ptr, i32, i32)

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { "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 = { builtin allocsize(0) }
attributes #6 = { nounwind }
attributes #7 = { 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, !6, i64 88}
!10 = !{!"_ZTSN4Glip6CoreGL6HdlFBOE", !11, i64 0, !13, i64 56, !12, i64 80, !17, i64 84, !6, i64 88, !17, i64 96}
!11 = !{!"_ZTSN4Glip6CoreGL24HdlAbstractTextureFormatE", !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 40, !12, i64 44, !12, i64 48}
!12 = !{!"int", !7, i64 0}
!13 = !{!"_ZTSSt6vectorIPN4Glip6CoreGL10HdlTextureESaIS3_EE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseIPN4Glip6CoreGL10HdlTextureESaIS3_EE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIPN4Glip6CoreGL10HdlTextureESaIS3_EE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIPN4Glip6CoreGL10HdlTextureESaIS3_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!17 = !{!"bool", !7, i64 0}
!18 = !{!12, !12, i64 0}


; 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: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, 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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Glip6CoreGL6HdlFBO14addDepthBufferEv(ptr noundef nonnull align 8 dereferenceable(97) %0) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca i32, align 4
  %3 = getelementptr inbounds i8, ptr %0, i64 88
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = icmp eq ptr %4, null
  br i1 %5, label %6, label %15

6:                                                ; preds = %1
  %7 = tail call noalias noundef nonnull dereferenceable(24) ptr @_Znwm(i64 noundef 24) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  store i32 6402, ptr %2, align 4, !tbaa !17
  %8 = invoke noundef i32 @_ZNK4Glip6CoreGL24HdlAbstractTextureFormat8getWidthEv(ptr noundef nonnull align 8 dereferenceable(52) %0)
          to label %9 unwind label %13

9:                                                ; preds = %6
  %10 = invoke noundef i32 @_ZNK4Glip6CoreGL24HdlAbstractTextureFormat9getHeightEv(ptr noundef nonnull align 8 dereferenceable(52) %0)
          to label %11 unwind label %13

11:                                               ; preds = %9
  invoke void @_ZN4Glip6CoreGL15HdlRenderBufferC1ERKjii(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 4 dereferenceable(4) %2, i32 noundef %8, i32 noundef %10)
          to label %12 unwind label %13

12:                                               ; preds = %11
  store ptr %7, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  br label %15

13:                                               ; preds = %11, %9, %6
  %14 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @_ZdlPvm(ptr noundef nonnull %7, i64 noundef 24) #7
  resume { ptr, i32 } %14

15:                                               ; preds = %12, %1
  ret void
}

declare noundef i32 @_ZNK4Glip6CoreGL24HdlAbstractTextureFormat8getWidthEv(ptr noundef nonnull align 8 dereferenceable(52)) local_unnamed_addr #4

declare noundef i32 @_ZNK4Glip6CoreGL24HdlAbstractTextureFormat9getHeightEv(ptr noundef nonnull align 8 dereferenceable(52)) local_unnamed_addr #4

declare void @_ZN4Glip6CoreGL15HdlRenderBufferC1ERKjii(ptr, ptr, i32, i32) local_unnamed_addr

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { "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 = { builtin allocsize(0) }
attributes #6 = { nounwind }
attributes #7 = { 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, !15, i64 88}
!6 = !{!"_ZTSN4Glip6CoreGL6HdlFBOE", !7, i64 0, !11, i64 56, !8, i64 80, !16, i64 84, !15, i64 88, !16, i64 96}
!7 = !{!"_ZTSN4Glip6CoreGL24HdlAbstractTextureFormatE", !8, i64 8, !8, i64 12, !8, i64 16, !8, i64 20, !8, i64 24, !8, i64 28, !8, i64 32, !8, i64 36, !8, i64 40, !8, i64 44, !8, i64 48}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"_ZTSSt6vectorIPN4Glip6CoreGL10HdlTextureESaIS3_EE", !12, i64 0}
!12 = !{!"_ZTSSt12_Vector_baseIPN4Glip6CoreGL10HdlTextureESaIS3_EE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIPN4Glip6CoreGL10HdlTextureESaIS3_EE12_Vector_implE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIPN4Glip6CoreGL10HdlTextureESaIS3_EE17_Vector_impl_dataE", !15, i64 0, !15, i64 8, !15, i64 16}
!15 = !{!"any pointer", !9, i64 0}
!16 = !{!"bool", !9, i64 0}
!17 = !{!8, !8, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass