; LLVM IR from OpenMathLib/OpenBLAS :: lapack-netlib/SRC (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 void @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 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 %15, 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 %14, 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 %14, align 8, !tbaa !5
  %33 = load ptr, ptr %16, align 8, !tbaa !5
  store i32 0, ptr %33, align 4, !tbaa !9
  %34 = load ptr, ptr %9, align 8, !tbaa !5
  %35 = call i32 @lsame_(ptr noundef %34, ptr noundef @.str)
  store i32 %35, ptr %20, align 4, !tbaa !9
  %36 = load ptr, ptr %10, align 8, !tbaa !5
  %37 = call i32 @lsame_(ptr noundef %36, ptr noundef @.str.1)
  store i32 %37, ptr %21, align 4, !tbaa !9
  %38 = load i32, ptr %20, align 4, !tbaa !9
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %46, label %40

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

44:                                               ; preds = %40
  %45 = load ptr, ptr %16, align 8, !tbaa !5
  store i32 -1, ptr %45, align 4, !tbaa !9
  br label %86

46:                                               ; preds = %40, %8
  %47 = load i32, ptr %21, align 4, !tbaa !9
  %48 = icmp ne i32 %47, 0
  br i1 %48, label %55, label %49

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

53:                                               ; preds = %49
  %54 = load ptr, ptr %16, align 8, !tbaa !5
  store i32 -2, ptr %54, align 4, !tbaa !9
  br label %85

55:                                               ; preds = %49, %46
  %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 %16, align 8, !tbaa !5
  store i32 -3, ptr %60, align 4, !tbaa !9
  br label %84

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 %16, align 8, !tbaa !5
  store i32 -4, ptr %66, align 4, !tbaa !9
  br label %83

67:                                               ; preds = %61
  %68 = load ptr, ptr %15, align 8, !tbaa !5
  %69 = load i32, ptr %68, align 4, !tbaa !9
  %70 = load ptr, ptr %11, align 8, !tbaa !5
  %71 = load i32, ptr %70, align 4, !tbaa !9
  %72 = icmp sge i32 1, %71
  br i1 %72, label %73, label %74

73:                                               ; preds = %67
  br label %77

74:                                               ; preds = %67
  %75 = load ptr, ptr %11, align 8, !tbaa !5
  %76 = load i32, ptr %75, align 4, !tbaa !9
  br label %77

77:                                               ; preds = %74, %73
  %78 = phi i32 [ 1, %73 ], [ %76, %74 ]
  %79 = icmp slt i32 %69, %78
  br i1 %79, label %80, label %82

80:                                               ; preds = %77
  %81 = load ptr, ptr %16, align 8, !tbaa !5
  store i32 -7, ptr %81, align 4, !tbaa !9
  br label %82

82:                                               ; preds = %80, %77
  br label %83

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

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

85:                                               ; preds = %84, %53
  br label %86

86:                                               ; preds = %85, %44
  %87 = load ptr, ptr %16, align 8, !tbaa !5
  %88 = load i32, ptr %87, align 4, !tbaa !9
  %89 = icmp ne i32 %88, 0
  br i1 %89, label %90, label %95

90:                                               ; preds = %86
  %91 = load ptr, ptr %16, align 8, !tbaa !5
  %92 = load i32, ptr %91, align 4, !tbaa !9
  %93 = sub nsw i32 0, %92
  store i32 %93, ptr %19, align 4, !tbaa !9
  %94 = call i32 @xerbla_(ptr noundef @.str.4, ptr noundef %19, i32 noundef 6)
  store i32 1, ptr %22, align 4
  br label %150

95:                                               ; preds = %86
  %96 = load ptr, ptr %11, align 8, !tbaa !5
  %97 = load i32, ptr %96, align 4, !tbaa !9
  %98 = icmp eq i32 %97, 0
  br i1 %98, label %103, label %99

99:                                               ; preds = %95
  %100 = load ptr, ptr %12, align 8, !tbaa !5
  %101 = load i32, ptr %100, align 4, !tbaa !9
  %102 = icmp eq i32 %101, 0
  br i1 %102, label %103, label %104

103:                                              ; preds = %99, %95
  store i32 1, ptr %22, align 4
  br label %150

104:                                              ; preds = %99
  %105 = load i32, ptr %21, align 4, !tbaa !9
  %106 = icmp ne i32 %105, 0
  br i1 %106, label %107, label %128

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

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

149:                                              ; preds = %128, %107
  store i32 1, ptr %22, align 4
  br label %150

150:                                              ; preds = %149, %103, %90
  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 void @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 = !{!"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"

%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 void @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 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
  %11 = tail call i32 @lsame_(ptr noundef %1, ptr noundef nonnull @.str.1) #4
  %.not = icmp eq i32 %10, 0
  br i1 %.not, label %12, label %14

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

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

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

17:                                               ; preds = %15, %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 %6, align 4, !tbaa !5
  %spec.select = tail call i32 @llvm.umax.i32(i32 %18, i32 1)
  %25 = icmp slt i32 %24, %spec.select
  br i1 %25, label %.thread.sink.split, label %26

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

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

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

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

33:                                               ; preds = %30
  br i1 %.not59, label %35, label %34

34:                                               ; preds = %33
  tail call void @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
  tail call void @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 %36

35:                                               ; preds = %33
  tail call void @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
  tail call void @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 %36

36:                                               ; preds = %34, %35, %30, %.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 void @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 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,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass