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

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

; 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: nounwind uwtable
define dso_local i32 @qnsearch_step(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca float, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.qnsearch_s, ptr %6, i32 0, i32 1
  %8 = load i32, ptr %7, align 8, !tbaa !9
  store i32 %8, ptr %4, align 4, !tbaa !13
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = call i32 @qnsearch_compute_gradient(ptr noundef %9)
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = call i32 @qnsearch_compute_Hessian(ptr noundef %11)
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.qnsearch_s, ptr %13, i32 0, i32 9
  %15 = load ptr, ptr %14, align 8, !tbaa !14
  %16 = load i32, ptr %4, align 4, !tbaa !13
  %17 = load i32, ptr %4, align 4, !tbaa !13
  %18 = call i32 @matrixf_inv(ptr noundef %15, i32 noundef %16, i32 noundef %17)
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.qnsearch_s, ptr %19, i32 0, i32 9
  %21 = load ptr, ptr %20, align 8, !tbaa !14
  %22 = load i32, ptr %4, align 4, !tbaa !13
  %23 = load i32, ptr %4, align 4, !tbaa !13
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.qnsearch_s, ptr %24, i32 0, i32 11
  %26 = load ptr, ptr %25, align 8, !tbaa !15
  %27 = load i32, ptr %4, align 4, !tbaa !13
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.qnsearch_s, ptr %28, i32 0, i32 10
  %30 = load ptr, ptr %29, align 8, !tbaa !16
  %31 = load i32, ptr %4, align 4, !tbaa !13
  %32 = call i32 @matrixf_mul(ptr noundef %21, i32 noundef %22, i32 noundef %23, ptr noundef %26, i32 noundef %27, i32 noundef 1, ptr noundef %30, i32 noundef %31, i32 noundef 1)
  store i32 0, ptr %3, align 4, !tbaa !13
  br label %33

33:                                               ; preds = %58, %1
  %34 = load i32, ptr %3, align 4, !tbaa !13
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.qnsearch_s, ptr %35, i32 0, i32 1
  %37 = load i32, ptr %36, align 8, !tbaa !9
  %38 = icmp ult i32 %34, %37
  br i1 %38, label %39, label %61

39:                                               ; preds = %33
  %40 = load ptr, ptr %2, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.qnsearch_s, ptr %40, i32 0, i32 5
  %42 = load float, ptr %41, align 8, !tbaa !17
  %43 = fneg float %42
  %44 = load ptr, ptr %2, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.qnsearch_s, ptr %44, i32 0, i32 10
  %46 = load ptr, ptr %45, align 8, !tbaa !16
  %47 = load i32, ptr %3, align 4, !tbaa !13
  %48 = zext i32 %47 to i64
  %49 = getelementptr inbounds float, ptr %46, i64 %48
  %50 = load float, ptr %49, align 4, !tbaa !18
  %51 = fmul float %43, %50
  %52 = load ptr, ptr %2, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.qnsearch_s, ptr %52, i32 0, i32 7
  %54 = load ptr, ptr %53, align 8, !tbaa !19
  %55 = load i32, ptr %3, align 4, !tbaa !13
  %56 = zext i32 %55 to i64
  %57 = getelementptr inbounds float, ptr %54, i64 %56
  store float %51, ptr %57, align 4, !tbaa !18
  br label %58

58:                                               ; preds = %39
  %59 = load i32, ptr %3, align 4, !tbaa !13
  %60 = add i32 %59, 1
  store i32 %60, ptr %3, align 4, !tbaa !13
  br label %33, !llvm.loop !20

61:                                               ; preds = %33
  store i32 0, ptr %3, align 4, !tbaa !13
  br label %62

62:                                               ; preds = %84, %61
  %63 = load i32, ptr %3, align 4, !tbaa !13
  %64 = load ptr, ptr %2, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.qnsearch_s, ptr %64, i32 0, i32 1
  %66 = load i32, ptr %65, align 8, !tbaa !9
  %67 = icmp ult i32 %63, %66
  br i1 %67, label %68, label %87

68:                                               ; preds = %62
  %69 = load ptr, ptr %2, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.qnsearch_s, ptr %69, i32 0, i32 7
  %71 = load ptr, ptr %70, align 8, !tbaa !19
  %72 = load i32, ptr %3, align 4, !tbaa !13
  %73 = zext i32 %72 to i64
  %74 = getelementptr inbounds float, ptr %71, i64 %73
  %75 = load float, ptr %74, align 4, !tbaa !18
  %76 = load ptr, ptr %2, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.qnsearch_s, ptr %76, i32 0, i32 0
  %78 = load ptr, ptr %77, align 8, !tbaa !22
  %79 = load i32, ptr %3, align 4, !tbaa !13
  %80 = zext i32 %79 to i64
  %81 = getelementptr inbounds float, ptr %78, i64 %80
  %82 = load float, ptr %81, align 4, !tbaa !18
  %83 = fadd float %82, %75
  store float %83, ptr %81, align 4, !tbaa !18
  br label %84

84:                                               ; preds = %68
  %85 = load i32, ptr %3, align 4, !tbaa !13
  %86 = add i32 %85, 1
  store i32 %86, ptr %3, align 4, !tbaa !13
  br label %62, !llvm.loop !23

87:                                               ; preds = %62
  %88 = load ptr, ptr %2, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.qnsearch_s, ptr %88, i32 0, i32 12
  %90 = load ptr, ptr %89, align 8, !tbaa !24
  %91 = load ptr, ptr %2, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.qnsearch_s, ptr %91, i32 0, i32 11
  %93 = load ptr, ptr %92, align 8, !tbaa !15
  %94 = load ptr, ptr %2, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.qnsearch_s, ptr %94, i32 0, i32 1
  %96 = load i32, ptr %95, align 8, !tbaa !9
  %97 = zext i32 %96 to i64
  %98 = mul i64 %97, 4
  call void @llvm.memmove.p0.p0.i64(ptr align 4 %90, ptr align 4 %93, i64 %98, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %99 = load ptr, ptr %2, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.qnsearch_s, ptr %99, i32 0, i32 13
  %101 = load ptr, ptr %100, align 8, !tbaa !25
  %102 = load ptr, ptr %2, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.qnsearch_s, ptr %102, i32 0, i32 15
  %104 = load ptr, ptr %103, align 8, !tbaa !26
  %105 = load ptr, ptr %2, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.qnsearch_s, ptr %105, i32 0, i32 0
  %107 = load ptr, ptr %106, align 8, !tbaa !22
  %108 = load ptr, ptr %2, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.qnsearch_s, ptr %108, i32 0, i32 1
  %110 = load i32, ptr %109, align 8, !tbaa !9
  %111 = call float %101(ptr noundef %104, ptr noundef %107, i32 noundef %110)
  store float %111, ptr %5, align 4, !tbaa !18
  %112 = load float, ptr %5, align 4, !tbaa !18
  %113 = load ptr, ptr %2, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.qnsearch_s, ptr %113, i32 0, i32 14
  %115 = load float, ptr %114, align 8, !tbaa !27
  %116 = fcmp ogt float %112, %115
  br i1 %116, label %117, label %122

117:                                              ; preds = %87
  %118 = load ptr, ptr %2, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.qnsearch_s, ptr %118, i32 0, i32 5
  %120 = load float, ptr %119, align 8, !tbaa !17
  %121 = fmul float %120, 0x3FEFAE1480000000
  store float %121, ptr %119, align 8, !tbaa !17
  br label %127

122:                                              ; preds = %87
  %123 = load ptr, ptr %2, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.qnsearch_s, ptr %123, i32 0, i32 5
  %125 = load float, ptr %124, align 8, !tbaa !17
  %126 = fmul float %125, 0x3FF00418A0000000
  store float %126, ptr %124, align 8, !tbaa !17
  br label %127

127:                                              ; preds = %122, %117
  %128 = load float, ptr %5, align 4, !tbaa !18
  %129 = load ptr, ptr %2, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.qnsearch_s, ptr %129, i32 0, i32 14
  store float %128, ptr %130, align 8, !tbaa !27
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  ret i32 0
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @qnsearch_compute_gradient(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @qnsearch_compute_Hessian(ptr noundef) #1

declare i32 @matrixf_inv(ptr noundef, i32 noundef, i32 noundef) #2

declare i32 @matrixf_mul(ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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/C++ TBAA"}
!9 = !{!10, !11, i64 8}
!10 = !{!"qnsearch_s", !6, i64 0, !11, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !12, i64 96, !6, i64 104, !11, i64 112}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!11, !11, i64 0}
!14 = !{!10, !6, i64 56}
!15 = !{!10, !6, i64 72}
!16 = !{!10, !6, i64 64}
!17 = !{!10, !12, i64 24}
!18 = !{!12, !12, i64 0}
!19 = !{!10, !6, i64 40}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!10, !6, i64 0}
!23 = distinct !{!23, !21}
!24 = !{!10, !6, i64 80}
!25 = !{!10, !6, i64 88}
!26 = !{!10, !6, i64 104}
!27 = !{!10, !12, i64 96}


; 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 @qnsearch_step(ptr noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 8
  %3 = load i32, ptr %2, align 8, !tbaa !5
  %4 = tail call i32 @qnsearch_compute_gradient(ptr noundef %0)
  %5 = tail call i32 @qnsearch_compute_Hessian(ptr noundef %0)
  %6 = getelementptr inbounds i8, ptr %0, i64 56
  %7 = load ptr, ptr %6, align 8, !tbaa !12
  %8 = tail call i32 @matrixf_inv(ptr noundef %7, i32 noundef %3, i32 noundef %3) #3
  %9 = load ptr, ptr %6, align 8, !tbaa !12
  %10 = getelementptr inbounds i8, ptr %0, i64 72
  %11 = load ptr, ptr %10, align 8, !tbaa !13
  %12 = getelementptr inbounds i8, ptr %0, i64 64
  %13 = load ptr, ptr %12, align 8, !tbaa !14
  %14 = tail call i32 @matrixf_mul(ptr noundef %9, i32 noundef %3, i32 noundef %3, ptr noundef %11, i32 noundef %3, i32 noundef 1, ptr noundef %13, i32 noundef %3, i32 noundef 1) #3
  %15 = load i32, ptr %2, align 8, !tbaa !5
  %.not = icmp eq i32 %15, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %1
  %16 = getelementptr inbounds i8, ptr %0, i64 24
  %17 = load ptr, ptr %12, align 8, !tbaa !14
  %18 = getelementptr inbounds i8, ptr %0, i64 40
  %19 = load ptr, ptr %18, align 8, !tbaa !15
  %wide.trip.count = zext i32 %15 to i64
  %min.iters.check = icmp ult i32 %15, 12
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.memcheck

scalar.ph.preheader:                              ; preds = %middle.block, %vector.memcheck, %.lr.ph
  %indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %.lr.ph ], [ %n.vec, %middle.block ]
  %xtraiter = and i64 %wide.trip.count, 1
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol

scalar.ph.prol:                                   ; preds = %scalar.ph.preheader
  %20 = load float, ptr %16, align 8, !tbaa !16
  %21 = fneg float %20
  %22 = getelementptr inbounds float, ptr %17, i64 %indvars.iv.ph
  %23 = load float, ptr %22, align 4, !tbaa !17
  %24 = fmul float %23, %21
  %25 = getelementptr inbounds float, ptr %19, i64 %indvars.iv.ph
  store float %24, ptr %25, align 4, !tbaa !17
  %indvars.iv.next.prol = or disjoint i64 %indvars.iv.ph, 1
  br label %scalar.ph.prol.loopexit

scalar.ph.prol.loopexit:                          ; preds = %scalar.ph.prol, %scalar.ph.preheader
  %indvars.iv.unr = phi i64 [ %indvars.iv.ph, %scalar.ph.preheader ], [ %indvars.iv.next.prol, %scalar.ph.prol ]
  %26 = add nsw i64 %wide.trip.count, -1
  %27 = icmp eq i64 %indvars.iv.ph, %26
  br i1 %27, label %.preheader, label %scalar.ph

vector.memcheck:                                  ; preds = %.lr.ph
  %28 = shl nuw nsw i64 %wide.trip.count, 2
  %scevgep = getelementptr i8, ptr %19, i64 %28
  %scevgep52 = getelementptr i8, ptr %0, i64 28
  %scevgep53 = getelementptr i8, ptr %17, i64 %28
  %bound0 = icmp ult ptr %19, %scevgep52
  %bound1 = icmp ult ptr %16, %scevgep
  %found.conflict = and i1 %bound0, %bound1
  %bound054 = icmp ult ptr %19, %scevgep53
  %bound155 = icmp ult ptr %17, %scevgep
  %found.conflict56 = and i1 %bound054, %bound155
  %conflict.rdx = or i1 %found.conflict, %found.conflict56
  br i1 %conflict.rdx, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %vector.memcheck
  %n.vec = and i64 %wide.trip.count, 4294967288
  %29 = load float, ptr %16, align 8, !tbaa !16, !alias.scope !18
  %broadcast.splatinsert57 = insertelement <4 x float> poison, float %29, i64 0
  %broadcast.splat58 = shufflevector <4 x float> %broadcast.splatinsert57, <4 x float> poison, <4 x i32> zeroinitializer
  %30 = fneg <4 x float> %broadcast.splat58
  %31 = fneg <4 x float> %broadcast.splat58
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %32 = getelementptr inbounds float, ptr %17, i64 %index
  %33 = getelementptr inbounds i8, ptr %32, i64 16
  %wide.load = load <4 x float>, ptr %32, align 4, !tbaa !17, !alias.scope !21
  %wide.load59 = load <4 x float>, ptr %33, align 4, !tbaa !17, !alias.scope !21
  %34 = fmul <4 x float> %wide.load, %30
  %35 = fmul <4 x float> %wide.load59, %31
  %36 = getelementptr inbounds float, ptr %19, i64 %index
  %37 = getelementptr inbounds i8, ptr %36, i64 16
  store <4 x float> %34, ptr %36, align 4, !tbaa !17, !alias.scope !23, !noalias !25
  store <4 x float> %35, ptr %37, align 4, !tbaa !17, !alias.scope !23, !noalias !25
  %index.next = add nuw i64 %index, 8
  %38 = icmp eq i64 %index.next, %n.vec
  br i1 %38, label %middle.block, label %vector.body, !llvm.loop !26

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %.preheader, label %scalar.ph.preheader

.preheader:                                       ; preds = %scalar.ph.prol.loopexit, %scalar.ph, %middle.block
  br i1 %.not, label %._crit_edge, label %.lr.ph43

.lr.ph43:                                         ; preds = %.preheader
  %39 = getelementptr inbounds i8, ptr %0, i64 40
  %40 = load ptr, ptr %39, align 8, !tbaa !15
  %41 = load ptr, ptr %0, align 8, !tbaa !30
  %wide.trip.count49 = zext i32 %15 to i64
  %min.iters.check68 = icmp ult i32 %15, 8
  br i1 %min.iters.check68, label %scalar.ph67.preheader, label %vector.memcheck60

scalar.ph67.preheader:                            ; preds = %middle.block66, %vector.memcheck60, %.lr.ph43
  %indvars.iv46.ph = phi i64 [ 0, %vector.memcheck60 ], [ 0, %.lr.ph43 ], [ %n.vec71, %middle.block66 ]
  %xtraiter81 = and i64 %wide.trip.count, 3
  %lcmp.mod82.not = icmp eq i64 %xtraiter81, 0
  br i1 %lcmp.mod82.not, label %scalar.ph67.prol.loopexit, label %scalar.ph67.prol

scalar.ph67.prol:                                 ; preds = %scalar.ph67.preheader, %scalar.ph67.prol
  %indvars.iv46.prol = phi i64 [ %indvars.iv.next47.prol, %scalar.ph67.prol ], [ %indvars.iv46.ph, %scalar.ph67.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %scalar.ph67.prol ], [ 0, %scalar.ph67.preheader ]
  %42 = getelementptr inbounds float, ptr %40, i64 %indvars.iv46.prol
  %43 = load float, ptr %42, align 4, !tbaa !17
  %44 = getelementptr inbounds float, ptr %41, i64 %indvars.iv46.prol
  %45 = load float, ptr %44, align 4, !tbaa !17
  %46 = fadd float %43, %45
  store float %46, ptr %44, align 4, !tbaa !17
  %indvars.iv.next47.prol = add nuw nsw i64 %indvars.iv46.prol, 1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter81
  br i1 %prol.iter.cmp.not, label %scalar.ph67.prol.loopexit, label %scalar.ph67.prol, !llvm.loop !31

scalar.ph67.prol.loopexit:                        ; preds = %scalar.ph67.prol, %scalar.ph67.preheader
  %indvars.iv46.unr = phi i64 [ %indvars.iv46.ph, %scalar.ph67.preheader ], [ %indvars.iv.next47.prol, %scalar.ph67.prol ]
  %47 = sub nsw i64 %indvars.iv46.ph, %wide.trip.count
  %48 = icmp ugt i64 %47, -4
  br i1 %48, label %._crit_edge.loopexit, label %scalar.ph67

vector.memcheck60:                                ; preds = %.lr.ph43
  %49 = shl nuw nsw i64 %wide.trip.count, 2
  %scevgep61 = getelementptr i8, ptr %41, i64 %49
  %scevgep62 = getelementptr i8, ptr %40, i64 %49
  %bound063 = icmp ult ptr %41, %scevgep62
  %bound164 = icmp ult ptr %40, %scevgep61
  %found.conflict65 = and i1 %bound063, %bound164
  br i1 %found.conflict65, label %scalar.ph67.preheader, label %vector.ph69

vector.ph69:                                      ; preds = %vector.memcheck60
  %n.vec71 = and i64 %wide.trip.count, 4294967288
  br label %vector.body73

vector.body73:                                    ; preds = %vector.body73, %vector.ph69
  %index74 = phi i64 [ 0, %vector.ph69 ], [ %index.next79, %vector.body73 ]
  %50 = getelementptr inbounds float, ptr %40, i64 %index74
  %51 = getelementptr inbounds i8, ptr %50, i64 16
  %wide.load75 = load <4 x float>, ptr %50, align 4, !tbaa !17, !alias.scope !33
  %wide.load76 = load <4 x float>, ptr %51, align 4, !tbaa !17, !alias.scope !33
  %52 = getelementptr inbounds float, ptr %41, i64 %index74
  %53 = getelementptr inbounds i8, ptr %52, i64 16
  %wide.load77 = load <4 x float>, ptr %52, align 4, !tbaa !17, !alias.scope !36, !noalias !33
  %wide.load78 = load <4 x float>, ptr %53, align 4, !tbaa !17, !alias.scope !36, !noalias !33
  %54 = fadd <4 x float> %wide.load75, %wide.load77
  %55 = fadd <4 x float> %wide.load76, %wide.load78
  store <4 x float> %54, ptr %52, align 4, !tbaa !17, !alias.scope !36, !noalias !33
  store <4 x float> %55, ptr %53, align 4, !tbaa !17, !alias.scope !36, !noalias !33
  %index.next79 = add nuw i64 %index74, 8
  %56 = icmp eq i64 %index.next79, %n.vec71
  br i1 %56, label %middle.block66, label %vector.body73, !llvm.loop !38

middle.block66:                                   ; preds = %vector.body73
  %cmp.n80 = icmp eq i64 %n.vec71, %wide.trip.count
  br i1 %cmp.n80, label %._crit_edge.loopexit, label %scalar.ph67.preheader

scalar.ph:                                        ; preds = %scalar.ph.prol.loopexit, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next.1, %scalar.ph ], [ %indvars.iv.unr, %scalar.ph.prol.loopexit ]
  %57 = load float, ptr %16, align 8, !tbaa !16
  %58 = fneg float %57
  %59 = getelementptr inbounds float, ptr %17, i64 %indvars.iv
  %60 = load float, ptr %59, align 4, !tbaa !17
  %61 = fmul float %60, %58
  %62 = getelementptr inbounds float, ptr %19, i64 %indvars.iv
  store float %61, ptr %62, align 4, !tbaa !17
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %63 = load float, ptr %16, align 8, !tbaa !16
  %64 = fneg float %63
  %65 = getelementptr inbounds float, ptr %17, i64 %indvars.iv.next
  %66 = load float, ptr %65, align 4, !tbaa !17
  %67 = fmul float %66, %64
  %68 = getelementptr inbounds float, ptr %19, i64 %indvars.iv.next
  store float %67, ptr %68, align 4, !tbaa !17
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, %wide.trip.count
  br i1 %exitcond.not.1, label %.preheader, label %scalar.ph, !llvm.loop !39

scalar.ph67:                                      ; preds = %scalar.ph67.prol.loopexit, %scalar.ph67
  %indvars.iv46 = phi i64 [ %indvars.iv.next47.3, %scalar.ph67 ], [ %indvars.iv46.unr, %scalar.ph67.prol.loopexit ]
  %69 = getelementptr inbounds float, ptr %40, i64 %indvars.iv46
  %70 = load float, ptr %69, align 4, !tbaa !17
  %71 = getelementptr inbounds float, ptr %41, i64 %indvars.iv46
  %72 = load float, ptr %71, align 4, !tbaa !17
  %73 = fadd float %70, %72
  store float %73, ptr %71, align 4, !tbaa !17
  %indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
  %74 = getelementptr inbounds float, ptr %40, i64 %indvars.iv.next47
  %75 = load float, ptr %74, align 4, !tbaa !17
  %76 = getelementptr inbounds float, ptr %41, i64 %indvars.iv.next47
  %77 = load float, ptr %76, align 4, !tbaa !17
  %78 = fadd float %75, %77
  store float %78, ptr %76, align 4, !tbaa !17
  %indvars.iv.next47.1 = add nuw nsw i64 %indvars.iv46, 2
  %79 = getelementptr inbounds float, ptr %40, i64 %indvars.iv.next47.1
  %80 = load float, ptr %79, align 4, !tbaa !17
  %81 = getelementptr inbounds float, ptr %41, i64 %indvars.iv.next47.1
  %82 = load float, ptr %81, align 4, !tbaa !17
  %83 = fadd float %80, %82
  store float %83, ptr %81, align 4, !tbaa !17
  %indvars.iv.next47.2 = add nuw nsw i64 %indvars.iv46, 3
  %84 = getelementptr inbounds float, ptr %40, i64 %indvars.iv.next47.2
  %85 = load float, ptr %84, align 4, !tbaa !17
  %86 = getelementptr inbounds float, ptr %41, i64 %indvars.iv.next47.2
  %87 = load float, ptr %86, align 4, !tbaa !17
  %88 = fadd float %85, %87
  store float %88, ptr %86, align 4, !tbaa !17
  %indvars.iv.next47.3 = add nuw nsw i64 %indvars.iv46, 4
  %exitcond50.not.3 = icmp eq i64 %indvars.iv.next47.3, %wide.trip.count49
  br i1 %exitcond50.not.3, label %._crit_edge.loopexit, label %scalar.ph67, !llvm.loop !40

._crit_edge.loopexit:                             ; preds = %scalar.ph67.prol.loopexit, %scalar.ph67, %middle.block66
  %89 = shl nuw nsw i64 %wide.trip.count49, 2
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader, %1
  %.pre-phi = phi i64 [ 0, %1 ], [ 0, %.preheader ], [ %89, %._crit_edge.loopexit ]
  %90 = getelementptr inbounds i8, ptr %0, i64 80
  %91 = load ptr, ptr %90, align 8, !tbaa !41
  %92 = load ptr, ptr %10, align 8, !tbaa !13
  tail call void @llvm.memmove.p0.p0.i64(ptr align 4 %91, ptr align 4 %92, i64 %.pre-phi, i1 false)
  %93 = getelementptr inbounds i8, ptr %0, i64 88
  %94 = load ptr, ptr %93, align 8, !tbaa !42
  %95 = getelementptr inbounds i8, ptr %0, i64 104
  %96 = load ptr, ptr %95, align 8, !tbaa !43
  %97 = load ptr, ptr %0, align 8, !tbaa !30
  %98 = load i32, ptr %2, align 8, !tbaa !5
  %99 = tail call float %94(ptr noundef %96, ptr noundef %97, i32 noundef %98) #3
  %100 = getelementptr inbounds i8, ptr %0, i64 96
  %101 = load float, ptr %100, align 8, !tbaa !44
  %102 = fcmp ogt float %99, %101
  %103 = getelementptr inbounds i8, ptr %0, i64 24
  %104 = load float, ptr %103, align 8, !tbaa !16
  %. = select i1 %102, float 0x3FEFAE1480000000, float 0x3FF00418A0000000
  %105 = fmul float %104, %.
  store float %105, ptr %103, align 8, !tbaa !16
  store float %99, ptr %100, align 8, !tbaa !44
  ret i32 0
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @qnsearch_compute_gradient(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @qnsearch_compute_Hessian(ptr noundef) local_unnamed_addr #0

declare i32 @matrixf_inv(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

declare i32 @matrixf_mul(ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #2

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 = { "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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, !10, i64 8}
!6 = !{!"qnsearch_s", !7, i64 0, !10, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !11, i64 96, !7, i64 104, !10, i64 112}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!6, !7, i64 56}
!13 = !{!6, !7, i64 72}
!14 = !{!6, !7, i64 64}
!15 = !{!6, !7, i64 40}
!16 = !{!6, !11, i64 24}
!17 = !{!11, !11, i64 0}
!18 = !{!19}
!19 = distinct !{!19, !20}
!20 = distinct !{!20, !"LVerDomain"}
!21 = !{!22}
!22 = distinct !{!22, !20}
!23 = !{!24}
!24 = distinct !{!24, !20}
!25 = !{!19, !22}
!26 = distinct !{!26, !27, !28, !29}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!"llvm.loop.isvectorized", i32 1}
!29 = !{!"llvm.loop.unroll.runtime.disable"}
!30 = !{!6, !7, i64 0}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.unroll.disable"}
!33 = !{!34}
!34 = distinct !{!34, !35}
!35 = distinct !{!35, !"LVerDomain"}
!36 = !{!37}
!37 = distinct !{!37, !35}
!38 = distinct !{!38, !27, !28, !29}
!39 = distinct !{!39, !27, !28}
!40 = distinct !{!40, !27, !28}
!41 = !{!6, !7, i64 80}
!42 = !{!6, !7, i64 88}
!43 = !{!6, !7, i64 104}
!44 = !{!6, !11, i64 96}


; Effective O3 passes: ADCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass