; LLVM IR from hadryansalles/Luz :: deps/imgui/imgui.ll (ZN5ImGui28RenderPlatformWindowsDefaultEPvS0_)

; 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.ImGuiPlatformIO = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, %struct.ImVector.0, %struct.ImVector.1 }
%struct.ImVector.0 = type { i32, i32, ptr }
%struct.ImVector.1 = type { i32, i32, ptr }
%struct.ImGuiViewport = type <{ i32, i32, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, float, i32, ptr, ptr, ptr, ptr, ptr, i8, i8, i8, i8, [4 x i8] }>
%struct.ImVec2 = type { float, float }

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5ImGui28RenderPlatformWindowsDefaultEPvS0_(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %11 = call noundef nonnull align 8 dereferenceable(216) ptr @_ZN5ImGui13GetPlatformIOEv()
  store ptr %11, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 1, ptr %6, align 4, !tbaa !9
  br label %12

12:                                               ; preds = %58, %2
  %13 = load i32, ptr %6, align 4, !tbaa !9
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.ImGuiPlatformIO, ptr %14, i32 0, i32 24
  %16 = getelementptr inbounds %struct.ImVector.1, ptr %15, i32 0, i32 0
  %17 = load i32, ptr %16, align 8, !tbaa !11
  %18 = icmp slt i32 %13, %17
  br i1 %18, label %20, label %19

19:                                               ; preds = %12
  store i32 2, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %61

20:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.ImGuiPlatformIO, ptr %21, i32 0, i32 24
  %23 = load i32, ptr %6, align 4, !tbaa !9
  %24 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8ImVectorIP13ImGuiViewportEixEi(ptr noundef nonnull align 8 dereferenceable(16) %22, i32 noundef %23)
  %25 = load ptr, ptr %24, align 8, !tbaa !5
  store ptr %25, ptr %8, align 8, !tbaa !5
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.ImGuiViewport, ptr %26, i32 0, i32 1
  %28 = load i32, ptr %27, align 4, !tbaa !15
  %29 = and i32 %28, 4096
  %30 = icmp ne i32 %29, 0
  br i1 %30, label %31, label %32

31:                                               ; preds = %20
  store i32 4, ptr %7, align 4
  br label %55

32:                                               ; preds = %20
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.ImGuiPlatformIO, ptr %33, i32 0, i32 13
  %35 = load ptr, ptr %34, align 8, !tbaa !20
  %36 = icmp ne ptr %35, null
  br i1 %36, label %37, label %43

37:                                               ; preds = %32
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.ImGuiPlatformIO, ptr %38, i32 0, i32 13
  %40 = load ptr, ptr %39, align 8, !tbaa !20
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  call void %40(ptr noundef %41, ptr noundef %42)
  br label %43

43:                                               ; preds = %37, %32
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.ImGuiPlatformIO, ptr %44, i32 0, i32 21
  %46 = load ptr, ptr %45, align 8, !tbaa !21
  %47 = icmp ne ptr %46, null
  br i1 %47, label %48, label %54

48:                                               ; preds = %43
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.ImGuiPlatformIO, ptr %49, i32 0, i32 21
  %51 = load ptr, ptr %50, align 8, !tbaa !21
  %52 = load ptr, ptr %8, align 8, !tbaa !5
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  call void %51(ptr noundef %52, ptr noundef %53)
  br label %54

54:                                               ; preds = %48, %43
  store i32 0, ptr %7, align 4
  br label %55

55:                                               ; preds = %54, %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  %56 = load i32, ptr %7, align 4
  switch i32 %56, label %112 [
    i32 0, label %57
    i32 4, label %58
  ]

57:                                               ; preds = %55
  br label %58

58:                                               ; preds = %57, %55
  %59 = load i32, ptr %6, align 4, !tbaa !9
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %6, align 4, !tbaa !9
  br label %12, !llvm.loop !22

61:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 1, ptr %9, align 4, !tbaa !9
  br label %62

62:                                               ; preds = %108, %61
  %63 = load i32, ptr %9, align 4, !tbaa !9
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.ImGuiPlatformIO, ptr %64, i32 0, i32 24
  %66 = getelementptr inbounds %struct.ImVector.1, ptr %65, i32 0, i32 0
  %67 = load i32, ptr %66, align 8, !tbaa !11
  %68 = icmp slt i32 %63, %67
  br i1 %68, label %70, label %69

69:                                               ; preds = %62
  store i32 5, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %111

70:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %71 = load ptr, ptr %5, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.ImGuiPlatformIO, ptr %71, i32 0, i32 24
  %73 = load i32, ptr %9, align 4, !tbaa !9
  %74 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8ImVectorIP13ImGuiViewportEixEi(ptr noundef nonnull align 8 dereferenceable(16) %72, i32 noundef %73)
  %75 = load ptr, ptr %74, align 8, !tbaa !5
  store ptr %75, ptr %10, align 8, !tbaa !5
  %76 = load ptr, ptr %10, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.ImGuiViewport, ptr %76, i32 0, i32 1
  %78 = load i32, ptr %77, align 4, !tbaa !15
  %79 = and i32 %78, 4096
  %80 = icmp ne i32 %79, 0
  br i1 %80, label %81, label %82

81:                                               ; preds = %70
  store i32 7, ptr %7, align 4
  br label %105

82:                                               ; preds = %70
  %83 = load ptr, ptr %5, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.ImGuiPlatformIO, ptr %83, i32 0, i32 14
  %85 = load ptr, ptr %84, align 8, !tbaa !24
  %86 = icmp ne ptr %85, null
  br i1 %86, label %87, label %93

87:                                               ; preds = %82
  %88 = load ptr, ptr %5, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.ImGuiPlatformIO, ptr %88, i32 0, i32 14
  %90 = load ptr, ptr %89, align 8, !tbaa !24
  %91 = load ptr, ptr %10, align 8, !tbaa !5
  %92 = load ptr, ptr %3, align 8, !tbaa !5
  call void %90(ptr noundef %91, ptr noundef %92)
  br label %93

93:                                               ; preds = %87, %82
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.ImGuiPlatformIO, ptr %94, i32 0, i32 22
  %96 = load ptr, ptr %95, align 8, !tbaa !25
  %97 = icmp ne ptr %96, null
  br i1 %97, label %98, label %104

98:                                               ; preds = %93
  %99 = load ptr, ptr %5, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.ImGuiPlatformIO, ptr %99, i32 0, i32 22
  %101 = load ptr, ptr %100, align 8, !tbaa !25
  %102 = load ptr, ptr %10, align 8, !tbaa !5
  %103 = load ptr, ptr %4, align 8, !tbaa !5
  call void %101(ptr noundef %102, ptr noundef %103)
  br label %104

104:                                              ; preds = %98, %93
  store i32 0, ptr %7, align 4
  br label %105

105:                                              ; preds = %104, %81
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  %106 = load i32, ptr %7, align 4
  switch i32 %106, label %112 [
    i32 0, label %107
    i32 7, label %108
  ]

107:                                              ; preds = %105
  br label %108

108:                                              ; preds = %107, %105
  %109 = load i32, ptr %9, align 4, !tbaa !9
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %9, align 4, !tbaa !9
  br label %62, !llvm.loop !26

111:                                              ; preds = %69
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret void

112:                                              ; preds = %105, %55
  unreachable
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN8ImVectorIP13ImGuiViewportEixEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #3 = { 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 #4 = { 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}
!11 = !{!12, !10, i64 200}
!12 = !{!"_ZTS15ImGuiPlatformIO", !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, !13, i64 184, !14, i64 200}
!13 = !{!"_ZTS8ImVectorI20ImGuiPlatformMonitorE", !10, i64 0, !10, i64 4, !6, i64 8}
!14 = !{!"_ZTS8ImVectorIP13ImGuiViewportE", !10, i64 0, !10, i64 4, !6, i64 8}
!15 = !{!16, !10, i64 4}
!16 = !{!"_ZTS13ImGuiViewport", !10, i64 0, !10, i64 4, !17, i64 8, !17, i64 16, !17, i64 24, !17, i64 32, !18, i64 40, !10, i64 44, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !19, i64 88, !19, i64 89, !19, i64 90, !19, i64 91}
!17 = !{!"_ZTS6ImVec2", !18, i64 0, !18, i64 4}
!18 = !{!"float", !7, i64 0}
!19 = !{!"bool", !7, i64 0}
!20 = !{!12, !6, i64 104}
!21 = !{!12, !6, i64 168}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!12, !6, i64 112}
!25 = !{!12, !6, i64 176}
!26 = distinct !{!26, !23}


; 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 nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(216) ptr @_ZN5ImGui13GetPlatformIOEv() local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5ImGui28RenderPlatformWindowsDefaultEPvS0_(ptr noundef %0, ptr noundef %1) local_unnamed_addr #1 {
  %3 = tail call noundef nonnull align 8 dereferenceable(216) ptr @_ZN5ImGui13GetPlatformIOEv()
  %4 = getelementptr inbounds i8, ptr %3, i64 200
  %5 = load i32, ptr %4, align 8, !tbaa !5
  %6 = icmp sgt i32 %5, 1
  br i1 %6, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %2
  %7 = getelementptr inbounds i8, ptr %3, i64 104
  %8 = getelementptr inbounds i8, ptr %3, i64 168
  br label %12

.preheader:                                       ; preds = %24
  %9 = icmp sgt i32 %26, 1
  br i1 %9, label %.lr.ph39, label %._crit_edge

.lr.ph39:                                         ; preds = %.preheader
  %10 = getelementptr inbounds i8, ptr %3, i64 112
  %11 = getelementptr inbounds i8, ptr %3, i64 176
  br label %28

12:                                               ; preds = %.lr.ph, %24
  %.037 = phi i32 [ 1, %.lr.ph ], [ %25, %24 ]
  %13 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8ImVectorIP13ImGuiViewportEixEi(ptr noundef nonnull align 8 dereferenceable(16) %4, i32 noundef %.037)
  %14 = load ptr, ptr %13, align 8, !tbaa !13
  %15 = getelementptr inbounds i8, ptr %14, i64 4
  %16 = load i32, ptr %15, align 4, !tbaa !14
  %17 = and i32 %16, 4096
  %.not34 = icmp eq i32 %17, 0
  br i1 %.not34, label %18, label %24

18:                                               ; preds = %12
  %19 = load ptr, ptr %7, align 8, !tbaa !19
  %.not35 = icmp eq ptr %19, null
  br i1 %.not35, label %21, label %20

20:                                               ; preds = %18
  tail call void %19(ptr noundef nonnull %14, ptr noundef %0)
  br label %21

21:                                               ; preds = %20, %18
  %22 = load ptr, ptr %8, align 8, !tbaa !20
  %.not36 = icmp eq ptr %22, null
  br i1 %.not36, label %24, label %23

23:                                               ; preds = %21
  tail call void %22(ptr noundef nonnull %14, ptr noundef %1)
  br label %24

24:                                               ; preds = %21, %23, %12
  %25 = add nuw nsw i32 %.037, 1
  %26 = load i32, ptr %4, align 8, !tbaa !5
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %12, label %.preheader, !llvm.loop !21

._crit_edge:                                      ; preds = %40, %2, %.preheader
  ret void

28:                                               ; preds = %.lr.ph39, %40
  %.02738 = phi i32 [ 1, %.lr.ph39 ], [ %41, %40 ]
  %29 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8ImVectorIP13ImGuiViewportEixEi(ptr noundef nonnull align 8 dereferenceable(16) %4, i32 noundef %.02738)
  %30 = load ptr, ptr %29, align 8, !tbaa !13
  %31 = getelementptr inbounds i8, ptr %30, i64 4
  %32 = load i32, ptr %31, align 4, !tbaa !14
  %33 = and i32 %32, 4096
  %.not = icmp eq i32 %33, 0
  br i1 %.not, label %34, label %40

34:                                               ; preds = %28
  %35 = load ptr, ptr %10, align 8, !tbaa !23
  %.not32 = icmp eq ptr %35, null
  br i1 %.not32, label %37, label %36

36:                                               ; preds = %34
  tail call void %35(ptr noundef nonnull %30, ptr noundef %0)
  br label %37

37:                                               ; preds = %36, %34
  %38 = load ptr, ptr %11, align 8, !tbaa !24
  %.not33 = icmp eq ptr %38, null
  br i1 %.not33, label %40, label %39

39:                                               ; preds = %37
  tail call void %38(ptr noundef nonnull %30, ptr noundef %1)
  br label %40

40:                                               ; preds = %37, %39, %28
  %41 = add nuw nsw i32 %.02738, 1
  %42 = load i32, ptr %4, align 8, !tbaa !5
  %43 = icmp slt i32 %41, %42
  br i1 %43, label %28, label %._crit_edge, !llvm.loop !25
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN8ImVectorIP13ImGuiViewportEixEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) local_unnamed_addr #2 align 2

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

!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, !11, i64 200}
!6 = !{!"_ZTS15ImGuiPlatformIO", !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, !10, i64 184, !12, i64 200}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTS8ImVectorI20ImGuiPlatformMonitorE", !11, i64 0, !11, i64 4, !7, i64 8}
!11 = !{!"int", !8, i64 0}
!12 = !{!"_ZTS8ImVectorIP13ImGuiViewportE", !11, i64 0, !11, i64 4, !7, i64 8}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !11, i64 4}
!15 = !{!"_ZTS13ImGuiViewport", !11, i64 0, !11, i64 4, !16, i64 8, !16, i64 16, !16, i64 24, !16, i64 32, !17, i64 40, !11, i64 44, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !18, i64 88, !18, i64 89, !18, i64 90, !18, i64 91}
!16 = !{!"_ZTS6ImVec2", !17, i64 0, !17, i64 4}
!17 = !{!"float", !8, i64 0}
!18 = !{!"bool", !8, i64 0}
!19 = !{!6, !7, i64 104}
!20 = !{!6, !7, i64 168}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!6, !7, i64 112}
!24 = !{!6, !7, i64 176}
!25 = distinct !{!25, !22}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass