; LLVM IR from theolundqvist/parallax-voxel-ray-marcher :: src/external/Dear ImGui/imgui.ll (ZN7ImGuiIO13AddFocusEventEb)

; 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, [22 x i32], float, float, ptr, ptr, float, i8, ptr, %struct.ImVec2, i8, i8, i8, i8, i8, i8, float, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, %struct.ImVec2, [5 x i8], float, float, i8, i8, i8, i8, [512 x i8], [20 x float], i8, i8, i8, i8, i8, i8, i8, float, i32, i32, i32, i32, i32, %struct.ImVec2, i32, i32, %struct.ImVec2, [5 x %struct.ImVec2], [5 x double], [5 x i8], [5 x i8], [5 x i8], [5 x i8], [5 x i8], [5 x float], [5 x float], [5 x %struct.ImVec2], [5 x float], [512 x float], [512 x float], [20 x float], [20 x float], float, i16, %struct.ImVector }
%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 @_ZN7ImGuiIO13AddFocusEventEb(ptr noundef nonnull align 8 dereferenceable(5456) %0, i1 noundef zeroext %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i8, align 1
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %7 = zext i1 %1 to i8
  store i8 %7, ptr %4, align 1, !tbaa !9
  %8 = load ptr, ptr %3, align 8
  %9 = load i8, ptr %4, align 1, !tbaa !9, !range !11, !noundef !12
  %10 = trunc i8 %9 to i1
  br i1 %10, label %11, label %12

11:                                               ; preds = %2
  br label %54

12:                                               ; preds = %2
  %13 = getelementptr inbounds %struct.ImGuiIO, ptr %8, i32 0, i32 44
  %14 = getelementptr inbounds [512 x i8], ptr %13, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 4 %14, i8 0, i64 512, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !13
  br label %15

15:                                               ; preds = %28, %12
  %16 = load i32, ptr %5, align 4, !tbaa !13
  %17 = icmp slt i32 %16, 512
  br i1 %17, label %19, label %18

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

19:                                               ; preds = %15
  %20 = getelementptr inbounds %struct.ImGuiIO, ptr %8, i32 0, i32 75
  %21 = load i32, ptr %5, align 4, !tbaa !13
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [512 x float], ptr %20, i64 0, i64 %22
  store float -1.000000e+00, ptr %23, align 4, !tbaa !15
  %24 = getelementptr inbounds %struct.ImGuiIO, ptr %8, i32 0, i32 74
  %25 = load i32, ptr %5, align 4, !tbaa !13
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [512 x float], ptr %24, i64 0, i64 %26
  store float -1.000000e+00, ptr %27, align 4, !tbaa !15
  br label %28

28:                                               ; preds = %19
  %29 = load i32, ptr %5, align 4, !tbaa !13
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %5, align 4, !tbaa !13
  br label %15, !llvm.loop !17

31:                                               ; preds = %18
  %32 = getelementptr inbounds %struct.ImGuiIO, ptr %8, i32 0, i32 43
  store i8 0, ptr %32, align 1, !tbaa !19
  %33 = getelementptr inbounds %struct.ImGuiIO, ptr %8, i32 0, i32 42
  store i8 0, ptr %33, align 2, !tbaa !24
  %34 = getelementptr inbounds %struct.ImGuiIO, ptr %8, i32 0, i32 41
  store i8 0, ptr %34, align 1, !tbaa !25
  %35 = getelementptr inbounds %struct.ImGuiIO, ptr %8, i32 0, i32 40
  store i8 0, ptr %35, align 8, !tbaa !26
  %36 = getelementptr inbounds %struct.ImGuiIO, ptr %8, i32 0, i32 61
  store i32 0, ptr %36, align 8, !tbaa !27
  %37 = getelementptr inbounds %struct.ImGuiIO, ptr %8, i32 0, i32 60
  store i32 0, ptr %37, align 4, !tbaa !28
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 0, ptr %6, align 4, !tbaa !13
  br label %38

38:                                               ; preds = %51, %31
  %39 = load i32, ptr %6, align 4, !tbaa !13
  %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 %6) #3
  br label %54

42:                                               ; preds = %38
  %43 = getelementptr inbounds %struct.ImGuiIO, ptr %8, i32 0, i32 77
  %44 = load i32, ptr %6, align 4, !tbaa !13
  %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 !15
  %47 = getelementptr inbounds %struct.ImGuiIO, ptr %8, i32 0, i32 76
  %48 = load i32, ptr %6, align 4, !tbaa !13
  %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 !15
  br label %51

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

54:                                               ; preds = %41, %11
  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 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"float", !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!20, !10, i64 315}
!20 = !{!"_ZTS7ImGuiIO", !14, i64 0, !14, i64 4, !21, i64 8, !16, i64 16, !16, i64 20, !6, i64 24, !6, i64 32, !16, i64 40, !16, i64 44, !16, i64 48, !7, i64 52, !16, i64 140, !16, i64 144, !6, i64 152, !6, i64 160, !16, i64 168, !10, i64 172, !6, i64 176, !21, i64 184, !10, i64 192, !10, i64 193, !10, i64 194, !10, i64 195, !10, i64 196, !10, i64 197, !16, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !21, i64 288, !7, i64 296, !16, i64 304, !16, i64 308, !10, i64 312, !10, i64 313, !10, i64 314, !10, i64 315, !7, i64 316, !7, i64 828, !10, i64 908, !10, i64 909, !10, i64 910, !10, i64 911, !10, i64 912, !10, i64 913, !10, i64 914, !16, i64 916, !14, i64 920, !14, i64 924, !14, i64 928, !14, i64 932, !14, i64 936, !21, i64 940, !14, i64 948, !14, i64 952, !21, i64 956, !7, i64 964, !7, i64 1008, !7, i64 1048, !7, i64 1053, !7, i64 1058, !7, i64 1063, !7, i64 1068, !7, i64 1076, !7, i64 1096, !7, i64 1116, !7, i64 1156, !7, i64 1176, !7, i64 3224, !7, i64 5272, !7, i64 5352, !16, i64 5432, !22, i64 5436, !23, i64 5440}
!21 = !{!"_ZTS6ImVec2", !16, i64 0, !16, i64 4}
!22 = !{!"short", !7, i64 0}
!23 = !{!"_ZTS8ImVectorItE", !14, i64 0, !14, i64 4, !6, i64 8}
!24 = !{!20, !10, i64 314}
!25 = !{!20, !10, i64 313}
!26 = !{!20, !10, i64 312}
!27 = !{!20, !14, i64 952}
!28 = !{!20, !14, i64 948}
!29 = distinct !{!29, !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"

; 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 @_ZN7ImGuiIO13AddFocusEventEb(ptr nocapture noundef nonnull writeonly align 8 dereferenceable(5456) %0, i1 noundef zeroext %1) local_unnamed_addr #1 align 2 {
  br i1 %1, label %.loopexit, label %vector.ph

vector.ph:                                        ; preds = %2
  %3 = getelementptr inbounds i8, ptr %0, i64 316
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(512) %3, i8 0, i64 512, i1 false)
  %4 = getelementptr inbounds i8, ptr %0, i64 3224
  %5 = getelementptr inbounds i8, ptr %0, i64 1176
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next.1, %vector.body ]
  %6 = getelementptr inbounds [512 x float], ptr %4, i64 0, i64 %index
  %7 = getelementptr inbounds i8, ptr %6, i64 16
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>, ptr %6, align 8, !tbaa !5
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>, ptr %7, align 8, !tbaa !5
  %8 = getelementptr inbounds [512 x float], ptr %5, i64 0, i64 %index
  %9 = getelementptr inbounds i8, ptr %8, i64 16
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>, ptr %8, align 8, !tbaa !5
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>, ptr %9, align 8, !tbaa !5
  %index.next = or disjoint i64 %index, 8
  %10 = getelementptr inbounds [512 x float], ptr %4, i64 0, i64 %index.next
  %11 = getelementptr inbounds i8, ptr %10, i64 16
  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 !5
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>, ptr %11, align 8, !tbaa !5
  %12 = getelementptr inbounds [512 x float], ptr %5, i64 0, i64 %index.next
  %13 = getelementptr inbounds i8, ptr %12, i64 16
  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 !5
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>, ptr %13, align 8, !tbaa !5
  %index.next.1 = add nuw nsw i64 %index, 16
  %14 = icmp eq i64 %index.next.1, 512
  br i1 %14, label %.loopexit.loopexit, label %vector.body, !llvm.loop !9

