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

; 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 @dlarrr_(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 double, align 8
  %11 = alloca double, align 8
  %12 = alloca i32, align 4
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca i32, align 4
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  %18 = alloca double, align 8
  %19 = alloca double, align 8
  %20 = alloca double, align 8
  %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 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  %23 = getelementptr inbounds double, 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 double, 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 %138

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

44:                                               ; preds = %31
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = getelementptr inbounds double, ptr %45, i64 1
  %47 = load double, ptr %46, align 8, !tbaa !11
  br label %53

48:                                               ; preds = %31
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = getelementptr inbounds double, ptr %49, i64 1
  %51 = load double, ptr %50, align 8, !tbaa !11
  %52 = fneg double %51
  br label %53

53:                                               ; preds = %48, %44
  %54 = phi double [ %47, %44 ], [ %52, %48 ]
  %55 = call double @sqrt(double noundef %54) #4
  store double %55, ptr %19, align 8, !tbaa !11
  %56 = load double, ptr %19, align 8, !tbaa !11
  %57 = load double, ptr %11, align 8, !tbaa !11
  %58 = fcmp olt double %56, %57
  br i1 %58, label %59, label %60

59:                                               ; preds = %53
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %60

60:                                               ; preds = %59, %53
  %61 = load i32, ptr %15, align 4, !tbaa !9
  %62 = icmp ne i32 %61, 0
  br i1 %62, label %64, label %63

63:                                               ; preds = %60
  br label %131

64:                                               ; preds = %60
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = load i32, ptr %65, align 4, !tbaa !9
  store i32 %66, ptr %9, align 4, !tbaa !9
  store i32 2, ptr %12, align 4, !tbaa !9
  br label %67

67:                                               ; preds = %127, %64
  %68 = load i32, ptr %12, align 4, !tbaa !9
  %69 = load i32, ptr %9, align 4, !tbaa !9
  %70 = icmp sle i32 %68, %69
  br i1 %70, label %71, label %130

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

79:                                               ; preds = %71
  %80 = load double, ptr %10, align 8, !tbaa !11
  br label %84

81:                                               ; preds = %71
  %82 = load double, ptr %10, align 8, !tbaa !11
  %83 = fneg double %82
  br label %84

84:                                               ; preds = %81, %79
  %85 = phi double [ %80, %79 ], [ %83, %81 ]
  %86 = call double @sqrt(double noundef %85) #4
  store double %86, ptr %20, align 8, !tbaa !11
  %87 = load double, ptr %20, align 8, !tbaa !11
  %88 = load double, ptr %11, align 8, !tbaa !11
  %89 = fcmp olt double %87, %88
  br i1 %89, label %90, label %91

90:                                               ; preds = %84
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %91

91:                                               ; preds = %90, %84
  %92 = load i32, ptr %15, align 4, !tbaa !9
  %93 = icmp ne i32 %92, 0
  br i1 %93, label %95, label %94

94:                                               ; preds = %91
  br label %131

95:                                               ; preds = %91
  %96 = load ptr, ptr %7, align 8, !tbaa !5
  %97 = load i32, ptr %12, align 4, !tbaa !9
  %98 = sub nsw i32 %97, 1
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds double, ptr %96, i64 %99
  %101 = load double, ptr %100, align 8, !tbaa !11
  store double %101, ptr %10, align 8, !tbaa !11
  %102 = load double, ptr %10, align 8, !tbaa !11
  %103 = fcmp oge double %102, 0.000000e+00
  br i1 %103, label %104, label %106

104:                                              ; preds = %95
  %105 = load double, ptr %10, align 8, !tbaa !11
  br label %109

106:                                              ; preds = %95
  %107 = load double, ptr %10, align 8, !tbaa !11
  %108 = fneg double %107
  br label %109

109:                                              ; preds = %106, %104
  %110 = phi double [ %105, %104 ], [ %108, %106 ]
  %111 = load double, ptr %19, align 8, !tbaa !11
  %112 = load double, ptr %20, align 8, !tbaa !11
  %113 = fmul double %111, %112
  %114 = fdiv double %110, %113
  store double %114, ptr %17, align 8, !tbaa !11
  %115 = load double, ptr %13, align 8, !tbaa !11
  %116 = load double, ptr %17, align 8, !tbaa !11
  %117 = fadd double %115, %116
  %118 = fcmp oge double %117, 0x3FEFF7CED916872B
  br i1 %118, label %119, label %120

119:                                              ; preds = %109
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %120

120:                                              ; preds = %119, %109
  %121 = load i32, ptr %15, align 4, !tbaa !9
  %122 = icmp ne i32 %121, 0
  br i1 %122, label %124, label %123

123:                                              ; preds = %120
  br label %131

124:                                              ; preds = %120
  %125 = load double, ptr %20, align 8, !tbaa !11
  store double %125, ptr %19, align 8, !tbaa !11
  %126 = load double, ptr %17, align 8, !tbaa !11
  store double %126, ptr %13, align 8, !tbaa !11
  br label %127

127:                                              ; preds = %124
  %128 = load i32, ptr %12, align 4, !tbaa !9
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %12, align 4, !tbaa !9
  br label %67, !llvm.loop !13

130:                                              ; preds = %67
  br label %131

131:                                              ; preds = %130, %123, %94, %63
  %132 = load i32, ptr %15, align 4, !tbaa !9
  %133 = icmp ne i32 %132, 0
  br i1 %133, label %134, label %136

134:                                              ; preds = %131
  %135 = load ptr, ptr %8, align 8, !tbaa !5
  store i32 0, ptr %135, align 4, !tbaa !9
  store i32 1, ptr %21, align 4
  br label %138

136:                                              ; preds = %131
  br label %137

137:                                              ; preds = %136
  store i32 1, ptr %21, align 4
  br label %138

138:                                              ; preds = %137, %134, %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, 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 double @dlamch_(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 = !{!"double", !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 @dlarrr_(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 -8
  %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 double @dlamch_(ptr noundef nonnull @.str) #3
  %10 = tail call double @dlamch_(ptr noundef nonnull @.str.1) #3
  %11 = fdiv double %9, %10
  %12 = tail call double @sqrt(double noundef %11) #3
  %13 = load double, ptr %1, align 8, !tbaa !9
  %14 = fcmp ult double %13, 0.000000e+00
  %15 = fneg double %13
  %16 = select i1 %14, double %15, double %13
  %17 = tail call double @sqrt(double noundef %16) #3
  %18 = fcmp olt double %17, %12
  br i1 %18, label %.critedge, label %19

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

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

22:                                               ; preds = %30
  %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, %22
  %indvars.iv = phi i64 [ 2, %.lr.ph.preheader ], [ %indvars.iv.next, %22 ]
  %.050 = phi double [ %17, %.lr.ph.preheader ], [ %28, %22 ]
  %.04148 = phi double [ 0.000000e+00, %.lr.ph.preheader ], [ %36, %22 ]
  %23 = getelementptr inbounds double, ptr %5, i64 %indvars.iv
  %24 = load double, ptr %23, align 8, !tbaa !9
  %25 = fcmp oge double %24, 0.000000e+00
  %26 = fneg double %24
  %27 = select i1 %25, double %24, double %26
  %28 = tail call double @sqrt(double noundef %27) #3
  %29 = fcmp olt double %28, %12
  br i1 %29, label %.critedge, label %30

30:                                               ; preds = %.lr.ph
  %gep = getelementptr double, ptr %invariant.gep, i64 %indvars.iv
  %31 = load double, ptr %gep, align 8, !tbaa !9
  %32 = fcmp oge double %31, 0.000000e+00
  %33 = fneg double %31
  %34 = select i1 %32, double %31, double %33
  %35 = fmul double %.050, %28
  %36 = fdiv double %34, %35
  %37 = fadd double %.04148, %36
  %38 = fcmp ult double %37, 0x3FEFF7CED916872B
  br i1 %38, label %22, label %.critedge

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

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

declare double @dlamch_(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #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 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" }
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, !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 = !{!"double", !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