; LLVM IR from OpenMathLib/OpenBLAS :: lapack-netlib/LAPACKE/src (lapacke_clangb_work)

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

; Function Attrs: nounwind uwtable
define dso_local float @LAPACKE_clangb_work(i32 noundef %0, i8 noundef signext %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, ptr noundef %5, i32 noundef %6, ptr noundef %7) #0 {
  %9 = alloca float, align 4
  %10 = alloca i32, align 4
  %11 = alloca i8, align 1
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca float, align 4
  %20 = alloca i8, align 1
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  store i32 %0, ptr %10, align 4, !tbaa !5
  store i8 %1, ptr %11, align 1, !tbaa !9
  store i32 %2, ptr %12, align 4, !tbaa !5
  store i32 %3, ptr %13, align 4, !tbaa !5
  store i32 %4, ptr %14, align 4, !tbaa !5
  store ptr %5, ptr %15, align 8, !tbaa !10
  store i32 %6, ptr %16, align 4, !tbaa !5
  store ptr %7, ptr %17, align 8, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  store i32 0, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  store float 0.000000e+00, ptr %19, align 4, !tbaa !12
  %23 = load i32, ptr %10, align 4, !tbaa !5
  %24 = icmp eq i32 %23, 102
  br i1 %24, label %25, label %29

25:                                               ; preds = %8
  %26 = load ptr, ptr %15, align 8, !tbaa !10
  %27 = load ptr, ptr %17, align 8, !tbaa !10
  %28 = call float @clangb_(ptr noundef %11, ptr noundef %12, ptr noundef %13, ptr noundef %14, ptr noundef %26, ptr noundef %16, ptr noundef %27, i64 noundef 1)
  store float %28, ptr %19, align 4, !tbaa !12
  br label %100

29:                                               ; preds = %8
  %30 = load i32, ptr %10, align 4, !tbaa !5
  %31 = icmp eq i32 %30, 101
  br i1 %31, label %32, label %97

32:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 1, ptr %20) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  store ptr null, ptr %21, align 8, !tbaa !10
  %33 = load i32, ptr %16, align 4, !tbaa !5
  %34 = load i32, ptr %13, align 4, !tbaa !5
  %35 = load i32, ptr %14, align 4, !tbaa !5
  %36 = add nsw i32 %34, %35
  %37 = add nsw i32 %36, 1
  %38 = icmp slt i32 %33, %37
  br i1 %38, label %39, label %43

39:                                               ; preds = %32
  store i32 -7, ptr %18, align 4, !tbaa !5
  %40 = load i32, ptr %18, align 4, !tbaa !5
  call void @LAPACKE_xerbla(ptr noundef @.str, i32 noundef %40)
  %41 = load i32, ptr %18, align 4, !tbaa !5
  %42 = sitofp i32 %41 to float
  store float %42, ptr %9, align 4
  store i32 1, ptr %22, align 4
  br label %94

43:                                               ; preds = %32
  %44 = load i8, ptr %11, align 1, !tbaa !9
  %45 = call i32 @LAPACKE_lsame(i8 noundef signext %44, i8 noundef signext 49) #7
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %51, label %47

47:                                               ; preds = %43
  %48 = load i8, ptr %11, align 1, !tbaa !9
  %49 = call i32 @LAPACKE_lsame(i8 noundef signext %48, i8 noundef signext 111) #7
  %50 = icmp ne i32 %49, 0
  br i1 %50, label %51, label %52

51:                                               ; preds = %47, %43
  store i8 105, ptr %20, align 1, !tbaa !9
  br label %60

52:                                               ; preds = %47
  %53 = load i8, ptr %11, align 1, !tbaa !9
  %54 = call i32 @LAPACKE_lsame(i8 noundef signext %53, i8 noundef signext 105) #7
  %55 = icmp ne i32 %54, 0
  br i1 %55, label %56, label %57

56:                                               ; preds = %52
  store i8 49, ptr %20, align 1, !tbaa !9
  br label %59

57:                                               ; preds = %52
  %58 = load i8, ptr %11, align 1, !tbaa !9
  store i8 %58, ptr %20, align 1, !tbaa !9
  br label %59

59:                                               ; preds = %57, %56
  br label %60

60:                                               ; preds = %59, %51
  %61 = load i8, ptr %20, align 1, !tbaa !9
  %62 = call i32 @LAPACKE_lsame(i8 noundef signext %61, i8 noundef signext 105) #7
  %63 = icmp ne i32 %62, 0
  br i1 %63, label %64, label %79

64:                                               ; preds = %60
  %65 = load i32, ptr %12, align 4, !tbaa !5
  %66 = icmp sgt i32 1, %65
  br i1 %66, label %67, label %68

67:                                               ; preds = %64
  br label %70

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

70:                                               ; preds = %68, %67
  %71 = phi i32 [ 1, %67 ], [ %69, %68 ]
  %72 = sext i32 %71 to i64
  %73 = mul i64 4, %72
  %74 = call noalias ptr @malloc(i64 noundef %73) #8
  store ptr %74, ptr %21, align 8, !tbaa !10
  %75 = load ptr, ptr %21, align 8, !tbaa !10
  %76 = icmp eq ptr %75, null
  br i1 %76, label %77, label %78

77:                                               ; preds = %70
  store i32 -1010, ptr %18, align 4, !tbaa !5
  br label %88

78:                                               ; preds = %70
  br label %79

79:                                               ; preds = %78, %60
  %80 = load ptr, ptr %15, align 8, !tbaa !10
  %81 = load ptr, ptr %17, align 8, !tbaa !10
  %82 = call float @clangb_(ptr noundef %11, ptr noundef %12, ptr noundef %14, ptr noundef %13, ptr noundef %80, ptr noundef %16, ptr noundef %81, i64 noundef 1)
  store float %82, ptr %19, align 4, !tbaa !12
  %83 = load ptr, ptr %21, align 8, !tbaa !10
  %84 = icmp ne ptr %83, null
  br i1 %84, label %85, label %87

85:                                               ; preds = %79
  %86 = load ptr, ptr %21, align 8, !tbaa !10
  call void @free(ptr noundef %86) #6
  br label %87

87:                                               ; preds = %85, %79
  br label %88

88:                                               ; preds = %87, %77
  %89 = load i32, ptr %18, align 4, !tbaa !5
  %90 = icmp eq i32 %89, -1011
  br i1 %90, label %91, label %93

91:                                               ; preds = %88
  %92 = load i32, ptr %18, align 4, !tbaa !5
  call void @LAPACKE_xerbla(ptr noundef @.str, i32 noundef %92)
  br label %93

93:                                               ; preds = %91, %88
  store i32 0, ptr %22, align 4
  br label %94

94:                                               ; preds = %93, %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #6
  %95 = load i32, ptr %22, align 4
  switch i32 %95, label %102 [
    i32 0, label %96
  ]

96:                                               ; preds = %94
  br label %99

97:                                               ; preds = %29
  store i32 -1, ptr %18, align 4, !tbaa !5
  %98 = load i32, ptr %18, align 4, !tbaa !5
  call void @LAPACKE_xerbla(ptr noundef @.str, i32 noundef %98)
  br label %99

99:                                               ; preds = %97, %96
  br label %100

100:                                              ; preds = %99, %25
  %101 = load float, ptr %19, align 4, !tbaa !12
  store float %101, ptr %9, align 4
  store i32 1, ptr %22, align 4
  br label %102

102:                                              ; preds = %100, %94
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  %103 = load float, ptr %9, align 4
  ret float %103
}

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

declare float @clangb_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) #2

declare void @LAPACKE_xerbla(ptr noundef, i32 noundef) #2

; Function Attrs: nounwind willreturn memory(none)
declare i32 @LAPACKE_lsame(i8 noundef signext, i8 noundef signext) #3

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #4

; Function Attrs: nounwind
declare void @free(ptr noundef) #5

; 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 willreturn memory(none) "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 allocsize(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 #5 = { 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 #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(none) }
attributes #8 = { nounwind allocsize(0) }

!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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"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 [20 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local float @LAPACKE_clangb_work(i32 noundef %0, i8 noundef signext %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, ptr noundef %5, i32 noundef %6, ptr noundef %7) local_unnamed_addr #0 {
  %9 = alloca i8, align 1
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store i8 %1, ptr %9, align 1, !tbaa !5
  store i32 %2, ptr %10, align 4, !tbaa !8
  store i32 %3, ptr %11, align 4, !tbaa !8
  store i32 %4, ptr %12, align 4, !tbaa !8
  store i32 %6, ptr %13, align 4, !tbaa !8
  switch i32 %0, label %21 [
    i32 102, label %14
    i32 101, label %16
  ]

14:                                               ; preds = %8
  %15 = call float @clangb_(ptr noundef nonnull %9, ptr noundef nonnull %10, ptr noundef nonnull %11, ptr noundef nonnull %12, ptr noundef %5, ptr noundef nonnull %13, ptr noundef %7, i64 noundef 1) #2
  br label %22

16:                                               ; preds = %8
  %17 = add nsw i32 %4, %3
  %.not = icmp slt i32 %17, %6
  br i1 %.not, label %18, label %20

18:                                               ; preds = %16
  %19 = call float @clangb_(ptr noundef nonnull %9, ptr noundef nonnull %10, ptr noundef nonnull %12, ptr noundef nonnull %11, ptr noundef %5, ptr noundef nonnull %13, ptr noundef %7, i64 noundef 1) #2
  br label %22

20:                                               ; preds = %16
  tail call void @LAPACKE_xerbla(ptr noundef nonnull @.str, i32 noundef -7) #2
  br label %22

21:                                               ; preds = %8
  tail call void @LAPACKE_xerbla(ptr noundef nonnull @.str, i32 noundef -1) #2
  br label %22

22:                                               ; preds = %18, %20, %14, %21
  %.122 = phi float [ -7.000000e+00, %20 ], [ %15, %14 ], [ 0.000000e+00, %21 ], [ %19, %18 ]
  ret float %.122
}

declare float @clangb_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

declare void @LAPACKE_xerbla(ptr noundef, i32 noundef) local_unnamed_addr #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 = { "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 }

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass