; LLVM IR from OpenMathLib/OpenBLAS :: lapack-netlib/SRC (slarrr)

; 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"

@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [10 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @slarrr_(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca float, align 4
  %11 = alloca float, align 4
  %12 = alloca i32, align 4
  %13 = alloca float, align 4
  %14 = alloca float, align 4
  %15 = alloca i32, align 4
  %16 = alloca float, align 4
  %17 = alloca float, align 4
  %18 = alloca float, align 4
  %19 = alloca float, align 4
  %20 = alloca float, align 4
  %21 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  %23 = getelementptr inbounds float, ptr %22, i32 -1
  store ptr %23, ptr %7, align 8, !tbaa !5
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = getelementptr inbounds float, ptr %24, i32 -1
  store ptr %25, ptr %6, align 8, !tbaa !5
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = load i32, ptr %26, align 4, !tbaa !9
  %28 = icmp sle i32 %27, 0
  br i1 %28, label %29, label %31

29:                                               ; preds = %4
  %30 = load ptr, ptr %8, align 8, !tbaa !5
  store i32 0, ptr %30, align 4, !tbaa !9
  store i32 1, ptr %21, align 4
  br label %144

31:                                               ; preds = %4
  %32 = load ptr, ptr %8, align 8, !tbaa !5
  store i32 1, ptr %32, align 4, !tbaa !9
  %33 = call float @slamch_(ptr noundef @.str)
  store float %33, ptr %14, align 4, !tbaa !11
  %34 = call float @slamch_(ptr noundef @.str.1)
  store float %34, ptr %18, align 4, !tbaa !11
  %35 = load float, ptr %14, align 4, !tbaa !11
  %36 = load float, ptr %18, align 4, !tbaa !11
  %37 = fdiv float %35, %36
  store float %37, ptr %16, align 4, !tbaa !11
  %38 = load float, ptr %16, align 4, !tbaa !11
  %39 = fpext float %38 to double
  %40 = call double @sqrt(double noundef %39) #4
  %41 = fptrunc double %40 to float
  store float %41, ptr %11, align 4, !tbaa !11
  store i32 1, ptr %15, align 4, !tbaa !9
  store float 0.000000e+00, ptr %13, align 4, !tbaa !11
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = getelementptr inbounds float, ptr %42, i64 1
  %44 = load float, ptr %43, align 4, !tbaa !11
  %45 = fcmp oge float %44, 0.000000e+00
  br i1 %45, label %46, label %50

46:                                               ; preds = %31
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = getelementptr inbounds float, ptr %47, i64 1
  %49 = load float, ptr %48, align 4, !tbaa !11
  br label %55

50:                                               ; preds = %31
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = getelementptr inbounds float, ptr %51, i64 1
  %53 = load float, ptr %52, align 4, !tbaa !11
  %54 = fneg float %53
  br label %55

55:                                               ; preds = %50, %46
  %56 = phi float [ %49, %46 ], [ %54, %50 ]
  %57 = fpext float %56 to double
  %58 = call double @sqrt(double noundef %57) #4
  %59 = fptrunc double %58 to float
  store float %59, ptr %19, align 4, !tbaa !11
  %60 = load float, ptr %19, align 4, !tbaa !11
  %61 = load float, ptr %11, align 4, !tbaa !11
  %62 = fcmp olt float %60, %61
  br i1 %62, label %63, label %64

63:                                               ; preds = %55
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %64

64:                                               ; preds = %63, %55
  %65 = load i32, ptr %15, align 4, !tbaa !9
  %66 = icmp ne i32 %65, 0
  br i1 %66, label %68, label %67

67:                                               ; preds = %64
  br label %137

68:                                               ; preds = %64
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = load i32, ptr %69, align 4, !tbaa !9
  store i32 %70, ptr %9, align 4, !tbaa !9
  store i32 2, ptr %12, align 4, !tbaa !9
  br label %71

71:                                               ; preds = %133, %68
  %72 = load i32, ptr %12, align 4, !tbaa !9
  %73 = load i32, ptr %9, align 4, !tbaa !9
  %74 = icmp sle i32 %72, %73
  br i1 %74, label %75, label %136

75:                                               ; preds = %71
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = load i32, ptr %12, align 4, !tbaa !9
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds float, ptr %76, i64 %78
  %80 = load float, ptr %79, align 4, !tbaa !11
  store float %80, ptr %10, align 4, !tbaa !11
  %81 = load float, ptr %10, align 4, !tbaa !11
  %82 = fcmp oge float %81, 0.000000e+00
  br i1 %82, label %83, label %85

83:                                               ; preds = %75
  %84 = load float, ptr %10, align 4, !tbaa !11
  br label %88

85:                                               ; preds = %75
  %86 = load float, ptr %10, align 4, !tbaa !11
  %87 = fneg float %86
  br label %88

88:                                               ; preds = %85, %83
  %89 = phi float [ %84, %83 ], [ %87, %85 ]
  %90 = fpext float %89 to double
  %91 = call double @sqrt(double noundef %90) #4
  %92 = fptrunc double %91 to float
  store float %92, ptr %20, align 4, !tbaa !11
  %93 = load float, ptr %20, align 4, !tbaa !11
  %94 = load float, ptr %11, align 4, !tbaa !11
  %95 = fcmp olt float %93, %94
  br i1 %95, label %96, label %97

96:                                               ; preds = %88
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %97

97:                                               ; preds = %96, %88
  %98 = load i32, ptr %15, align 4, !tbaa !9
  %99 = icmp ne i32 %98, 0
  br i1 %99, label %101, label %100

100:                                              ; preds = %97
  br label %137

101:                                              ; preds = %97
  %102 = load ptr, ptr %7, align 8, !tbaa !5
  %103 = load i32, ptr %12, align 4, !tbaa !9
  %104 = sub nsw i32 %103, 1
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds float, ptr %102, i64 %105
  %107 = load float, ptr %106, align 4, !tbaa !11
  store float %107, ptr %10, align 4, !tbaa !11
  %108 = load float, ptr %10, align 4, !tbaa !11
  %109 = fcmp oge float %108, 0.000000e+00
  br i1 %109, label %110, label %112

110:                                              ; preds = %101
  %111 = load float, ptr %10, align 4, !tbaa !11
  br label %115

112:                                              ; preds = %101
  %113 = load float, ptr %10, align 4, !tbaa !11
  %114 = fneg float %113
  br label %115

115:                                              ; preds = %112, %110
  %116 = phi float [ %111, %110 ], [ %114, %112 ]
  %117 = load float, ptr %19, align 4, !tbaa !11
  %118 = load float, ptr %20, align 4, !tbaa !11
  %119 = fmul float %117, %118
  %120 = fdiv float %116, %119
  store float %120, ptr %17, align 4, !tbaa !11
  %121 = load float, ptr %13, align 4, !tbaa !11
  %122 = load float, ptr %17, align 4, !tbaa !11
  %123 = fadd float %121, %122
  %124 = fcmp oge float %123, 0x3FEFF7CEE0000000
  br i1 %124, label %125, label %126

125:                                              ; preds = %115
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %126

126:                                              ; preds = %125, %115
  %127 = load i32, ptr %15, align 4, !tbaa !9
  %128 = icmp ne i32 %127, 0
  br i1 %128, label %130, label %129

129:                                              ; preds = %126
  br label %137

130:                                              ; preds = %126
  %131 = load float, ptr %20, align 4, !tbaa !11
  store float %131, ptr %19, align 4, !tbaa !11
  %132 = load float, ptr %17, align 4, !tbaa !11
  store float %132, ptr %13, align 4, !tbaa !11
  br label %133

133:                                              ; preds = %130
  %134 = load i32, ptr %12, align 4, !tbaa !9
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr %12, align 4, !tbaa !9
  br label %71, !llvm.loop !13

136:                                              ; preds = %71
  br label %137

137:                                              ; preds = %136, %129, %100, %67
  %138 = load i32, ptr %15, align 4, !tbaa !9
  %139 = icmp ne i32 %138, 0
  br i1 %139, label %140, label %142

140:                                              ; preds = %137
  %141 = load ptr, ptr %8, align 8, !tbaa !5
  store i32 0, ptr %141, align 4, !tbaa !9
  store i32 1, ptr %21, align 4
  br label %144

142:                                              ; preds = %137
  br label %143

143:                                              ; preds = %142
  store i32 1, ptr %21, align 4
  br label %144

144:                                              ; preds = %143, %140, %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

declare float @slamch_(ptr noundef) #2

; Function Attrs: nounwind
declare double @sqrt(double noundef) #3

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind "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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; 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"

@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [10 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @slarrr_(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2, ptr nocapture noundef writeonly %3) local_unnamed_addr #0 {
  %5 = getelementptr inbounds i8, ptr %1, i64 -4
  %6 = load i32, ptr %0, align 4, !tbaa !5
  %7 = icmp slt i32 %6, 1
  br i1 %7, label %.critedge.sink.split, label %8

8:                                                ; preds = %4
  store i32 1, ptr %3, align 4, !tbaa !5
  %9 = tail call float @slamch_(ptr noundef nonnull @.str) #2
  %10 = tail call float @slamch_(ptr noundef nonnull @.str.1) #2
  %11 = fdiv float %9, %10
  %sqrtf = tail call float @sqrtf(float noundef %11) #3
  %12 = load float, ptr %1, align 4, !tbaa !9
  %13 = fcmp ult float %12, 0.000000e+00
  %14 = fneg float %12
  %15 = select i1 %13, float %14, float %12
  %sqrtf44 = tail call float @sqrtf(float noundef %15) #3
  %16 = fcmp olt float %sqrtf44, %sqrtf
  br i1 %16, label %.critedge, label %17

17:                                               ; preds = %8
  %18 = load i32, ptr %0, align 4, !tbaa !5
  %invariant.gep = getelementptr i8, ptr %2, i64 -8
  %.not49 = icmp slt i32 %18, 2
  br i1 %.not49, label %.critedge.sink.split, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %17
  %19 = add nuw i32 %18, 1
  %wide.trip.count = zext i32 %19 to i64
  br label %.lr.ph

20:                                               ; preds = %27
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.critedge.sink.split, label %.lr.ph, !llvm.loop !11

.lr.ph:                                           ; preds = %.lr.ph.preheader, %20
  %indvars.iv = phi i64 [ 2, %.lr.ph.preheader ], [ %indvars.iv.next, %20 ]
  %.052 = phi float [ %sqrtf44, %.lr.ph.preheader ], [ %sqrtf45, %20 ]
  %.04150 = phi float [ 0.000000e+00, %.lr.ph.preheader ], [ %33, %20 ]
  %21 = getelementptr inbounds float, ptr %5, i64 %indvars.iv
  %22 = load float, ptr %21, align 4, !tbaa !9
  %23 = fcmp oge float %22, 0.000000e+00
  %24 = fneg float %22
  %25 = select i1 %23, float %22, float %24
  %sqrtf45 = tail call float @sqrtf(float noundef %25) #3
  %26 = fcmp olt float %sqrtf45, %sqrtf
  br i1 %26, label %.critedge, label %27

27:                                               ; preds = %.lr.ph
  %gep = getelementptr float, ptr %invariant.gep, i64 %indvars.iv
  %28 = load float, ptr %gep, align 4, !tbaa !9
  %29 = fcmp oge float %28, 0.000000e+00
  %30 = fneg float %28
  %31 = select i1 %29, float %28, float %30
  %32 = fmul float %.052, %sqrtf45
  %33 = fdiv float %31, %32
  %34 = fadd float %.04150, %33
  %35 = fcmp ult float %34, 0x3FEFF7CEE0000000
  br i1 %35, label %20, label %.critedge

.critedge.sink.split:                             ; preds = %20, %17, %4
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %.critedge

.critedge:                                        ; preds = %.lr.ph, %27, %.critedge.sink.split, %8
  ret void
}

declare float @slamch_(ptr noundef) local_unnamed_addr #1

declare float @sqrtf(float) local_unnamed_addr

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 = { nounwind }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "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 = !{!"int", !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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass