; LLVM IR from yangfengzzz/DigitalVox4 :: editor/imgui_node_editor.ll (ZN3vox10NodeEditor6Detail14NavigateAction9MatchZoomEif)

; 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.vox::NodeEditor::Detail::NavigateAction" = type <{ %"struct.vox::NodeEditor::Detail::EditorAction", i8, [3 x i8], float, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, ptr, %struct.ImVec2, %struct.ImVec2, %"struct.vox::NodeEditor::Detail::NavigateAnimation", i32, [4 x i8], i64, ptr, i8, [3 x i8], %struct.ImVec2, [4 x i8] }>
%"struct.vox::NodeEditor::Detail::EditorAction" = type { ptr, ptr }
%"struct.vox::NodeEditor::Detail::NavigateAnimation" = type { %"struct.vox::NodeEditor::Detail::Animation.base", ptr, %struct.ImRect, %struct.ImRect }
%"struct.vox::NodeEditor::Detail::Animation.base" = type <{ ptr, ptr, i32, float, float }>
%struct.ImRect = type { %struct.ImVec2, %struct.ImVec2 }
%struct.ImVec2 = type { float, float }

@_ZN3vox10NodeEditor6Detail14NavigateAction12s_ZoomLevelsE = external dso_local constant [18 x float], align 16

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

; Function Attrs: mustprogress uwtable
define dso_local noundef float @_ZN3vox10NodeEditor6Detail14NavigateAction9MatchZoomEif(ptr noundef nonnull align 8 dereferenceable(184) %0, i32 noundef %1, float noundef %2) #2 align 2 {
  %4 = alloca float, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca float, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca float, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store float %2, ptr %7, align 4, !tbaa !11
  %12 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %13 = load i32, ptr %6, align 4, !tbaa !9
  %14 = call noundef i32 @_ZN3vox10NodeEditor6Detail14NavigateAction14MatchZoomIndexEi(ptr noundef nonnull align 8 dereferenceable(184) %12, i32 noundef %13)
  store i32 %14, ptr %8, align 4, !tbaa !9
  %15 = load i32, ptr %8, align 4, !tbaa !9
  %16 = icmp slt i32 %15, 0
  br i1 %16, label %17, label %19

17:                                               ; preds = %3
  %18 = load float, ptr %7, align 4, !tbaa !11
  store float %18, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %50

19:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %20 = load i32, ptr %8, align 4, !tbaa !9
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [18 x float], ptr @_ZN3vox10NodeEditor6Detail14NavigateAction12s_ZoomLevelsE, i64 0, i64 %21
  %23 = load float, ptr %22, align 4, !tbaa !11
  store float %23, ptr %10, align 4, !tbaa !11
  %24 = load float, ptr %10, align 4, !tbaa !11
  %25 = getelementptr inbounds %"struct.vox::NodeEditor::Detail::NavigateAction", ptr %12, i32 0, i32 3
  %26 = load float, ptr %25, align 4, !tbaa !13
  %27 = fsub float %24, %26
  %28 = call float @llvm.fabs.f32(float %27)
  %29 = fcmp ogt float %28, 0x3F50624DE0000000
  br i1 %29, label %30, label %32

30:                                               ; preds = %19
  %31 = load float, ptr %10, align 4, !tbaa !11
  store float %31, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %49

32:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %33 = load i32, ptr %8, align 4, !tbaa !9
  %34 = load i32, ptr %6, align 4, !tbaa !9
  %35 = add nsw i32 %33, %34
  store i32 %35, ptr %11, align 4, !tbaa !9
  %36 = load i32, ptr %11, align 4, !tbaa !9
  %37 = icmp sge i32 %36, 0
  br i1 %37, label %38, label %46

38:                                               ; preds = %32
  %39 = load i32, ptr %11, align 4, !tbaa !9
  %40 = icmp slt i32 %39, 18
  br i1 %40, label %41, label %46

41:                                               ; preds = %38
  %42 = load i32, ptr %11, align 4, !tbaa !9
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [18 x float], ptr @_ZN3vox10NodeEditor6Detail14NavigateAction12s_ZoomLevelsE, i64 0, i64 %43
  %45 = load float, ptr %44, align 4, !tbaa !11
  store float %45, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %48

46:                                               ; preds = %38, %32
  %47 = load float, ptr %7, align 4, !tbaa !11
  store float %47, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %48

48:                                               ; preds = %46, %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %49

49:                                               ; preds = %48, %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %50

50:                                               ; preds = %49, %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  %51 = load float, ptr %4, align 4
  ret float %51
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN3vox10NodeEditor6Detail14NavigateAction14MatchZoomIndexEi(ptr noundef nonnull align 8 dereferenceable(184), i32 noundef) #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { 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 = { 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, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !12, i64 20}
!14 = !{!"_ZTSN3vox10NodeEditor6Detail14NavigateActionE", !15, i64 0, !16, i64 16, !12, i64 20, !17, i64 24, !17, i64 32, !17, i64 40, !6, i64 48, !17, i64 56, !17, i64 64, !18, i64 72, !22, i64 144, !23, i64 152, !6, i64 160, !16, i64 168, !17, i64 172}
!15 = !{!"_ZTSN3vox10NodeEditor6Detail12EditorActionE", !6, i64 8}
!16 = !{!"bool", !7, i64 0}
!17 = !{!"_ZTS6ImVec2", !12, i64 0, !12, i64 4}
!18 = !{!"_ZTSN3vox10NodeEditor6Detail17NavigateAnimationE", !19, i64 0, !6, i64 32, !21, i64 40, !21, i64 56}
!19 = !{!"_ZTSN3vox10NodeEditor6Detail9AnimationE", !6, i64 8, !20, i64 16, !12, i64 20, !12, i64 24}
!20 = !{!"_ZTSN3vox10NodeEditor6Detail9Animation5StateE", !7, i64 0}
!21 = !{!"_ZTS6ImRect", !17, i64 0, !17, i64 8}
!22 = !{!"_ZTSN3vox10NodeEditor6Detail14NavigateAction16NavigationReasonE", !7, i64 0}
!23 = !{!"long", !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"

@_ZN3vox10NodeEditor6Detail14NavigateAction12s_ZoomLevelsE = external dso_local local_unnamed_addr constant [18 x float], align 16

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fabs.f32(float) #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef float @_ZN3vox10NodeEditor6Detail14NavigateAction9MatchZoomEif(ptr noundef nonnull align 8 dereferenceable(184) %0, i32 noundef %1, float noundef %2) local_unnamed_addr #1 align 2 {
  %4 = tail call noundef i32 @_ZN3vox10NodeEditor6Detail14NavigateAction14MatchZoomIndexEi(ptr noundef nonnull align 8 dereferenceable(184) %0, i32 noundef %1)
  %5 = icmp slt i32 %4, 0
  br i1 %5, label %21, label %6

6:                                                ; preds = %3
  %7 = zext nneg i32 %4 to i64
  %8 = getelementptr inbounds [18 x float], ptr @_ZN3vox10NodeEditor6Detail14NavigateAction12s_ZoomLevelsE, i64 0, i64 %7
  %9 = load float, ptr %8, align 4, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %0, i64 20
  %11 = load float, ptr %10, align 4, !tbaa !9
  %12 = fsub float %9, %11
  %13 = tail call float @llvm.fabs.f32(float %12)
  %14 = fcmp ogt float %13, 0x3F50624DE0000000
  br i1 %14, label %21, label %15

15:                                               ; preds = %6
  %16 = add nsw i32 %4, %1
  %or.cond = icmp ult i32 %16, 18
  br i1 %or.cond, label %17, label %21

17:                                               ; preds = %15
  %18 = zext nneg i32 %16 to i64
  %19 = getelementptr inbounds [18 x float], ptr @_ZN3vox10NodeEditor6Detail14NavigateAction12s_ZoomLevelsE, i64 0, i64 %18
  %20 = load float, ptr %19, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %6, %15, %17, %3
  %.2 = phi float [ %2, %3 ], [ %9, %6 ], [ %20, %17 ], [ %2, %15 ]
  ret float %.2
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN3vox10NodeEditor6Detail14NavigateAction14MatchZoomIndexEi(ptr noundef nonnull align 8 dereferenceable(184), i32 noundef) local_unnamed_addr #1 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !6, i64 0}
!6 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 20}
!10 = !{!"_ZTSN3vox10NodeEditor6Detail14NavigateActionE", !11, i64 0, !13, i64 16, !6, i64 20, !14, i64 24, !14, i64 32, !14, i64 40, !12, i64 48, !14, i64 56, !14, i64 64, !15, i64 72, !19, i64 144, !20, i64 152, !12, i64 160, !13, i64 168, !14, i64 172}
!11 = !{!"_ZTSN3vox10NodeEditor6Detail12EditorActionE", !12, i64 8}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"_ZTS6ImVec2", !6, i64 0, !6, i64 4}
!15 = !{!"_ZTSN3vox10NodeEditor6Detail17NavigateAnimationE", !16, i64 0, !12, i64 32, !18, i64 40, !18, i64 56}
!16 = !{!"_ZTSN3vox10NodeEditor6Detail9AnimationE", !12, i64 8, !17, i64 16, !6, i64 20, !6, i64 24}
!17 = !{!"_ZTSN3vox10NodeEditor6Detail9Animation5StateE", !7, i64 0}
!18 = !{!"_ZTS6ImRect", !14, i64 0, !14, i64 8}
!19 = !{!"_ZTSN3vox10NodeEditor6Detail14NavigateAction16NavigationReasonE", !7, i64 0}
!20 = !{!"long", !7, i64 0}


; Effective O3 passes: GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass