; LLVM IR from Devaniti/BoolkaEngine :: ThirdParty/imgui/backends (imgui_impl_opengl3)

; 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"

@_ZL14g_ShaderHandle = external hidden global i32, align 4
@_ZL12g_VertHandle = external hidden global i32, align 4
@_ZL12g_FragHandle = external hidden global i32, align 4
@_ZL11g_VboHandle = external hidden global i32, align 4
@_ZL16g_ElementsHandle = external hidden global i32, align 4
@__glewDeleteBuffers = external global ptr, align 8
@__glewDetachShader = external global ptr, align 8
@__glewDeleteShader = external global ptr, align 8
@__glewDeleteProgram = external global ptr, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_Z38ImGui_ImplOpenGL3_DestroyDeviceObjectsv() #0 {
  %1 = load i32, ptr @_ZL11g_VboHandle, align 4, !tbaa !5
  %2 = icmp ne i32 %1, 0
  br i1 %2, label %3, label %5

3:                                                ; preds = %0
  %4 = load ptr, ptr @__glewDeleteBuffers, align 8, !tbaa !9
  call void %4(i32 noundef 1, ptr noundef @_ZL11g_VboHandle)
  store i32 0, ptr @_ZL11g_VboHandle, align 4, !tbaa !5
  br label %5

5:                                                ; preds = %3, %0
  %6 = load i32, ptr @_ZL16g_ElementsHandle, align 4, !tbaa !5
  %7 = icmp ne i32 %6, 0
  br i1 %7, label %8, label %10

8:                                                ; preds = %5
  %9 = load ptr, ptr @__glewDeleteBuffers, align 8, !tbaa !9
  call void %9(i32 noundef 1, ptr noundef @_ZL16g_ElementsHandle)
  store i32 0, ptr @_ZL16g_ElementsHandle, align 4, !tbaa !5
  br label %10

10:                                               ; preds = %8, %5
  %11 = load i32, ptr @_ZL14g_ShaderHandle, align 4, !tbaa !5
  %12 = icmp ne i32 %11, 0
  br i1 %12, label %13, label %20

13:                                               ; preds = %10
  %14 = load i32, ptr @_ZL12g_VertHandle, align 4, !tbaa !5
  %15 = icmp ne i32 %14, 0
  br i1 %15, label %16, label %20

16:                                               ; preds = %13
  %17 = load ptr, ptr @__glewDetachShader, align 8, !tbaa !9
  %18 = load i32, ptr @_ZL14g_ShaderHandle, align 4, !tbaa !5
  %19 = load i32, ptr @_ZL12g_VertHandle, align 4, !tbaa !5
  call void %17(i32 noundef %18, i32 noundef %19)
  br label %20

20:                                               ; preds = %16, %13, %10
  %21 = load i32, ptr @_ZL14g_ShaderHandle, align 4, !tbaa !5
  %22 = icmp ne i32 %21, 0
  br i1 %22, label %23, label %30

23:                                               ; preds = %20
  %24 = load i32, ptr @_ZL12g_FragHandle, align 4, !tbaa !5
  %25 = icmp ne i32 %24, 0
  br i1 %25, label %26, label %30

26:                                               ; preds = %23
  %27 = load ptr, ptr @__glewDetachShader, align 8, !tbaa !9
  %28 = load i32, ptr @_ZL14g_ShaderHandle, align 4, !tbaa !5
  %29 = load i32, ptr @_ZL12g_FragHandle, align 4, !tbaa !5
  call void %27(i32 noundef %28, i32 noundef %29)
  br label %30

30:                                               ; preds = %26, %23, %20
  %31 = load i32, ptr @_ZL12g_VertHandle, align 4, !tbaa !5
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %33, label %36

33:                                               ; preds = %30
  %34 = load ptr, ptr @__glewDeleteShader, align 8, !tbaa !9
  %35 = load i32, ptr @_ZL12g_VertHandle, align 4, !tbaa !5
  call void %34(i32 noundef %35)
  store i32 0, ptr @_ZL12g_VertHandle, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %33, %30
  %37 = load i32, ptr @_ZL12g_FragHandle, align 4, !tbaa !5
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %39, label %42

39:                                               ; preds = %36
  %40 = load ptr, ptr @__glewDeleteShader, align 8, !tbaa !9
  %41 = load i32, ptr @_ZL12g_FragHandle, align 4, !tbaa !5
  call void %40(i32 noundef %41)
  store i32 0, ptr @_ZL12g_FragHandle, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %39, %36
  %43 = load i32, ptr @_ZL14g_ShaderHandle, align 4, !tbaa !5
  %44 = icmp ne i32 %43, 0
  br i1 %44, label %45, label %48

45:                                               ; preds = %42
  %46 = load ptr, ptr @__glewDeleteProgram, align 8, !tbaa !9
  %47 = load i32, ptr @_ZL14g_ShaderHandle, align 4, !tbaa !5
  call void %46(i32 noundef %47)
  store i32 0, ptr @_ZL14g_ShaderHandle, align 4, !tbaa !5
  br label %48

48:                                               ; preds = %45, %42
  call void @_Z37ImGui_ImplOpenGL3_DestroyFontsTexturev()
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z37ImGui_ImplOpenGL3_DestroyFontsTexturev() #0

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" }

!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}


; 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"

@_ZL14g_ShaderHandle = external hidden local_unnamed_addr global i32, align 4
@_ZL12g_VertHandle = external hidden local_unnamed_addr global i32, align 4
@_ZL12g_FragHandle = external hidden local_unnamed_addr global i32, align 4
@_ZL11g_VboHandle = external hidden global i32, align 4
@_ZL16g_ElementsHandle = external hidden global i32, align 4
@__glewDeleteBuffers = external local_unnamed_addr global ptr, align 8
@__glewDetachShader = external local_unnamed_addr global ptr, align 8
@__glewDeleteShader = external local_unnamed_addr global ptr, align 8
@__glewDeleteProgram = external local_unnamed_addr global ptr, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_Z38ImGui_ImplOpenGL3_DestroyDeviceObjectsv() local_unnamed_addr #0 {
  %1 = load i32, ptr @_ZL11g_VboHandle, align 4, !tbaa !5
  %.not = icmp eq i32 %1, 0
  br i1 %.not, label %4, label %2

2:                                                ; preds = %0
  %3 = load ptr, ptr @__glewDeleteBuffers, align 8, !tbaa !9
  tail call void %3(i32 noundef 1, ptr noundef nonnull @_ZL11g_VboHandle)
  store i32 0, ptr @_ZL11g_VboHandle, align 4, !tbaa !5
  br label %4

4:                                                ; preds = %2, %0
  %5 = load i32, ptr @_ZL16g_ElementsHandle, align 4, !tbaa !5
  %.not10 = icmp eq i32 %5, 0
  br i1 %.not10, label %8, label %6

6:                                                ; preds = %4
  %7 = load ptr, ptr @__glewDeleteBuffers, align 8, !tbaa !9
  tail call void %7(i32 noundef 1, ptr noundef nonnull @_ZL16g_ElementsHandle)
  store i32 0, ptr @_ZL16g_ElementsHandle, align 4, !tbaa !5
  br label %8

8:                                                ; preds = %6, %4
  %9 = load i32, ptr @_ZL14g_ShaderHandle, align 4, !tbaa !5
  %10 = icmp ne i32 %9, 0
  %11 = load i32, ptr @_ZL12g_VertHandle, align 4
  %12 = icmp ne i32 %11, 0
  %or.cond = select i1 %10, i1 %12, i1 false
  br i1 %or.cond, label %13, label %15

13:                                               ; preds = %8
  %14 = load ptr, ptr @__glewDetachShader, align 8, !tbaa !9
  tail call void %14(i32 noundef %9, i32 noundef %11)
  %.pre = load i32, ptr @_ZL14g_ShaderHandle, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %13, %8
  %16 = phi i32 [ %.pre, %13 ], [ %9, %8 ]
  %17 = icmp ne i32 %16, 0
  %18 = load i32, ptr @_ZL12g_FragHandle, align 4
  %19 = icmp ne i32 %18, 0
  %or.cond3 = select i1 %17, i1 %19, i1 false
  br i1 %or.cond3, label %20, label %22

20:                                               ; preds = %15
  %21 = load ptr, ptr @__glewDetachShader, align 8, !tbaa !9
  tail call void %21(i32 noundef %16, i32 noundef %18)
  br label %22

22:                                               ; preds = %20, %15
  %23 = load i32, ptr @_ZL12g_VertHandle, align 4, !tbaa !5
  %.not11 = icmp eq i32 %23, 0
  br i1 %.not11, label %26, label %24

24:                                               ; preds = %22
  %25 = load ptr, ptr @__glewDeleteShader, align 8, !tbaa !9
  tail call void %25(i32 noundef %23)
  store i32 0, ptr @_ZL12g_VertHandle, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %24, %22
  %27 = load i32, ptr @_ZL12g_FragHandle, align 4, !tbaa !5
  %.not12 = icmp eq i32 %27, 0
  br i1 %.not12, label %30, label %28

28:                                               ; preds = %26
  %29 = load ptr, ptr @__glewDeleteShader, align 8, !tbaa !9
  tail call void %29(i32 noundef %27)
  store i32 0, ptr @_ZL12g_FragHandle, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %28, %26
  %31 = load i32, ptr @_ZL14g_ShaderHandle, align 4, !tbaa !5
  %.not13 = icmp eq i32 %31, 0
  br i1 %.not13, label %34, label %32

32:                                               ; preds = %30
  %33 = load ptr, ptr @__glewDeleteProgram, align 8, !tbaa !9
  tail call void %33(i32 noundef %31)
  store i32 0, ptr @_ZL14g_ShaderHandle, align 4, !tbaa !5
  br label %34

34:                                               ; preds = %32, %30
  tail call void @_Z37ImGui_ImplOpenGL3_DestroyFontsTexturev()
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z37ImGui_ImplOpenGL3_DestroyFontsTexturev() local_unnamed_addr #0

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" }

!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}


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