; LLVM IR from niuyishuai/PDCABB :: LAPACK_BLAS/LAPACK (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 i32 @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 i32, align 4
  %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 i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = 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
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #3
  %24 = load ptr, ptr %14, align 8, !tbaa !5
  %25 = load i64, ptr %24, align 8, !tbaa !9
  store i64 %25, ptr %18, align 8, !tbaa !9
  %26 = load i64, ptr %18, align 8, !tbaa !9
  %27 = add nsw i64 1, %26
  store i64 %27, ptr %19, align 8, !tbaa !9
  %28 = load i64, ptr %19, align 8, !tbaa !9
  %29 = load ptr, ptr %13, align 8, !tbaa !5
  %30 = sub i64 0, %28
  %31 = getelementptr inbounds %struct.complex, ptr %29, i64 %30
  store ptr %31, ptr %13, align 8, !tbaa !5
  %32 = load ptr, ptr %16, align 8, !tbaa !5
  %33 = load i64, ptr %32, align 8, !tbaa !9
  store i64 %33, ptr %20, align 8, !tbaa !9
  %34 = load i64, ptr %20, align 8, !tbaa !9
  %35 = add nsw i64 1, %34
  store i64 %35, ptr %21, align 8, !tbaa !9
  %36 = load i64, ptr %21, align 8, !tbaa !9
  %37 = load ptr, ptr %15, align 8, !tbaa !5
  %38 = sub i64 0, %36
  %39 = getelementptr inbounds %struct.complex, ptr %37, i64 %38
  store ptr %39, ptr %15, align 8, !tbaa !5
  %40 = load ptr, ptr %17, align 8, !tbaa !5
  store i64 0, ptr %40, align 8, !tbaa !9
  %41 = load ptr, ptr %10, align 8, !tbaa !5
  %42 = call i64 @lsame_(ptr noundef %41, ptr noundef @.str)
  %43 = icmp ne i64 %42, 0
  br i1 %43, label %50, label %44

44:                                               ; preds = %8
  %45 = load ptr, ptr %10, align 8, !tbaa !5
  %46 = call i64 @lsame_(ptr noundef %45, ptr noundef @.str.1)
  %47 = icmp ne i64 %46, 0
  br i1 %47, label %50, label %48

48:                                               ; preds = %44
  %49 = load ptr, ptr %17, align 8, !tbaa !5
  store i64 -1, ptr %49, align 8, !tbaa !9
  br label %96

50:                                               ; preds = %44, %8
  %51 = load ptr, ptr %11, align 8, !tbaa !5
  %52 = load i64, ptr %51, align 8, !tbaa !9
  %53 = icmp slt i64 %52, 0
  br i1 %53, label %54, label %56

54:                                               ; preds = %50
  %55 = load ptr, ptr %17, align 8, !tbaa !5
  store i64 -2, ptr %55, align 8, !tbaa !9
  br label %95

56:                                               ; preds = %50
  %57 = load ptr, ptr %12, align 8, !tbaa !5
  %58 = load i64, ptr %57, align 8, !tbaa !9
  %59 = icmp slt i64 %58, 0
  br i1 %59, label %60, label %62

60:                                               ; preds = %56
  %61 = load ptr, ptr %17, align 8, !tbaa !5
  store i64 -3, ptr %61, align 8, !tbaa !9
  br label %94

62:                                               ; preds = %56
  %63 = load ptr, ptr %14, align 8, !tbaa !5
  %64 = load i64, ptr %63, align 8, !tbaa !9
  %65 = load ptr, ptr %11, align 8, !tbaa !5
  %66 = load i64, ptr %65, align 8, !tbaa !9
  %67 = icmp sge i64 1, %66
  br i1 %67, label %68, label %69

68:                                               ; preds = %62
  br label %72

69:                                               ; preds = %62
  %70 = load ptr, ptr %11, align 8, !tbaa !5
  %71 = load i64, ptr %70, align 8, !tbaa !9
  br label %72

72:                                               ; preds = %69, %68
  %73 = phi i64 [ 1, %68 ], [ %71, %69 ]
  %74 = icmp slt i64 %64, %73
  br i1 %74, label %75, label %77

75:                                               ; preds = %72
  %76 = load ptr, ptr %17, align 8, !tbaa !5
  store i64 -5, ptr %76, align 8, !tbaa !9
  br label %93

77:                                               ; preds = %72
  %78 = load ptr, ptr %16, align 8, !tbaa !5
  %79 = load i64, ptr %78, align 8, !tbaa !9
  %80 = load ptr, ptr %11, align 8, !tbaa !5
  %81 = load i64, ptr %80, align 8, !tbaa !9
  %82 = icmp sge i64 1, %81
  br i1 %82, label %83, label %84

83:                                               ; preds = %77
  br label %87

84:                                               ; preds = %77
  %85 = load ptr, ptr %11, align 8, !tbaa !5
  %86 = load i64, ptr %85, align 8, !tbaa !9
  br label %87

87:                                               ; preds = %84, %83
  %88 = phi i64 [ 1, %83 ], [ %86, %84 ]
  %89 = icmp slt i64 %79, %88
  br i1 %89, label %90, label %92

90:                                               ; preds = %87
  %91 = load ptr, ptr %17, align 8, !tbaa !5
  store i64 -7, ptr %91, align 8, !tbaa !9
  br label %92

92:                                               ; preds = %90, %87
  br label %93

93:                                               ; preds = %92, %75
  br label %94

94:                                               ; preds = %93, %60
  br label %95

95:                                               ; preds = %94, %54
  br label %96

96:                                               ; preds = %95, %48
  %97 = load ptr, ptr %17, align 8, !tbaa !5
  %98 = load i64, ptr %97, align 8, !tbaa !9
  %99 = icmp ne i64 %98, 0
  br i1 %99, label %100, label %105

100:                                              ; preds = %96
  %101 = load ptr, ptr %17, align 8, !tbaa !5
  %102 = load i64, ptr %101, align 8, !tbaa !9
  %103 = sub nsw i64 0, %102
  store i64 %103, ptr %22, align 8, !tbaa !9
  %104 = call i32 @xerbla_(ptr noundef @.str.2, ptr noundef %22)
  store i32 0, ptr %9, align 4
  store i32 1, ptr %23, align 4
  br label %132

105:                                              ; preds = %96
  %106 = load ptr, ptr %10, align 8, !tbaa !5
  %107 = load ptr, ptr %11, align 8, !tbaa !5
  %108 = load ptr, ptr %13, align 8, !tbaa !5
  %109 = load i64, ptr %19, align 8, !tbaa !9
  %110 = getelementptr inbounds %struct.complex, ptr %108, i64 %109
  %111 = load ptr, ptr %14, align 8, !tbaa !5
  %112 = load ptr, ptr %17, align 8, !tbaa !5
  %113 = call i32 @cpotrf_(ptr noundef %106, ptr noundef %107, ptr noundef %110, ptr noundef %111, ptr noundef %112)
  %114 = load ptr, ptr %17, align 8, !tbaa !5
  %115 = load i64, ptr %114, align 8, !tbaa !9
  %116 = icmp eq i64 %115, 0
  br i1 %116, label %117, label %131

117:                                              ; preds = %105
  %118 = load ptr, ptr %10, align 8, !tbaa !5
  %119 = load ptr, ptr %11, align 8, !tbaa !5
  %120 = load ptr, ptr %12, align 8, !tbaa !5
  %121 = load ptr, ptr %13, align 8, !tbaa !5
  %122 = load i64, ptr %19, align 8, !tbaa !9
  %123 = getelementptr inbounds %struct.complex, ptr %121, i64 %122
  %124 = load ptr, ptr %14, align 8, !tbaa !5
  %125 = load ptr, ptr %15, align 8, !tbaa !5
  %126 = load i64, ptr %21, align 8, !tbaa !9
  %127 = getelementptr inbounds %struct.complex, ptr %125, i64 %126
  %128 = load ptr, ptr %16, align 8, !tbaa !5
  %129 = load ptr, ptr %17, align 8, !tbaa !5
  %130 = call i32 @cpotrs_(ptr noundef %118, ptr noundef %119, ptr noundef %120, ptr noundef %123, ptr noundef %124, ptr noundef %127, ptr noundef %128, ptr noundef %129)
  br label %131

131:                                              ; preds = %117, %105
  store i32 0, ptr %9, align 4
  store i32 1, ptr %23, align 4
  br label %132

132:                                              ; preds = %131, %100
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  %133 = load i32, ptr %9, align 4
  ret i32 %133
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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 i64, ptr %7, align 8, !tbaa !5
  %32 = icmp eq i64 %31, 0
  br i1 %32, label %33, label %35

33:                                               ; preds = %29
  %34 = tail call i32 @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 %35

35:                                               ; preds = %29, %33, %.thread
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  ret i32 0
}

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

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

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

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

declare i32 @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 i64 @llvm.umax.i64(i64, i64) #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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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