; LLVM IR from OpenMathLib/OpenBLAS :: lapack-netlib/LAPACKE/src (lapacke_claset_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 i32 @LAPACKE_claset_work(i32 noundef %0, i8 noundef signext %1, i32 noundef %2, i32 noundef %3, <2 x float> noundef %4, <2 x float> noundef %5, ptr noundef %6, i32 noundef %7) #0 {
  %9 = alloca i32, align 4
  %10 = alloca { float, float }, align 4
  %11 = alloca { float, float }, align 4
  %12 = alloca i32, align 4
  %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 i32, align 4
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  store <2 x float> %4, ptr %10, align 4
  store <2 x float> %5, ptr %11, align 4
  store i32 %0, ptr %12, align 4, !tbaa !5
  store i8 %1, ptr %13, align 1, !tbaa !9
  store i32 %2, ptr %14, align 4, !tbaa !5
  store i32 %3, 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) #5
  store i32 0, ptr %18, align 4, !tbaa !5
  %22 = load i32, ptr %12, align 4, !tbaa !5
  %23 = icmp eq i32 %22, 102
  br i1 %23, label %24, label %26

24:                                               ; preds = %8
  %25 = load ptr, ptr %16, align 8, !tbaa !10
  call void @claset_(ptr noundef %13, ptr noundef %14, ptr noundef %15, ptr noundef %10, ptr noundef %11, ptr noundef %25, ptr noundef %17, i64 noundef 1)
  br label %88

26:                                               ; preds = %8
  %27 = load i32, ptr %12, align 4, !tbaa !5
  %28 = icmp eq i32 %27, 101
  br i1 %28, label %29, label %85

29:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  %30 = load i32, ptr %14, align 4, !tbaa !5
  %31 = icmp sgt i32 1, %30
  br i1 %31, label %32, label %33

32:                                               ; preds = %29
  br label %35

33:                                               ; preds = %29
  %34 = load i32, ptr %14, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %33, %32
  %36 = phi i32 [ 1, %32 ], [ %34, %33 ]
  store i32 %36, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  store ptr null, ptr %20, align 8, !tbaa !10
  %37 = load i32, ptr %17, align 4, !tbaa !5
  %38 = load i32, ptr %15, align 4, !tbaa !5
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %40, label %43

40:                                               ; preds = %35
  store i32 -8, ptr %18, align 4, !tbaa !5
  %41 = load i32, ptr %18, align 4, !tbaa !5
  call void @LAPACKE_xerbla(ptr noundef @.str, i32 noundef %41)
  %42 = load i32, ptr %18, align 4, !tbaa !5
  store i32 %42, ptr %9, align 4
  store i32 1, ptr %21, align 4
  br label %82

43:                                               ; preds = %35
  %44 = load i32, ptr %19, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = mul i64 8, %45
  %47 = load i32, ptr %15, align 4, !tbaa !5
  %48 = icmp sgt i32 1, %47
  br i1 %48, label %49, label %50

49:                                               ; preds = %43
  br label %52

50:                                               ; preds = %43
  %51 = load i32, ptr %15, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %50, %49
  %53 = phi i32 [ 1, %49 ], [ %51, %50 ]
  %54 = sext i32 %53 to i64
  %55 = mul i64 %46, %54
  %56 = call noalias ptr @malloc(i64 noundef %55) #6
  store ptr %56, ptr %20, align 8, !tbaa !10
  %57 = load ptr, ptr %20, align 8, !tbaa !10
  %58 = icmp eq ptr %57, null
  br i1 %58, label %59, label %60

59:                                               ; preds = %52
  store i32 -1011, ptr %18, align 4, !tbaa !5
  br label %76

60:                                               ; preds = %52
  %61 = load i32, ptr %12, align 4, !tbaa !5
  %62 = load i32, ptr %14, align 4, !tbaa !5
  %63 = load i32, ptr %15, align 4, !tbaa !5
  %64 = load ptr, ptr %16, align 8, !tbaa !10
  %65 = load i32, ptr %17, align 4, !tbaa !5
  %66 = load ptr, ptr %20, align 8, !tbaa !10
  %67 = load i32, ptr %19, align 4, !tbaa !5
  call void @LAPACKE_cge_trans(i32 noundef %61, i32 noundef %62, i32 noundef %63, ptr noundef %64, i32 noundef %65, ptr noundef %66, i32 noundef %67)
  %68 = load ptr, ptr %20, align 8, !tbaa !10
  call void @claset_(ptr noundef %13, ptr noundef %14, ptr noundef %15, ptr noundef %10, ptr noundef %11, ptr noundef %68, ptr noundef %19, i64 noundef 1)
  store i32 0, ptr %18, align 4, !tbaa !5
  %69 = load i32, ptr %14, align 4, !tbaa !5
  %70 = load i32, ptr %15, align 4, !tbaa !5
  %71 = load ptr, ptr %20, align 8, !tbaa !10
  %72 = load i32, ptr %19, align 4, !tbaa !5
  %73 = load ptr, ptr %16, align 8, !tbaa !10
  %74 = load i32, ptr %17, align 4, !tbaa !5
  call void @LAPACKE_cge_trans(i32 noundef 102, i32 noundef %69, i32 noundef %70, ptr noundef %71, i32 noundef %72, ptr noundef %73, i32 noundef %74)
  %75 = load ptr, ptr %20, align 8, !tbaa !10
  call void @free(ptr noundef %75) #5
  br label %76

76:                                               ; preds = %60, %59
  %77 = load i32, ptr %18, align 4, !tbaa !5
  %78 = icmp eq i32 %77, -1011
  br i1 %78, label %79, label %81

79:                                               ; preds = %76
  %80 = load i32, ptr %18, align 4, !tbaa !5
  call void @LAPACKE_xerbla(ptr noundef @.str, i32 noundef %80)
  br label %81

81:                                               ; preds = %79, %76
  store i32 0, ptr %21, align 4
  br label %82

82:                                               ; preds = %81, %40
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  %83 = load i32, ptr %21, align 4
  switch i32 %83, label %90 [
    i32 0, label %84
  ]

84:                                               ; preds = %82
  br label %87

85:                                               ; preds = %26
  store i32 -1, ptr %18, align 4, !tbaa !5
  %86 = load i32, ptr %18, align 4, !tbaa !5
  call void @LAPACKE_xerbla(ptr noundef @.str, i32 noundef %86)
  br label %87

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

88:                                               ; preds = %87, %24
  %89 = load i32, ptr %18, align 4, !tbaa !5
  store i32 %89, ptr %9, align 4
  store i32 1, ptr %21, align 4
  br label %90

90:                                               ; preds = %88, %82
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  %91 = load i32, ptr %9, align 4
  ret i32 %91
}

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

declare void @claset_(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 allocsize(0)
declare noalias ptr @malloc(i64 noundef) #3

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

; 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"="64" "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}


; 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 noundef i32 @LAPACKE_claset_work(i32 noundef %0, i8 noundef signext %1, i32 noundef %2, i32 noundef %3, <2 x float> noundef %4, <2 x float> noundef %5, ptr noundef %6, i32 noundef %7) local_unnamed_addr #0 {
  %9 = alloca { float, float }, align 8
  %10 = alloca { float, float }, align 8
  %11 = alloca i8, align 1
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store <2 x float> %4, ptr %9, align 8
  store <2 x float> %5, ptr %10, align 8
  store i8 %1, ptr %11, align 1, !tbaa !5
  store i32 %2, ptr %12, align 4, !tbaa !8
  store i32 %3, ptr %13, align 4, !tbaa !8
  store i32 %7, ptr %14, align 4, !tbaa !8
  switch i32 %0, label %34 [
    i32 102, label %16
    i32 101, label %17
  ]

16:                                               ; preds = %8
  call void @claset_(ptr noundef nonnull %11, ptr noundef nonnull %12, ptr noundef nonnull %13, ptr noundef nonnull %9, ptr noundef nonnull %10, ptr noundef %6, ptr noundef nonnull %14, i64 noundef 1) #6
  br label %35

17:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %15) #6
  %18 = tail call i32 @llvm.smax.i32(i32 %2, i32 1)
  store i32 %18, ptr %15, align 4, !tbaa !8
  %.not = icmp slt i32 %7, %3
  br i1 %.not, label %19, label %20

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

20:                                               ; preds = %17
  %21 = zext nneg i32 %18 to i64
  %22 = shl nuw nsw i64 %21, 3
  %23 = tail call i32 @llvm.smax.i32(i32 %3, i32 1)
  %24 = zext nneg i32 %23 to i64
  %25 = mul i64 %22, %24
  %26 = tail call noalias ptr @malloc(i64 noundef %25) #7
  %27 = icmp eq ptr %26, null
  br i1 %27, label %32, label %28

28:                                               ; preds = %20
  tail call void @LAPACKE_cge_trans(i32 noundef 101, i32 noundef %2, i32 noundef %3, ptr noundef %6, i32 noundef %7, ptr noundef nonnull %26, i32 noundef %18) #6
  call void @claset_(ptr noundef nonnull %11, ptr noundef nonnull %12, ptr noundef nonnull %13, ptr noundef nonnull %9, ptr noundef nonnull %10, ptr noundef nonnull %26, ptr noundef nonnull %15, i64 noundef 1) #6
  %29 = load i32, ptr %12, align 4, !tbaa !8
  %30 = load i32, ptr %13, align 4, !tbaa !8
  %31 = load i32, ptr %15, align 4, !tbaa !8
  call void @LAPACKE_cge_trans(i32 noundef 102, i32 noundef %29, i32 noundef %30, ptr noundef nonnull %26, i32 noundef %31, ptr noundef %6, i32 noundef %7) #6
  call void @free(ptr noundef nonnull %26) #6
  br label %33

32:                                               ; preds = %20
  tail call void @LAPACKE_xerbla(ptr noundef nonnull @.str, i32 noundef -1011) #6
  br label %33

33:                                               ; preds = %28, %32, %19
  %spec.select = phi i32 [ -8, %19 ], [ -1011, %32 ], [ 0, %28 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %15) #6
  br label %35

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

35:                                               ; preds = %33, %16, %34
  %.120 = phi i32 [ 0, %16 ], [ -1, %34 ], [ %spec.select, %33 ]
  ret i32 %.120
}

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

declare void @claset_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

declare void @LAPACKE_xerbla(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

declare void @LAPACKE_cge_trans(i32 noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

; 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

; 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"="64" "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { 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 = !{!"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,GVNPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass