; LLVM IR from Samson-Mano/EM_Propogation_simulation :: EM_Propogation_simulation/src/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.ImVec2 = type { float, float }
%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, i8, i8, 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], ptr, %struct.ImVec2, [5 x i8], float, float, i32, 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], 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.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: mustprogress nounwind uwtable
declare dso_local void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #1 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; 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) #3

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

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

12:                                               ; preds = %9
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %32

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

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

32:                                               ; preds = %12
  %33 = getelementptr inbounds %struct.ImGuiIO, ptr %6, i32 0, i32 67
  store i8 0, ptr %33, align 1, !tbaa !19
  %34 = getelementptr inbounds %struct.ImGuiIO, ptr %6, i32 0, i32 66
  store i8 0, ptr %34, align 2, !tbaa !25
  %35 = getelementptr inbounds %struct.ImGuiIO, ptr %6, i32 0, i32 65
  store i8 0, ptr %35, align 1, !tbaa !26
  %36 = getelementptr inbounds %struct.ImGuiIO, ptr %6, i32 0, i32 64
  store i8 0, ptr %36, align 4, !tbaa !27
  %37 = getelementptr inbounds %struct.ImGuiIO, ptr %6, i32 0, i32 68
  store i32 0, ptr %37, align 8, !tbaa !28
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %4, float noundef 0xC7EFFFFFE0000000, float noundef 0xC7EFFFFFE0000000)
  %38 = getelementptr inbounds %struct.ImGuiIO, ptr %6, i32 0, i32 59
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %38, ptr align 4 %4, i64 8, i1 false), !tbaa.struct !29
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %39

39:                                               ; preds = %56, %32
  %40 = load i32, ptr %5, align 4, !tbaa !9
  %41 = icmp slt i32 %40, 5
  br i1 %41, label %43, label %42

42:                                               ; preds = %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %59

43:                                               ; preds = %39
  %44 = getelementptr inbounds %struct.ImGuiIO, ptr %6, i32 0, i32 60
  %45 = load i32, ptr %5, align 4, !tbaa !9
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [5 x i8], ptr %44, i64 0, i64 %46
  store i8 0, ptr %47, align 1, !tbaa !31
  %48 = getelementptr inbounds %struct.ImGuiIO, ptr %6, i32 0, i32 83
  %49 = load i32, ptr %5, align 4, !tbaa !9
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [5 x float], ptr %48, i64 0, i64 %50
  store float -1.000000e+00, ptr %51, align 4, !tbaa !30
  %52 = getelementptr inbounds %struct.ImGuiIO, ptr %6, i32 0, i32 82
  %53 = load i32, ptr %5, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [5 x float], ptr %52, i64 0, i64 %54
  store float -1.000000e+00, ptr %55, align 4, !tbaa !30
  br label %56

56:                                               ; preds = %43
  %57 = load i32, ptr %5, align 4, !tbaa !9
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %5, align 4, !tbaa !9
  br label %39, !llvm.loop !32

59:                                               ; preds = %42
  %60 = getelementptr inbounds %struct.ImGuiIO, ptr %6, i32 0, i32 62
  store float 0.000000e+00, ptr %60, align 4, !tbaa !33
  %61 = getelementptr inbounds %struct.ImGuiIO, ptr %6, i32 0, i32 61
  store float 0.000000e+00, ptr %61, align 8, !tbaa !34
  ret void
}

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 #5 = { 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 3615}
!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, !13, i64 124, !13, i64 125, !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, !6, i64 3576, !21, i64 3584, !7, i64 3592, !14, i64 3600, !14, i64 3604, !22, i64 3608, !13, i64 3612, !13, i64 3613, !13, i64 3614, !13, i64 3615, !10, i64 3616, !7, i64 3620, !13, i64 14052, !21, i64 14056, !7, i64 14064, !7, i64 14104, !7, i64 14144, !7, i64 14149, !7, i64 14154, !7, i64 14164, !7, i64 14174, !7, i64 14179, !7, i64 14184, !13, i64 14189, !7, i64 14192, !7, i64 14212, !7, i64 14232, !14, i64 14252, !13, i64 14256, !13, i64 14257, !7, i64 14258, !13, i64 14259, !23, i64 14260, !24, i64 14264}
!21 = !{!"_ZTS6ImVec2", !14, i64 0, !14, i64 4}
!22 = !{!"_ZTS16ImGuiMouseSource", !7, i64 0}
!23 = !{!"short", !7, i64 0}
!24 = !{!"_ZTS8ImVectorItE", !10, i64 0, !10, i64 4, !6, i64 8}
!25 = !{!20, !13, i64 3614}
!26 = !{!20, !13, i64 3613}
!27 = !{!20, !13, i64 3612}
!28 = !{!20, !10, i64 3616}
!29 = !{i64 0, i64 4, !30, i64 4, i64 4, !30}
!30 = !{!14, !14, i64 0}
!31 = !{!13, !13, i64 0}
!32 = distinct !{!32, !18}
!33 = !{!20, !14, i64 3604}
!34 = !{!20, !14, 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.ImVec2 = type { float, float }
%struct.ImGuiKeyData = type { i8, float, float, float }

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN7ImGuiIO14ClearInputKeysEv(ptr nocapture noundef nonnull writeonly align 8 dereferenceable(14280) %0) local_unnamed_addr #1 align 2 {
  %2 = alloca %struct.ImVec2, align 8
  %3 = getelementptr inbounds i8, ptr %0, i64 2856
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(652) %3, i8 0, i64 652, i1 false)
  %4 = getelementptr inbounds i8, ptr %0, i64 3620
  br label %14

5:                                                ; preds = %14
  %6 = getelementptr inbounds i8, ptr %0, i64 3612
  store i64 0, ptr %6, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %2, float noundef 0xC7EFFFFFE0000000, float noundef 0xC7EFFFFFE0000000)
  %7 = getelementptr inbounds i8, ptr %0, i64 3584
  %8 = load i64, ptr %2, align 8
  store i64 %8, ptr %7, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  %9 = getelementptr inbounds i8, ptr %0, i64 3592
  %10 = getelementptr inbounds i8, ptr %0, i64 14192
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(5) %9, i8 0, i64 5, i1 false), !tbaa !5
  %11 = getelementptr inbounds i8, ptr %0, i64 14224
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>, ptr %10, align 8, !tbaa !9
  store <2 x float> <float -1.000000e+00, float -1.000000e+00>, ptr %11, align 8, !tbaa !9
  %12 = getelementptr inbounds i8, ptr %0, i64 14208
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>, ptr %12, align 8, !tbaa !9
  %13 = getelementptr inbounds i8, ptr %0, i64 3600
  store <2 x float> zeroinitializer, ptr %13, align 8, !tbaa !9
  ret void

14:                                               ; preds = %14, %1
  %indvars.iv = phi i64 [ 0, %1 ], [ %indvars.iv.next.3, %14 ]
  %15 = getelementptr inbounds [652 x %struct.ImGuiKeyData], ptr %4, i64 0, i64 %indvars.iv
  store i8 0, ptr %15, align 4, !tbaa !11
  %16 = getelementptr inbounds i8, ptr %15, i64 4
  store <2 x float> <float -1.000000e+00, float -1.000000e+00>, ptr %16, align 8, !tbaa !9
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %17 = getelementptr inbounds [652 x %struct.ImGuiKeyData], ptr %4, i64 0, i64 %indvars.iv.next
  store i8 0, ptr %17, align 4, !tbaa !11
  %18 = getelementptr inbounds i8, ptr %17, i64 4
  store <2 x float> <float -1.000000e+00, float -1.000000e+00>, ptr %18, align 8, !tbaa !9
  %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 2
  %19 = getelementptr inbounds [652 x %struct.ImGuiKeyData], ptr %4, i64 0, i64 %indvars.iv.next.1
  store i8 0, ptr %19, align 4, !tbaa !11
  %20 = getelementptr inbounds i8, ptr %19, i64 4
  store <2 x float> <float -1.000000e+00, float -1.000000e+00>, ptr %20, align 8, !tbaa !9
  %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 3
  %21 = getelementptr inbounds [652 x %struct.ImGuiKeyData], ptr %4, i64 0, i64 %indvars.iv.next.2
  store i8 0, ptr %21, align 4, !tbaa !11
  %22 = getelementptr inbounds i8, ptr %21, i64 4
  store <2 x float> <float -1.000000e+00, float -1.000000e+00>, ptr %22, align 8, !tbaa !9
  %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 %5, label %14, !llvm.loop !13
}

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


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