; LLVM IR from niuyishuai/PDCABB :: LAPACK_BLAS/LAPACK (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 i32 @slarrr_(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #0 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca float, align 4
  %12 = alloca i64, align 8
  %13 = alloca float, align 4
  %14 = alloca float, align 4
  %15 = alloca float, align 4
  %16 = alloca float, align 4
  %17 = alloca float, align 4
  %18 = alloca float, align 4
  %19 = alloca i64, align 8
  %20 = alloca float, align 4
  %21 = alloca float, align 4
  %22 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 8, 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 8, ptr %19) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #4
  %23 = load ptr, ptr %8, align 8, !tbaa !5
  %24 = getelementptr inbounds float, ptr %23, i32 -1
  store ptr %24, ptr %8, align 8, !tbaa !5
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = getelementptr inbounds float, ptr %25, i32 -1
  store ptr %26, ptr %7, align 8, !tbaa !5
  %27 = load ptr, ptr %9, align 8, !tbaa !5
  store i64 1, ptr %27, align 8, !tbaa !9
  %28 = call double @slamch_(ptr noundef @.str)
  %29 = fptrunc double %28 to float
  store float %29, ptr %18, align 4, !tbaa !11
  %30 = call double @slamch_(ptr noundef @.str.1)
  %31 = fptrunc double %30 to float
  store float %31, ptr %13, align 4, !tbaa !11
  %32 = load float, ptr %18, align 4, !tbaa !11
  %33 = load float, ptr %13, align 4, !tbaa !11
  %34 = fdiv float %32, %33
  store float %34, ptr %20, align 4, !tbaa !11
  %35 = load float, ptr %20, align 4, !tbaa !11
  %36 = fpext float %35 to double
  %37 = call double @sqrt(double noundef %36) #4
  %38 = fptrunc double %37 to float
  store float %38, ptr %16, align 4, !tbaa !11
  store i64 1, ptr %19, align 8, !tbaa !9
  store float 0.000000e+00, ptr %17, align 4, !tbaa !11
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = getelementptr inbounds float, ptr %39, i64 1
  %41 = load float, ptr %40, align 4, !tbaa !11
  %42 = fcmp oge float %41, 0.000000e+00
  br i1 %42, label %43, label %47

43:                                               ; preds = %4
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  %45 = getelementptr inbounds float, ptr %44, i64 1
  %46 = load float, ptr %45, align 4, !tbaa !11
  br label %52

47:                                               ; preds = %4
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = getelementptr inbounds float, ptr %48, i64 1
  %50 = load float, ptr %49, align 4, !tbaa !11
  %51 = fneg float %50
  br label %52

52:                                               ; preds = %47, %43
  %53 = phi float [ %46, %43 ], [ %51, %47 ]
  %54 = fpext float %53 to double
  %55 = call double @sqrt(double noundef %54) #4
  %56 = fptrunc double %55 to float
  store float %56, ptr %14, align 4, !tbaa !11
  %57 = load float, ptr %14, align 4, !tbaa !11
  %58 = load float, ptr %16, align 4, !tbaa !11
  %59 = fcmp olt float %57, %58
  br i1 %59, label %60, label %61

60:                                               ; preds = %52
  store i64 0, ptr %19, align 8, !tbaa !9
  br label %61

61:                                               ; preds = %60, %52
  %62 = load i64, ptr %19, align 8, !tbaa !9
  %63 = icmp ne i64 %62, 0
  br i1 %63, label %65, label %64

64:                                               ; preds = %61
  br label %135

65:                                               ; preds = %61
  %66 = load ptr, ptr %6, align 8, !tbaa !5
  %67 = load i64, ptr %66, align 8, !tbaa !9
  store i64 %67, ptr %10, align 8, !tbaa !9
  store i64 2, ptr %12, align 8, !tbaa !9
  br label %68

68:                                               ; preds = %131, %65
  %69 = load i64, ptr %12, align 8, !tbaa !9
  %70 = load i64, ptr %10, align 8, !tbaa !9
  %71 = icmp sle i64 %69, %70
  br i1 %71, label %72, label %134

72:                                               ; preds = %68
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  %74 = load i64, ptr %12, align 8, !tbaa !9
  %75 = getelementptr inbounds float, ptr %73, i64 %74
  %76 = load float, ptr %75, align 4, !tbaa !11
  store float %76, ptr %11, align 4, !tbaa !11
  %77 = load float, ptr %11, align 4, !tbaa !11
  %78 = fcmp oge float %77, 0.000000e+00
  br i1 %78, label %79, label %81

79:                                               ; preds = %72
  %80 = load float, ptr %11, align 4, !tbaa !11
  br label %84

81:                                               ; preds = %72
  %82 = load float, ptr %11, align 4, !tbaa !11
  %83 = fneg float %82
  br label %84

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

92:                                               ; preds = %84
  store i64 0, ptr %19, align 8, !tbaa !9
  br label %93

93:                                               ; preds = %92, %84
  %94 = load i64, ptr %19, align 8, !tbaa !9
  %95 = icmp ne i64 %94, 0
  br i1 %95, label %97, label %96

96:                                               ; preds = %93
  br label %135

97:                                               ; preds = %93
  %98 = load ptr, ptr %8, align 8, !tbaa !5
  %99 = load i64, ptr %12, align 8, !tbaa !9
  %100 = sub nsw i64 %99, 1
  %101 = getelementptr inbounds float, ptr %98, i64 %100
  %102 = load float, ptr %101, align 4, !tbaa !11
  store float %102, ptr %11, align 4, !tbaa !11
  %103 = load float, ptr %11, align 4, !tbaa !11
  %104 = fcmp oge float %103, 0.000000e+00
  br i1 %104, label %105, label %107

105:                                              ; preds = %97
  %106 = load float, ptr %11, align 4, !tbaa !11
  br label %110

107:                                              ; preds = %97
  %108 = load float, ptr %11, align 4, !tbaa !11
  %109 = fneg float %108
  br label %110

110:                                              ; preds = %107, %105
  %111 = phi float [ %106, %105 ], [ %109, %107 ]
  %112 = fpext float %111 to double
  %113 = load float, ptr %14, align 4, !tbaa !11
  %114 = load float, ptr %15, align 4, !tbaa !11
  %115 = fmul float %113, %114
  %116 = fpext float %115 to double
  %117 = fdiv double %112, %116
  %118 = fptrunc double %117 to float
  store float %118, ptr %21, align 4, !tbaa !11
  %119 = load float, ptr %17, align 4, !tbaa !11
  %120 = load float, ptr %21, align 4, !tbaa !11
  %121 = fadd float %119, %120
  %122 = fcmp oge float %121, 0x3FEFF7CEE0000000
  br i1 %122, label %123, label %124

123:                                              ; preds = %110
  store i64 0, ptr %19, align 8, !tbaa !9
  br label %124

124:                                              ; preds = %123, %110
  %125 = load i64, ptr %19, align 8, !tbaa !9
  %126 = icmp ne i64 %125, 0
  br i1 %126, label %128, label %127

127:                                              ; preds = %124
  br label %135

128:                                              ; preds = %124
  %129 = load float, ptr %15, align 4, !tbaa !11
  store float %129, ptr %14, align 4, !tbaa !11
  %130 = load float, ptr %21, align 4, !tbaa !11
  store float %130, ptr %17, align 4, !tbaa !11
  br label %131

131:                                              ; preds = %128
  %132 = load i64, ptr %12, align 8, !tbaa !9
  %133 = add nsw i64 %132, 1
  store i64 %133, ptr %12, align 8, !tbaa !9
  br label %68, !llvm.loop !13

134:                                              ; preds = %68
  br label %135

135:                                              ; preds = %134, %127, %96, %64
  %136 = load i64, ptr %19, align 8, !tbaa !9
  %137 = icmp ne i64 %136, 0
  br i1 %137, label %138, label %140

138:                                              ; preds = %135
  %139 = load ptr, ptr %9, align 8, !tbaa !5
  store i64 0, ptr %139, align 8, !tbaa !9
  store i32 0, ptr %5, align 4
  store i32 1, ptr %22, align 4
  br label %142

140:                                              ; preds = %135
  br label %141

141:                                              ; preds = %140
  store i32 0, ptr %5, align 4
  store i32 1, ptr %22, align 4
  br label %142

142:                                              ; preds = %141, %138
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 8, 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 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  %143 = load i32, ptr %5, align 4
  ret i32 %143
}

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

declare double @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 = !{!"long", !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 noundef i32 @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
  store i64 1, ptr %3, align 8, !tbaa !5
  %6 = tail call double @slamch_(ptr noundef nonnull @.str) #2
  %7 = fptrunc double %6 to float
  %8 = tail call double @slamch_(ptr noundef nonnull @.str.1) #2
  %9 = fptrunc double %8 to float
  %10 = fdiv float %7, %9
  %sqrtf = tail call float @sqrtf(float noundef %10) #3
  %11 = load float, ptr %1, align 4, !tbaa !9
  %12 = fcmp ult float %11, 0.000000e+00
  %13 = fneg float %11
  %14 = select i1 %12, float %13, float %11
  %sqrtf43 = tail call float @sqrtf(float noundef %14) #3
  %15 = fcmp olt float %sqrtf43, %sqrtf
  br i1 %15, label %.critedge, label %16

16:                                               ; preds = %4
  %17 = load i64, ptr %0, align 8, !tbaa !5
  %.not48 = icmp slt i64 %17, 2
  br i1 %.not48, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %16
  %18 = getelementptr i8, ptr %2, i64 -8
  br label %21

19:                                               ; preds = %28
  %20 = add nuw i64 %.04050, 1
  %exitcond.not = icmp eq i64 %.04050, %17
  br i1 %exitcond.not, label %._crit_edge, label %21, !llvm.loop !11

21:                                               ; preds = %.lr.ph, %19
  %.03951 = phi float [ 0.000000e+00, %.lr.ph ], [ %35, %19 ]
  %.04050 = phi i64 [ 2, %.lr.ph ], [ %20, %19 ]
  %.04149 = phi float [ %sqrtf43, %.lr.ph ], [ %sqrtf44, %19 ]
  %22 = getelementptr inbounds float, ptr %5, i64 %.04050
  %23 = load float, ptr %22, align 4, !tbaa !9
  %24 = fcmp oge float %23, 0.000000e+00
  %25 = fneg float %23
  %26 = select i1 %24, float %23, float %25
  %sqrtf44 = tail call float @sqrtf(float noundef %26) #3
  %27 = fcmp olt float %sqrtf44, %sqrtf
  br i1 %27, label %.critedge, label %28

28:                                               ; preds = %21
  %29 = getelementptr float, ptr %18, i64 %.04050
  %30 = load float, ptr %29, align 4, !tbaa !9
  %31 = fcmp oge float %30, 0.000000e+00
  %32 = fneg float %30
  %33 = select i1 %31, float %30, float %32
  %34 = fmul float %.04149, %sqrtf44
  %35 = fdiv float %33, %34
  %36 = fadd float %.03951, %35
  %37 = fcmp ult float %36, 0x3FEFF7CEE0000000
  br i1 %37, label %19, label %.critedge

._crit_edge:                                      ; preds = %19, %16
  store i64 0, ptr %3, align 8, !tbaa !5
  br label %.critedge

.critedge:                                        ; preds = %21, %28, %4, %._crit_edge
  ret i32 0
}

declare double @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 = !{!"long", !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