.loopexit.loopexit:                               ; preds = %vector.body
  %15 = getelementptr inbounds i8, ptr %0, i64 312
  %16 = getelementptr inbounds i8, ptr %0, i64 952
  store i32 0, ptr %16, align 8, !tbaa !13
  %17 = getelementptr inbounds i8, ptr %0, i64 948
  store i32 0, ptr %17, align 4, !tbaa !21
  %18 = getelementptr inbounds i8, ptr %0, i64 5352
  %19 = getelementptr inbounds i8, ptr %0, i64 5272
  store i32 0, ptr %15, align 8
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>, ptr %18, align 8, !tbaa !5
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>, ptr %19, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %0, i64 5368
  %21 = getelementptr inbounds i8, ptr %0, i64 5288
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>, ptr %20, align 8, !tbaa !5
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>, ptr %21, align 8, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %0, i64 5384
  %23 = getelementptr inbounds i8, ptr %0, i64 5304
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>, ptr %22, align 8, !tbaa !5
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>, ptr %23, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %0, i64 5400
  %25 = getelementptr inbounds i8, ptr %0, i64 5320
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>, ptr %24, align 8, !tbaa !5
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>, ptr %25, align 8, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %0, i64 5416
  %27 = getelementptr inbounds i8, ptr %0, i64 5336
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>, ptr %26, align 8, !tbaa !5
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>, ptr %27, align 8, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %2
  ret void
}

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, !6, i64 0}
!6 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = !{!14, !15, i64 952}
!14 = !{!"_ZTS7ImGuiIO", !15, i64 0, !15, i64 4, !16, i64 8, !6, i64 16, !6, i64 20, !17, i64 24, !17, i64 32, !6, i64 40, !6, i64 44, !6, i64 48, !7, i64 52, !6, i64 140, !6, i64 144, !17, i64 152, !17, i64 160, !6, i64 168, !18, i64 172, !17, i64 176, !16, i64 184, !18, i64 192, !18, i64 193, !18, i64 194, !18, i64 195, !18, i64 196, !18, i64 197, !6, i64 200, !17, i64 208, !17, i64 216, !17, i64 224, !17, i64 232, !17, i64 240, !17, i64 248, !17, i64 256, !17, i64 264, !17, i64 272, !17, i64 280, !16, i64 288, !7, i64 296, !6, i64 304, !6, i64 308, !18, i64 312, !18, i64 313, !18, i64 314, !18, i64 315, !7, i64 316, !7, i64 828, !18, i64 908, !18, i64 909, !18, i64 910, !18, i64 911, !18, i64 912, !18, i64 913, !18, i64 914, !6, i64 916, !15, i64 920, !15, i64 924, !15, i64 928, !15, i64 932, !15, i64 936, !16, i64 940, !15, i64 948, !15, i64 952, !16, i64 956, !7, i64 964, !7, i64 1008, !7, i64 1048, !7, i64 1053, !7, i64 1058, !7, i64 1063, !7, i64 1068, !7, i64 1076, !7, i64 1096, !7, i64 1116, !7, i64 1156, !7, i64 1176, !7, i64 3224, !7, i64 5272, !7, i64 5352, !6, i64 5432, !19, i64 5436, !20, i64 5440}
!15 = !{!"int", !7, i64 0}
!16 = !{!"_ZTS6ImVec2", !6, i64 0, !6, i64 4}
!17 = !{!"any pointer", !7, i64 0}
!18 = !{!"bool", !7, i64 0}
!19 = !{!"short", !7, i64 0}
!20 = !{!"_ZTS8ImVectorItE", !15, i64 0, !15, i64 4, !17, i64 8}
!21 = !{!14, !15, i64 948}


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