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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @csrscl_(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 float, align 4
  %10 = alloca i32, align 4
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  %14 = alloca float, align 4
  %15 = alloca float, align 4
  %16 = alloca float, align 4
  %17 = 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) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  %18 = load ptr, ptr %7, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.complex, ptr %18, i32 -1
  store ptr %19, ptr %7, align 8, !tbaa !5
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = load i32, ptr %20, align 4, !tbaa !9
  %22 = icmp sle i32 %21, 0
  br i1 %22, label %23, label %24

23:                                               ; preds = %4
  store i32 1, ptr %17, align 4
  br label %99

24:                                               ; preds = %4
  %25 = call float @slamch_(ptr noundef @.str)
  store float %25, ptr %15, align 4, !tbaa !11
  %26 = load float, ptr %15, align 4, !tbaa !11
  %27 = fdiv float 1.000000e+00, %26
  store float %27, ptr %14, align 4, !tbaa !11
  call void @slabad_(ptr noundef %15, ptr noundef %14)
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = load float, ptr %28, align 4, !tbaa !11
  store float %29, ptr %9, align 4, !tbaa !11
  store float 1.000000e+00, ptr %11, align 4, !tbaa !11
  br label %30

30:                                               ; preds = %97, %24
  %31 = load float, ptr %9, align 4, !tbaa !11
  %32 = load float, ptr %15, align 4, !tbaa !11
  %33 = fmul float %31, %32
  store float %33, ptr %12, align 4, !tbaa !11
  %34 = load float, ptr %11, align 4, !tbaa !11
  %35 = load float, ptr %14, align 4, !tbaa !11
  %36 = fdiv float %34, %35
  store float %36, ptr %13, align 4, !tbaa !11
  %37 = load float, ptr %12, align 4, !tbaa !11
  %38 = fcmp oge float %37, 0.000000e+00
  br i1 %38, label %39, label %41

39:                                               ; preds = %30
  %40 = load float, ptr %12, align 4, !tbaa !11
  br label %44

41:                                               ; preds = %30
  %42 = load float, ptr %12, align 4, !tbaa !11
  %43 = fneg float %42
  br label %44

44:                                               ; preds = %41, %39
  %45 = phi float [ %40, %39 ], [ %43, %41 ]
  %46 = load float, ptr %11, align 4, !tbaa !11
  %47 = fcmp oge float %46, 0.000000e+00
  br i1 %47, label %48, label %50

48:                                               ; preds = %44
  %49 = load float, ptr %11, align 4, !tbaa !11
  br label %53

50:                                               ; preds = %44
  %51 = load float, ptr %11, align 4, !tbaa !11
  %52 = fneg float %51
  br label %53

53:                                               ; preds = %50, %48
  %54 = phi float [ %49, %48 ], [ %52, %50 ]
  %55 = fcmp ogt float %45, %54
  br i1 %55, label %56, label %62

56:                                               ; preds = %53
  %57 = load float, ptr %11, align 4, !tbaa !11
  %58 = fcmp une float %57, 0.000000e+00
  br i1 %58, label %59, label %62

59:                                               ; preds = %56
  %60 = load float, ptr %15, align 4, !tbaa !11
  store float %60, ptr %16, align 4, !tbaa !11
  store i32 0, ptr %10, align 4, !tbaa !9
  %61 = load float, ptr %12, align 4, !tbaa !11
  store float %61, ptr %9, align 4, !tbaa !11
  br label %90

62:                                               ; preds = %56, %53
  %63 = load float, ptr %13, align 4, !tbaa !11
  %64 = fcmp oge float %63, 0.000000e+00
  br i1 %64, label %65, label %67

65:                                               ; preds = %62
  %66 = load float, ptr %13, align 4, !tbaa !11
  br label %70

67:                                               ; preds = %62
  %68 = load float, ptr %13, align 4, !tbaa !11
  %69 = fneg float %68
  br label %70

70:                                               ; preds = %67, %65
  %71 = phi float [ %66, %65 ], [ %69, %67 ]
  %72 = load float, ptr %9, align 4, !tbaa !11
  %73 = fcmp oge float %72, 0.000000e+00
  br i1 %73, label %74, label %76

74:                                               ; preds = %70
  %75 = load float, ptr %9, align 4, !tbaa !11
  br label %79

76:                                               ; preds = %70
  %77 = load float, ptr %9, align 4, !tbaa !11
  %78 = fneg float %77
  br label %79

79:                                               ; preds = %76, %74
  %80 = phi float [ %75, %74 ], [ %78, %76 ]
  %81 = fcmp ogt float %71, %80
  br i1 %81, label %82, label %85

82:                                               ; preds = %79
  %83 = load float, ptr %14, align 4, !tbaa !11
  store float %83, ptr %16, align 4, !tbaa !11
  store i32 0, ptr %10, align 4, !tbaa !9
  %84 = load float, ptr %13, align 4, !tbaa !11
  store float %84, ptr %11, align 4, !tbaa !11
  br label %89

85:                                               ; preds = %79
  %86 = load float, ptr %11, align 4, !tbaa !11
  %87 = load float, ptr %9, align 4, !tbaa !11
  %88 = fdiv float %86, %87
  store float %88, ptr %16, align 4, !tbaa !11
  store i32 1, ptr %10, align 4, !tbaa !9
  br label %89

89:                                               ; preds = %85, %82
  br label %90

90:                                               ; preds = %89, %59
  %91 = load ptr, ptr %5, align 8, !tbaa !5
  %92 = load ptr, ptr %7, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.complex, ptr %92, i64 1
  %94 = load ptr, ptr %8, align 8, !tbaa !5
  call void @csscal_(ptr noundef %91, ptr noundef %16, ptr noundef %93, ptr noundef %94)
  %95 = load i32, ptr %10, align 4, !tbaa !9
  %96 = icmp ne i32 %95, 0
  br i1 %96, label %98, label %97

97:                                               ; preds = %90
  br label %30

98:                                               ; preds = %90
  store i32 1, ptr %17, align 4
  br label %99

99:                                               ; preds = %98, %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  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

declare void @slabad_(ptr noundef, ptr noundef) #2

declare void @csscal_(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

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

!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}


; 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 [2 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @csrscl_(ptr noundef %0, ptr nocapture noundef readonly %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #0 {
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #3
  %8 = load i32, ptr %0, align 4, !tbaa !5
  %9 = icmp slt i32 %8, 1
  br i1 %9, label %39, label %10

10:                                               ; preds = %4
  %11 = tail call float @slamch_(ptr noundef nonnull @.str) #3
  store float %11, ptr %6, align 4, !tbaa !9
  %12 = fdiv float 1.000000e+00, %11
  store float %12, ptr %5, align 4, !tbaa !9
  call void @slabad_(ptr noundef nonnull %6, ptr noundef nonnull %5) #3
  %13 = load float, ptr %1, align 4, !tbaa !9
  br label %14

14:                                               ; preds = %38, %10
  %.026 = phi float [ 1.000000e+00, %10 ], [ %.127, %38 ]
  %.0 = phi float [ %13, %10 ], [ %.1, %38 ]
  %15 = load float, ptr %6, align 4, !tbaa !9
  %16 = fmul float %.0, %15
  %17 = insertelement <2 x float> poison, float %16, i64 0
  %18 = insertelement <2 x float> %17, float %.026, i64 1
  %19 = fcmp oge <2 x float> %18, zeroinitializer
  %20 = fneg <2 x float> %18
  %21 = select <2 x i1> %19, <2 x float> %18, <2 x float> %20
  %22 = extractelement <2 x float> %21, i64 0
  %23 = extractelement <2 x float> %21, i64 1
  %24 = fcmp ogt float %22, %23
  %25 = fcmp une float %.026, 0.000000e+00
  %or.cond = and i1 %25, %24
  br i1 %or.cond, label %38, label %26

26:                                               ; preds = %14
  %27 = load float, ptr %5, align 4, !tbaa !9
  %28 = fdiv float %.026, %27
  %29 = insertelement <2 x float> poison, float %28, i64 0
  %30 = insertelement <2 x float> %29, float %.0, i64 1
  %31 = fcmp oge <2 x float> %30, zeroinitializer
  %32 = fneg <2 x float> %30
  %33 = select <2 x i1> %31, <2 x float> %30, <2 x float> %32
  %34 = extractelement <2 x float> %33, i64 0
  %35 = extractelement <2 x float> %33, i64 1
  %36 = fcmp ogt float %34, %35
  br i1 %36, label %38, label %.thread

.thread:                                          ; preds = %26
  %37 = fdiv float %.026, %.0
  store float %37, ptr %7, align 4, !tbaa !9
  call void @csscal_(ptr noundef nonnull %0, ptr noundef nonnull %7, ptr noundef %2, ptr noundef %3) #3
  br label %39

38:                                               ; preds = %26, %14
  %storemerge = phi float [ %15, %14 ], [ %27, %26 ]
  %.127 = phi float [ %.026, %14 ], [ %28, %26 ]
  %.1 = phi float [ %16, %14 ], [ %.0, %26 ]
  store float %storemerge, ptr %7, align 4, !tbaa !9
  call void @csscal_(ptr noundef nonnull %0, ptr noundef nonnull %7, ptr noundef %2, ptr noundef %3) #3
  br label %14

39:                                               ; preds = %.thread, %4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #3
  ret void
}

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

declare float @slamch_(ptr noundef) local_unnamed_addr #2

declare void @slabad_(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @csscal_(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress 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 = { mustprogress 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 }

!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}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass