; 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::OpenGLShaderProgram" = type { ptr, i32, %"class.juce::String" }
%"class.juce::String" = type { %"class.juce::CharPointer_UTF8" }
%"class.juce::CharPointer_UTF8" = type { ptr }
%"class.juce::OpenGLContext" = type <{ %"struct.juce::OpenGLExtensionFunctions", ptr, ptr, double, %"class.juce::ScopedPointer.1", %"class.juce::OpenGLPixelFormat", [4 x i8], ptr, i32, [4 x i8], i64, i8, i8, i8, [5 x i8] }>
%"struct.juce::OpenGLExtensionFunctions" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%"class.juce::ScopedPointer.1" = type { ptr }
%"class.juce::OpenGLPixelFormat" = type <{ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, [3 x i8] }>

declare i32 @__gxx_personality_v0(...)

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_ZNK4juce19OpenGLShaderProgram12getProgramIDEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  br label %4

4:                                                ; preds = %1
  br label %5

5:                                                ; preds = %4
  br label %6

6:                                                ; preds = %5
  %7 = getelementptr inbounds %"class.juce::OpenGLShaderProgram", ptr %3, i32 0, i32 1
  %8 = load i32, ptr %7, align 8, !tbaa !9
  %9 = icmp eq i32 %8, 0
  br i1 %9, label %10, label %19

10:                                               ; preds = %6
  %11 = getelementptr inbounds %"class.juce::OpenGLShaderProgram", ptr %3, i32 0, i32 0
  %12 = load ptr, ptr %11, align 8, !tbaa !14
  %13 = getelementptr inbounds %"class.juce::OpenGLContext", ptr %12, i32 0, i32 0
  %14 = getelementptr inbounds %"struct.juce::OpenGLExtensionFunctions", ptr %13, i32 0, i32 6
  %15 = load ptr, ptr %14, align 8, !tbaa !15
  %16 = invoke noundef i32 %15()
          to label %17 unwind label %22

17:                                               ; preds = %10
  %18 = getelementptr inbounds %"class.juce::OpenGLShaderProgram", ptr %3, i32 0, i32 1
  store i32 %16, ptr %18, align 8, !tbaa !9
  br label %19

19:                                               ; preds = %17, %6
  %20 = getelementptr inbounds %"class.juce::OpenGLShaderProgram", ptr %3, i32 0, i32 1
  %21 = load i32, ptr %20, align 8, !tbaa !9
  ret i32 %21

22:                                               ; preds = %10
  %23 = landingpad { ptr, i32 }
          catch ptr null
  %24 = extractvalue { ptr, i32 } %23, 0
  call void @__clang_call_terminate(ptr %24) #2
  unreachable
}

attributes #0 = { noinline noreturn nounwind uwtable "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 = { noreturn 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, !11, i64 8}
!10 = !{!"_ZTSN4juce19OpenGLShaderProgramE", !6, i64 0, !11, i64 8, !12, i64 16}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTSN4juce6StringE", !13, i64 0}
!13 = !{!"_ZTSN4juce16CharPointer_UTF8E", !6, i64 0}
!14 = !{!10, !6, i64 0}
!15 = !{!16, !6, i64 48}
!16 = !{!"_ZTSN4juce13OpenGLContextE", !17, i64 0, !6, i64 384, !6, i64 392, !18, i64 400, !19, i64 408, !20, i64 416, !6, i64 464, !21, i64 472, !22, i64 480, !23, i64 488, !23, i64 489, !23, i64 490}
!17 = !{!"_ZTSN4juce24OpenGLExtensionFunctionsE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368, !6, i64 376}
!18 = !{!"double", !7, i64 0}
!19 = !{!"_ZTSN4juce13ScopedPointerINS_13OpenGLContext10AttachmentEEE", !6, i64 0}
!20 = !{!"_ZTSN4juce17OpenGLPixelFormatE", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !7, i64 40}
!21 = !{!"_ZTSN4juce13OpenGLContext13OpenGLVersionE", !7, i64 0}
!22 = !{!"long", !7, i64 0}
!23 = !{!"bool", !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"

declare i32 @__gxx_personality_v0(...)

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_ZNK4juce19OpenGLShaderProgram12getProgramIDEv(ptr nocapture noundef nonnull align 8 dereferenceable(24) %0) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 8
  %3 = load i32, ptr %2, align 8, !tbaa !5
  %4 = icmp eq i32 %3, 0
  br i1 %4, label %5, label %11

5:                                                ; preds = %1
  %6 = load ptr, ptr %0, align 8, !tbaa !13
  %7 = getelementptr inbounds i8, ptr %6, i64 48
  %8 = load ptr, ptr %7, align 8, !tbaa !14
  %9 = invoke noundef i32 %8()
          to label %10 unwind label %13

10:                                               ; preds = %5
  store i32 %9, ptr %2, align 8, !tbaa !5
  br label %11

11:                                               ; preds = %10, %1
  %12 = phi i32 [ %9, %10 ], [ %3, %1 ]
  ret i32 %12

13:                                               ; preds = %5
  %14 = landingpad { ptr, i32 }
          catch ptr null
  %15 = extractvalue { ptr, i32 } %14, 0
  tail call void @__clang_call_terminate(ptr %15) #2
  unreachable
}

attributes #0 = { noinline noreturn nounwind uwtable "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 = { noreturn 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, !10, i64 8}
!6 = !{!"_ZTSN4juce19OpenGLShaderProgramE", !7, i64 0, !10, i64 8, !11, i64 16}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"_ZTSN4juce6StringE", !12, i64 0}
!12 = !{!"_ZTSN4juce16CharPointer_UTF8E", !7, i64 0}
!13 = !{!6, !7, i64 0}
!14 = !{!15, !7, i64 48}
!15 = !{!"_ZTSN4juce13OpenGLContextE", !16, i64 0, !7, i64 384, !7, i64 392, !17, i64 400, !18, i64 408, !19, i64 416, !7, i64 464, !20, i64 472, !21, i64 480, !22, i64 488, !22, i64 489, !22, i64 490}
!16 = !{!"_ZTSN4juce24OpenGLExtensionFunctionsE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !7, i64 120, !7, i64 128, !7, i64 136, !7, i64 144, !7, i64 152, !7, i64 160, !7, i64 168, !7, i64 176, !7, i64 184, !7, i64 192, !7, i64 200, !7, i64 208, !7, i64 216, !7, i64 224, !7, i64 232, !7, i64 240, !7, i64 248, !7, i64 256, !7, i64 264, !7, i64 272, !7, i64 280, !7, i64 288, !7, i64 296, !7, i64 304, !7, i64 312, !7, i64 320, !7, i64 328, !7, i64 336, !7, i64 344, !7, i64 352, !7, i64 360, !7, i64 368, !7, i64 376}
!17 = !{!"double", !8, i64 0}
!18 = !{!"_ZTSN4juce13ScopedPointerINS_13OpenGLContext10AttachmentEEE", !7, i64 0}
!19 = !{!"_ZTSN4juce17OpenGLPixelFormatE", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !8, i64 40}
!20 = !{!"_ZTSN4juce13OpenGLContext13OpenGLVersionE", !8, i64 0}
!21 = !{!"long", !8, i64 0}
!22 = !{!"bool", !8, i64 0}


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