; LLVM IR from niuyishuai/PDCABB :: LAPACK_BLAS/LAPACK (cpftrs)

; 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 [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1
@c_b1 = external hidden global %struct.complex, align 4

; Function Attrs: nounwind uwtable
define dso_local i32 @cpftrs_(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 %16, 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 %15, align 8, !tbaa !5
  %30 = sub i64 0, %28
  %31 = getelementptr inbounds %struct.complex, ptr %29, i64 %30
  store ptr %31, ptr %15, align 8, !tbaa !5
  %32 = load ptr, ptr %17, align 8, !tbaa !5
  store i64 0, ptr %32, align 8, !tbaa !9
  %33 = load ptr, ptr %10, align 8, !tbaa !5
  %34 = call i64 @lsame_(ptr noundef %33, ptr noundef @.str)
  store i64 %34, ptr %21, align 8, !tbaa !9
  %35 = load ptr, ptr %11, align 8, !tbaa !5
  %36 = call i64 @lsame_(ptr noundef %35, ptr noundef @.str.1)
  store i64 %36, ptr %22, align 8, !tbaa !9
  %37 = load i64, ptr %21, align 8, !tbaa !9
  %38 = icmp ne i64 %37, 0
  br i1 %38, label %45, label %39

39:                                               ; preds = %8
  %40 = load ptr, ptr %10, align 8, !tbaa !5
  %41 = call i64 @lsame_(ptr noundef %40, ptr noundef @.str.2)
  %42 = icmp ne i64 %41, 0
  br i1 %42, label %45, label %43

43:                                               ; preds = %39
  %44 = load ptr, ptr %17, align 8, !tbaa !5
  store i64 -1, ptr %44, align 8, !tbaa !9
  br label %85

45:                                               ; preds = %39, %8
  %46 = load i64, ptr %22, align 8, !tbaa !9
  %47 = icmp ne i64 %46, 0
  br i1 %47, label %54, label %48

48:                                               ; preds = %45
  %49 = load ptr, ptr %11, align 8, !tbaa !5
  %50 = call i64 @lsame_(ptr noundef %49, ptr noundef @.str.3)
  %51 = icmp ne i64 %50, 0
  br i1 %51, label %54, label %52

52:                                               ; preds = %48
  %53 = load ptr, ptr %17, align 8, !tbaa !5
  store i64 -2, ptr %53, align 8, !tbaa !9
  br label %84

54:                                               ; preds = %48, %45
  %55 = load ptr, ptr %12, align 8, !tbaa !5
  %56 = load i64, ptr %55, align 8, !tbaa !9
  %57 = icmp slt i64 %56, 0
  br i1 %57, label %58, label %60

58:                                               ; preds = %54
  %59 = load ptr, ptr %17, align 8, !tbaa !5
  store i64 -3, ptr %59, align 8, !tbaa !9
  br label %83

60:                                               ; preds = %54
  %61 = load ptr, ptr %13, align 8, !tbaa !5
  %62 = load i64, ptr %61, align 8, !tbaa !9
  %63 = icmp slt i64 %62, 0
  br i1 %63, label %64, label %66

64:                                               ; preds = %60
  %65 = load ptr, ptr %17, align 8, !tbaa !5
  store i64 -4, ptr %65, align 8, !tbaa !9
  br label %82

66:                                               ; preds = %60
  %67 = load ptr, ptr %16, align 8, !tbaa !5
  %68 = load i64, ptr %67, align 8, !tbaa !9
  %69 = load ptr, ptr %12, align 8, !tbaa !5
  %70 = load i64, ptr %69, align 8, !tbaa !9
  %71 = icmp sge i64 1, %70
  br i1 %71, label %72, label %73

72:                                               ; preds = %66
  br label %76

73:                                               ; preds = %66
  %74 = load ptr, ptr %12, align 8, !tbaa !5
  %75 = load i64, ptr %74, align 8, !tbaa !9
  br label %76

76:                                               ; preds = %73, %72
  %77 = phi i64 [ 1, %72 ], [ %75, %73 ]
  %78 = icmp slt i64 %68, %77
  br i1 %78, label %79, label %81

79:                                               ; preds = %76
  %80 = load ptr, ptr %17, align 8, !tbaa !5
  store i64 -7, ptr %80, align 8, !tbaa !9
  br label %81

81:                                               ; preds = %79, %76
  br label %82

82:                                               ; preds = %81, %64
  br label %83

83:                                               ; preds = %82, %58
  br label %84

84:                                               ; preds = %83, %52
  br label %85

85:                                               ; preds = %84, %43
  %86 = load ptr, ptr %17, align 8, !tbaa !5
  %87 = load i64, ptr %86, align 8, !tbaa !9
  %88 = icmp ne i64 %87, 0
  br i1 %88, label %89, label %94

89:                                               ; preds = %85
  %90 = load ptr, ptr %17, align 8, !tbaa !5
  %91 = load i64, ptr %90, align 8, !tbaa !9
  %92 = sub nsw i64 0, %91
  store i64 %92, ptr %20, align 8, !tbaa !9
  %93 = call i32 @xerbla_(ptr noundef @.str.4, ptr noundef %20)
  store i32 0, ptr %9, align 4
  store i32 1, ptr %23, align 4
  br label %149

94:                                               ; preds = %85
  %95 = load ptr, ptr %12, align 8, !tbaa !5
  %96 = load i64, ptr %95, align 8, !tbaa !9
  %97 = icmp eq i64 %96, 0
  br i1 %97, label %102, label %98

98:                                               ; preds = %94
  %99 = load ptr, ptr %13, align 8, !tbaa !5
  %100 = load i64, ptr %99, align 8, !tbaa !9
  %101 = icmp eq i64 %100, 0
  br i1 %101, label %102, label %103

102:                                              ; preds = %98, %94
  store i32 0, ptr %9, align 4
  store i32 1, ptr %23, align 4
  br label %149

103:                                              ; preds = %98
  %104 = load i64, ptr %22, align 8, !tbaa !9
  %105 = icmp ne i64 %104, 0
  br i1 %105, label %106, label %127

106:                                              ; preds = %103
  %107 = load ptr, ptr %10, align 8, !tbaa !5
  %108 = load ptr, ptr %11, align 8, !tbaa !5
  %109 = load ptr, ptr %12, align 8, !tbaa !5
  %110 = load ptr, ptr %13, align 8, !tbaa !5
  %111 = load ptr, ptr %14, align 8, !tbaa !5
  %112 = load ptr, ptr %15, align 8, !tbaa !5
  %113 = load i64, ptr %19, align 8, !tbaa !9
  %114 = getelementptr inbounds %struct.complex, ptr %112, i64 %113
  %115 = load ptr, ptr %16, align 8, !tbaa !5
  %116 = call i32 @ctfsm_(ptr noundef %107, ptr noundef @.str.1, ptr noundef %108, ptr noundef @.str, ptr noundef @.str, ptr noundef %109, ptr noundef %110, ptr noundef @c_b1, ptr noundef %111, ptr noundef %114, ptr noundef %115)
  %117 = load ptr, ptr %10, align 8, !tbaa !5
  %118 = load ptr, ptr %11, align 8, !tbaa !5
  %119 = load ptr, ptr %12, align 8, !tbaa !5
  %120 = load ptr, ptr %13, align 8, !tbaa !5
  %121 = load ptr, ptr %14, align 8, !tbaa !5
  %122 = load ptr, ptr %15, align 8, !tbaa !5
  %123 = load i64, ptr %19, align 8, !tbaa !9
  %124 = getelementptr inbounds %struct.complex, ptr %122, i64 %123
  %125 = load ptr, ptr %16, align 8, !tbaa !5
  %126 = call i32 @ctfsm_(ptr noundef %117, ptr noundef @.str.1, ptr noundef %118, ptr noundef @.str.2, ptr noundef @.str, ptr noundef %119, ptr noundef %120, ptr noundef @c_b1, ptr noundef %121, ptr noundef %124, ptr noundef %125)
  br label %148

127:                                              ; preds = %103
  %128 = load ptr, ptr %10, align 8, !tbaa !5
  %129 = load ptr, ptr %11, align 8, !tbaa !5
  %130 = load ptr, ptr %12, align 8, !tbaa !5
  %131 = load ptr, ptr %13, align 8, !tbaa !5
  %132 = load ptr, ptr %14, align 8, !tbaa !5
  %133 = load ptr, ptr %15, align 8, !tbaa !5
  %134 = load i64, ptr %19, align 8, !tbaa !9
  %135 = getelementptr inbounds %struct.complex, ptr %133, i64 %134
  %136 = load ptr, ptr %16, align 8, !tbaa !5
  %137 = call i32 @ctfsm_(ptr noundef %128, ptr noundef @.str.1, ptr noundef %129, ptr noundef @.str.2, ptr noundef @.str, ptr noundef %130, ptr noundef %131, ptr noundef @c_b1, ptr noundef %132, ptr noundef %135, ptr noundef %136)
  %138 = load ptr, ptr %10, align 8, !tbaa !5
  %139 = load ptr, ptr %11, align 8, !tbaa !5
  %140 = load ptr, ptr %12, align 8, !tbaa !5
  %141 = load ptr, ptr %13, align 8, !tbaa !5
  %142 = load ptr, ptr %14, align 8, !tbaa !5
  %143 = load ptr, ptr %15, align 8, !tbaa !5
  %144 = load i64, ptr %19, align 8, !tbaa !9
  %145 = getelementptr inbounds %struct.complex, ptr %143, i64 %144
  %146 = load ptr, ptr %16, align 8, !tbaa !5
  %147 = call i32 @ctfsm_(ptr noundef %138, ptr noundef @.str.1, ptr noundef %139, ptr noundef @.str, ptr noundef @.str, ptr noundef %140, ptr noundef %141, ptr noundef @c_b1, ptr noundef %142, ptr noundef %145, ptr noundef %146)
  br label %148

148:                                              ; preds = %127, %106
  store i32 0, ptr %9, align 4
  store i32 1, ptr %23, align 4
  br label %149

149:                                              ; preds = %148, %102, %89
  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
  %150 = load i32, ptr %9, align 4
  ret i32 %150
}

; 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 @ctfsm_(ptr noundef, ptr noundef, 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 = !{!"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"

%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 [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1
@c_b1 = external hidden global %struct.complex, align 4

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @cpftrs_(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr nocapture 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
  %11 = tail call i64 @lsame_(ptr noundef %1, ptr noundef nonnull @.str.1) #4
  %.not = icmp eq i64 %10, 0
  br i1 %.not, label %12, label %14

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

14:                                               ; preds = %12, %8
  %.not60 = icmp eq i64 %11, 0
  br i1 %.not60, label %15, label %17

15:                                               ; preds = %14
  %16 = tail call i64 @lsame_(ptr noundef %1, ptr noundef nonnull @.str.3) #4
  %.not61 = icmp eq i64 %16, 0
  br i1 %.not61, label %.thread.sink.split, label %17

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

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

23:                                               ; preds = %20
  %24 = load i64, ptr %6, align 8, !tbaa !5
  %spec.select = tail call i64 @llvm.umax.i64(i64 %18, i64 1)
  %25 = icmp slt i64 %24, %spec.select
  br i1 %25, label %.thread.sink.split, label %26

26:                                               ; preds = %23
  %.pr = load i64, ptr %7, align 8, !tbaa !5
  %.not62 = icmp eq i64 %.pr, 0
  br i1 %.not62, label %30, label %.thread

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

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

30:                                               ; preds = %26
  %31 = icmp eq i64 %18, 0
  %32 = icmp eq i64 %21, 0
  %or.cond = or i1 %31, %32
  br i1 %or.cond, label %40, label %33

33:                                               ; preds = %30
  br i1 %.not60, label %37, label %34

34:                                               ; preds = %33
  %35 = tail call i32 @ctfsm_(ptr noundef %0, ptr noundef nonnull @.str.1, ptr noundef %1, ptr noundef nonnull @.str, ptr noundef nonnull @.str, ptr noundef nonnull %2, ptr noundef nonnull %3, ptr noundef nonnull @c_b1, ptr noundef %4, ptr noundef %5, ptr noundef nonnull %6) #4
  %36 = tail call i32 @ctfsm_(ptr noundef %0, ptr noundef nonnull @.str.1, ptr noundef %1, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str, ptr noundef nonnull %2, ptr noundef nonnull %3, ptr noundef nonnull @c_b1, ptr noundef %4, ptr noundef %5, ptr noundef nonnull %6) #4
  br label %40

37:                                               ; preds = %33
  %38 = tail call i32 @ctfsm_(ptr noundef %0, ptr noundef nonnull @.str.1, ptr noundef %1, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str, ptr noundef nonnull %2, ptr noundef nonnull %3, ptr noundef nonnull @c_b1, ptr noundef %4, ptr noundef %5, ptr noundef nonnull %6) #4
  %39 = tail call i32 @ctfsm_(ptr noundef %0, ptr noundef nonnull @.str.1, ptr noundef %1, ptr noundef nonnull @.str, ptr noundef nonnull @.str, ptr noundef nonnull %2, ptr noundef nonnull %3, ptr noundef nonnull @c_b1, ptr noundef %4, ptr noundef %5, ptr noundef nonnull %6) #4
  br label %40

40:                                               ; preds = %34, %37, %30, %.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 @ctfsm_(ptr noundef, ptr noundef, 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 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,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass