; LLVM IR from Devaniti/BoolkaEngine :: ThirdParty/imgui/imgui_widgets.ll (ZN16ImGuiMenuColumns11DeclColumnsEfff)

; 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.ImGuiMenuColumns = type { float, float, float, [3 x float], [3 x float] }

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef float @_ZL5ImMaxIfET_S0_S0_(float noundef, float noundef) #1

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

; Function Attrs: mustprogress uwtable
define dso_local noundef float @_ZN16ImGuiMenuColumns11DeclColumnsEfff(ptr noundef nonnull align 4 dereferenceable(36) %0, float noundef %1, float noundef %2, float noundef %3) #2 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store float %1, ptr %6, align 4, !tbaa !9
  store float %2, ptr %7, align 4, !tbaa !9
  store float %3, ptr %8, align 4, !tbaa !9
  %10 = load ptr, ptr %5, align 8
  %11 = getelementptr inbounds %struct.ImGuiMenuColumns, ptr %10, i32 0, i32 2
  store float 0.000000e+00, ptr %11, align 4, !tbaa !11
  %12 = getelementptr inbounds %struct.ImGuiMenuColumns, ptr %10, i32 0, i32 4
  %13 = getelementptr inbounds [3 x float], ptr %12, i64 0, i64 0
  %14 = load float, ptr %13, align 4, !tbaa !9
  %15 = load float, ptr %6, align 4, !tbaa !9
  %16 = call noundef float @_ZL5ImMaxIfET_S0_S0_(float noundef %14, float noundef %15)
  %17 = getelementptr inbounds %struct.ImGuiMenuColumns, ptr %10, i32 0, i32 4
  %18 = getelementptr inbounds [3 x float], ptr %17, i64 0, i64 0
  store float %16, ptr %18, align 4, !tbaa !9
  %19 = getelementptr inbounds %struct.ImGuiMenuColumns, ptr %10, i32 0, i32 4
  %20 = getelementptr inbounds [3 x float], ptr %19, i64 0, i64 1
  %21 = load float, ptr %20, align 4, !tbaa !9
  %22 = load float, ptr %7, align 4, !tbaa !9
  %23 = call noundef float @_ZL5ImMaxIfET_S0_S0_(float noundef %21, float noundef %22)
  %24 = getelementptr inbounds %struct.ImGuiMenuColumns, ptr %10, i32 0, i32 4
  %25 = getelementptr inbounds [3 x float], ptr %24, i64 0, i64 1
  store float %23, ptr %25, align 4, !tbaa !9
  %26 = getelementptr inbounds %struct.ImGuiMenuColumns, ptr %10, i32 0, i32 4
  %27 = getelementptr inbounds [3 x float], ptr %26, i64 0, i64 2
  %28 = load float, ptr %27, align 4, !tbaa !9
  %29 = load float, ptr %8, align 4, !tbaa !9
  %30 = call noundef float @_ZL5ImMaxIfET_S0_S0_(float noundef %28, float noundef %29)
  %31 = getelementptr inbounds %struct.ImGuiMenuColumns, ptr %10, i32 0, i32 4
  %32 = getelementptr inbounds [3 x float], ptr %31, i64 0, i64 2
  store float %30, ptr %32, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 0, ptr %9, align 4, !tbaa !13
  br label %33

33:                                               ; preds = %62, %4
  %34 = load i32, ptr %9, align 4, !tbaa !13
  %35 = icmp slt i32 %34, 3
  br i1 %35, label %37, label %36

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

37:                                               ; preds = %33
  %38 = getelementptr inbounds %struct.ImGuiMenuColumns, ptr %10, i32 0, i32 4
  %39 = load i32, ptr %9, align 4, !tbaa !13
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [3 x float], ptr %38, i64 0, i64 %40
  %42 = load float, ptr %41, align 4, !tbaa !9
  %43 = load i32, ptr %9, align 4, !tbaa !13
  %44 = icmp sgt i32 %43, 0
  br i1 %44, label %45, label %55

45:                                               ; preds = %37
  %46 = getelementptr inbounds %struct.ImGuiMenuColumns, ptr %10, i32 0, i32 4
  %47 = load i32, ptr %9, align 4, !tbaa !13
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [3 x float], ptr %46, i64 0, i64 %48
  %50 = load float, ptr %49, align 4, !tbaa !9
  %51 = fcmp ogt float %50, 0.000000e+00
  br i1 %51, label %52, label %55

52:                                               ; preds = %45
  %53 = getelementptr inbounds %struct.ImGuiMenuColumns, ptr %10, i32 0, i32 0
  %54 = load float, ptr %53, align 4, !tbaa !15
  br label %56

55:                                               ; preds = %45, %37
  br label %56

56:                                               ; preds = %55, %52
  %57 = phi float [ %54, %52 ], [ 0.000000e+00, %55 ]
  %58 = fadd float %42, %57
  %59 = getelementptr inbounds %struct.ImGuiMenuColumns, ptr %10, i32 0, i32 2
  %60 = load float, ptr %59, align 4, !tbaa !11
  %61 = fadd float %60, %58
  store float %61, ptr %59, align 4, !tbaa !11
  br label %62

62:                                               ; preds = %56
  %63 = load i32, ptr %9, align 4, !tbaa !13
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %9, align 4, !tbaa !13
  br label %33, !llvm.loop !16

65:                                               ; preds = %36
  %66 = getelementptr inbounds %struct.ImGuiMenuColumns, ptr %10, i32 0, i32 1
  %67 = load float, ptr %66, align 4, !tbaa !18
  %68 = getelementptr inbounds %struct.ImGuiMenuColumns, ptr %10, i32 0, i32 2
  %69 = load float, ptr %68, align 4, !tbaa !11
  %70 = call noundef float @_ZL5ImMaxIfET_S0_S0_(float noundef %67, float noundef %69)
  ret float %70
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 = !{!"float", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"_ZTS16ImGuiMenuColumns", !10, i64 0, !10, i64 4, !10, i64 8, !7, i64 12, !7, i64 24}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!12, !10, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!12, !10, i64 4}


; 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: inlinehint mustprogress nounwind uwtable
declare hidden noundef float @_ZL5ImMaxIfET_S0_S0_(float noundef, float noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef float @_ZN16ImGuiMenuColumns11DeclColumnsEfff(ptr nocapture noundef nonnull align 4 dereferenceable(36) %0, float noundef %1, float noundef %2, float noundef %3) local_unnamed_addr #1 align 2 {
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  store float 0.000000e+00, ptr %5, align 4, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %7 = load float, ptr %6, align 4, !tbaa !10
  %8 = tail call noundef float @_ZL5ImMaxIfET_S0_S0_(float noundef %7, float noundef %1)
  store float %8, ptr %6, align 4, !tbaa !10
  %9 = getelementptr inbounds i8, ptr %0, i64 28
  %10 = load float, ptr %9, align 4, !tbaa !10
  %11 = tail call noundef float @_ZL5ImMaxIfET_S0_S0_(float noundef %10, float noundef %2)
  store float %11, ptr %9, align 4, !tbaa !10
  %12 = getelementptr inbounds i8, ptr %0, i64 32
  %13 = load float, ptr %12, align 4, !tbaa !10
  %14 = tail call noundef float @_ZL5ImMaxIfET_S0_S0_(float noundef %13, float noundef %3)
  store float %14, ptr %12, align 4, !tbaa !10
  %15 = load <4 x float>, ptr %0, align 4
  %.promoted = load float, ptr %5, align 4, !tbaa !5
  %16 = load float, ptr %6, align 4, !tbaa !10
  %17 = fadd float %16, 0.000000e+00
  %18 = fadd float %.promoted, %17
  %19 = getelementptr inbounds i8, ptr %0, i64 28
  %20 = load float, ptr %19, align 4, !tbaa !10
  %21 = insertelement <2 x float> poison, float %20, i64 0
  %22 = insertelement <2 x float> %21, float %14, i64 1
  %23 = fcmp ogt <2 x float> %22, zeroinitializer
  %24 = shufflevector <4 x float> %15, <4 x float> poison, <2 x i32> zeroinitializer
  %25 = select <2 x i1> %23, <2 x float> %24, <2 x float> zeroinitializer
  %26 = fadd <2 x float> %22, %25
  %27 = extractelement <2 x float> %26, i64 0
  %28 = fadd float %18, %27
  %29 = extractelement <2 x float> %26, i64 1
  %30 = fadd float %28, %29
  store float %30, ptr %5, align 4, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %0, i64 4
  %32 = load float, ptr %31, align 4, !tbaa !11
  %33 = tail call noundef float @_ZL5ImMaxIfET_S0_S0_(float noundef %32, float noundef %30)
  ret float %33
}

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

!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 8}
!6 = !{!"_ZTS16ImGuiMenuColumns", !7, i64 0, !7, i64 4, !7, i64 8, !8, i64 12, !8, i64 24}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!7, !7, i64 0}
!11 = !{!6, !7, i64 4}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LICMPass,LoopRotatePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass,VectorCombinePass