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

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

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

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

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

33:                                               ; preds = %29, %10
  %34 = call i32 @LAPACKE_get_nancheck()
  %35 = icmp ne i32 %34, 0
  br i1 %35, label %36, label %46

36:                                               ; preds = %33
  %37 = load i32, ptr %12, align 4, !tbaa !5
  %38 = load i32, ptr %13, align 4, !tbaa !5
  %39 = load i32, ptr %14, align 4, !tbaa !5
  %40 = load ptr, ptr %18, align 8, !tbaa !9
  %41 = load i32, ptr %19, align 4, !tbaa !5
  %42 = call i32 @LAPACKE_cge_nancheck(i32 noundef %37, i32 noundef %38, i32 noundef %39, ptr noundef %40, i32 noundef %41)
  %43 = icmp ne i32 %42, 0
  br i1 %43, label %44, label %45

44:                                               ; preds = %36
  store i32 -7, ptr %11, align 4
  store i32 1, ptr %26, align 4
  br label %94

45:                                               ; preds = %36
  br label %46

46:                                               ; preds = %45, %33
  %47 = load i32, ptr %12, align 4, !tbaa !5
  %48 = load i32, ptr %13, align 4, !tbaa !5
  %49 = load i32, ptr %14, align 4, !tbaa !5
  %50 = load i32, ptr %15, align 4, !tbaa !5
  %51 = load i32, ptr %16, align 4, !tbaa !5
  %52 = load i32, ptr %17, align 4, !tbaa !5
  %53 = load ptr, ptr %18, align 8, !tbaa !9
  %54 = load i32, ptr %19, align 4, !tbaa !5
  %55 = load ptr, ptr %20, align 8, !tbaa !9
  %56 = load i32, ptr %21, align 4, !tbaa !5
  %57 = load i32, ptr %23, align 4, !tbaa !5
  %58 = call i32 @LAPACKE_cgetsqrhrt_work(i32 noundef %47, i32 noundef %48, i32 noundef %49, i32 noundef %50, i32 noundef %51, i32 noundef %52, ptr noundef %53, i32 noundef %54, ptr noundef %55, i32 noundef %56, ptr noundef %25, i32 noundef %57)
  store i32 %58, ptr %22, align 4, !tbaa !5
  %59 = load i32, ptr %22, align 4, !tbaa !5
  %60 = icmp ne i32 %59, 0
  br i1 %60, label %61, label %62

61:                                               ; preds = %46
  br label %87

62:                                               ; preds = %46
  %63 = load float, ptr %25, align 4, !tbaa !11
  %64 = fptosi float %63 to i32
  store i32 %64, ptr %23, align 4, !tbaa !5
  %65 = load i32, ptr %23, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = mul i64 8, %66
  %68 = call noalias ptr @malloc(i64 noundef %67) #6
  store ptr %68, ptr %24, align 8, !tbaa !9
  %69 = load ptr, ptr %24, align 8, !tbaa !9
  %70 = icmp eq ptr %69, null
  br i1 %70, label %71, label %72

71:                                               ; preds = %62
  store i32 -1010, ptr %22, align 4, !tbaa !5
  br label %87

72:                                               ; preds = %62
  %73 = load i32, ptr %12, align 4, !tbaa !5
  %74 = load i32, ptr %13, align 4, !tbaa !5
  %75 = load i32, ptr %14, align 4, !tbaa !5
  %76 = load i32, ptr %15, align 4, !tbaa !5
  %77 = load i32, ptr %16, align 4, !tbaa !5
  %78 = load i32, ptr %17, align 4, !tbaa !5
  %79 = load ptr, ptr %18, align 8, !tbaa !9
  %80 = load i32, ptr %19, align 4, !tbaa !5
  %81 = load ptr, ptr %20, align 8, !tbaa !9
  %82 = load i32, ptr %21, align 4, !tbaa !5
  %83 = load ptr, ptr %24, align 8, !tbaa !9
  %84 = load i32, ptr %23, align 4, !tbaa !5
  %85 = call i32 @LAPACKE_cgetsqrhrt_work(i32 noundef %73, i32 noundef %74, i32 noundef %75, i32 noundef %76, i32 noundef %77, i32 noundef %78, ptr noundef %79, i32 noundef %80, ptr noundef %81, i32 noundef %82, ptr noundef %83, i32 noundef %84)
  store i32 %85, ptr %22, align 4, !tbaa !5
  %86 = load ptr, ptr %24, align 8, !tbaa !9
  call void @free(ptr noundef %86) #5
  br label %87

87:                                               ; preds = %72, %71, %61
  %88 = load i32, ptr %22, align 4, !tbaa !5
  %89 = icmp eq i32 %88, -1010
  br i1 %89, label %90, label %92

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

92:                                               ; preds = %90, %87
  %93 = load i32, ptr %22, align 4, !tbaa !5
  store i32 %93, ptr %11, align 4
  store i32 1, ptr %26, align 4
  br label %94

94:                                               ; preds = %92, %44, %32
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  %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

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

declare i32 @LAPACKE_cgetsqrhrt_work(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, i32 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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"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 [19 x i8], align 1

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

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

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

16:                                               ; preds = %14
  %17 = tail call i32 @LAPACKE_cge_nancheck(i32 noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %6, i32 noundef %7) #5
  %.not41 = icmp eq i32 %17, 0
  br i1 %.not41, label %18, label %31

18:                                               ; preds = %16, %14
  %19 = call i32 @LAPACKE_cgetsqrhrt_work(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, ptr noundef %6, i32 noundef %7, ptr noundef %8, i32 noundef %9, ptr noundef nonnull %11, i32 noundef -1) #5
  %.not42 = icmp eq i32 %19, 0
  br i1 %.not42, label %20, label %29

20:                                               ; preds = %18
  %21 = load float, ptr %11, align 4, !tbaa !5
  %22 = fptosi float %21 to i32
  %23 = sext i32 %22 to i64
  %24 = shl nsw i64 %23, 3
  %25 = call noalias ptr @malloc(i64 noundef %24) #6
  %26 = icmp eq ptr %25, null
  br i1 %26, label %.thread, label %27

27:                                               ; preds = %20
  %28 = call i32 @LAPACKE_cgetsqrhrt_work(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, ptr noundef %6, i32 noundef %7, ptr noundef %8, i32 noundef %9, ptr noundef nonnull %25, i32 noundef %22) #5
  call void @free(ptr noundef nonnull %25) #5
  br label %29

29:                                               ; preds = %18, %27
  %.0 = phi i32 [ %19, %18 ], [ %28, %27 ]
  %30 = icmp eq i32 %.0, -1010
  br i1 %30, label %.thread, label %31

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

31:                                               ; preds = %29, %.thread, %16, %13
  %.038 = phi i32 [ -1, %13 ], [ -7, %16 ], [ -1010, %.thread ], [ %.0, %29 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #5
  ret i32 %.038
}

; 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_cgetsqrhrt_work(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, i32 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,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass,TailCallElimPass