; LLVM IR from PepcyCh/bisemutum-engine :: bisemutum/thirdparty/ImGuizmo/example/imgui.ll (ZN7ImGuiIO14ClearInputKeysEv)

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

; 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: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN7ImGuiIO14ClearInputKeysEv(ptr noundef nonnull align 8 dereferenceable(14264) %0) #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8
  %5 = getelementptr inbounds %struct.ImGuiIO, ptr %4, i32 0, i32 54
  %6 = getelementptr inbounds [652 x i8], ptr %5, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 8 %6, i8 0, i64 652, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %7

7:                                                ; preds = %27, %1
  %8 = load i32, ptr %3, align 4, !tbaa !9
  %9 = icmp slt i32 %8, 652
  br i1 %9, label %11, label %10

10:                                               ; preds = %7
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  br label %30

11:                                               ; preds = %7
  %12 = getelementptr inbounds %struct.ImGuiIO, ptr %4, i32 0, i32 65
  %13 = load i32, ptr %3, align 4, !tbaa !9
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds [652 x %struct.ImGuiKeyData], ptr %12, i64 0, i64 %14
  %16 = getelementptr inbounds %struct.ImGuiKeyData, ptr %15, i32 0, i32 0
  store i8 0, ptr %16, align 4, !tbaa !11
  %17 = getelementptr inbounds %struct.ImGuiIO, ptr %4, i32 0, i32 65
  %18 = load i32, ptr %3, align 4, !tbaa !9
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [652 x %struct.ImGuiKeyData], ptr %17, i64 0, i64 %19
  %21 = getelementptr inbounds %struct.ImGuiKeyData, ptr %20, i32 0, i32 1
  store float -1.000000e+00, ptr %21, align 4, !tbaa !15
  %22 = getelementptr inbounds %struct.ImGuiIO, ptr %4, i32 0, i32 65
  %23 = load i32, ptr %3, align 4, !tbaa !9
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [652 x %struct.ImGuiKeyData], ptr %22, i64 0, i64 %24
  %26 = getelementptr inbounds %struct.ImGuiKeyData, ptr %25, i32 0, i32 2
  store float -1.000000e+00, ptr %26, align 4, !tbaa !16
  br label %27

27:                                               ; preds = %11
  %28 = load i32, ptr %3, align 4, !tbaa !9
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %3, align 4, !tbaa !9
  br label %7, !llvm.loop !17

30:                                               ; preds = %10
  %31 = getelementptr inbounds %struct.ImGuiIO, ptr %4, i32 0, i32 63
  store i8 0, ptr %31, align 1, !tbaa !19
  %32 = getelementptr inbounds %struct.ImGuiIO, ptr %4, i32 0, i32 62
  store i8 0, ptr %32, align 2, !tbaa !24
  %33 = getelementptr inbounds %struct.ImGuiIO, ptr %4, i32 0, i32 61
  store i8 0, ptr %33, align 1, !tbaa !25
  %34 = getelementptr inbounds %struct.ImGuiIO, ptr %4, i32 0, i32 60
  store i8 0, ptr %34, align 4, !tbaa !26
  %35 = getelementptr inbounds %struct.ImGuiIO, ptr %4, i32 0, i32 64
  store i32 0, ptr %35, align 8, !tbaa !27
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { 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 #3 = { 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, !13, i64 0}
!12 = !{!"_ZTS12ImGuiKeyData", !13, i64 0, !14, i64 4, !14, i64 8, !14, i64 12}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = !{!12, !14, i64 4}
!16 = !{!12, !14, i64 8}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!20, !13, i64 3599}
!20 = !{!"_ZTS7ImGuiIO", !10, i64 0, !10, i64 4, !21, i64 8, !14, i64 16, !14, i64 20, !6, i64 24, !6, i64 32, !14, i64 40, !14, i64 44, !14, i64 48, !14, i64 52, !14, i64 56, !14, i64 60, !14, i64 64, !6, i64 72, !6, i64 80, !14, i64 88, !13, i64 92, !6, i64 96, !21, i64 104, !13, i64 112, !13, i64 113, !13, i64 114, !13, i64 115, !13, i64 116, !13, i64 117, !13, i64 118, !13, i64 119, !14, 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, !13, i64 208, !13, i64 209, !13, i64 210, !13, i64 211, !13, i64 212, !13, i64 213, !13, i64 214, !14, i64 216, !10, i64 220, !10, i64 224, !10, i64 228, !10, i64 232, !10, i64 236, !21, i64 240, !7, i64 248, !7, i64 2856, !7, i64 3508, !21, i64 3572, !7, i64 3580, !14, i64 3588, !14, i64 3592, !13, i64 3596, !13, i64 3597, !13, i64 3598, !13, i64 3599, !10, i64 3600, !7, i64 3604, !13, i64 14036, !21, i64 14040, !7, i64 14048, !7, i64 14088, !7, i64 14128, !7, i64 14133, !7, i64 14138, !7, i64 14148, !7, i64 14158, !7, i64 14163, !7, i64 14168, !7, i64 14176, !7, i64 14196, !7, i64 14216, !14, i64 14236, !13, i64 14240, !13, i64 14241, !7, i64 14242, !13, i64 14243, !22, i64 14244, !23, i64 14248}
!21 = !{!"_ZTS6ImVec2", !14, i64 0, !14, i64 4}
!22 = !{!"short", !7, i64 0}
!23 = !{!"_ZTS8ImVectorItE", !10, i64 0, !10, i64 4, !6, i64 8}
!24 = !{!20, !13, i64 3598}
!25 = !{!20, !13, i64 3597}
!26 = !{!20, !13, i64 3596}
!27 = !{!20, !10, i64 3600}


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

%struct.ImGuiKeyData = type { i8, float, float, float }

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

; Function Attrs: mustprogress nofree norecurse nosync nounwind memory(argmem: write) uwtable
define dso_local void @_ZN7ImGuiIO14ClearInputKeysEv(ptr nocapture noundef nonnull writeonly align 8 dereferenceable(14264) %0) local_unnamed_addr #1 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 2856
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(652) %2, i8 0, i64 652, i1 false)
  %3 = getelementptr inbounds i8, ptr %0, i64 3604
  br label %6

4:                                                ; preds = %6
  %5 = getelementptr inbounds i8, ptr %0, i64 3596
  store i64 0, ptr %5, align 4
  ret void

6:                                                ; preds = %6, %1
  %indvars.iv = phi i64 [ 0, %1 ], [ %indvars.iv.next.3, %6 ]
  %7 = getelementptr inbounds [652 x %struct.ImGuiKeyData], ptr %3, i64 0, i64 %indvars.iv
  store i8 0, ptr %7, align 4, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %7, i64 4
  store <2 x float> <float -1.000000e+00, float -1.000000e+00>, ptr %8, align 8, !tbaa !11
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %9 = getelementptr inbounds [652 x %struct.ImGuiKeyData], ptr %3, i64 0, i64 %indvars.iv.next
  store i8 0, ptr %9, align 4, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %9, i64 4
  store <2 x float> <float -1.000000e+00, float -1.000000e+00>, ptr %10, align 8, !tbaa !11
  %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 2
  %11 = getelementptr inbounds [652 x %struct.ImGuiKeyData], ptr %3, i64 0, i64 %indvars.iv.next.1
  store i8 0, ptr %11, align 4, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %11, i64 4
  store <2 x float> <float -1.000000e+00, float -1.000000e+00>, ptr %12, align 8, !tbaa !11
  %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 3
  %13 = getelementptr inbounds [652 x %struct.ImGuiKeyData], ptr %3, i64 0, i64 %indvars.iv.next.2
  store i8 0, ptr %13, align 4, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %13, i64 4
  store <2 x float> <float -1.000000e+00, float -1.000000e+00>, ptr %14, align 8, !tbaa !11
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, 652
  br i1 %exitcond.not.3, label %4, label %6, !llvm.loop !12
}

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { mustprogress nofree norecurse nosync nounwind memory(argmem: write) 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, !7, i64 0}
!6 = !{!"_ZTS12ImGuiKeyData", !7, i64 0, !10, i64 4, !10, i64 8, !10, i64 12}
!7 = !{!"bool", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"float", !8, i64 0}
!11 = !{!10, !10, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,LoopUnrollPass,MemCpyOptPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass