; LLVM IR from rcliftonharvey/dspfilters4juce :: DSPFilters4JUCEDemo/JuceLibraryCode (juce_opengl)

; 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.juce::OpenGLFrameBuffer" = type { %"class.juce::ScopedPointer", %"class.juce::ScopedPointer.0" }
%"class.juce::ScopedPointer" = type { ptr }
%"class.juce::ScopedPointer.0" = type { ptr }

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4juce17OpenGLFrameBuffer10initialiseERNS_13OpenGLContextEii(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(491) %1, i32 noundef %2, i32 noundef %3) #0 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !9
  %11 = load ptr, ptr %5, align 8
  br label %12

12:                                               ; preds = %4
  br label %13

13:                                               ; preds = %12
  %14 = getelementptr inbounds %"class.juce::OpenGLFrameBuffer", ptr %11, i32 0, i32 0
  %15 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN4juce13ScopedPointerINS_17OpenGLFrameBuffer5PimplEEaSEPS2_(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef null)
  %16 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 32) #5
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = load i32, ptr %7, align 4, !tbaa !9
  %19 = load i32, ptr %8, align 4, !tbaa !9
  invoke void @_ZN4juce17OpenGLFrameBuffer5PimplC2ERNS_13OpenGLContextEiibb(ptr noundef nonnull align 8 dereferenceable(30) %16, ptr noundef nonnull align 8 dereferenceable(491) %17, i32 noundef %18, i32 noundef %19, i1 noundef zeroext false, i1 noundef zeroext false)
          to label %20 unwind label %29

20:                                               ; preds = %13
  %21 = getelementptr inbounds %"class.juce::OpenGLFrameBuffer", ptr %11, i32 0, i32 0
  %22 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN4juce13ScopedPointerINS_17OpenGLFrameBuffer5PimplEEaSEPS2_(ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef %16)
  %23 = getelementptr inbounds %"class.juce::OpenGLFrameBuffer", ptr %11, i32 0, i32 0
  %24 = call noundef ptr @_ZNK4juce13ScopedPointerINS_17OpenGLFrameBuffer5PimplEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %23) #6
  %25 = call noundef zeroext i1 @_ZNK4juce17OpenGLFrameBuffer5Pimpl9createdOkEv(ptr noundef nonnull align 8 dereferenceable(30) %24)
  br i1 %25, label %33, label %26

26:                                               ; preds = %20
  %27 = getelementptr inbounds %"class.juce::OpenGLFrameBuffer", ptr %11, i32 0, i32 0
  %28 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN4juce13ScopedPointerINS_17OpenGLFrameBuffer5PimplEEaSEPS2_(ptr noundef nonnull align 8 dereferenceable(8) %27, ptr noundef null)
  br label %33

29:                                               ; preds = %13
  %30 = landingpad { ptr, i32 }
          cleanup
  %31 = extractvalue { ptr, i32 } %30, 0
  store ptr %31, ptr %9, align 8
  %32 = extractvalue { ptr, i32 } %30, 1
  store i32 %32, ptr %10, align 4
  call void @_ZdlPvm(ptr noundef %16, i64 noundef 32) #7
  br label %37

33:                                               ; preds = %26, %20
  %34 = getelementptr inbounds %"class.juce::OpenGLFrameBuffer", ptr %11, i32 0, i32 0
  %35 = call noundef ptr @_ZNK4juce13ScopedPointerINS_17OpenGLFrameBuffer5PimplEEcvPS2_Ev(ptr noundef nonnull align 8 dereferenceable(8) %34) #6
  %36 = icmp ne ptr %35, null
  ret i1 %36

37:                                               ; preds = %29
  %38 = load ptr, ptr %9, align 8
  %39 = load i32, ptr %10, align 4
  %40 = insertvalue { ptr, i32 } poison, ptr %38, 0
  %41 = insertvalue { ptr, i32 } %40, i32 %39, 1
  resume { ptr, i32 } %41
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce17OpenGLFrameBuffer5PimplC2ERNS_13OpenGLContextEiibb(ptr noundef nonnull align 8 dereferenceable(30), ptr noundef nonnull align 8 dereferenceable(491), i32 noundef, i32 noundef, i1 noundef zeroext, i1 noundef zeroext) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

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

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

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

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

attributes #0 = { 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 #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 = { 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 = { 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 #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 = { 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, !10, i64 0}
!10 = !{!"int", !7, 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"

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4juce17OpenGLFrameBuffer10initialiseERNS_13OpenGLContextEii(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(491) %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %5 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN4juce13ScopedPointerINS_17OpenGLFrameBuffer5PimplEEaSEPS2_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef null)
  %6 = tail call noalias noundef nonnull dereferenceable(32) ptr @_Znwm(i64 noundef 32) #5
  invoke void @_ZN4juce17OpenGLFrameBuffer5PimplC2ERNS_13OpenGLContextEiibb(ptr noundef nonnull align 8 dereferenceable(30) %6, ptr noundef nonnull align 8 dereferenceable(491) %1, i32 noundef %2, i32 noundef %3, i1 noundef zeroext false, i1 noundef zeroext false)
          to label %7 unwind label %13

7:                                                ; preds = %4
  %8 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN4juce13ScopedPointerINS_17OpenGLFrameBuffer5PimplEEaSEPS2_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull %6)
  %9 = tail call noundef ptr @_ZNK4juce13ScopedPointerINS_17OpenGLFrameBuffer5PimplEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %0) #6
  %10 = tail call noundef zeroext i1 @_ZNK4juce17OpenGLFrameBuffer5Pimpl9createdOkEv(ptr noundef nonnull align 8 dereferenceable(30) %9)
  br i1 %10, label %15, label %11

11:                                               ; preds = %7
  %12 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN4juce13ScopedPointerINS_17OpenGLFrameBuffer5PimplEEaSEPS2_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef null)
  br label %15

13:                                               ; preds = %4
  %14 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %6, i64 noundef 32) #7
  resume { ptr, i32 } %14

15:                                               ; preds = %11, %7
  %16 = tail call noundef ptr @_ZNK4juce13ScopedPointerINS_17OpenGLFrameBuffer5PimplEEcvPS2_Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #6
  %17 = icmp ne ptr %16, null
  ret i1 %17
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce17OpenGLFrameBuffer5PimplC2ERNS_13OpenGLContextEiibb(ptr noundef nonnull align 8 dereferenceable(30), ptr noundef nonnull align 8 dereferenceable(491), i32 noundef, i32 noundef, i1 noundef zeroext, i1 noundef zeroext) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

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

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

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

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

attributes #0 = { 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 #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 = { 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 = { 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 #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 = { 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)"}


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