; LLVM IR from Devaniti/BoolkaEngine :: ThirdParty/imgui/imgui_tables.ll (ZN5ImGui23TableGetHeaderRowHeightEv)

; 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.ImGuiStyle = type { float, %struct.ImVec2, float, float, %struct.ImVec2, %struct.ImVec2, i32, float, float, float, float, %struct.ImVec2, float, float, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, float, float, float, float, float, float, float, float, float, float, i32, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, float, i8, i8, i8, float, float, [53 x %struct.ImVec4] }
%struct.ImVec4 = type { float, float, float, float }

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN5ImGui19TableGetColumnCountEv() #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN5ImGui18TableGetColumnNameEi(i32 noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN5ImGui19TableGetColumnFlagsEi(i32 noundef) #4

; Function Attrs: mustprogress uwtable
define dso_local noundef float @_ZN5ImGui23TableGetHeaderRowHeightEv() #5 {
  %1 = alloca float, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %struct.ImVec2, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #7
  %5 = call noundef float @_ZN5ImGui17GetTextLineHeightEv()
  store float %5, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  %6 = call noundef i32 @_ZN5ImGui19TableGetColumnCountEv()
  store i32 %6, ptr %2, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %7

7:                                                ; preds = %26, %0
  %8 = load i32, ptr %3, align 4, !tbaa !9
  %9 = load i32, ptr %2, align 4, !tbaa !9
  %10 = icmp slt i32 %8, %9
  br i1 %10, label %12, label %11

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

12:                                               ; preds = %7
  %13 = load i32, ptr %3, align 4, !tbaa !9
  %14 = call noundef i32 @_ZN5ImGui19TableGetColumnFlagsEi(i32 noundef %13)
  %15 = and i32 %14, 1048576
  %16 = icmp ne i32 %15, 0
  br i1 %16, label %17, label %25

17:                                               ; preds = %12
  %18 = load float, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  %19 = load i32, ptr %3, align 4, !tbaa !9
  %20 = call noundef ptr @_ZN5ImGui18TableGetColumnNameEi(i32 noundef %19)
  %21 = call <2 x float> @_ZN5ImGui12CalcTextSizeEPKcS1_bf(ptr noundef %20, ptr noundef null, i1 noundef zeroext false, float noundef -1.000000e+00)
  store <2 x float> %21, ptr %4, align 4
  %22 = getelementptr inbounds %struct.ImVec2, ptr %4, i32 0, i32 1
  %23 = load float, ptr %22, align 4, !tbaa !11
  %24 = call noundef float @_ZL5ImMaxIfET_S0_S0_(float noundef %18, float noundef %23)
  store float %24, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  br label %25

25:                                               ; preds = %17, %12
  br label %26

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

29:                                               ; preds = %11
  %30 = call noundef nonnull align 4 dereferenceable(1044) ptr @_ZN5ImGui8GetStyleEv()
  %31 = getelementptr inbounds %struct.ImGuiStyle, ptr %30, i32 0, i32 16
  %32 = getelementptr inbounds %struct.ImVec2, ptr %31, i32 0, i32 1
  %33 = load float, ptr %32, align 4, !tbaa !15
  %34 = load float, ptr %1, align 4, !tbaa !5
  %35 = call float @llvm.fmuladd.f32(float %33, float 2.000000e+00, float %34)
  store float %35, ptr %1, align 4, !tbaa !5
  %36 = load float, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #7
  ret float %36
}

declare noundef float @_ZN5ImGui17GetTextLineHeightEv() #6

declare <2 x float> @_ZN5ImGui12CalcTextSizeEPKcS1_bf(ptr noundef, ptr noundef, i1 noundef zeroext, float noundef) #6

declare noundef nonnull align 4 dereferenceable(1044) ptr @_ZN5ImGui8GetStyleEv() #6

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 #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 = { mustprogress uwtable "min-legal-vector-width"="64" "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 #6 = { "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 #7 = { 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 = !{!"float", !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, !6, i64 4}
!12 = !{!"_ZTS6ImVec2", !6, i64 0, !6, i64 4}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !6, i64 92}
!16 = !{!"_ZTS10ImGuiStyle", !6, i64 0, !12, i64 4, !6, i64 12, !6, i64 16, !12, i64 20, !12, i64 28, !10, i64 36, !6, i64 40, !6, i64 44, !6, i64 48, !6, i64 52, !12, i64 56, !6, i64 64, !6, i64 68, !12, i64 72, !12, i64 80, !12, i64 88, !12, i64 96, !6, i64 104, !6, i64 108, !6, i64 112, !6, i64 116, !6, i64 120, !6, i64 124, !6, i64 128, !6, i64 132, !6, i64 136, !6, i64 140, !10, i64 144, !12, i64 148, !12, i64 156, !12, i64 164, !12, i64 172, !6, i64 180, !17, i64 184, !17, i64 185, !17, i64 186, !6, i64 188, !6, i64 192, !7, i64 196}
!17 = !{!"bool", !7, i64 0}


; 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 nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN5ImGui19TableGetColumnCountEv() local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN5ImGui18TableGetColumnNameEi(i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN5ImGui19TableGetColumnFlagsEi(i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local noundef float @_ZN5ImGui23TableGetHeaderRowHeightEv() local_unnamed_addr #4 {
  %1 = tail call noundef float @_ZN5ImGui17GetTextLineHeightEv()
  %2 = tail call noundef i32 @_ZN5ImGui19TableGetColumnCountEv()
  %3 = icmp sgt i32 %2, 0
  br i1 %3, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %14, %0
  %.0.lcssa = phi float [ %1, %0 ], [ %.1, %14 ]
  %4 = tail call noundef nonnull align 4 dereferenceable(1044) ptr @_ZN5ImGui8GetStyleEv()
  %5 = getelementptr inbounds i8, ptr %4, i64 92
  %6 = load float, ptr %5, align 4, !tbaa !5
  %7 = tail call float @llvm.fmuladd.f32(float %6, float 2.000000e+00, float %.0.lcssa)
  ret float %7

.lr.ph:                                           ; preds = %0, %14
  %.09 = phi float [ %.1, %14 ], [ %1, %0 ]
  %.078 = phi i32 [ %15, %14 ], [ 0, %0 ]
  %8 = tail call noundef i32 @_ZN5ImGui19TableGetColumnFlagsEi(i32 noundef %.078)
  %9 = and i32 %8, 1048576
  %.not = icmp eq i32 %9, 0
  br i1 %.not, label %14, label %10

10:                                               ; preds = %.lr.ph
  %11 = tail call noundef ptr @_ZN5ImGui18TableGetColumnNameEi(i32 noundef %.078)
  %12 = tail call <2 x float> @_ZN5ImGui12CalcTextSizeEPKcS1_bf(ptr noundef %11, ptr noundef null, i1 noundef zeroext false, float noundef -1.000000e+00)
  %.sroa.0.4.vec.extract = extractelement <2 x float> %12, i64 1
  %13 = tail call noundef float @_ZL5ImMaxIfET_S0_S0_(float noundef %.09, float noundef %.sroa.0.4.vec.extract)
  br label %14

14:                                               ; preds = %.lr.ph, %10
  %.1 = phi float [ %13, %10 ], [ %.09, %.lr.ph ]
  %15 = add nuw nsw i32 %.078, 1
  %exitcond.not = icmp eq i32 %15, %2
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !13
}

declare noundef float @_ZN5ImGui17GetTextLineHeightEv() local_unnamed_addr #5

declare <2 x float> @_ZN5ImGui12CalcTextSizeEPKcS1_bf(ptr noundef, ptr noundef, i1 noundef zeroext, float noundef) local_unnamed_addr #5

declare noundef nonnull align 4 dereferenceable(1044) ptr @_ZN5ImGui8GetStyleEv() local_unnamed_addr #5

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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { 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 #4 = { mustprogress uwtable "min-legal-vector-width"="64" "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 = { "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 92}
!6 = !{!"_ZTS10ImGuiStyle", !7, i64 0, !10, i64 4, !7, i64 12, !7, i64 16, !10, i64 20, !10, i64 28, !11, i64 36, !7, i64 40, !7, i64 44, !7, i64 48, !7, i64 52, !10, i64 56, !7, i64 64, !7, i64 68, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !7, i64 104, !7, i64 108, !7, i64 112, !7, i64 116, !7, i64 120, !7, i64 124, !7, i64 128, !7, i64 132, !7, i64 136, !7, i64 140, !11, i64 144, !10, i64 148, !10, i64 156, !10, i64 164, !10, i64 172, !7, i64 180, !12, i64 184, !12, i64 185, !12, i64 186, !7, i64 188, !7, i64 192, !8, i64 196}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTS6ImVec2", !7, i64 0, !7, i64 4}
!11 = !{!"int", !8, i64 0}
!12 = !{!"bool", !8, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass