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

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

; Function Attrs: nounwind uwtable
define dso_local float @LAPACKE_clantr(i32 noundef %0, i8 noundef signext %1, i8 noundef signext %2, i8 noundef signext %3, i32 noundef %4, i32 noundef %5, ptr noundef %6, i32 noundef %7) #0 {
  %9 = alloca float, align 4
  %10 = alloca i32, align 4
  %11 = alloca i8, align 1
  %12 = alloca i8, align 1
  %13 = alloca i8, align 1
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca float, align 4
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  store i32 %0, ptr %10, align 4, !tbaa !5
  store i8 %1, ptr %11, align 1, !tbaa !9
  store i8 %2, ptr %12, align 1, !tbaa !9
  store i8 %3, ptr %13, align 1, !tbaa !9
  store i32 %4, ptr %14, align 4, !tbaa !5
  store i32 %5, ptr %15, align 4, !tbaa !5
  store ptr %6, ptr %16, align 8, !tbaa !10
  store i32 %7, ptr %17, align 4, !tbaa !5
  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
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  store ptr null, ptr %20, align 8, !tbaa !10
  %22 = load i32, ptr %10, align 4, !tbaa !5
  %23 = icmp ne i32 %22, 102
  br i1 %23, label %24, label %28

24:                                               ; preds = %8
  %25 = load i32, ptr %10, align 4, !tbaa !5
  %26 = icmp ne i32 %25, 101
  br i1 %26, label %27, label %28

27:                                               ; preds = %24
  call void @LAPACKE_xerbla(ptr noundef @.str, i32 noundef -1)
  store float -1.000000e+00, ptr %9, align 4
  store i32 1, ptr %21, align 4
  br label %102

28:                                               ; preds = %24, %8
  %29 = call i32 @LAPACKE_get_nancheck()
  %30 = icmp ne i32 %29, 0
  br i1 %30, label %31, label %43

31:                                               ; preds = %28
  %32 = load i32, ptr %10, align 4, !tbaa !5
  %33 = load i8, ptr %12, align 1, !tbaa !9
  %34 = load i8, ptr %13, align 1, !tbaa !9
  %35 = load i32, ptr %14, align 4, !tbaa !5
  %36 = load i32, ptr %15, align 4, !tbaa !5
  %37 = load ptr, ptr %16, align 8, !tbaa !10
  %38 = load i32, ptr %17, align 4, !tbaa !5
  %39 = call i32 @LAPACKE_ctz_nancheck(i32 noundef %32, i8 noundef signext 102, i8 noundef signext %33, i8 noundef signext %34, i32 noundef %35, i32 noundef %36, ptr noundef %37, i32 noundef %38)
  %40 = icmp ne i32 %39, 0
  br i1 %40, label %41, label %42

41:                                               ; preds = %31
  store float -7.000000e+00, ptr %9, align 4
  store i32 1, ptr %21, align 4
  br label %102

42:                                               ; preds = %31
  br label %43

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

47:                                               ; preds = %43
  %48 = load i32, ptr %14, align 4, !tbaa !5
  %49 = load i32, ptr %15, align 4, !tbaa !5
  %50 = icmp sgt i32 %48, %49
  br i1 %50, label %51, label %53

51:                                               ; preds = %47
  %52 = load i32, ptr %14, align 4, !tbaa !5
  br label %55

53:                                               ; preds = %47
  %54 = load i32, ptr %15, align 4, !tbaa !5
  br label %55

55:                                               ; preds = %53, %51
  %56 = phi i32 [ %52, %51 ], [ %54, %53 ]
  %57 = icmp sgt i32 1, %56
  br i1 %57, label %58, label %59

58:                                               ; preds = %55
  br label %69

59:                                               ; preds = %55
  %60 = load i32, ptr %14, align 4, !tbaa !5
  %61 = load i32, ptr %15, align 4, !tbaa !5
  %62 = icmp sgt i32 %60, %61
  br i1 %62, label %63, label %65

63:                                               ; preds = %59
  %64 = load i32, ptr %14, align 4, !tbaa !5
  br label %67

65:                                               ; preds = %59
  %66 = load i32, ptr %15, align 4, !tbaa !5
  br label %67

67:                                               ; preds = %65, %63
  %68 = phi i32 [ %64, %63 ], [ %66, %65 ]
  br label %69

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

76:                                               ; preds = %69
  store i32 -1010, ptr %18, align 4, !tbaa !5
  br label %95

77:                                               ; preds = %69
  br label %78

78:                                               ; preds = %77, %43
  %79 = load i32, ptr %10, align 4, !tbaa !5
  %80 = load i8, ptr %11, align 1, !tbaa !9
  %81 = load i8, ptr %12, align 1, !tbaa !9
  %82 = load i8, ptr %13, align 1, !tbaa !9
  %83 = load i32, ptr %14, align 4, !tbaa !5
  %84 = load i32, ptr %15, align 4, !tbaa !5
  %85 = load ptr, ptr %16, align 8, !tbaa !10
  %86 = load i32, ptr %17, align 4, !tbaa !5
  %87 = load ptr, ptr %20, align 8, !tbaa !10
  %88 = call float @LAPACKE_clantr_work(i32 noundef %79, i8 noundef signext %80, i8 noundef signext %81, i8 noundef signext %82, i32 noundef %83, i32 noundef %84, ptr noundef %85, i32 noundef %86, ptr noundef %87)
  store float %88, ptr %19, align 4, !tbaa !12
  %89 = load i8, ptr %11, align 1, !tbaa !9
  %90 = call i32 @LAPACKE_lsame(i8 noundef signext %89, i8 noundef signext 105) #7
  %91 = icmp ne i32 %90, 0
  br i1 %91, label %92, label %94

92:                                               ; preds = %78
  %93 = load ptr, ptr %20, align 8, !tbaa !10
  call void @free(ptr noundef %93) #6
  br label %94

94:                                               ; preds = %92, %78
  br label %95

95:                                               ; preds = %94, %76
  %96 = load i32, ptr %18, align 4, !tbaa !5
  %97 = icmp eq i32 %96, -1010
  br i1 %97, label %98, label %100

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

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

102:                                              ; preds = %100, %41, %27
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  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 void @LAPACKE_xerbla(ptr noundef, i32 noundef) #2

declare i32 @LAPACKE_get_nancheck() #2

declare i32 @LAPACKE_ctz_nancheck(i32 noundef, i8 noundef signext, i8 noundef signext, i8 noundef signext, i32 noundef, i32 noundef, 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

declare float @LAPACKE_clantr_work(i32 noundef, i8 noundef signext, i8 noundef signext, i8 noundef signext, i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef) #2

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

; Function Attrs: nounwind uwtable
define dso_local float @LAPACKE_clantr(i32 noundef %0, i8 noundef signext %1, i8 noundef signext %2, i8 noundef signext %3, i32 noundef %4, i32 noundef %5, ptr noundef %6, i32 noundef %7) local_unnamed_addr #0 {
  %9 = add i32 %0, -103
  %or.cond = icmp ult i32 %9, -2
  br i1 %or.cond, label %10, label %11

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

11:                                               ; preds = %8
  %12 = tail call i32 @LAPACKE_get_nancheck() #6
  %.not = icmp eq i32 %12, 0
  br i1 %.not, label %15, label %13

13:                                               ; preds = %11
  %14 = tail call i32 @LAPACKE_ctz_nancheck(i32 noundef %0, i8 noundef signext 102, i8 noundef signext %2, i8 noundef signext %3, i32 noundef %4, i32 noundef %5, ptr noundef %6, i32 noundef %7) #6
  %.not39 = icmp eq i32 %14, 0
  br i1 %.not39, label %15, label %.thread42

15:                                               ; preds = %13, %11
  %16 = tail call i32 @LAPACKE_lsame(i8 noundef signext %1, i8 noundef signext 105) #7
  %.not40 = icmp eq i32 %16, 0
  br i1 %.not40, label %.thread, label %18

.thread:                                          ; preds = %15
  %17 = tail call float @LAPACKE_clantr_work(i32 noundef %0, i8 noundef signext %1, i8 noundef signext %2, i8 noundef signext %3, i32 noundef %4, i32 noundef %5, ptr noundef %6, i32 noundef %7, ptr noundef null) #6
  br label %.thread42

18:                                               ; preds = %15
  %19 = tail call i32 @llvm.smax.i32(i32 %4, i32 %5)
  %20 = icmp slt i32 %19, 1
  %21 = zext nneg i32 %19 to i64
  %22 = shl nuw nsw i64 %21, 2
  %23 = select i1 %20, i64 4, i64 %22
  %24 = tail call noalias ptr @malloc(i64 noundef %23) #8
  %25 = icmp eq ptr %24, null
  br i1 %25, label %28, label %26

26:                                               ; preds = %18
  %27 = tail call float @LAPACKE_clantr_work(i32 noundef %0, i8 noundef signext %1, i8 noundef signext %2, i8 noundef signext %3, i32 noundef %4, i32 noundef %5, ptr noundef %6, i32 noundef %7, ptr noundef nonnull %24) #6
  tail call void @free(ptr noundef nonnull %24) #6
  br label %.thread42

28:                                               ; preds = %18
  tail call void @LAPACKE_xerbla(ptr noundef nonnull @.str, i32 noundef -1010) #6
  br label %.thread42

.thread42:                                        ; preds = %.thread, %26, %28, %13, %10
  %.036 = phi float [ -1.000000e+00, %10 ], [ -7.000000e+00, %13 ], [ 0.000000e+00, %28 ], [ %17, %.thread ], [ %27, %26 ]
  ret float %.036
}

declare void @LAPACKE_xerbla(ptr noundef, i32 noundef) local_unnamed_addr #1

declare i32 @LAPACKE_get_nancheck() local_unnamed_addr #1

declare i32 @LAPACKE_ctz_nancheck(i32 noundef, i8 noundef signext, i8 noundef signext, i8 noundef signext, i32 noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare i32 @LAPACKE_lsame(i8 noundef signext, i8 noundef signext) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3

declare float @LAPACKE_clantr_work(i32 noundef, i8 noundef signext, i8 noundef signext, i8 noundef signext, i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5

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 nosync 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 #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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)"}


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