; LLVM IR from OpenMathLib/OpenBLAS :: lapack-netlib/SRC (cppsv)

; 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"

%struct.complex = type { float, float }

@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @cppsv_(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6) #0 {
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  store ptr %6, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %19 = load ptr, ptr %11, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.complex, ptr %19, i32 -1
  store ptr %20, ptr %11, align 8, !tbaa !5
  %21 = load ptr, ptr %13, align 8, !tbaa !5
  %22 = load i32, ptr %21, align 4, !tbaa !9
  store i32 %22, ptr %15, align 4, !tbaa !9
  %23 = load i32, ptr %15, align 4, !tbaa !9
  %24 = mul nsw i32 %23, 1
  %25 = add nsw i32 1, %24
  store i32 %25, ptr %16, align 4, !tbaa !9
  %26 = load i32, ptr %16, align 4, !tbaa !9
  %27 = load ptr, ptr %12, align 8, !tbaa !5
  %28 = sext i32 %26 to i64
  %29 = sub i64 0, %28
  %30 = getelementptr inbounds %struct.complex, ptr %27, i64 %29
  store ptr %30, ptr %12, align 8, !tbaa !5
  %31 = load ptr, ptr %14, align 8, !tbaa !5
  store i32 0, ptr %31, align 4, !tbaa !9
  %32 = load ptr, ptr %8, align 8, !tbaa !5
  %33 = call i32 @lsame_(ptr noundef %32, ptr noundef @.str)
  %34 = icmp ne i32 %33, 0
  br i1 %34, label %41, label %35

35:                                               ; preds = %7
  %36 = load ptr, ptr %8, align 8, !tbaa !5
  %37 = call i32 @lsame_(ptr noundef %36, ptr noundef @.str.1)
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %41, label %39

39:                                               ; preds = %35
  %40 = load ptr, ptr %14, align 8, !tbaa !5
  store i32 -1, ptr %40, align 4, !tbaa !9
  br label %71

41:                                               ; preds = %35, %7
  %42 = load ptr, ptr %9, align 8, !tbaa !5
  %43 = load i32, ptr %42, align 4, !tbaa !9
  %44 = icmp slt i32 %43, 0
  br i1 %44, label %45, label %47

45:                                               ; preds = %41
  %46 = load ptr, ptr %14, align 8, !tbaa !5
  store i32 -2, ptr %46, align 4, !tbaa !9
  br label %70

47:                                               ; preds = %41
  %48 = load ptr, ptr %10, align 8, !tbaa !5
  %49 = load i32, ptr %48, align 4, !tbaa !9
  %50 = icmp slt i32 %49, 0
  br i1 %50, label %51, label %53

51:                                               ; preds = %47
  %52 = load ptr, ptr %14, align 8, !tbaa !5
  store i32 -3, ptr %52, align 4, !tbaa !9
  br label %69

53:                                               ; preds = %47
  %54 = load ptr, ptr %13, align 8, !tbaa !5
  %55 = load i32, ptr %54, align 4, !tbaa !9
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  %57 = load i32, ptr %56, align 4, !tbaa !9
  %58 = icmp sge i32 1, %57
  br i1 %58, label %59, label %60

59:                                               ; preds = %53
  br label %63

60:                                               ; preds = %53
  %61 = load ptr, ptr %9, align 8, !tbaa !5
  %62 = load i32, ptr %61, align 4, !tbaa !9
  br label %63

63:                                               ; preds = %60, %59
  %64 = phi i32 [ 1, %59 ], [ %62, %60 ]
  %65 = icmp slt i32 %55, %64
  br i1 %65, label %66, label %68

66:                                               ; preds = %63
  %67 = load ptr, ptr %14, align 8, !tbaa !5
  store i32 -6, ptr %67, align 4, !tbaa !9
  br label %68

68:                                               ; preds = %66, %63
  br label %69

69:                                               ; preds = %68, %51
  br label %70

70:                                               ; preds = %69, %45
  br label %71

71:                                               ; preds = %70, %39
  %72 = load ptr, ptr %14, align 8, !tbaa !5
  %73 = load i32, ptr %72, align 4, !tbaa !9
  %74 = icmp ne i32 %73, 0
  br i1 %74, label %75, label %80

75:                                               ; preds = %71
  %76 = load ptr, ptr %14, align 8, !tbaa !5
  %77 = load i32, ptr %76, align 4, !tbaa !9
  %78 = sub nsw i32 0, %77
  store i32 %78, ptr %17, align 4, !tbaa !9
  %79 = call i32 @xerbla_(ptr noundef @.str.2, ptr noundef %17, i32 noundef 6)
  store i32 1, ptr %18, align 4
  br label %102

80:                                               ; preds = %71
  %81 = load ptr, ptr %8, align 8, !tbaa !5
  %82 = load ptr, ptr %9, align 8, !tbaa !5
  %83 = load ptr, ptr %11, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.complex, ptr %83, i64 1
  %85 = load ptr, ptr %14, align 8, !tbaa !5
  call void @cpptrf_(ptr noundef %81, ptr noundef %82, ptr noundef %84, ptr noundef %85)
  %86 = load ptr, ptr %14, align 8, !tbaa !5
  %87 = load i32, ptr %86, align 4, !tbaa !9
  %88 = icmp eq i32 %87, 0
  br i1 %88, label %89, label %101

89:                                               ; preds = %80
  %90 = load ptr, ptr %8, align 8, !tbaa !5
  %91 = load ptr, ptr %9, align 8, !tbaa !5
  %92 = load ptr, ptr %10, align 8, !tbaa !5
  %93 = load ptr, ptr %11, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.complex, ptr %93, i64 1
  %95 = load ptr, ptr %12, align 8, !tbaa !5
  %96 = load i32, ptr %16, align 4, !tbaa !9
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds %struct.complex, ptr %95, i64 %97
  %99 = load ptr, ptr %13, align 8, !tbaa !5
  %100 = load ptr, ptr %14, align 8, !tbaa !5
  call void @cpptrs_(ptr noundef %90, ptr noundef %91, ptr noundef %92, ptr noundef %94, ptr noundef %98, ptr noundef %99, ptr noundef %100)
  br label %101

101:                                              ; preds = %89, %80
  store i32 1, ptr %18, align 4
  br label %102

102:                                              ; preds = %101, %75
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  ret void
}

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

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

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

declare void @cpptrf_(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

declare void @cpptrs_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr 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 }

!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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !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 [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @cppsv_(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6) local_unnamed_addr #0 {
  %8 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  store i32 0, ptr %6, align 4, !tbaa !5
  %9 = tail call i32 @lsame_(ptr noundef %0, ptr noundef nonnull @.str) #4
  %.not = icmp eq i32 %9, 0
  br i1 %.not, label %10, label %12

10:                                               ; preds = %7
  %11 = tail call i32 @lsame_(ptr noundef %0, ptr noundef nonnull @.str.1) #4
  %.not32 = icmp eq i32 %11, 0
  br i1 %.not32, label %.thread.sink.split, label %12

12:                                               ; preds = %10, %7
  %13 = load i32, ptr %1, align 4, !tbaa !5
  %14 = icmp slt i32 %13, 0
  br i1 %14, label %.thread.sink.split, label %15

15:                                               ; preds = %12
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = icmp slt i32 %16, 0
  br i1 %17, label %.thread.sink.split, label %18

18:                                               ; preds = %15
  %19 = load i32, ptr %5, align 4, !tbaa !5
  %spec.select = tail call i32 @llvm.umax.i32(i32 %13, i32 1)
  %20 = icmp slt i32 %19, %spec.select
  br i1 %20, label %.thread.sink.split, label %21

21:                                               ; preds = %18
  %.pr = load i32, ptr %6, align 4, !tbaa !5
  %.not33 = icmp eq i32 %.pr, 0
  br i1 %.not33, label %25, label %.thread

.thread.sink.split:                               ; preds = %18, %15, %12, %10
  %.sink = phi i32 [ -1, %10 ], [ -2, %12 ], [ -3, %15 ], [ -6, %18 ]
  store i32 %.sink, ptr %6, align 4, !tbaa !5
  br label %.thread

.thread:                                          ; preds = %.thread.sink.split, %21
  %22 = phi i32 [ %.pr, %21 ], [ %.sink, %.thread.sink.split ]
  %23 = sub nsw i32 0, %22
  store i32 %23, ptr %8, align 4, !tbaa !5
  %24 = call i32 @xerbla_(ptr noundef nonnull @.str.2, ptr noundef nonnull %8, i32 noundef 6) #4
  br label %29

25:                                               ; preds = %21
  tail call void @cpptrf_(ptr noundef %0, ptr noundef nonnull %1, ptr noundef %3, ptr noundef nonnull %6) #4
  %26 = load i32, ptr %6, align 4, !tbaa !5
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %28, label %29

28:                                               ; preds = %25
  tail call void @cpptrs_(ptr noundef %0, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef %3, ptr noundef %4, ptr noundef nonnull %5, ptr noundef nonnull %6) #4
  br label %29

29:                                               ; preds = %25, %28, %.thread
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  ret void
}

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

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

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

declare void @cpptrf_(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @cpptrs_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; 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.umax.i32(i32, i32) #3

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }

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


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