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

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

27:                                               ; preds = %10
  %28 = load i32, ptr %12, align 4, !tbaa !5
  %29 = icmp ne i32 %28, 101
  br i1 %29, label %30, label %31

30:                                               ; preds = %27
  call void @LAPACKE_xerbla(ptr noundef @.str, i32 noundef -1)
  store i32 -1, ptr %11, align 4
  store i32 1, ptr %24, align 4
  br label %94

31:                                               ; preds = %27, %10
  %32 = call i32 @LAPACKE_get_nancheck()
  %33 = icmp ne i32 %32, 0
  br i1 %33, label %34, label %82

34:                                               ; preds = %31
  %35 = load i8, ptr %14, align 1, !tbaa !9
  %36 = call i32 @LAPACKE_lsame(i8 noundef signext %35, i8 noundef signext 99) #5
  %37 = icmp ne i32 %36, 0
  br i1 %37, label %38, label %40

38:                                               ; preds = %34
  %39 = load i32, ptr %16, align 4, !tbaa !5
  br label %49

40:                                               ; preds = %34
  %41 = load i8, ptr %14, align 1, !tbaa !9
  %42 = call i32 @LAPACKE_lsame(i8 noundef signext %41, i8 noundef signext 114) #5
  %43 = icmp ne i32 %42, 0
  br i1 %43, label %44, label %46

44:                                               ; preds = %40
  %45 = load i32, ptr %15, align 4, !tbaa !5
  br label %47

46:                                               ; preds = %40
  br label %47

47:                                               ; preds = %46, %44
  %48 = phi i32 [ %45, %44 ], [ 1, %46 ]
  br label %49

49:                                               ; preds = %47, %38
  %50 = phi i32 [ %39, %38 ], [ %48, %47 ]
  store i32 %50, ptr %22, align 4, !tbaa !5
  %51 = load i8, ptr %14, align 1, !tbaa !9
  %52 = call i32 @LAPACKE_lsame(i8 noundef signext %51, i8 noundef signext 99) #5
  %53 = icmp ne i32 %52, 0
  br i1 %53, label %54, label %56

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

56:                                               ; preds = %49
  %57 = load i8, ptr %14, align 1, !tbaa !9
  %58 = call i32 @LAPACKE_lsame(i8 noundef signext %57, i8 noundef signext 114) #5
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %62

60:                                               ; preds = %56
  %61 = load i32, ptr %16, align 4, !tbaa !5
  br label %63

62:                                               ; preds = %56
  br label %63

63:                                               ; preds = %62, %60
  %64 = phi i32 [ %61, %60 ], [ 1, %62 ]
  br label %65

65:                                               ; preds = %63, %54
  %66 = phi i32 [ %55, %54 ], [ %64, %63 ]
  store i32 %66, ptr %23, align 4, !tbaa !5
  %67 = load i32, ptr %16, align 4, !tbaa !5
  %68 = load ptr, ptr %19, align 8, !tbaa !10
  %69 = call i32 @LAPACKE_c_nancheck(i32 noundef %67, ptr noundef %68, i32 noundef 1)
  %70 = icmp ne i32 %69, 0
  br i1 %70, label %71, label %72

71:                                               ; preds = %65
  store i32 -8, ptr %11, align 4
  store i32 1, ptr %24, align 4
  br label %94

72:                                               ; preds = %65
  %73 = load i32, ptr %12, align 4, !tbaa !5
  %74 = load i32, ptr %23, align 4, !tbaa !5
  %75 = load i32, ptr %22, align 4, !tbaa !5
  %76 = load ptr, ptr %17, align 8, !tbaa !10
  %77 = load i32, ptr %18, align 4, !tbaa !5
  %78 = call i32 @LAPACKE_cge_nancheck(i32 noundef %73, i32 noundef %74, i32 noundef %75, ptr noundef %76, i32 noundef %77)
  %79 = icmp ne i32 %78, 0
  br i1 %79, label %80, label %81

80:                                               ; preds = %72
  store i32 -6, ptr %11, align 4
  store i32 1, ptr %24, align 4
  br label %94

81:                                               ; preds = %72
  br label %82

82:                                               ; preds = %81, %31
  %83 = load i32, ptr %12, align 4, !tbaa !5
  %84 = load i8, ptr %13, align 1, !tbaa !9
  %85 = load i8, ptr %14, align 1, !tbaa !9
  %86 = load i32, ptr %15, align 4, !tbaa !5
  %87 = load i32, ptr %16, align 4, !tbaa !5
  %88 = load ptr, ptr %17, align 8, !tbaa !10
  %89 = load i32, ptr %18, align 4, !tbaa !5
  %90 = load ptr, ptr %19, align 8, !tbaa !10
  %91 = load ptr, ptr %20, align 8, !tbaa !10
  %92 = load i32, ptr %21, align 4, !tbaa !5
  %93 = call i32 @LAPACKE_clarft_work(i32 noundef %83, i8 noundef signext %84, i8 noundef signext %85, i32 noundef %86, i32 noundef %87, ptr noundef %88, i32 noundef %89, ptr noundef %90, ptr noundef %91, i32 noundef %92)
  store i32 %93, ptr %11, align 4
  store i32 1, ptr %24, align 4
  br label %94

94:                                               ; preds = %82, %80, %71, %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  %95 = load i32, ptr %11, align 4
  ret i32 %95
}

; 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

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

declare i32 @LAPACKE_c_nancheck(i32 noundef, ptr noundef, i32 noundef) #2

declare i32 @LAPACKE_cge_nancheck(i32 noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef) #2

declare i32 @LAPACKE_clarft_work(i32 noundef, i8 noundef signext, i8 noundef signext, i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, i32 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 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 }
attributes #5 = { nounwind willreturn memory(none) }

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


; 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 i32 @LAPACKE_clarft(i32 noundef %0, i8 noundef signext %1, i8 noundef signext %2, i32 noundef %3, i32 noundef %4, ptr noundef %5, i32 noundef %6, ptr noundef %7, ptr noundef %8, i32 noundef %9) local_unnamed_addr #0 {
  %11 = add i32 %0, -103
  %or.cond = icmp ult i32 %11, -2
  br i1 %or.cond, label %12, label %13

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

13:                                               ; preds = %10
  %14 = tail call i32 @LAPACKE_get_nancheck() #3
  %.not = icmp eq i32 %14, 0
  br i1 %.not, label %27, label %15

15:                                               ; preds = %13
  %16 = tail call i32 @LAPACKE_lsame(i8 noundef signext %2, i8 noundef signext 99) #4
  %.not28 = icmp eq i32 %16, 0
  br i1 %.not28, label %17, label %21

17:                                               ; preds = %15
  %18 = tail call i32 @LAPACKE_lsame(i8 noundef signext %2, i8 noundef signext 114) #4
  %.not29 = icmp eq i32 %18, 0
  %19 = select i1 %.not29, i32 1, i32 %3
  %20 = select i1 %.not29, i32 1, i32 %4
  br label %21

21:                                               ; preds = %15, %17
  %22 = phi i32 [ %19, %17 ], [ %4, %15 ]
  %23 = phi i32 [ %20, %17 ], [ %3, %15 ]
  %24 = tail call i32 @LAPACKE_c_nancheck(i32 noundef %4, ptr noundef %7, i32 noundef 1) #3
  %.not31 = icmp eq i32 %24, 0
  br i1 %.not31, label %25, label %29

25:                                               ; preds = %21
  %26 = tail call i32 @LAPACKE_cge_nancheck(i32 noundef %0, i32 noundef %23, i32 noundef %22, ptr noundef %5, i32 noundef %6) #3
  %.not32 = icmp eq i32 %26, 0
  br i1 %.not32, label %27, label %29

27:                                               ; preds = %25, %13
  %28 = tail call i32 @LAPACKE_clarft_work(i32 noundef %0, i8 noundef signext %1, i8 noundef signext %2, i32 noundef %3, i32 noundef %4, ptr noundef %5, i32 noundef %6, ptr noundef %7, ptr noundef %8, i32 noundef %9) #3
  br label %29

29:                                               ; preds = %25, %21, %27, %12
  %.0 = phi i32 [ -1, %12 ], [ %28, %27 ], [ -8, %21 ], [ -6, %25 ]
  ret i32 %.0
}

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

declare i32 @LAPACKE_get_nancheck() 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

declare i32 @LAPACKE_c_nancheck(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

declare i32 @LAPACKE_cge_nancheck(i32 noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

declare i32 @LAPACKE_clarft_work(i32 noundef, i8 noundef signext, i8 noundef signext, i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, 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 = { 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 = { nounwind }
attributes #4 = { nounwind willreturn memory(none) }

!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: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass,TailCallElimPass