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

; 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.ImGuiListClipper = type { i32, i32, i32, i32, i32, float, float }

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN16ImGuiListClipper3EndEv(ptr noundef nonnull align 4 dereferenceable(28) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  %4 = getelementptr inbounds %struct.ImGuiListClipper, ptr %3, i32 0, i32 2
  %5 = load i32, ptr %4, align 4, !tbaa !9
  %6 = icmp slt i32 %5, 0
  br i1 %6, label %7, label %8

7:                                                ; preds = %1
  br label %33

8:                                                ; preds = %1
  %9 = getelementptr inbounds %struct.ImGuiListClipper, ptr %3, i32 0, i32 2
  %10 = load i32, ptr %9, align 4, !tbaa !9
  %11 = icmp slt i32 %10, 2147483647
  br i1 %11, label %12, label %30

12:                                               ; preds = %8
  %13 = getelementptr inbounds %struct.ImGuiListClipper, ptr %3, i32 0, i32 0
  %14 = load i32, ptr %13, align 4, !tbaa !13
  %15 = icmp sge i32 %14, 0
  br i1 %15, label %16, label %30

16:                                               ; preds = %12
  %17 = getelementptr inbounds %struct.ImGuiListClipper, ptr %3, i32 0, i32 6
  %18 = load float, ptr %17, align 4, !tbaa !14
  %19 = getelementptr inbounds %struct.ImGuiListClipper, ptr %3, i32 0, i32 2
  %20 = load i32, ptr %19, align 4, !tbaa !9
  %21 = getelementptr inbounds %struct.ImGuiListClipper, ptr %3, i32 0, i32 4
  %22 = load i32, ptr %21, align 4, !tbaa !15
  %23 = sub nsw i32 %20, %22
  %24 = sitofp i32 %23 to float
  %25 = getelementptr inbounds %struct.ImGuiListClipper, ptr %3, i32 0, i32 5
  %26 = load float, ptr %25, align 4, !tbaa !16
  %27 = call float @llvm.fmuladd.f32(float %24, float %26, float %18)
  %28 = getelementptr inbounds %struct.ImGuiListClipper, ptr %3, i32 0, i32 5
  %29 = load float, ptr %28, align 4, !tbaa !16
  call void @_ZL32SetCursorPosYAndSetupForPrevLineff(float noundef %27, float noundef %29)
  br label %30

30:                                               ; preds = %16, %12, %8
  %31 = getelementptr inbounds %struct.ImGuiListClipper, ptr %3, i32 0, i32 2
  store i32 -1, ptr %31, align 4, !tbaa !9
  %32 = getelementptr inbounds %struct.ImGuiListClipper, ptr %3, i32 0, i32 3
  store i32 3, ptr %32, align 4, !tbaa !17
  br label %33

33:                                               ; preds = %30, %7
  ret void
}

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL32SetCursorPosYAndSetupForPrevLineff(float noundef, float noundef) #1

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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" }

!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, !11, i64 8}
!10 = !{!"_ZTS16ImGuiListClipper", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !12, i64 20, !12, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!10, !11, i64 0}
!14 = !{!10, !12, i64 24}
!15 = !{!10, !11, i64 16}
!16 = !{!10, !12, i64 20}
!17 = !{!10, !11, i64 12}


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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN16ImGuiListClipper3EndEv(ptr nocapture noundef nonnull align 4 dereferenceable(28) %0) local_unnamed_addr #1 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 8
  %3 = load i32, ptr %2, align 4, !tbaa !5
  %4 = icmp slt i32 %3, 0
  br i1 %4, label %20, label %5

5:                                                ; preds = %1
  %.not = icmp ne i32 %3, 2147483647
  %6 = load i32, ptr %0, align 4
  %7 = icmp sgt i32 %6, -1
  %or.cond = select i1 %.not, i1 %7, i1 false
  br i1 %or.cond, label %8, label %18

8:                                                ; preds = %5
  %9 = getelementptr inbounds i8, ptr %0, i64 24
  %10 = load float, ptr %9, align 4, !tbaa !11
  %11 = getelementptr inbounds i8, ptr %0, i64 16
  %12 = load i32, ptr %11, align 4, !tbaa !12
  %13 = sub nsw i32 %3, %12
  %14 = sitofp i32 %13 to float
  %15 = getelementptr inbounds i8, ptr %0, i64 20
  %16 = load float, ptr %15, align 4, !tbaa !13
  %17 = tail call float @llvm.fmuladd.f32(float %14, float %16, float %10)
  tail call void @_ZL32SetCursorPosYAndSetupForPrevLineff(float noundef %17, float noundef %16)
  br label %18

18:                                               ; preds = %8, %5
  store i32 -1, ptr %2, align 4, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %0, i64 12
  store i32 3, ptr %19, align 4, !tbaa !14
  br label %20

20:                                               ; preds = %1, %18
  ret void
}

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL32SetCursorPosYAndSetupForPrevLineff(float noundef, float noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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" }

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


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