; LLVM IR from khushmmehta/Scorch-V :: src/vendor/imgui/backends/imgui_impl_glfw.ll (Z23ImGui_ImplGlfw_Shutdownv)

; 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.ImGui_ImplGlfw_Data = type { ptr, i32, double, ptr, [9 x ptr], %struct.ImVec2, [348 x ptr], i8, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.ImVec2 = type { float, float }
%struct.ImGuiIO = type { i32, i32, %struct.ImVec2, float, float, ptr, ptr, ptr, ptr, float, i8, ptr, %struct.ImVec2, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, float, float, float, float, float, float, i8, i8, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i16, i8, i8, i8, i8, i8, i8, i8, float, i32, i32, i32, i32, %struct.ImVec2, [666 x i32], [666 x i8], [16 x float], ptr, ptr, %struct.ImVec2, [5 x i8], float, float, i32, i32, i8, i8, i8, i8, i32, [666 x %struct.ImGuiKeyData], i8, %struct.ImVec2, [5 x %struct.ImVec2], [5 x double], [5 x i8], [5 x i8], [5 x i16], [5 x i16], [5 x i8], [5 x i8], [5 x i8], i8, [5 x float], [5 x float], [5 x %struct.ImVec2], [5 x float], float, i8, i8, i8, i8, i16, %struct.ImVector }
%struct.ImGuiKeyData = type { i8, float, float, float }
%struct.ImVector = type { i32, i32, ptr }

@.str.2 = external hidden unnamed_addr constant [100 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [73 x i8], align 1
@__PRETTY_FUNCTION__._Z23ImGui_ImplGlfw_Shutdownv = external hidden unnamed_addr constant [31 x i8], align 1

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

; Function Attrs: mustprogress uwtable
declare hidden noundef ptr @_ZL29ImGui_ImplGlfw_GetBackendDatav() #1

declare noundef nonnull align 8 dereferenceable(14624) ptr @_ZN5ImGui5GetIOEv() #2

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z31ImGui_ImplGlfw_RestoreCallbacksP10GLFWwindow(ptr noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z23ImGui_ImplGlfw_Shutdownv() #1 {
  %1 = alloca ptr, align 8
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #4
  %4 = call noundef ptr @_ZL29ImGui_ImplGlfw_GetBackendDatav()
  store ptr %4, ptr %1, align 8, !tbaa !5
  %5 = load ptr, ptr %1, align 8, !tbaa !5
  %6 = icmp ne ptr %5, null
  br i1 %6, label %7, label %8

7:                                                ; preds = %0
  br label %8

8:                                                ; preds = %7, %0
  %9 = phi i1 [ false, %0 ], [ true, %7 ]
  br i1 %9, label %10, label %11

10:                                               ; preds = %8
  br label %13

11:                                               ; preds = %8
  call void @__assert_fail(ptr noundef @.str.7, ptr noundef @.str.2, i32 noundef 674, ptr noundef @__PRETTY_FUNCTION__._Z23ImGui_ImplGlfw_Shutdownv) #5
  unreachable

12:                                               ; No predecessors!
  br label %13

13:                                               ; preds = %12, %10
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  %14 = call noundef nonnull align 8 dereferenceable(14624) ptr @_ZN5ImGui5GetIOEv()
  store ptr %14, ptr %2, align 8, !tbaa !5
  call void @_ZL40ImGui_ImplGlfw_ShutdownPlatformInterfacev()
  %15 = load ptr, ptr %1, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %15, i32 0, i32 7
  %17 = load i8, ptr %16, align 8, !tbaa !9, !range !16, !noundef !17
  %18 = trunc i8 %17 to i1
  br i1 %18, label %19, label %23

19:                                               ; preds = %13
  %20 = load ptr, ptr %1, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %20, i32 0, i32 0
  %22 = load ptr, ptr %21, align 8, !tbaa !18
  call void @_Z31ImGui_ImplGlfw_RestoreCallbacksP10GLFWwindow(ptr noundef %22)
  br label %23

23:                                               ; preds = %19, %13
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 0, ptr %3, align 4, !tbaa !19
  br label %24

24:                                               ; preds = %35, %23
  %25 = load i32, ptr %3, align 4, !tbaa !19
  %26 = icmp slt i32 %25, 9
  br i1 %26, label %28, label %27

27:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %38

28:                                               ; preds = %24
  %29 = load ptr, ptr %1, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %29, i32 0, i32 4
  %31 = load i32, ptr %3, align 4, !tbaa !19
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [9 x ptr], ptr %30, i64 0, i64 %32
  %34 = load ptr, ptr %33, align 8, !tbaa !5
  call void @glfwDestroyCursor(ptr noundef %34)
  br label %35

35:                                               ; preds = %28
  %36 = load i32, ptr %3, align 4, !tbaa !19
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %3, align 4, !tbaa !19
  br label %24, !llvm.loop !21

38:                                               ; preds = %27
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.ImGuiIO, ptr %39, i32 0, i32 39
  store ptr null, ptr %40, align 8, !tbaa !23
  %41 = load ptr, ptr %2, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.ImGuiIO, ptr %41, i32 0, i32 41
  store ptr null, ptr %42, align 8, !tbaa !28
  %43 = load ptr, ptr %2, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.ImGuiIO, ptr %43, i32 0, i32 1
  %45 = load i32, ptr %44, align 4, !tbaa !29
  %46 = and i32 %45, -3080
  store i32 %46, ptr %44, align 4, !tbaa !29
  %47 = load ptr, ptr %1, align 8, !tbaa !5
  call void @_Z9IM_DELETEI19ImGui_ImplGlfw_DataEvPT_(ptr noundef %47)
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #4
  ret void
}

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL40ImGui_ImplGlfw_ShutdownPlatformInterfacev() #1

declare void @glfwDestroyCursor(ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z9IM_DELETEI19ImGui_ImplGlfw_DataEvPT_(ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "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 = { noreturn 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 = { nounwind }
attributes #5 = { 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, !15, i64 2896}
!10 = !{!"_ZTS19ImGui_ImplGlfw_Data", !6, i64 0, !11, i64 8, !12, i64 16, !6, i64 24, !7, i64 32, !13, i64 104, !7, i64 112, !15, i64 2896, !15, i64 2897, !15, i64 2898, !6, i64 2904, !6, i64 2912, !6, i64 2920, !6, i64 2928, !6, i64 2936, !6, i64 2944, !6, i64 2952, !6, i64 2960}
!11 = !{!"_ZTS13GlfwClientApi", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!"_ZTS6ImVec2", !14, i64 0, !14, i64 4}
!14 = !{!"float", !7, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!10, !6, i64 0}
!19 = !{!20, !20, i64 0}
!20 = !{!"int", !7, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!24, !6, i64 128}
!24 = !{!"_ZTS7ImGuiIO", !20, i64 0, !20, i64 4, !13, i64 8, !14, i64 16, !14, i64 20, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !14, i64 56, !15, i64 60, !6, i64 64, !13, i64 72, !15, i64 80, !15, i64 81, !15, i64 82, !15, i64 83, !15, i64 84, !15, i64 85, !15, i64 86, !15, i64 87, !15, i64 88, !15, i64 89, !15, i64 90, !15, i64 91, !15, i64 92, !15, i64 93, !15, i64 94, !15, i64 95, !14, i64 96, !14, i64 100, !14, i64 104, !14, i64 108, !14, i64 112, !14, i64 116, !15, i64 120, !15, i64 121, !15, i64 122, !15, i64 123, !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, !25, i64 200, !15, i64 202, !15, i64 203, !15, i64 204, !15, i64 205, !15, i64 206, !15, i64 207, !15, i64 208, !14, i64 212, !20, i64 216, !20, i64 220, !20, i64 224, !20, i64 228, !13, i64 232, !7, i64 240, !7, i64 2904, !7, i64 3572, !6, i64 3640, !6, i64 3648, !13, i64 3656, !7, i64 3664, !14, i64 3672, !14, i64 3676, !26, i64 3680, !20, i64 3684, !15, i64 3688, !15, i64 3689, !15, i64 3690, !15, i64 3691, !20, i64 3692, !7, i64 3696, !15, i64 14352, !13, i64 14356, !7, i64 14364, !7, i64 14408, !7, i64 14448, !7, i64 14453, !7, i64 14458, !7, i64 14468, !7, i64 14478, !7, i64 14483, !7, i64 14488, !15, i64 14493, !7, i64 14496, !7, i64 14516, !7, i64 14536, !7, i64 14576, !14, i64 14596, !15, i64 14600, !15, i64 14601, !7, i64 14602, !15, i64 14603, !25, i64 14604, !27, i64 14608}
!25 = !{!"short", !7, i64 0}
!26 = !{!"_ZTS16ImGuiMouseSource", !7, i64 0}
!27 = !{!"_ZTS8ImVectorItE", !20, i64 0, !20, i64 4, !6, i64 8}
!28 = !{!24, !6, i64 144}
!29 = !{!24, !20, i64 4}


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

@.str.2 = external hidden unnamed_addr constant [100 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [73 x i8], align 1
@__PRETTY_FUNCTION__._Z23ImGui_ImplGlfw_Shutdownv = external hidden unnamed_addr constant [31 x i8], align 1

; Function Attrs: mustprogress uwtable
declare hidden noundef ptr @_ZL29ImGui_ImplGlfw_GetBackendDatav() local_unnamed_addr #0

declare noundef nonnull align 8 dereferenceable(14624) ptr @_ZN5ImGui5GetIOEv() local_unnamed_addr #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z31ImGui_ImplGlfw_RestoreCallbacksP10GLFWwindow(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_Z23ImGui_ImplGlfw_Shutdownv() local_unnamed_addr #0 {
  %1 = tail call noundef ptr @_ZL29ImGui_ImplGlfw_GetBackendDatav()
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %2, label %3

2:                                                ; preds = %0
  tail call void @__assert_fail(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.2, i32 noundef 674, ptr noundef nonnull @__PRETTY_FUNCTION__._Z23ImGui_ImplGlfw_Shutdownv) #3
  unreachable

3:                                                ; preds = %0
  %4 = tail call noundef nonnull align 8 dereferenceable(14624) ptr @_ZN5ImGui5GetIOEv()
  tail call void @_ZL40ImGui_ImplGlfw_ShutdownPlatformInterfacev()
  %5 = getelementptr inbounds i8, ptr %1, i64 2896
  %6 = load i8, ptr %5, align 8, !tbaa !5, !range !15, !noundef !16
  %7 = trunc nuw i8 %6 to i1
  br i1 %7, label %8, label %10

8:                                                ; preds = %3
  %9 = load ptr, ptr %1, align 8, !tbaa !17
  tail call void @_Z31ImGui_ImplGlfw_RestoreCallbacksP10GLFWwindow(ptr noundef %9)
  br label %10

10:                                               ; preds = %8, %3
  %11 = getelementptr inbounds i8, ptr %1, i64 32
  %12 = load ptr, ptr %11, align 8, !tbaa !18
  tail call void @glfwDestroyCursor(ptr noundef %12)
  %13 = getelementptr inbounds i8, ptr %1, i64 40
  %14 = load ptr, ptr %13, align 8, !tbaa !18
  tail call void @glfwDestroyCursor(ptr noundef %14)
  %15 = getelementptr inbounds i8, ptr %1, i64 48
  %16 = load ptr, ptr %15, align 8, !tbaa !18
  tail call void @glfwDestroyCursor(ptr noundef %16)
  %17 = getelementptr inbounds i8, ptr %1, i64 56
  %18 = load ptr, ptr %17, align 8, !tbaa !18
  tail call void @glfwDestroyCursor(ptr noundef %18)
  %19 = getelementptr inbounds i8, ptr %1, i64 64
  %20 = load ptr, ptr %19, align 8, !tbaa !18
  tail call void @glfwDestroyCursor(ptr noundef %20)
  %21 = getelementptr inbounds i8, ptr %1, i64 72
  %22 = load ptr, ptr %21, align 8, !tbaa !18
  tail call void @glfwDestroyCursor(ptr noundef %22)
  %23 = getelementptr inbounds i8, ptr %1, i64 80
  %24 = load ptr, ptr %23, align 8, !tbaa !18
  tail call void @glfwDestroyCursor(ptr noundef %24)
  %25 = getelementptr inbounds i8, ptr %1, i64 88
  %26 = load ptr, ptr %25, align 8, !tbaa !18
  tail call void @glfwDestroyCursor(ptr noundef %26)
  %27 = getelementptr inbounds i8, ptr %1, i64 96
  %28 = load ptr, ptr %27, align 8, !tbaa !18
  tail call void @glfwDestroyCursor(ptr noundef %28)
  %29 = getelementptr inbounds i8, ptr %4, i64 128
  store ptr null, ptr %29, align 8, !tbaa !19
  %30 = getelementptr inbounds i8, ptr %4, i64 144
  store ptr null, ptr %30, align 8, !tbaa !25
  %31 = getelementptr inbounds i8, ptr %4, i64 4
  %32 = load i32, ptr %31, align 4, !tbaa !26
  %33 = and i32 %32, -3080
  store i32 %33, ptr %31, align 4, !tbaa !26
  tail call void @_Z9IM_DELETEI19ImGui_ImplGlfw_DataEvPT_(ptr noundef nonnull %1)
  ret void
}

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL40ImGui_ImplGlfw_ShutdownPlatformInterfacev() local_unnamed_addr #0

declare void @glfwDestroyCursor(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z9IM_DELETEI19ImGui_ImplGlfw_DataEvPT_(ptr noundef) 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" }
attributes #1 = { "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 "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 = { 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, !14, i64 2896}
!6 = !{!"_ZTS19ImGui_ImplGlfw_Data", !7, i64 0, !10, i64 8, !11, i64 16, !7, i64 24, !8, i64 32, !12, i64 104, !8, i64 112, !14, i64 2896, !14, i64 2897, !14, i64 2898, !7, i64 2904, !7, i64 2912, !7, i64 2920, !7, i64 2928, !7, i64 2936, !7, i64 2944, !7, i64 2952, !7, i64 2960}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTS13GlfwClientApi", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!"_ZTS6ImVec2", !13, i64 0, !13, i64 4}
!13 = !{!"float", !8, i64 0}
!14 = !{!"bool", !8, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!6, !7, i64 0}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !7, i64 128}
!20 = !{!"_ZTS7ImGuiIO", !21, i64 0, !21, i64 4, !12, i64 8, !13, i64 16, !13, i64 20, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !13, i64 56, !14, i64 60, !7, i64 64, !12, i64 72, !14, i64 80, !14, i64 81, !14, i64 82, !14, i64 83, !14, i64 84, !14, i64 85, !14, i64 86, !14, i64 87, !14, i64 88, !14, i64 89, !14, i64 90, !14, i64 91, !14, i64 92, !14, i64 93, !14, i64 94, !14, i64 95, !13, i64 96, !13, i64 100, !13, i64 104, !13, i64 108, !13, i64 112, !13, i64 116, !14, i64 120, !14, i64 121, !14, i64 122, !14, i64 123, !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, !22, i64 200, !14, i64 202, !14, i64 203, !14, i64 204, !14, i64 205, !14, i64 206, !14, i64 207, !14, i64 208, !13, i64 212, !21, i64 216, !21, i64 220, !21, i64 224, !21, i64 228, !12, i64 232, !8, i64 240, !8, i64 2904, !8, i64 3572, !7, i64 3640, !7, i64 3648, !12, i64 3656, !8, i64 3664, !13, i64 3672, !13, i64 3676, !23, i64 3680, !21, i64 3684, !14, i64 3688, !14, i64 3689, !14, i64 3690, !14, i64 3691, !21, i64 3692, !8, i64 3696, !14, i64 14352, !12, i64 14356, !8, i64 14364, !8, i64 14408, !8, i64 14448, !8, i64 14453, !8, i64 14458, !8, i64 14468, !8, i64 14478, !8, i64 14483, !8, i64 14488, !14, i64 14493, !8, i64 14496, !8, i64 14516, !8, i64 14536, !8, i64 14576, !13, i64 14596, !14, i64 14600, !14, i64 14601, !8, i64 14602, !14, i64 14603, !22, i64 14604, !24, i64 14608}
!21 = !{!"int", !8, i64 0}
!22 = !{!"short", !8, i64 0}
!23 = !{!"_ZTS16ImGuiMouseSource", !8, i64 0}
!24 = !{!"_ZTS8ImVectorItE", !21, i64 0, !21, i64 4, !7, i64 8}
!25 = !{!20, !7, i64 144}
!26 = !{!20, !21, i64 4}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,SROAPass,SimplifyCFGPass,TailCallElimPass