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

; 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 @cposv_(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7) #0 {
  %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 ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store ptr %2, ptr %11, align 8, !tbaa !5
  store ptr %3, ptr %12, align 8, !tbaa !5
  store ptr %4, ptr %13, align 8, !tbaa !5
  store ptr %5, ptr %14, align 8, !tbaa !5
  store ptr %6, ptr %15, align 8, !tbaa !5
  store ptr %7, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #3
  %23 = load ptr, ptr %13, align 8, !tbaa !5
  %24 = load i32, ptr %23, align 4, !tbaa !9
  store i32 %24, ptr %17, align 4, !tbaa !9
  %25 = load i32, ptr %17, align 4, !tbaa !9
  %26 = mul nsw i32 %25, 1
  %27 = add nsw i32 1, %26
  store i32 %27, ptr %18, align 4, !tbaa !9
  %28 = load i32, ptr %18, align 4, !tbaa !9
  %29 = load ptr, ptr %12, align 8, !tbaa !5
  %30 = sext i32 %28 to i64
  %31 = sub i64 0, %30
  %32 = getelementptr inbounds %struct.complex, ptr %29, i64 %31
  store ptr %32, ptr %12, align 8, !tbaa !5
  %33 = load ptr, ptr %15, align 8, !tbaa !5
  %34 = load i32, ptr %33, align 4, !tbaa !9
  store i32 %34, ptr %19, align 4, !tbaa !9
  %35 = load i32, ptr %19, align 4, !tbaa !9
  %36 = mul nsw i32 %35, 1
  %37 = add nsw i32 1, %36
  store i32 %37, ptr %20, align 4, !tbaa !9
  %38 = load i32, ptr %20, align 4, !tbaa !9
  %39 = load ptr, ptr %14, align 8, !tbaa !5
  %40 = sext i32 %38 to i64
  %41 = sub i64 0, %40
  %42 = getelementptr inbounds %struct.complex, ptr %39, i64 %41
  store ptr %42, ptr %14, align 8, !tbaa !5
  %43 = load ptr, ptr %16, align 8, !tbaa !5
  store i32 0, ptr %43, align 4, !tbaa !9
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  %45 = call i32 @lsame_(ptr noundef %44, ptr noundef @.str)
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %53, label %47

47:                                               ; preds = %8
  %48 = load ptr, ptr %9, align 8, !tbaa !5
  %49 = call i32 @lsame_(ptr noundef %48, ptr noundef @.str.1)
  %50 = icmp ne i32 %49, 0
  br i1 %50, label %53, label %51

51:                                               ; preds = %47
  %52 = load ptr, ptr %16, align 8, !tbaa !5
  store i32 -1, ptr %52, align 4, !tbaa !9
  br label %99

53:                                               ; preds = %47, %8
  %54 = load ptr, ptr %10, align 8, !tbaa !5
  %55 = load i32, ptr %54, align 4, !tbaa !9
  %56 = icmp slt i32 %55, 0
  br i1 %56, label %57, label %59

57:                                               ; preds = %53
  %58 = load ptr, ptr %16, align 8, !tbaa !5
  store i32 -2, ptr %58, align 4, !tbaa !9
  br label %98

59:                                               ; preds = %53
  %60 = load ptr, ptr %11, align 8, !tbaa !5
  %61 = load i32, ptr %60, align 4, !tbaa !9
  %62 = icmp slt i32 %61, 0
  br i1 %62, label %63, label %65

63:                                               ; preds = %59
  %64 = load ptr, ptr %16, align 8, !tbaa !5
  store i32 -3, ptr %64, align 4, !tbaa !9
  br label %97

65:                                               ; preds = %59
  %66 = load ptr, ptr %13, align 8, !tbaa !5
  %67 = load i32, ptr %66, align 4, !tbaa !9
  %68 = load ptr, ptr %10, align 8, !tbaa !5
  %69 = load i32, ptr %68, align 4, !tbaa !9
  %70 = icmp sge i32 1, %69
  br i1 %70, label %71, label %72

71:                                               ; preds = %65
  br label %75

72:                                               ; preds = %65
  %73 = load ptr, ptr %10, align 8, !tbaa !5
  %74 = load i32, ptr %73, align 4, !tbaa !9
  br label %75

75:                                               ; preds = %72, %71
  %76 = phi i32 [ 1, %71 ], [ %74, %72 ]
  %77 = icmp slt i32 %67, %76
  br i1 %77, label %78, label %80

78:                                               ; preds = %75
  %79 = load ptr, ptr %16, align 8, !tbaa !5
  store i32 -5, ptr %79, align 4, !tbaa !9
  br label %96

80:                                               ; preds = %75
  %81 = load ptr, ptr %15, align 8, !tbaa !5
  %82 = load i32, ptr %81, align 4, !tbaa !9
  %83 = load ptr, ptr %10, align 8, !tbaa !5
  %84 = load i32, ptr %83, align 4, !tbaa !9
  %85 = icmp sge i32 1, %84
  br i1 %85, label %86, label %87

86:                                               ; preds = %80
  br label %90

87:                                               ; preds = %80
  %88 = load ptr, ptr %10, align 8, !tbaa !5
  %89 = load i32, ptr %88, align 4, !tbaa !9
  br label %90

90:                                               ; preds = %87, %86
  %91 = phi i32 [ 1, %86 ], [ %89, %87 ]
  %92 = icmp slt i32 %82, %91
  br i1 %92, label %93, label %95

93:                                               ; preds = %90
  %94 = load ptr, ptr %16, align 8, !tbaa !5
  store i32 -7, ptr %94, align 4, !tbaa !9
  br label %95

95:                                               ; preds = %93, %90
  br label %96

96:                                               ; preds = %95, %78
  br label %97

97:                                               ; preds = %96, %63
  br label %98

98:                                               ; preds = %97, %57
  br label %99

99:                                               ; preds = %98, %51
  %100 = load ptr, ptr %16, align 8, !tbaa !5
  %101 = load i32, ptr %100, align 4, !tbaa !9
  %102 = icmp ne i32 %101, 0
  br i1 %102, label %103, label %108

103:                                              ; preds = %99
  %104 = load ptr, ptr %16, align 8, !tbaa !5
  %105 = load i32, ptr %104, align 4, !tbaa !9
  %106 = sub nsw i32 0, %105
  store i32 %106, ptr %21, align 4, !tbaa !9
  %107 = call i32 @xerbla_(ptr noundef @.str.2, ptr noundef %21, i32 noundef 6)
  store i32 1, ptr %22, align 4
  br label %137

108:                                              ; preds = %99
  %109 = load ptr, ptr %9, align 8, !tbaa !5
  %110 = load ptr, ptr %10, align 8, !tbaa !5
  %111 = load ptr, ptr %12, align 8, !tbaa !5
  %112 = load i32, ptr %18, align 4, !tbaa !9
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds %struct.complex, ptr %111, i64 %113
  %115 = load ptr, ptr %13, align 8, !tbaa !5
  %116 = load ptr, ptr %16, align 8, !tbaa !5
  %117 = call i32 @cpotrf_(ptr noundef %109, ptr noundef %110, ptr noundef %114, ptr noundef %115, ptr noundef %116)
  %118 = load ptr, ptr %16, align 8, !tbaa !5
  %119 = load i32, ptr %118, align 4, !tbaa !9
  %120 = icmp eq i32 %119, 0
  br i1 %120, label %121, label %136

121:                                              ; preds = %108
  %122 = load ptr, ptr %9, align 8, !tbaa !5
  %123 = load ptr, ptr %10, align 8, !tbaa !5
  %124 = load ptr, ptr %11, align 8, !tbaa !5
  %125 = load ptr, ptr %12, align 8, !tbaa !5
  %126 = load i32, ptr %18, align 4, !tbaa !9
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds %struct.complex, ptr %125, i64 %127
  %129 = load ptr, ptr %13, align 8, !tbaa !5
  %130 = load ptr, ptr %14, align 8, !tbaa !5
  %131 = load i32, ptr %20, align 4, !tbaa !9
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds %struct.complex, ptr %130, i64 %132
  %134 = load ptr, ptr %15, align 8, !tbaa !5
  %135 = load ptr, ptr %16, align 8, !tbaa !5
  call void @cpotrs_(ptr noundef %122, ptr noundef %123, ptr noundef %124, ptr noundef %128, ptr noundef %129, ptr noundef %133, ptr noundef %134, ptr noundef %135)
  br label %136

136:                                              ; preds = %121, %108
  store i32 1, ptr %22, align 4
  br label %137

137:                                              ; preds = %136, %103
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #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 i32 @cpotrf_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

declare void @cpotrs_(ptr noundef, 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 @cposv_(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7) local_unnamed_addr #0 {
  %9 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #4
  store i32 0, ptr %7, align 4, !tbaa !5
  %10 = tail call i32 @lsame_(ptr noundef %0, ptr noundef nonnull @.str) #4
  %.not = icmp eq i32 %10, 0
  br i1 %.not, label %11, label %13

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

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

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

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

22:                                               ; preds = %19
  %23 = load i32, ptr %6, align 4, !tbaa !5
  %24 = icmp slt i32 %23, %spec.select
  br i1 %24, label %.thread.sink.split, label %25

25:                                               ; preds = %22
  %.pr = load i32, ptr %7, align 4, !tbaa !5
  %.not45 = icmp eq i32 %.pr, 0
  br i1 %.not45, label %29, label %.thread

.thread.sink.split:                               ; preds = %22, %19, %16, %13, %11
  %.sink = phi i32 [ -1, %11 ], [ -2, %13 ], [ -3, %16 ], [ -5, %19 ], [ -7, %22 ]
  store i32 %.sink, ptr %7, align 4, !tbaa !5
  br label %.thread

.thread:                                          ; preds = %.thread.sink.split, %25
  %26 = phi i32 [ %.pr, %25 ], [ %.sink, %.thread.sink.split ]
  %27 = sub nsw i32 0, %26
  store i32 %27, ptr %9, align 4, !tbaa !5
  %28 = call i32 @xerbla_(ptr noundef nonnull @.str.2, ptr noundef nonnull %9, i32 noundef 6) #4
  br label %34

29:                                               ; preds = %25
  %30 = tail call i32 @cpotrf_(ptr noundef %0, ptr noundef nonnull %1, ptr noundef %3, ptr noundef nonnull %4, ptr noundef nonnull %7) #4
  %31 = load i32, ptr %7, align 4, !tbaa !5
  %32 = icmp eq i32 %31, 0
  br i1 %32, label %33, label %34

33:                                               ; preds = %29
  tail call void @cpotrs_(ptr noundef %0, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef %3, ptr noundef nonnull %4, ptr noundef %5, ptr noundef nonnull %6, ptr noundef nonnull %7) #4
  br label %34

34:                                               ; preds = %29, %33, %.thread
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #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 i32 @cpotrf_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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