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

; 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"

@.str = external hidden unnamed_addr constant [2 x i8], align 1
@c__1 = external hidden global i32, align 4
@.str.1 = external hidden unnamed_addr constant [9 x i8], align 1
@c_n1 = external hidden global i32, align 4
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @dsytri_3_(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
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = 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
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #3
  %28 = load ptr, ptr %13, align 8, !tbaa !5
  %29 = load i32, ptr %28, align 4, !tbaa !9
  store i32 %29, ptr %19, align 4, !tbaa !9
  %30 = load i32, ptr %19, align 4, !tbaa !9
  %31 = mul nsw i32 %30, 1
  %32 = add nsw i32 1, %31
  store i32 %32, ptr %20, align 4, !tbaa !9
  %33 = load i32, ptr %20, align 4, !tbaa !9
  %34 = load ptr, ptr %12, align 8, !tbaa !5
  %35 = sext i32 %33 to i64
  %36 = sub i64 0, %35
  %37 = getelementptr inbounds double, ptr %34, i64 %36
  store ptr %37, ptr %12, align 8, !tbaa !5
  %38 = load ptr, ptr %14, align 8, !tbaa !5
  %39 = getelementptr inbounds double, ptr %38, i32 -1
  store ptr %39, ptr %14, align 8, !tbaa !5
  %40 = load ptr, ptr %15, align 8, !tbaa !5
  %41 = getelementptr inbounds i32, ptr %40, i32 -1
  store ptr %41, ptr %15, align 8, !tbaa !5
  %42 = load ptr, ptr %16, align 8, !tbaa !5
  %43 = getelementptr inbounds double, ptr %42, i32 -1
  store ptr %43, ptr %16, align 8, !tbaa !5
  %44 = load ptr, ptr %18, align 8, !tbaa !5
  store i32 0, ptr %44, align 4, !tbaa !9
  %45 = load ptr, ptr %10, align 8, !tbaa !5
  %46 = call i32 @lsame_(ptr noundef %45, ptr noundef @.str)
  store i32 %46, ptr %23, align 4, !tbaa !9
  %47 = load ptr, ptr %17, align 8, !tbaa !5
  %48 = load i32, ptr %47, align 4, !tbaa !9
  %49 = icmp eq i32 %48, -1
  %50 = zext i1 %49 to i32
  store i32 %50, ptr %26, align 4, !tbaa !9
  store i32 1, ptr %21, align 4, !tbaa !9
  %51 = load ptr, ptr %10, align 8, !tbaa !5
  %52 = load ptr, ptr %11, align 8, !tbaa !5
  %53 = call i32 @ilaenv_(ptr noundef @c__1, ptr noundef @.str.1, ptr noundef %51, ptr noundef %52, ptr noundef @c_n1, ptr noundef @c_n1, ptr noundef @c_n1, i32 noundef 8, i32 noundef 1)
  store i32 %53, ptr %22, align 4, !tbaa !9
  %54 = load i32, ptr %21, align 4, !tbaa !9
  %55 = load i32, ptr %22, align 4, !tbaa !9
  %56 = icmp sge i32 %54, %55
  br i1 %56, label %57, label %59

57:                                               ; preds = %9
  %58 = load i32, ptr %21, align 4, !tbaa !9
  br label %61

59:                                               ; preds = %9
  %60 = load i32, ptr %22, align 4, !tbaa !9
  br label %61

61:                                               ; preds = %59, %57
  %62 = phi i32 [ %58, %57 ], [ %60, %59 ]
  store i32 %62, ptr %24, align 4, !tbaa !9
  %63 = load ptr, ptr %11, align 8, !tbaa !5
  %64 = load i32, ptr %63, align 4, !tbaa !9
  %65 = load i32, ptr %24, align 4, !tbaa !9
  %66 = add nsw i32 %64, %65
  %67 = add nsw i32 %66, 1
  %68 = load i32, ptr %24, align 4, !tbaa !9
  %69 = add nsw i32 %68, 3
  %70 = mul nsw i32 %67, %69
  store i32 %70, ptr %25, align 4, !tbaa !9
  %71 = load i32, ptr %23, align 4, !tbaa !9
  %72 = icmp ne i32 %71, 0
  br i1 %72, label %79, label %73

73:                                               ; preds = %61
  %74 = load ptr, ptr %10, align 8, !tbaa !5
  %75 = call i32 @lsame_(ptr noundef %74, ptr noundef @.str.2)
  %76 = icmp ne i32 %75, 0
  br i1 %76, label %79, label %77

77:                                               ; preds = %73
  %78 = load ptr, ptr %18, align 8, !tbaa !5
  store i32 -1, ptr %78, align 4, !tbaa !9
  br label %113

79:                                               ; preds = %73, %61
  %80 = load ptr, ptr %11, align 8, !tbaa !5
  %81 = load i32, ptr %80, align 4, !tbaa !9
  %82 = icmp slt i32 %81, 0
  br i1 %82, label %83, label %85

83:                                               ; preds = %79
  %84 = load ptr, ptr %18, align 8, !tbaa !5
  store i32 -2, ptr %84, align 4, !tbaa !9
  br label %112

85:                                               ; preds = %79
  %86 = load ptr, ptr %13, align 8, !tbaa !5
  %87 = load i32, ptr %86, align 4, !tbaa !9
  %88 = load ptr, ptr %11, align 8, !tbaa !5
  %89 = load i32, ptr %88, align 4, !tbaa !9
  %90 = icmp sge i32 1, %89
  br i1 %90, label %91, label %92

91:                                               ; preds = %85
  br label %95

92:                                               ; preds = %85
  %93 = load ptr, ptr %11, align 8, !tbaa !5
  %94 = load i32, ptr %93, align 4, !tbaa !9
  br label %95

95:                                               ; preds = %92, %91
  %96 = phi i32 [ 1, %91 ], [ %94, %92 ]
  %97 = icmp slt i32 %87, %96
  br i1 %97, label %98, label %100

98:                                               ; preds = %95
  %99 = load ptr, ptr %18, align 8, !tbaa !5
  store i32 -4, ptr %99, align 4, !tbaa !9
  br label %111

100:                                              ; preds = %95
  %101 = load ptr, ptr %17, align 8, !tbaa !5
  %102 = load i32, ptr %101, align 4, !tbaa !9
  %103 = load i32, ptr %25, align 4, !tbaa !9
  %104 = icmp slt i32 %102, %103
  br i1 %104, label %105, label %110

105:                                              ; preds = %100
  %106 = load i32, ptr %26, align 4, !tbaa !9
  %107 = icmp ne i32 %106, 0
  br i1 %107, label %110, label %108

108:                                              ; preds = %105
  %109 = load ptr, ptr %18, align 8, !tbaa !5
  store i32 -8, ptr %109, align 4, !tbaa !9
  br label %110

110:                                              ; preds = %108, %105, %100
  br label %111

111:                                              ; preds = %110, %98
  br label %112

112:                                              ; preds = %111, %83
  br label %113

113:                                              ; preds = %112, %77
  %114 = load ptr, ptr %18, align 8, !tbaa !5
  %115 = load i32, ptr %114, align 4, !tbaa !9
  %116 = icmp ne i32 %115, 0
  br i1 %116, label %117, label %122

117:                                              ; preds = %113
  %118 = load ptr, ptr %18, align 8, !tbaa !5
  %119 = load i32, ptr %118, align 4, !tbaa !9
  %120 = sub nsw i32 0, %119
  store i32 %120, ptr %21, align 4, !tbaa !9
  %121 = call i32 @xerbla_(ptr noundef @.str.1, ptr noundef %21, i32 noundef 8)
  store i32 1, ptr %27, align 4
  br label %155

122:                                              ; preds = %113
  %123 = load i32, ptr %26, align 4, !tbaa !9
  %124 = icmp ne i32 %123, 0
  br i1 %124, label %125, label %130

125:                                              ; preds = %122
  %126 = load i32, ptr %25, align 4, !tbaa !9
  %127 = sitofp i32 %126 to double
  %128 = load ptr, ptr %16, align 8, !tbaa !5
  %129 = getelementptr inbounds double, ptr %128, i64 1
  store double %127, ptr %129, align 8, !tbaa !11
  store i32 1, ptr %27, align 4
  br label %155

130:                                              ; preds = %122
  br label %131

131:                                              ; preds = %130
  %132 = load ptr, ptr %11, align 8, !tbaa !5
  %133 = load i32, ptr %132, align 4, !tbaa !9
  %134 = icmp eq i32 %133, 0
  br i1 %134, label %135, label %136

135:                                              ; preds = %131
  store i32 1, ptr %27, align 4
  br label %155

136:                                              ; preds = %131
  %137 = load ptr, ptr %10, align 8, !tbaa !5
  %138 = load ptr, ptr %11, align 8, !tbaa !5
  %139 = load ptr, ptr %12, align 8, !tbaa !5
  %140 = load i32, ptr %20, align 4, !tbaa !9
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds double, ptr %139, i64 %141
  %143 = load ptr, ptr %13, align 8, !tbaa !5
  %144 = load ptr, ptr %14, align 8, !tbaa !5
  %145 = getelementptr inbounds double, ptr %144, i64 1
  %146 = load ptr, ptr %15, align 8, !tbaa !5
  %147 = getelementptr inbounds i32, ptr %146, i64 1
  %148 = load ptr, ptr %16, align 8, !tbaa !5
  %149 = getelementptr inbounds double, ptr %148, i64 1
  %150 = load ptr, ptr %18, align 8, !tbaa !5
  call void @dsytri_3x_(ptr noundef %137, ptr noundef %138, ptr noundef %142, ptr noundef %143, ptr noundef %145, ptr noundef %147, ptr noundef %149, ptr noundef %24, ptr noundef %150)
  %151 = load i32, ptr %25, align 4, !tbaa !9
  %152 = sitofp i32 %151 to double
  %153 = load ptr, ptr %16, align 8, !tbaa !5
  %154 = getelementptr inbounds double, ptr %153, i64 1
  store double %152, ptr %154, align 8, !tbaa !11
  store i32 1, ptr %27, align 4
  br label %155

155:                                              ; preds = %136, %135, %125, %117
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #3
  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 @ilaenv_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef) #2

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

declare void @dsytri_3x_(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}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !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
@c__1 = external hidden global i32, align 4
@.str.1 = external hidden unnamed_addr constant [9 x i8], align 1
@c_n1 = external hidden global i32, align 4
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @dsytri_3_(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr nocapture noundef readonly %7, ptr noundef %8) local_unnamed_addr #0 {
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #4
  store i32 0, ptr %8, align 4, !tbaa !5
  %12 = tail call i32 @lsame_(ptr noundef %0, ptr noundef nonnull @.str) #4
  %13 = load i32, ptr %7, align 4, !tbaa !5
  %14 = icmp eq i32 %13, -1
  %15 = tail call i32 @ilaenv_(ptr noundef nonnull @c__1, ptr noundef nonnull @.str.1, ptr noundef %0, ptr noundef %1, ptr noundef nonnull @c_n1, ptr noundef nonnull @c_n1, ptr noundef nonnull @c_n1, i32 noundef 8, i32 noundef 1) #4
  %16 = tail call i32 @llvm.smax.i32(i32 %15, i32 1)
  store i32 %16, ptr %11, align 4, !tbaa !5
  %17 = load i32, ptr %1, align 4, !tbaa !5
  %18 = add nuw i32 %16, 1
  %19 = add i32 %18, %17
  %20 = add nuw nsw i32 %16, 3
  %21 = mul nsw i32 %19, %20
  %.not = icmp eq i32 %12, 0
  br i1 %.not, label %22, label %24

22:                                               ; preds = %9
  %23 = tail call i32 @lsame_(ptr noundef %0, ptr noundef nonnull @.str.2) #4
  %.not46 = icmp eq i32 %23, 0
  br i1 %.not46, label %.thread.sink.split, label %._crit_edge

._crit_edge:                                      ; preds = %22
  %.pre = load i32, ptr %1, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %._crit_edge, %9
  %25 = phi i32 [ %.pre, %._crit_edge ], [ %17, %9 ]
  %26 = icmp slt i32 %25, 0
  br i1 %26, label %.thread.sink.split, label %27

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

30:                                               ; preds = %27
  %31 = load i32, ptr %7, align 4, !tbaa !5
  %32 = icmp sge i32 %31, %21
  %or.cond = select i1 %32, i1 true, i1 %14
  br i1 %or.cond, label %33, label %.thread.sink.split

33:                                               ; preds = %30
  %.pr = load i32, ptr %8, align 4, !tbaa !5
  %.not47 = icmp eq i32 %.pr, 0
  br i1 %.not47, label %37, label %.thread

.thread.sink.split:                               ; preds = %30, %27, %24, %22
  %.sink = phi i32 [ -1, %22 ], [ -2, %24 ], [ -4, %27 ], [ -8, %30 ]
  store i32 %.sink, ptr %8, align 4, !tbaa !5
  br label %.thread

.thread:                                          ; preds = %.thread.sink.split, %33
  %34 = phi i32 [ %.pr, %33 ], [ %.sink, %.thread.sink.split ]
  %35 = sub nsw i32 0, %34
  store i32 %35, ptr %10, align 4, !tbaa !5
  %36 = call i32 @xerbla_(ptr noundef nonnull @.str.1, ptr noundef nonnull %10, i32 noundef 8) #4
  br label %44

37:                                               ; preds = %33
  br i1 %14, label %38, label %40

38:                                               ; preds = %37
  %39 = sitofp i32 %21 to double
  store double %39, ptr %6, align 8, !tbaa !9
  br label %44

40:                                               ; preds = %37
  %41 = icmp eq i32 %25, 0
  br i1 %41, label %44, label %42

42:                                               ; preds = %40
  call void @dsytri_3x_(ptr noundef %0, ptr noundef nonnull %1, ptr noundef %2, ptr noundef nonnull %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef nonnull %11, ptr noundef nonnull %8) #4
  %43 = sitofp i32 %21 to double
  store double %43, ptr %6, align 8, !tbaa !9
  br label %44

44:                                               ; preds = %40, %42, %38, %.thread
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #4
  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 @ilaenv_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

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

declare void @dsytri_3x_(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.smax.i32(i32, i32) #3

; 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"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}


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