; LLVM IR from jan-van-bergen/GPU-Raytracer :: include/Imgui/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, ptr, ptr, float, i8, ptr, %struct.ImVec2, 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, [645 x i32], [512 x i8], %struct.ImVec2, [5 x i8], float, float, i8, i8, i8, i8, [20 x float], i32, i32, [645 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], [20 x float], [20 x float], float, 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(14160) %0) #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  %6 = getelementptr inbounds %struct.ImGuiIO, ptr %5, i32 0, i32 51
  %7 = getelementptr inbounds [512 x i8], ptr %6, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 4 %7, i8 0, i64 512, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %8

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

11:                                               ; preds = %8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  br label %31

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

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

31:                                               ; preds = %11
  %32 = getelementptr inbounds %struct.ImGuiIO, ptr %5, i32 0, i32 59
  store i8 0, ptr %32, align 1, !tbaa !19
  %33 = getelementptr inbounds %struct.ImGuiIO, ptr %5, i32 0, i32 58
  store i8 0, ptr %33, align 2, !tbaa !24
  %34 = getelementptr inbounds %struct.ImGuiIO, ptr %5, i32 0, i32 57
  store i8 0, ptr %34, align 1, !tbaa !25
  %35 = getelementptr inbounds %struct.ImGuiIO, ptr %5, i32 0, i32 56
  store i8 0, ptr %35, align 4, !tbaa !26
  %36 = getelementptr inbounds %struct.ImGuiIO, ptr %5, i32 0, i32 62
  store i32 0, ptr %36, align 4, !tbaa !27
  %37 = getelementptr inbounds %struct.ImGuiIO, ptr %5, i32 0, i32 61
  store i32 0, ptr %37, align 8, !tbaa !28
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %38

38:                                               ; preds = %51, %31
  %39 = load i32, ptr %4, align 4, !tbaa !9
  %40 = icmp slt i32 %39, 20
  br i1 %40, label %42, label %41

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

42:                                               ; preds = %38
  %43 = getelementptr inbounds %struct.ImGuiIO, ptr %5, i32 0, i32 79
  %44 = load i32, ptr %4, align 4, !tbaa !9
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [20 x float], ptr %43, i64 0, i64 %45
  store float -1.000000e+00, ptr %46, align 4, !tbaa !29
  %47 = getelementptr inbounds %struct.ImGuiIO, ptr %5, i32 0, i32 78
  %48 = load i32, ptr %4, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [20 x float], ptr %47, i64 0, i64 %49
  store float -1.000000e+00, ptr %50, align 4, !tbaa !29
  br label %51

51:                                               ; preds = %42
  %52 = load i32, ptr %4, align 4, !tbaa !9
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %4, align 4, !tbaa !9
  br label %38, !llvm.loop !30

54:                                               ; preds = %41
  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 3359}
!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, !6, i64 64, !6, i64 72, !14, i64 80, !13, i64 84, !6, i64 88, !21, i64 96, !13, i64 104, !13, i64 105, !13, i64 106, !13, i64 107, !13, i64 108, !13, i64 109, !13, i64 110, !14, 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, !13, i64 200, !13, i64 201, !13, i64 202, !13, i64 203, !13, i64 204, !13, i64 205, !13, i64 206, !14, i64 208, !10, i64 212, !10, i64 216, !10, i64 220, !10, i64 224, !10, i64 228, !21, i64 232, !7, i64 240, !7, i64 2820, !21, i64 3332, !7, i64 3340, !14, i64 3348, !14, i64 3352, !13, i64 3356, !13, i64 3357, !13, i64 3358, !13, i64 3359, !7, i64 3360, !10, i64 3440, !10, i64 3444, !7, i64 3448, !13, i64 13768, !21, i64 13772, !7, i64 13780, !7, i64 13824, !7, i64 13864, !7, i64 13869, !7, i64 13874, !7, i64 13884, !7, i64 13894, !7, i64 13899, !7, i64 13904, !7, i64 13912, !7, i64 13932, !7, i64 13952, !7, i64 13972, !7, i64 14052, !14, i64 14132, !13, i64 14136, !7, i64 14137, !13, i64 14138, !22, i64 14140, !23, i64 14144}
!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 3358}
!25 = !{!20, !13, i64 3357}
!26 = !{!20, !13, i64 3356}
!27 = !{!20, !10, i64 3444}
!28 = !{!20, !10, i64 3440}
!29 = !{!14, !14, i64 0}
!30 = distinct !{!30, !18}


; 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(14160) %0) local_unnamed_addr #1 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 2820
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(512) %2, i8 0, i64 512, i1 false)
  %3 = getelementptr inbounds i8, ptr %0, i64 3448
  br label %18

4:                                                ; preds = %18
  %5 = getelementptr inbounds i8, ptr %0, i64 3356
  %6 = getelementptr inbounds i8, ptr %0, i64 3444
  store i32 0, ptr %6, align 4, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 3440
  store i32 0, ptr %7, align 8, !tbaa !16
  %8 = getelementptr inbounds i8, ptr %0, i64 14052
  %9 = getelementptr inbounds i8, ptr %0, i64 13972
  store i32 0, ptr %5, align 4
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>, ptr %8, align 4, !tbaa !17
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>, ptr %9, align 4, !tbaa !17
  %10 = getelementptr inbounds i8, ptr %0, i64 14068
  %11 = getelementptr inbounds i8, ptr %0, i64 13988
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>, ptr %10, align 4, !tbaa !17
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>, ptr %11, align 4, !tbaa !17
  %12 = getelementptr inbounds i8, ptr %0, i64 14084
  %13 = getelementptr inbounds i8, ptr %0, i64 14004
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>, ptr %12, align 4, !tbaa !17
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>, ptr %13, align 4, !tbaa !17
  %14 = getelementptr inbounds i8, ptr %0, i64 14100
  %15 = getelementptr inbounds i8, ptr %0, i64 14020
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>, ptr %14, align 4, !tbaa !17
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>, ptr %15, align 4, !tbaa !17
  %16 = getelementptr inbounds i8, ptr %0, i64 14116
  %17 = getelementptr inbounds i8, ptr %0, i64 14036
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>, ptr %16, align 4, !tbaa !17
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>, ptr %17, align 4, !tbaa !17
  ret void

18:                                               ; preds = %18, %1
  %indvars.iv = phi i64 [ 0, %1 ], [ %indvars.iv.next.4, %18 ]
  %19 = getelementptr inbounds [645 x %struct.ImGuiKeyData], ptr %3, i64 0, i64 %indvars.iv
  store i8 0, ptr %19, align 8, !tbaa !18
  %20 = getelementptr inbounds i8, ptr %19, i64 4
  store <2 x float> <float -1.000000e+00, float -1.000000e+00>, ptr %20, align 4, !tbaa !17
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %21 = getelementptr inbounds [645 x %struct.ImGuiKeyData], ptr %3, i64 0, i64 %indvars.iv.next
  store i8 0, ptr %21, align 8, !tbaa !18
  %22 = getelementptr inbounds i8, ptr %21, i64 4
  store <2 x float> <float -1.000000e+00, float -1.000000e+00>, ptr %22, align 4, !tbaa !17
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %23 = getelementptr inbounds [645 x %struct.ImGuiKeyData], ptr %3, i64 0, i64 %indvars.iv.next.1
  store i8 0, ptr %23, align 8, !tbaa !18
  %24 = getelementptr inbounds i8, ptr %23, i64 4
  store <2 x float> <float -1.000000e+00, float -1.000000e+00>, ptr %24, align 4, !tbaa !17
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
  %25 = getelementptr inbounds [645 x %struct.ImGuiKeyData], ptr %3, i64 0, i64 %indvars.iv.next.2
  store i8 0, ptr %25, align 8, !tbaa !18
  %26 = getelementptr inbounds i8, ptr %25, i64 4
  store <2 x float> <float -1.000000e+00, float -1.000000e+00>, ptr %26, align 4, !tbaa !17
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %27 = getelementptr inbounds [645 x %struct.ImGuiKeyData], ptr %3, i64 0, i64 %indvars.iv.next.3
  store i8 0, ptr %27, align 8, !tbaa !18
  %28 = getelementptr inbounds i8, ptr %27, i64 4
  store <2 x float> <float -1.000000e+00, float -1.000000e+00>, ptr %28, align 4, !tbaa !17
  %indvars.iv.next.4 = add nuw nsw i64 %indvars.iv, 5
  %exitcond.not.4 = icmp eq i64 %indvars.iv.next.4, 645
  br i1 %exitcond.not.4, label %4, label %18, !llvm.loop !20
}

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 3444}
!6 = !{!"_ZTS7ImGuiIO", !7, i64 0, !7, i64 4, !10, i64 8, !11, i64 16, !11, i64 20, !12, i64 24, !12, i64 32, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !12, i64 64, !12, i64 72, !11, i64 80, !13, i64 84, !12, i64 88, !10, i64 96, !13, i64 104, !13, i64 105, !13, i64 106, !13, i64 107, !13, i64 108, !13, i64 109, !13, i64 110, !11, i64 112, !12, i64 120, !12, i64 128, !12, i64 136, !12, i64 144, !12, i64 152, !12, i64 160, !12, i64 168, !12, i64 176, !12, i64 184, !12, i64 192, !13, i64 200, !13, i64 201, !13, i64 202, !13, i64 203, !13, i64 204, !13, i64 205, !13, i64 206, !11, i64 208, !7, i64 212, !7, i64 216, !7, i64 220, !7, i64 224, !7, i64 228, !10, i64 232, !8, i64 240, !8, i64 2820, !10, i64 3332, !8, i64 3340, !11, i64 3348, !11, i64 3352, !13, i64 3356, !13, i64 3357, !13, i64 3358, !13, i64 3359, !8, i64 3360, !7, i64 3440, !7, i64 3444, !8, i64 3448, !13, i64 13768, !10, i64 13772, !8, i64 13780, !8, i64 13824, !8, i64 13864, !8, i64 13869, !8, i64 13874, !8, i64 13884, !8, i64 13894, !8, i64 13899, !8, i64 13904, !8, i64 13912, !8, i64 13932, !8, i64 13952, !8, i64 13972, !8, i64 14052, !11, i64 14132, !13, i64 14136, !8, i64 14137, !13, i64 14138, !14, i64 14140, !15, i64 14144}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTS6ImVec2", !11, i64 0, !11, i64 4}
!11 = !{!"float", !8, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!"bool", !8, i64 0}
!14 = !{!"short", !8, i64 0}
!15 = !{!"_ZTS8ImVectorItE", !7, i64 0, !7, i64 4, !12, i64 8}
!16 = !{!6, !7, i64 3440}
!17 = !{!11, !11, i64 0}
!18 = !{!19, !13, i64 0}
!19 = !{!"_ZTS12ImGuiKeyData", !13, i64 0, !11, i64 4, !11, i64 8, !11, i64 12}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}


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