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

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

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

53:                                               ; preds = %49
  %54 = load ptr, ptr %18, align 8, !tbaa !5
  store i32 -1, ptr %54, align 4, !tbaa !9
  br label %102

55:                                               ; preds = %49, %9
  %56 = load ptr, ptr %11, align 8, !tbaa !5
  %57 = load i32, ptr %56, align 4, !tbaa !9
  %58 = icmp slt i32 %57, 0
  br i1 %58, label %59, label %61

59:                                               ; preds = %55
  %60 = load ptr, ptr %18, align 8, !tbaa !5
  store i32 -2, ptr %60, align 4, !tbaa !9
  br label %101

61:                                               ; preds = %55
  %62 = load ptr, ptr %12, align 8, !tbaa !5
  %63 = load i32, ptr %62, align 4, !tbaa !9
  %64 = icmp slt i32 %63, 0
  br i1 %64, label %65, label %67

65:                                               ; preds = %61
  %66 = load ptr, ptr %18, align 8, !tbaa !5
  store i32 -3, ptr %66, align 4, !tbaa !9
  br label %100

67:                                               ; preds = %61
  %68 = load ptr, ptr %13, align 8, !tbaa !5
  %69 = load i32, ptr %68, align 4, !tbaa !9
  %70 = icmp slt i32 %69, 0
  br i1 %70, label %71, label %73

71:                                               ; preds = %67
  %72 = load ptr, ptr %18, align 8, !tbaa !5
  store i32 -4, ptr %72, align 4, !tbaa !9
  br label %99

73:                                               ; preds = %67
  %74 = load ptr, ptr %15, align 8, !tbaa !5
  %75 = load i32, ptr %74, align 4, !tbaa !9
  %76 = load ptr, ptr %12, align 8, !tbaa !5
  %77 = load i32, ptr %76, align 4, !tbaa !9
  %78 = add nsw i32 %77, 1
  %79 = icmp slt i32 %75, %78
  br i1 %79, label %80, label %82

80:                                               ; preds = %73
  %81 = load ptr, ptr %18, align 8, !tbaa !5
  store i32 -6, ptr %81, align 4, !tbaa !9
  br label %98

82:                                               ; preds = %73
  %83 = load ptr, ptr %17, align 8, !tbaa !5
  %84 = load i32, ptr %83, align 4, !tbaa !9
  %85 = load ptr, ptr %11, align 8, !tbaa !5
  %86 = load i32, ptr %85, align 4, !tbaa !9
  %87 = icmp sge i32 1, %86
  br i1 %87, label %88, label %89

88:                                               ; preds = %82
  br label %92

89:                                               ; preds = %82
  %90 = load ptr, ptr %11, align 8, !tbaa !5
  %91 = load i32, ptr %90, align 4, !tbaa !9
  br label %92

92:                                               ; preds = %89, %88
  %93 = phi i32 [ 1, %88 ], [ %91, %89 ]
  %94 = icmp slt i32 %84, %93
  br i1 %94, label %95, label %97

95:                                               ; preds = %92
  %96 = load ptr, ptr %18, align 8, !tbaa !5
  store i32 -8, ptr %96, align 4, !tbaa !9
  br label %97

97:                                               ; preds = %95, %92
  br label %98

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

99:                                               ; preds = %98, %71
  br label %100

100:                                              ; preds = %99, %65
  br label %101

101:                                              ; preds = %100, %59
  br label %102

102:                                              ; preds = %101, %53
  %103 = load ptr, ptr %18, align 8, !tbaa !5
  %104 = load i32, ptr %103, align 4, !tbaa !9
  %105 = icmp ne i32 %104, 0
  br i1 %105, label %106, label %111

106:                                              ; preds = %102
  %107 = load ptr, ptr %18, align 8, !tbaa !5
  %108 = load i32, ptr %107, align 4, !tbaa !9
  %109 = sub nsw i32 0, %108
  store i32 %109, ptr %23, align 4, !tbaa !9
  %110 = call i32 @xerbla_(ptr noundef @.str.2, ptr noundef %23, i32 noundef 6)
  store i32 1, ptr %24, align 4
  br label %141

111:                                              ; preds = %102
  %112 = load ptr, ptr %10, align 8, !tbaa !5
  %113 = load ptr, ptr %11, align 8, !tbaa !5
  %114 = load ptr, ptr %12, align 8, !tbaa !5
  %115 = load ptr, ptr %14, align 8, !tbaa !5
  %116 = load i32, ptr %20, align 4, !tbaa !9
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds %struct.complex, ptr %115, i64 %117
  %119 = load ptr, ptr %15, align 8, !tbaa !5
  %120 = load ptr, ptr %18, align 8, !tbaa !5
  call void @cpbtrf_(ptr noundef %112, ptr noundef %113, ptr noundef %114, ptr noundef %118, ptr noundef %119, ptr noundef %120)
  %121 = load ptr, ptr %18, align 8, !tbaa !5
  %122 = load i32, ptr %121, align 4, !tbaa !9
  %123 = icmp eq i32 %122, 0
  br i1 %123, label %124, label %140

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

140:                                              ; preds = %124, %111
  store i32 1, ptr %24, align 4
  br label %141

141:                                              ; preds = %140, %106
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #3
  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
  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 @cpbtrf_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

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

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

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

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

20:                                               ; preds = %17
  %21 = load i32, ptr %3, align 4, !tbaa !5
  %22 = icmp slt i32 %21, 0
  br i1 %22, label %.thread.sink.split, label %23

23:                                               ; preds = %20
  %24 = load i32, ptr %5, align 4, !tbaa !5
  %.not48 = icmp sgt i32 %24, %18
  br i1 %.not48, label %25, label %.thread.sink.split

25:                                               ; preds = %23
  %26 = load i32, ptr %7, align 4, !tbaa !5
  %spec.select = tail call i32 @llvm.umax.i32(i32 %15, i32 1)
  %27 = icmp slt i32 %26, %spec.select
  br i1 %27, label %.thread.sink.split, label %28

28:                                               ; preds = %25
  %.pr = load i32, ptr %8, align 4, !tbaa !5
  %.not49 = icmp eq i32 %.pr, 0
  br i1 %.not49, label %32, label %.thread

.thread.sink.split:                               ; preds = %25, %23, %20, %17, %14, %12
  %.sink = phi i32 [ -1, %12 ], [ -2, %14 ], [ -3, %17 ], [ -4, %20 ], [ -6, %23 ], [ -8, %25 ]
  store i32 %.sink, ptr %8, align 4, !tbaa !5
  br label %.thread

.thread:                                          ; preds = %.thread.sink.split, %28
  %29 = phi i32 [ %.pr, %28 ], [ %.sink, %.thread.sink.split ]
  %30 = sub nsw i32 0, %29
  store i32 %30, ptr %10, align 4, !tbaa !5
  %31 = call i32 @xerbla_(ptr noundef nonnull @.str.2, ptr noundef nonnull %10, i32 noundef 6) #4
  br label %36

32:                                               ; preds = %28
  tail call void @cpbtrf_(ptr noundef %0, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef %4, ptr noundef nonnull %5, ptr noundef nonnull %8) #4
  %33 = load i32, ptr %8, align 4, !tbaa !5
  %34 = icmp eq i32 %33, 0
  br i1 %34, label %35, label %36

35:                                               ; preds = %32
  tail call void @cpbtrs_(ptr noundef %0, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3, ptr noundef %4, ptr noundef nonnull %5, ptr noundef %6, ptr noundef nonnull %7, ptr noundef nonnull %8) #4
  br label %36

36:                                               ; preds = %32, %35, %.thread
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #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 @cpbtrf_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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