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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @LAPACKE_ctrsyl3(i32 noundef %0, i8 noundef signext %1, i8 noundef signext %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, ptr noundef %6, i32 noundef %7, ptr noundef %8, i32 noundef %9, ptr noundef %10, i32 noundef %11, ptr noundef %12) #0 {
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i8, align 1
  %17 = alloca i8, align 1
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca ptr, align 8
  %24 = alloca i32, align 4
  %25 = alloca ptr, align 8
  %26 = alloca i32, align 4
  %27 = alloca ptr, align 8
  %28 = alloca i32, align 4
  %29 = alloca [2 x float], align 4
  %30 = alloca ptr, align 8
  %31 = alloca i32, align 4
  %32 = alloca i32, align 4
  %33 = alloca i32, align 4
  store i32 %0, ptr %15, align 4, !tbaa !5
  store i8 %1, ptr %16, align 1, !tbaa !9
  store i8 %2, ptr %17, align 1, !tbaa !9
  store i32 %3, ptr %18, align 4, !tbaa !5
  store i32 %4, ptr %19, align 4, !tbaa !5
  store i32 %5, ptr %20, align 4, !tbaa !5
  store ptr %6, ptr %21, align 8, !tbaa !10
  store i32 %7, ptr %22, align 4, !tbaa !5
  store ptr %8, ptr %23, align 8, !tbaa !10
  store i32 %9, ptr %24, align 4, !tbaa !5
  store ptr %10, ptr %25, align 8, !tbaa !10
  store i32 %11, ptr %26, align 4, !tbaa !5
  store ptr %12, ptr %27, align 8, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #5
  store i32 0, ptr %28, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #5
  store ptr null, ptr %30, align 8, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %31) #5
  store i32 -1, ptr %31, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #5
  store i32 -1, ptr %32, align 4, !tbaa !5
  %34 = load i32, ptr %15, align 4, !tbaa !5
  %35 = icmp ne i32 %34, 102
  br i1 %35, label %36, label %40

36:                                               ; preds = %13
  %37 = load i32, ptr %15, align 4, !tbaa !5
  %38 = icmp ne i32 %37, 101
  br i1 %38, label %39, label %40

39:                                               ; preds = %36
  call void @LAPACKE_xerbla(ptr noundef @.str, i32 noundef -1)
  store i32 -1, ptr %14, align 4
  store i32 1, ptr %33, align 4
  br label %133

40:                                               ; preds = %36, %13
  %41 = call i32 @LAPACKE_get_nancheck()
  %42 = icmp ne i32 %41, 0
  br i1 %42, label %43, label %71

43:                                               ; preds = %40
  %44 = load i32, ptr %15, align 4, !tbaa !5
  %45 = load i32, ptr %19, align 4, !tbaa !5
  %46 = load i32, ptr %19, align 4, !tbaa !5
  %47 = load ptr, ptr %21, align 8, !tbaa !10
  %48 = load i32, ptr %22, align 4, !tbaa !5
  %49 = call i32 @LAPACKE_cge_nancheck(i32 noundef %44, i32 noundef %45, i32 noundef %46, ptr noundef %47, i32 noundef %48)
  %50 = icmp ne i32 %49, 0
  br i1 %50, label %51, label %52

51:                                               ; preds = %43
  store i32 -7, ptr %14, align 4
  store i32 1, ptr %33, align 4
  br label %133

52:                                               ; preds = %43
  %53 = load i32, ptr %15, align 4, !tbaa !5
  %54 = load i32, ptr %20, align 4, !tbaa !5
  %55 = load i32, ptr %20, align 4, !tbaa !5
  %56 = load ptr, ptr %23, align 8, !tbaa !10
  %57 = load i32, ptr %24, align 4, !tbaa !5
  %58 = call i32 @LAPACKE_cge_nancheck(i32 noundef %53, i32 noundef %54, i32 noundef %55, ptr noundef %56, i32 noundef %57)
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %61

60:                                               ; preds = %52
  store i32 -9, ptr %14, align 4
  store i32 1, ptr %33, align 4
  br label %133

61:                                               ; preds = %52
  %62 = load i32, ptr %15, align 4, !tbaa !5
  %63 = load i32, ptr %19, align 4, !tbaa !5
  %64 = load i32, ptr %20, align 4, !tbaa !5
  %65 = load ptr, ptr %25, align 8, !tbaa !10
  %66 = load i32, ptr %26, align 4, !tbaa !5
  %67 = call i32 @LAPACKE_cge_nancheck(i32 noundef %62, i32 noundef %63, i32 noundef %64, ptr noundef %65, i32 noundef %66)
  %68 = icmp ne i32 %67, 0
  br i1 %68, label %69, label %70

69:                                               ; preds = %61
  store i32 -11, ptr %14, align 4
  store i32 1, ptr %33, align 4
  br label %133

70:                                               ; preds = %61
  br label %71

71:                                               ; preds = %70, %40
  %72 = load i32, ptr %15, align 4, !tbaa !5
  %73 = load i8, ptr %16, align 1, !tbaa !9
  %74 = load i8, ptr %17, align 1, !tbaa !9
  %75 = load i32, ptr %18, align 4, !tbaa !5
  %76 = load i32, ptr %19, align 4, !tbaa !5
  %77 = load i32, ptr %20, align 4, !tbaa !5
  %78 = load ptr, ptr %21, align 8, !tbaa !10
  %79 = load i32, ptr %22, align 4, !tbaa !5
  %80 = load ptr, ptr %23, align 8, !tbaa !10
  %81 = load i32, ptr %24, align 4, !tbaa !5
  %82 = load ptr, ptr %25, align 8, !tbaa !10
  %83 = load i32, ptr %26, align 4, !tbaa !5
  %84 = load ptr, ptr %27, align 8, !tbaa !10
  %85 = getelementptr inbounds [2 x float], ptr %29, i64 0, i64 0
  %86 = load i32, ptr %31, align 4, !tbaa !5
  %87 = call i32 @LAPACKE_ctrsyl3_work(i32 noundef %72, i8 noundef signext %73, i8 noundef signext %74, i32 noundef %75, i32 noundef %76, i32 noundef %77, ptr noundef %78, i32 noundef %79, ptr noundef %80, i32 noundef %81, ptr noundef %82, i32 noundef %83, ptr noundef %84, ptr noundef %85, i32 noundef %86)
  store i32 %87, ptr %28, align 4, !tbaa !5
  %88 = load i32, ptr %28, align 4, !tbaa !5
  %89 = icmp ne i32 %88, 0
  br i1 %89, label %90, label %91

90:                                               ; preds = %71
  br label %126

91:                                               ; preds = %71
  %92 = getelementptr inbounds [2 x float], ptr %29, i64 0, i64 0
  %93 = load float, ptr %92, align 4, !tbaa !12
  %94 = fptosi float %93 to i32
  store i32 %94, ptr %31, align 4, !tbaa !5
  %95 = load i32, ptr %31, align 4, !tbaa !5
  %96 = sitofp i32 %95 to float
  %97 = getelementptr inbounds [2 x float], ptr %29, i64 0, i64 1
  %98 = load float, ptr %97, align 4, !tbaa !12
  %99 = fmul float %96, %98
  %100 = fptosi float %99 to i32
  store i32 %100, ptr %32, align 4, !tbaa !5
  %101 = load i32, ptr %32, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = mul i64 4, %102
  %104 = call noalias ptr @malloc(i64 noundef %103) #6
  store ptr %104, ptr %30, align 8, !tbaa !10
  %105 = load ptr, ptr %30, align 8, !tbaa !10
  %106 = icmp eq ptr %105, null
  br i1 %106, label %107, label %108

107:                                              ; preds = %91
  store i32 -1010, ptr %28, align 4, !tbaa !5
  br label %126

108:                                              ; preds = %91
  %109 = load i32, ptr %15, align 4, !tbaa !5
  %110 = load i8, ptr %16, align 1, !tbaa !9
  %111 = load i8, ptr %17, align 1, !tbaa !9
  %112 = load i32, ptr %18, align 4, !tbaa !5
  %113 = load i32, ptr %19, align 4, !tbaa !5
  %114 = load i32, ptr %20, align 4, !tbaa !5
  %115 = load ptr, ptr %21, align 8, !tbaa !10
  %116 = load i32, ptr %22, align 4, !tbaa !5
  %117 = load ptr, ptr %23, align 8, !tbaa !10
  %118 = load i32, ptr %24, align 4, !tbaa !5
  %119 = load ptr, ptr %25, align 8, !tbaa !10
  %120 = load i32, ptr %26, align 4, !tbaa !5
  %121 = load ptr, ptr %27, align 8, !tbaa !10
  %122 = load ptr, ptr %30, align 8, !tbaa !10
  %123 = load i32, ptr %31, align 4, !tbaa !5
  %124 = call i32 @LAPACKE_ctrsyl3_work(i32 noundef %109, i8 noundef signext %110, i8 noundef signext %111, i32 noundef %112, i32 noundef %113, i32 noundef %114, ptr noundef %115, i32 noundef %116, ptr noundef %117, i32 noundef %118, ptr noundef %119, i32 noundef %120, ptr noundef %121, ptr noundef %122, i32 noundef %123)
  store i32 %124, ptr %28, align 4, !tbaa !5
  %125 = load ptr, ptr %30, align 8, !tbaa !10
  call void @free(ptr noundef %125) #5
  br label %126

126:                                              ; preds = %108, %107, %90
  %127 = load i32, ptr %28, align 4, !tbaa !5
  %128 = icmp eq i32 %127, -1010
  br i1 %128, label %129, label %131

129:                                              ; preds = %126
  %130 = load i32, ptr %28, align 4, !tbaa !5
  call void @LAPACKE_xerbla(ptr noundef @.str, i32 noundef %130)
  br label %131

131:                                              ; preds = %129, %126
  %132 = load i32, ptr %28, align 4, !tbaa !5
  store i32 %132, ptr %14, align 4
  store i32 1, ptr %33, align 4
  br label %133

133:                                              ; preds = %131, %69, %60, %51, %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #5
  %134 = load i32, ptr %14, align 4
  ret i32 %134
}

; 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_cge_nancheck(i32 noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef) #2

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

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

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

; 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 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 #4 = { 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 #5 = { nounwind }
attributes #6 = { 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 [16 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @LAPACKE_ctrsyl3(i32 noundef %0, i8 noundef signext %1, i8 noundef signext %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, ptr noundef %6, i32 noundef %7, ptr noundef %8, i32 noundef %9, ptr noundef %10, i32 noundef %11, ptr noundef %12) local_unnamed_addr #0 {
  %14 = alloca [2 x float], align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #5
  %15 = add i32 %0, -103
  %or.cond = icmp ult i32 %15, -2
  br i1 %or.cond, label %16, label %17

16:                                               ; preds = %13
  tail call void @LAPACKE_xerbla(ptr noundef nonnull @.str, i32 noundef -1) #5
  br label %43

17:                                               ; preds = %13
  %18 = tail call i32 @LAPACKE_get_nancheck() #5
  %.not = icmp eq i32 %18, 0
  br i1 %.not, label %25, label %19

19:                                               ; preds = %17
  %20 = tail call i32 @LAPACKE_cge_nancheck(i32 noundef %0, i32 noundef %4, i32 noundef %4, ptr noundef %6, i32 noundef %7) #5
  %.not58 = icmp eq i32 %20, 0
  br i1 %.not58, label %21, label %43

21:                                               ; preds = %19
  %22 = tail call i32 @LAPACKE_cge_nancheck(i32 noundef %0, i32 noundef %5, i32 noundef %5, ptr noundef %8, i32 noundef %9) #5
  %.not59 = icmp eq i32 %22, 0
  br i1 %.not59, label %23, label %43

23:                                               ; preds = %21
  %24 = tail call i32 @LAPACKE_cge_nancheck(i32 noundef %0, i32 noundef %4, i32 noundef %5, ptr noundef %10, i32 noundef %11) #5
  %.not60 = icmp eq i32 %24, 0
  br i1 %.not60, label %25, label %43

25:                                               ; preds = %23, %17
  %26 = call i32 @LAPACKE_ctrsyl3_work(i32 noundef %0, i8 noundef signext %1, i8 noundef signext %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, ptr noundef %6, i32 noundef %7, ptr noundef %8, i32 noundef %9, ptr noundef %10, i32 noundef %11, ptr noundef %12, ptr noundef nonnull %14, i32 noundef -1) #5
  %.not61 = icmp eq i32 %26, 0
  br i1 %.not61, label %27, label %41

27:                                               ; preds = %25
  %28 = load float, ptr %14, align 4, !tbaa !5
  %29 = fptosi float %28 to i32
  %30 = sitofp i32 %29 to float
  %31 = getelementptr inbounds i8, ptr %14, i64 4
  %32 = load float, ptr %31, align 4, !tbaa !5
  %33 = fmul float %32, %30
  %34 = fptosi float %33 to i32
  %35 = sext i32 %34 to i64
  %36 = shl nsw i64 %35, 2
  %37 = call noalias ptr @malloc(i64 noundef %36) #6
  %38 = icmp eq ptr %37, null
  br i1 %38, label %.thread, label %39

39:                                               ; preds = %27
  %40 = call i32 @LAPACKE_ctrsyl3_work(i32 noundef %0, i8 noundef signext %1, i8 noundef signext %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, ptr noundef %6, i32 noundef %7, ptr noundef %8, i32 noundef %9, ptr noundef %10, i32 noundef %11, ptr noundef %12, ptr noundef nonnull %37, i32 noundef %29) #5
  call void @free(ptr noundef nonnull %37) #5
  br label %41

41:                                               ; preds = %25, %39
  %.0 = phi i32 [ %26, %25 ], [ %40, %39 ]
  %42 = icmp eq i32 %.0, -1010
  br i1 %42, label %.thread, label %43

.thread:                                          ; preds = %27, %41
  call void @LAPACKE_xerbla(ptr noundef nonnull @.str, i32 noundef -1010) #5
  br label %43

43:                                               ; preds = %41, %.thread, %23, %21, %19, %16
  %.055 = phi i32 [ -1, %16 ], [ -7, %19 ], [ -9, %21 ], [ -11, %23 ], [ -1010, %.thread ], [ %.0, %41 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #5
  ret i32 %.055
}

; Function Attrs: mustprogress 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) local_unnamed_addr #2

declare i32 @LAPACKE_get_nancheck() local_unnamed_addr #2

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

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

; 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: 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 = { 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 = { nounwind }
attributes #6 = { 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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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