; LLVM IR from Samson-Mano/EM_Propogation_simulation :: EM_Propogation_simulation/src/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, 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, float, %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 i32, align 4
  %5 = alloca %struct.ImVec2, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #7
  %6 = call noundef float @_ZN5ImGui17GetTextLineHeightEv()
  store float %6, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  %7 = call noundef i32 @_ZN5ImGui19TableGetColumnCountEv()
  store i32 %7, 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 %8

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

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

13:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  %14 = load i32, ptr %3, align 4, !tbaa !9
  %15 = call noundef i32 @_ZN5ImGui19TableGetColumnFlagsEi(i32 noundef %14)
  store i32 %15, ptr %4, align 4, !tbaa !9
  %16 = load i32, ptr %4, align 4, !tbaa !9
  %17 = and i32 %16, 16777216
  %18 = icmp ne i32 %17, 0
  br i1 %18, label %19, label %31

19:                                               ; preds = %13
  %20 = load i32, ptr %4, align 4, !tbaa !9
  %21 = and i32 %20, 4096
  %22 = icmp ne i32 %21, 0
  br i1 %22, label %31, label %23

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

31:                                               ; preds = %23, %19, %13
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %32

32:                                               ; preds = %31
  %33 = load i32, ptr %3, align 4, !tbaa !9
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %3, align 4, !tbaa !9
  br label %8, !llvm.loop !13

35:                                               ; preds = %12
  %36 = call noundef nonnull align 4 dereferenceable(1068) ptr @_ZN5ImGui8GetStyleEv()
  %37 = getelementptr inbounds %struct.ImGuiStyle, ptr %36, i32 0, i32 17
  %38 = getelementptr inbounds %struct.ImVec2, ptr %37, i32 0, i32 1
  %39 = load float, ptr %38, align 4, !tbaa !15
  %40 = load float, ptr %1, align 4, !tbaa !5
  %41 = call float @llvm.fmuladd.f32(float %39, float 2.000000e+00, float %40)
  store float %41, ptr %1, align 4, !tbaa !5
  %42 = 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 %42
}

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(1068) 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 96}
!16 = !{!"_ZTS10ImGuiStyle", !6, i64 0, !6, i64 4, !12, i64 8, !6, i64 16, !6, i64 20, !12, i64 24, !12, i64 32, !10, i64 40, !6, i64 44, !6, i64 48, !6, i64 52, !6, i64 56, !12, i64 60, !6, i64 68, !6, i64 72, !12, i64 76, !12, i64 84, !12, i64 92, !12, i64 100, !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, !6, i64 144, !10, i64 148, !12, i64 152, !12, i64 160, !6, i64 168, !12, i64 172, !12, i64 180, !12, i64 188, !12, i64 196, !6, i64 204, !17, i64 208, !17, i64 209, !17, i64 210, !6, i64 212, !6, i64 216, !7, i64 220}
!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(1068) ptr @_ZN5ImGui8GetStyleEv()
  %5 = getelementptr inbounds i8, ptr %4, i64 96
  %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
  %.012 = phi float [ %.1, %14 ], [ %1, %0 ]
  %.0911 = phi i32 [ %15, %14 ], [ 0, %0 ]
  %8 = tail call noundef i32 @_ZN5ImGui19TableGetColumnFlagsEi(i32 noundef %.0911)
  %9 = and i32 %8, 16781312
  %or.cond = icmp eq i32 %9, 16777216
  br i1 %or.cond, label %10, label %14

10:                                               ; preds = %.lr.ph
  %11 = tail call noundef ptr @_ZN5ImGui18TableGetColumnNameEi(i32 noundef %.0911)
  %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 %.012, float noundef %.sroa.0.4.vec.extract)
  br label %14

14:                                               ; preds = %10, %.lr.ph
  %.1 = phi float [ %13, %10 ], [ %.012, %.lr.ph ]
  %15 = add nuw nsw i32 %.0911, 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(1068) 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 96}
!6 = !{!"_ZTS10ImGuiStyle", !7, i64 0, !7, i64 4, !10, i64 8, !7, i64 16, !7, i64 20, !10, i64 24, !10, i64 32, !11, i64 40, !7, i64 44, !7, i64 48, !7, i64 52, !7, i64 56, !10, i64 60, !7, i64 68, !7, i64 72, !10, i64 76, !10, i64 84, !10, i64 92, !10, i64 100, !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, !7, i64 144, !11, i64 148, !10, i64 152, !10, i64 160, !7, i64 168, !10, i64 172, !10, i64 180, !10, i64 188, !10, i64 196, !7, i64 204, !12, i64 208, !12, i64 209, !12, i64 210, !7, i64 212, !7, i64 216, !8, i64 220}
!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