; LLVM IR from jgaeddert/liquid-dsp :: src/optim/src (qs1dsearch)

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

; Function Attrs: nounwind uwtable
define dso_local i32 @qs1dsearch_init_bounds(ptr noundef %0, float noundef %1, float noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store float %1, ptr %5, align 4, !tbaa !9
  store float %2, ptr %6, align 4, !tbaa !9
  %7 = load float, ptr %5, align 4, !tbaa !9
  %8 = load float, ptr %6, align 4, !tbaa !9
  %9 = fcmp olt float %7, %8
  br i1 %9, label %10, label %12

10:                                               ; preds = %3
  %11 = load float, ptr %5, align 4, !tbaa !9
  br label %14

12:                                               ; preds = %3
  %13 = load float, ptr %6, align 4, !tbaa !9
  br label %14

14:                                               ; preds = %12, %10
  %15 = phi float [ %11, %10 ], [ %13, %12 ]
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.qs1dsearch_s, ptr %16, i32 0, i32 0
  store float %15, ptr %17, align 8, !tbaa !11
  %18 = load float, ptr %5, align 4, !tbaa !9
  %19 = load float, ptr %6, align 4, !tbaa !9
  %20 = fcmp olt float %18, %19
  br i1 %20, label %21, label %23

21:                                               ; preds = %14
  %22 = load float, ptr %6, align 4, !tbaa !9
  br label %25

23:                                               ; preds = %14
  %24 = load float, ptr %5, align 4, !tbaa !9
  br label %25

25:                                               ; preds = %23, %21
  %26 = phi float [ %22, %21 ], [ %24, %23 ]
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.qs1dsearch_s, ptr %27, i32 0, i32 4
  store float %26, ptr %28, align 8, !tbaa !14
  %29 = load float, ptr %5, align 4, !tbaa !9
  %30 = load float, ptr %6, align 4, !tbaa !9
  %31 = fadd float %29, %30
  %32 = fmul float 5.000000e-01, %31
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.qs1dsearch_s, ptr %33, i32 0, i32 2
  store float %32, ptr %34, align 8, !tbaa !15
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.qs1dsearch_s, ptr %35, i32 0, i32 11
  %37 = load ptr, ptr %36, align 8, !tbaa !16
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.qs1dsearch_s, ptr %38, i32 0, i32 0
  %40 = load float, ptr %39, align 8, !tbaa !11
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.qs1dsearch_s, ptr %41, i32 0, i32 12
  %43 = load ptr, ptr %42, align 8, !tbaa !17
  %44 = call float %37(float noundef %40, ptr noundef %43)
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.qs1dsearch_s, ptr %45, i32 0, i32 5
  store float %44, ptr %46, align 4, !tbaa !18
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.qs1dsearch_s, ptr %47, i32 0, i32 11
  %49 = load ptr, ptr %48, align 8, !tbaa !16
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.qs1dsearch_s, ptr %50, i32 0, i32 2
  %52 = load float, ptr %51, align 8, !tbaa !15
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.qs1dsearch_s, ptr %53, i32 0, i32 12
  %55 = load ptr, ptr %54, align 8, !tbaa !17
  %56 = call float %49(float noundef %52, ptr noundef %55)
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.qs1dsearch_s, ptr %57, i32 0, i32 7
  store float %56, ptr %58, align 4, !tbaa !19
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.qs1dsearch_s, ptr %59, i32 0, i32 11
  %61 = load ptr, ptr %60, align 8, !tbaa !16
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.qs1dsearch_s, ptr %62, i32 0, i32 4
  %64 = load float, ptr %63, align 8, !tbaa !14
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.qs1dsearch_s, ptr %65, i32 0, i32 12
  %67 = load ptr, ptr %66, align 8, !tbaa !17
  %68 = call float %61(float noundef %64, ptr noundef %67)
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.qs1dsearch_s, ptr %69, i32 0, i32 9
  store float %68, ptr %70, align 4, !tbaa !20
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.qs1dsearch_s, ptr %71, i32 0, i32 10
  store i32 1, ptr %72, align 8, !tbaa !21
  ret i32 0
}

attributes #0 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"qs1dsearch_s", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !13, i64 40, !6, i64 48, !6, i64 56, !13, i64 64, !13, i64 68}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !10, i64 16}
!15 = !{!12, !10, i64 8}
!16 = !{!12, !6, i64 48}
!17 = !{!12, !6, i64 56}
!18 = !{!12, !10, i64 20}
!19 = !{!12, !10, i64 28}
!20 = !{!12, !10, i64 36}
!21 = !{!12, !13, i64 40}


; 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: nounwind uwtable
define dso_local noundef i32 @qs1dsearch_init_bounds(ptr nocapture noundef %0, float noundef %1, float noundef %2) local_unnamed_addr #0 {
  %4 = fcmp olt float %1, %2
  %5 = select i1 %4, float %1, float %2
  store float %5, ptr %0, align 8, !tbaa !5
  %6 = select i1 %4, float %2, float %1
  %7 = getelementptr inbounds i8, ptr %0, i64 16
  store float %6, ptr %7, align 8, !tbaa !12
  %8 = fadd float %1, %2
  %9 = fmul float %8, 5.000000e-01
  %10 = getelementptr inbounds i8, ptr %0, i64 8
  store float %9, ptr %10, align 8, !tbaa !13
  %11 = getelementptr inbounds i8, ptr %0, i64 48
  %12 = load ptr, ptr %11, align 8, !tbaa !14
  %13 = getelementptr inbounds i8, ptr %0, i64 56
  %14 = load ptr, ptr %13, align 8, !tbaa !15
  %15 = tail call float %12(float noundef %5, ptr noundef %14) #1
  %16 = getelementptr inbounds i8, ptr %0, i64 20
  store float %15, ptr %16, align 4, !tbaa !16
  %17 = load ptr, ptr %11, align 8, !tbaa !14
  %18 = load float, ptr %10, align 8, !tbaa !13
  %19 = load ptr, ptr %13, align 8, !tbaa !15
  %20 = tail call float %17(float noundef %18, ptr noundef %19) #1
  %21 = getelementptr inbounds i8, ptr %0, i64 28
  store float %20, ptr %21, align 4, !tbaa !17
  %22 = load ptr, ptr %11, align 8, !tbaa !14
  %23 = load float, ptr %7, align 8, !tbaa !12
  %24 = load ptr, ptr %13, align 8, !tbaa !15
  %25 = tail call float %22(float noundef %23, ptr noundef %24) #1
  %26 = getelementptr inbounds i8, ptr %0, i64 36
  store float %25, ptr %26, align 4, !tbaa !18
  %27 = getelementptr inbounds i8, ptr %0, i64 40
  store i32 1, ptr %27, align 8, !tbaa !19
  ret i32 0
}

attributes #0 = { 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 = { 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, !7, i64 0}
!6 = !{!"qs1dsearch_s", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36, !10, i64 40, !11, i64 48, !11, i64 56, !10, i64 64, !10, i64 68}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!6, !7, i64 16}
!13 = !{!6, !7, i64 8}
!14 = !{!6, !11, i64 48}
!15 = !{!6, !11, i64 56}
!16 = !{!6, !7, i64 20}
!17 = !{!6, !7, i64 28}
!18 = !{!6, !7, i64 36}
!19 = !{!6, !10, i64 40}


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