; LLVM IR from SanketSarmalkar/Numerical_Methods :: System_of_Equation/DirectMethod.ll (Z17guass_eliminationPPdii)

; 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.9 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [57 x i8], align 1

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

declare i32 @printf(ptr noundef, ...) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z17guass_eliminationPPdii(ptr noundef %0, i32 noundef %1, i32 noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca double, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %15

15:                                               ; preds = %135, %3
  %16 = load i32, ptr %10, align 4, !tbaa !9
  %17 = load i32, ptr %5, align 4, !tbaa !9
  %18 = icmp slt i32 %16, %17
  br i1 %18, label %19, label %138

19:                                               ; preds = %15
  %20 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %20, ptr %11, align 4, !tbaa !9
  br label %21

21:                                               ; preds = %58, %19
  %22 = load i32, ptr %11, align 4, !tbaa !9
  %23 = load i32, ptr %6, align 4, !tbaa !9
  %24 = sub nsw i32 %23, 1
  %25 = icmp slt i32 %22, %24
  br i1 %25, label %26, label %61

26:                                               ; preds = %21
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = load i32, ptr %10, align 4, !tbaa !9
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds ptr, ptr %27, i64 %29
  %31 = load ptr, ptr %30, align 8, !tbaa !5
  %32 = load i32, ptr %11, align 4, !tbaa !9
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds double, ptr %31, i64 %33
  %35 = load double, ptr %34, align 8, !tbaa !11
  %36 = call double @llvm.fabs.f64(double %35)
  %37 = fcmp olt double %36, 1.000000e-05
  br i1 %37, label %38, label %56

38:                                               ; preds = %26
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = load i32, ptr %10, align 4, !tbaa !9
  %41 = load i32, ptr %11, align 4, !tbaa !9
  %42 = load i32, ptr %5, align 4, !tbaa !9
  call void @_Z12exchange_rowPPdiii(ptr noundef %39, i32 noundef %40, i32 noundef %41, i32 noundef %42)
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = load i32, ptr %10, align 4, !tbaa !9
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds ptr, ptr %43, i64 %45
  %47 = load ptr, ptr %46, align 8, !tbaa !5
  %48 = load i32, ptr %11, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds double, ptr %47, i64 %49
  %51 = load double, ptr %50, align 8, !tbaa !11
  %52 = call double @llvm.fabs.f64(double %51)
  %53 = fcmp ogt double %52, 1.000000e-05
  br i1 %53, label %54, label %55

54:                                               ; preds = %38
  br label %61

55:                                               ; preds = %38
  br label %57

56:                                               ; preds = %26
  br label %61

57:                                               ; preds = %55
  br label %58

58:                                               ; preds = %57
  %59 = load i32, ptr %11, align 4, !tbaa !9
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %11, align 4, !tbaa !9
  br label %21, !llvm.loop !13

61:                                               ; preds = %56, %54, %21
  %62 = load i32, ptr %10, align 4, !tbaa !9
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %12, align 4, !tbaa !9
  br label %64

64:                                               ; preds = %131, %61
  %65 = load i32, ptr %12, align 4, !tbaa !9
  %66 = load i32, ptr %5, align 4, !tbaa !9
  %67 = icmp slt i32 %65, %66
  br i1 %67, label %68, label %134

68:                                               ; preds = %64
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = load i32, ptr %10, align 4, !tbaa !9
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds ptr, ptr %69, i64 %71
  %73 = load ptr, ptr %72, align 8, !tbaa !5
  %74 = load i32, ptr %11, align 4, !tbaa !9
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds double, ptr %73, i64 %75
  %77 = load double, ptr %76, align 8, !tbaa !11
  %78 = fcmp oeq double %77, 0.000000e+00
  br i1 %78, label %79, label %80

79:                                               ; preds = %68
  br label %134

80:                                               ; preds = %68
  %81 = load ptr, ptr %4, align 8, !tbaa !5
  %82 = load i32, ptr %12, align 4, !tbaa !9
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds ptr, ptr %81, i64 %83
  %85 = load ptr, ptr %84, align 8, !tbaa !5
  %86 = load i32, ptr %11, align 4, !tbaa !9
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds double, ptr %85, i64 %87
  %89 = load double, ptr %88, align 8, !tbaa !11
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = load i32, ptr %10, align 4, !tbaa !9
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds ptr, ptr %90, i64 %92
  %94 = load ptr, ptr %93, align 8, !tbaa !5
  %95 = load i32, ptr %11, align 4, !tbaa !9
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds double, ptr %94, i64 %96
  %98 = load double, ptr %97, align 8, !tbaa !11
  %99 = fdiv double %89, %98
  store double %99, ptr %14, align 8, !tbaa !11
  %100 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %100, ptr %13, align 4, !tbaa !9
  br label %101

101:                                              ; preds = %127, %80
  %102 = load i32, ptr %13, align 4, !tbaa !9
  %103 = load i32, ptr %6, align 4, !tbaa !9
  %104 = icmp slt i32 %102, %103
  br i1 %104, label %105, label %130

105:                                              ; preds = %101
  %106 = load double, ptr %14, align 8, !tbaa !11
  %107 = load ptr, ptr %4, align 8, !tbaa !5
  %108 = load i32, ptr %10, align 4, !tbaa !9
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds ptr, ptr %107, i64 %109
  %111 = load ptr, ptr %110, align 8, !tbaa !5
  %112 = load i32, ptr %13, align 4, !tbaa !9
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds double, ptr %111, i64 %113
  %115 = load double, ptr %114, align 8, !tbaa !11
  %116 = load ptr, ptr %4, align 8, !tbaa !5
  %117 = load i32, ptr %12, align 4, !tbaa !9
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds ptr, ptr %116, i64 %118
  %120 = load ptr, ptr %119, align 8, !tbaa !5
  %121 = load i32, ptr %13, align 4, !tbaa !9
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds double, ptr %120, i64 %122
  %124 = load double, ptr %123, align 8, !tbaa !11
  %125 = fneg double %106
  %126 = call double @llvm.fmuladd.f64(double %125, double %115, double %124)
  store double %126, ptr %123, align 8, !tbaa !11
  br label %127

127:                                              ; preds = %105
  %128 = load i32, ptr %13, align 4, !tbaa !9
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %13, align 4, !tbaa !9
  br label %101, !llvm.loop !15

130:                                              ; preds = %101
  br label %131

131:                                              ; preds = %130
  %132 = load i32, ptr %12, align 4, !tbaa !9
  %133 = add nsw i32 %132, 1
  store i32 %133, ptr %12, align 4, !tbaa !9
  br label %64, !llvm.loop !16

134:                                              ; preds = %79, %64
  br label %135

135:                                              ; preds = %134
  %136 = load i32, ptr %10, align 4, !tbaa !9
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr %10, align 4, !tbaa !9
  br label %15, !llvm.loop !17

138:                                              ; preds = %15
  store i32 0, ptr %9, align 4, !tbaa !9
  store i32 0, ptr %8, align 4, !tbaa !9
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %139

139:                                              ; preds = %170, %138
  %140 = load i32, ptr %10, align 4, !tbaa !9
  %141 = load i32, ptr %5, align 4, !tbaa !9
  %142 = icmp slt i32 %140, %141
  br i1 %142, label %143, label %173

143:                                              ; preds = %139
  %144 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %144, ptr %11, align 4, !tbaa !9
  br label %145

145:                                              ; preds = %166, %143
  %146 = load i32, ptr %11, align 4, !tbaa !9
  %147 = load i32, ptr %6, align 4, !tbaa !9
  %148 = sub nsw i32 %147, 1
  %149 = icmp slt i32 %146, %148
  br i1 %149, label %150, label %169

150:                                              ; preds = %145
  %151 = load ptr, ptr %4, align 8, !tbaa !5
  %152 = load i32, ptr %10, align 4, !tbaa !9
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds ptr, ptr %151, i64 %153
  %155 = load ptr, ptr %154, align 8, !tbaa !5
  %156 = load i32, ptr %11, align 4, !tbaa !9
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds double, ptr %155, i64 %157
  %159 = load double, ptr %158, align 8, !tbaa !11
  %160 = call double @llvm.fabs.f64(double %159)
  %161 = fcmp ogt double %160, 1.000000e-05
  br i1 %161, label %162, label %165

162:                                              ; preds = %150
  %163 = load i32, ptr %8, align 4, !tbaa !9
  %164 = add nsw i32 %163, 1
  store i32 %164, ptr %8, align 4, !tbaa !9
  br label %169

165:                                              ; preds = %150
  br label %166

166:                                              ; preds = %165
  %167 = load i32, ptr %11, align 4, !tbaa !9
  %168 = add nsw i32 %167, 1
  store i32 %168, ptr %11, align 4, !tbaa !9
  br label %145, !llvm.loop !18

169:                                              ; preds = %162, %145
  br label %170

170:                                              ; preds = %169
  %171 = load i32, ptr %10, align 4, !tbaa !9
  %172 = add nsw i32 %171, 1
  store i32 %172, ptr %10, align 4, !tbaa !9
  br label %139, !llvm.loop !19

173:                                              ; preds = %139
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %174

174:                                              ; preds = %204, %173
  %175 = load i32, ptr %10, align 4, !tbaa !9
  %176 = load i32, ptr %5, align 4, !tbaa !9
  %177 = icmp slt i32 %175, %176
  br i1 %177, label %178, label %207

178:                                              ; preds = %174
  %179 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %179, ptr %11, align 4, !tbaa !9
  br label %180

180:                                              ; preds = %200, %178
  %181 = load i32, ptr %11, align 4, !tbaa !9
  %182 = load i32, ptr %6, align 4, !tbaa !9
  %183 = icmp slt i32 %181, %182
  br i1 %183, label %184, label %203

184:                                              ; preds = %180
  %185 = load ptr, ptr %4, align 8, !tbaa !5
  %186 = load i32, ptr %10, align 4, !tbaa !9
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds ptr, ptr %185, i64 %187
  %189 = load ptr, ptr %188, align 8, !tbaa !5
  %190 = load i32, ptr %11, align 4, !tbaa !9
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds double, ptr %189, i64 %191
  %193 = load double, ptr %192, align 8, !tbaa !11
  %194 = call double @llvm.fabs.f64(double %193)
  %195 = fcmp ogt double %194, 1.000000e-05
  br i1 %195, label %196, label %199

196:                                              ; preds = %184
  %197 = load i32, ptr %9, align 4, !tbaa !9
  %198 = add nsw i32 %197, 1
  store i32 %198, ptr %9, align 4, !tbaa !9
  br label %203

199:                                              ; preds = %184
  br label %200

200:                                              ; preds = %199
  %201 = load i32, ptr %11, align 4, !tbaa !9
  %202 = add nsw i32 %201, 1
  store i32 %202, ptr %11, align 4, !tbaa !9
  br label %180, !llvm.loop !20

203:                                              ; preds = %196, %180
  br label %204

204:                                              ; preds = %203
  %205 = load i32, ptr %10, align 4, !tbaa !9
  %206 = add nsw i32 %205, 1
  store i32 %206, ptr %10, align 4, !tbaa !9
  br label %174, !llvm.loop !21

207:                                              ; preds = %174
  %208 = load i32, ptr %8, align 4, !tbaa !9
  %209 = load i32, ptr %9, align 4, !tbaa !9
  %210 = icmp ne i32 %208, %209
  br i1 %210, label %211, label %217

211:                                              ; preds = %207
  store i32 -1, ptr %7, align 4, !tbaa !9
  %212 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  %213 = load ptr, ptr %4, align 8, !tbaa !5
  %214 = load i32, ptr %5, align 4, !tbaa !9
  %215 = load i32, ptr %6, align 4, !tbaa !9
  call void @_Z13show_solutionPPdii(ptr noundef %213, i32 noundef %214, i32 noundef %215)
  %216 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  br label %244

217:                                              ; preds = %207
  %218 = load i32, ptr %8, align 4, !tbaa !9
  %219 = load i32, ptr %6, align 4, !tbaa !9
  %220 = sub nsw i32 %219, 1
  %221 = icmp eq i32 %218, %220
  br i1 %221, label %222, label %232

222:                                              ; preds = %217
  store i32 0, ptr %7, align 4, !tbaa !9
  %223 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  %224 = load ptr, ptr %4, align 8, !tbaa !5
  %225 = load i32, ptr %5, align 4, !tbaa !9
  %226 = load i32, ptr %6, align 4, !tbaa !9
  call void @_Z13show_solutionPPdii(ptr noundef %224, i32 noundef %225, i32 noundef %226)
  %227 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  %228 = load ptr, ptr %4, align 8, !tbaa !5
  %229 = load i32, ptr %5, align 4, !tbaa !9
  %230 = load i32, ptr %6, align 4, !tbaa !9
  %231 = sub nsw i32 %230, 1
  call void @_Z17back_substitutionPPdii(ptr noundef %228, i32 noundef %229, i32 noundef %231)
  br label %243

232:                                              ; preds = %217
  store i32 1, ptr %7, align 4, !tbaa !9
  %233 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  %234 = load ptr, ptr %4, align 8, !tbaa !5
  %235 = load i32, ptr %5, align 4, !tbaa !9
  %236 = load i32, ptr %6, align 4, !tbaa !9
  call void @_Z13show_solutionPPdii(ptr noundef %234, i32 noundef %235, i32 noundef %236)
  %237 = call i32 (ptr, ...) @printf(ptr noundef @.str.12)
  %238 = load ptr, ptr %4, align 8, !tbaa !5
  %239 = load i32, ptr %5, align 4, !tbaa !9
  %240 = load i32, ptr %6, align 4, !tbaa !9
  %241 = sub nsw i32 %240, 1
  %242 = load i32, ptr %8, align 4, !tbaa !9
  call void @_Z17back_substitutionPPdiii(ptr noundef %238, i32 noundef %239, i32 noundef %241, i32 noundef %242)
  br label %243

243:                                              ; preds = %232, %222
  br label %244

244:                                              ; preds = %243, %211
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  ret void
}

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z12exchange_rowPPdiii(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z13show_solutionPPdii(ptr noundef, i32 noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z17back_substitutionPPdii(ptr noundef, i32 noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z17back_substitutionPPdiii(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 #2 = { mustprogress 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { mustprogress 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 #5 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}
!21 = distinct !{!21, !14}


; 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.9 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [57 x i8], align 1

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_Z17guass_eliminationPPdii(ptr noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = icmp sgt i32 %1, 0
  br i1 %4, label %.preheader100.lr.ph, label %._crit_edge127.thread

.preheader100.lr.ph:                              ; preds = %3
  %5 = add nsw i32 %2, -1
  %6 = sext i32 %5 to i64
  %7 = zext nneg i32 %1 to i64
  %wide.trip.count144 = zext nneg i32 %1 to i64
  %wide.trip.count = zext i32 %5 to i64
  br label %.preheader100

.preheader100:                                    ; preds = %.preheader100.lr.ph, %._crit_edge113
  %indvars.iv136 = phi i64 [ 1, %.preheader100.lr.ph ], [ %indvars.iv.next137, %._crit_edge113 ]
  %indvars.iv = phi i64 [ 0, %.preheader100.lr.ph ], [ %indvars.iv.next, %._crit_edge113 ]
  %8 = getelementptr inbounds ptr, ptr %0, i64 %indvars.iv
  %9 = icmp slt i64 %indvars.iv, %6
  %10 = trunc nuw nsw i64 %indvars.iv to i32
  br i1 %9, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.preheader100
  %.pre = load ptr, ptr %8, align 8, !tbaa !5
  br label %.lr.ph

.preheader99:                                     ; preds = %._crit_edge113
  br i1 %4, label %.preheader97.lr.ph, label %._crit_edge127.thread

.preheader97.lr.ph:                               ; preds = %.preheader99
  %11 = add nsw i32 %2, -1
  %12 = sext i32 %11 to i64
  %wide.trip.count154 = zext nneg i32 %1 to i64
  %wide.trip.count151 = zext i32 %11 to i64
  br label %.preheader97

.lr.ph:                                           ; preds = %.lr.ph.preheader, %25
  %13 = phi ptr [ %.pre, %.lr.ph.preheader ], [ %20, %25 ]
  %indvars.iv130 = phi i64 [ %indvars.iv, %.lr.ph.preheader ], [ %indvars.iv.next131, %25 ]
  %14 = getelementptr inbounds double, ptr %13, i64 %indvars.iv130
  %15 = load double, ptr %14, align 8, !tbaa !9
  %16 = tail call double @llvm.fabs.f64(double %15)
  %17 = fcmp olt double %16, 1.000000e-05
  %18 = trunc nuw nsw i64 %indvars.iv130 to i32
  br i1 %17, label %19, label %._crit_edge

19:                                               ; preds = %.lr.ph
  tail call void @_Z12exchange_rowPPdiii(ptr noundef nonnull %0, i32 noundef %10, i32 noundef %18, i32 noundef %1)
  %20 = load ptr, ptr %8, align 8, !tbaa !5
  %21 = getelementptr inbounds double, ptr %20, i64 %indvars.iv130
  %22 = load double, ptr %21, align 8, !tbaa !9
  %23 = tail call double @llvm.fabs.f64(double %22)
  %24 = fcmp ogt double %23, 1.000000e-05
  br i1 %24, label %._crit_edge, label %25

25:                                               ; preds = %19
  %indvars.iv.next131 = add nuw nsw i64 %indvars.iv130, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next131, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !11

._crit_edge:                                      ; preds = %25, %19, %.lr.ph, %.preheader100
  %.083.lcssa = phi i32 [ %10, %.preheader100 ], [ %18, %.lr.ph ], [ %18, %19 ], [ %5, %25 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %26 = icmp ult i64 %indvars.iv.next, %7
  br i1 %26, label %.lr.ph112, label %._crit_edge113

.lr.ph112:                                        ; preds = %._crit_edge
  %.083.lcssa.fr = freeze i32 %.083.lcssa
  %27 = load ptr, ptr %8, align 8, !tbaa !5
  %28 = zext i32 %.083.lcssa.fr to i64
  %29 = getelementptr inbounds double, ptr %27, i64 %28
  %30 = icmp slt i32 %.083.lcssa.fr, %2
  br i1 %30, label %.lr.ph112.split.us.preheader, label %._crit_edge113

.lr.ph112.split.us.preheader:                     ; preds = %.lr.ph112
  %31 = shl nuw nsw i64 %28, 3
  %32 = xor i32 %.083.lcssa.fr, -1
  %33 = add i32 %32, %2
  %34 = zext i32 %33 to i64
  %35 = add nuw nsw i64 %28, %34
  %36 = shl nuw nsw i64 %35, 3
  %scevgep174 = getelementptr i8, ptr %27, i64 %31
  %scevgep175 = getelementptr i8, ptr %27, i64 8
  %scevgep176 = getelementptr i8, ptr %scevgep175, i64 %36
  %37 = xor i32 %.083.lcssa.fr, -1
  %38 = add i32 %37, %2
  %39 = zext i32 %38 to i64
  %40 = add nuw nsw i64 %39, 1
  %min.iters.check = icmp ult i32 %38, 3
  %n.vec = and i64 %40, 8589934588
  %ind.end = add nuw nsw i64 %n.vec, %28
  %cmp.n = icmp eq i64 %40, %n.vec
  br label %.lr.ph112.split.us

.lr.ph112.split.us:                               ; preds = %.lr.ph112.split.us.preheader, %._crit_edge109.us
  %indvars.iv138 = phi i64 [ %indvars.iv.next139, %._crit_edge109.us ], [ %indvars.iv136, %.lr.ph112.split.us.preheader ]
  %41 = load double, ptr %29, align 8, !tbaa !9
  %42 = fcmp oeq double %41, 0.000000e+00
  br i1 %42, label %._crit_edge113, label %.lr.ph108.us

.lr.ph108.us:                                     ; preds = %.lr.ph112.split.us
  %43 = getelementptr inbounds ptr, ptr %0, i64 %indvars.iv138
  %44 = load ptr, ptr %43, align 8, !tbaa !5
  %45 = getelementptr inbounds double, ptr %44, i64 %28
  %46 = load double, ptr %45, align 8, !tbaa !9
  %47 = fneg double %46
  %48 = fdiv double %47, %41
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.memcheck

vector.memcheck:                                  ; preds = %.lr.ph108.us
  %scevgep = getelementptr i8, ptr %44, i64 %31
  %scevgep172 = getelementptr i8, ptr %44, i64 8
  %scevgep173 = getelementptr i8, ptr %scevgep172, i64 %36
  %bound0 = icmp ult ptr %scevgep, %scevgep176
  %bound1 = icmp ult ptr %scevgep174, %scevgep173
  %found.conflict = and i1 %bound0, %bound1
  br i1 %found.conflict, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %vector.memcheck
  %broadcast.splatinsert = insertelement <2 x double> poison, double %48, i64 0
  %broadcast.splat = shufflevector <2 x double> %broadcast.splatinsert, <2 x double> poison, <2 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx = add i64 %index, %28
  %49 = getelementptr inbounds double, ptr %27, i64 %offset.idx
  %50 = getelementptr inbounds i8, ptr %49, i64 16
  %wide.load = load <2 x double>, ptr %49, align 8, !tbaa !9, !alias.scope !13
  %wide.load177 = load <2 x double>, ptr %50, align 8, !tbaa !9, !alias.scope !13
  %51 = getelementptr inbounds double, ptr %44, i64 %offset.idx
  %52 = getelementptr inbounds i8, ptr %51, i64 16
  %wide.load178 = load <2 x double>, ptr %51, align 8, !tbaa !9, !alias.scope !16, !noalias !13
  %wide.load179 = load <2 x double>, ptr %52, align 8, !tbaa !9, !alias.scope !16, !noalias !13
  %53 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %broadcast.splat, <2 x double> %wide.load, <2 x double> %wide.load178)
  %54 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %broadcast.splat, <2 x double> %wide.load177, <2 x double> %wide.load179)
  store <2 x double> %53, ptr %51, align 8, !tbaa !9, !alias.scope !16, !noalias !13
  store <2 x double> %54, ptr %52, align 8, !tbaa !9, !alias.scope !16, !noalias !13
  %index.next = add nuw i64 %index, 4
  %55 = icmp eq i64 %index.next, %n.vec
  br i1 %55, label %middle.block, label %vector.body, !llvm.loop !18

middle.block:                                     ; preds = %vector.body
  br i1 %cmp.n, label %._crit_edge109.us, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %middle.block, %vector.memcheck, %.lr.ph108.us
  %indvars.iv133.ph = phi i64 [ %28, %vector.memcheck ], [ %28, %.lr.ph108.us ], [ %ind.end, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv133 = phi i64 [ %indvars.iv.next134, %scalar.ph ], [ %indvars.iv133.ph, %scalar.ph.preheader ]
  %56 = getelementptr inbounds double, ptr %27, i64 %indvars.iv133
  %57 = load double, ptr %56, align 8, !tbaa !9
  %58 = getelementptr inbounds double, ptr %44, i64 %indvars.iv133
  %59 = load double, ptr %58, align 8, !tbaa !9
  %60 = tail call double @llvm.fmuladd.f64(double %48, double %57, double %59)
  store double %60, ptr %58, align 8, !tbaa !9
  %indvars.iv.next134 = add nuw nsw i64 %indvars.iv133, 1
  %61 = trunc nuw i64 %indvars.iv.next134 to i32
  %62 = icmp slt i32 %61, %2
  br i1 %62, label %scalar.ph, label %._crit_edge109.us, !llvm.loop !21

._crit_edge109.us:                                ; preds = %scalar.ph, %middle.block
  %indvars.iv.next139 = add nuw nsw i64 %indvars.iv138, 1
  %exitcond142.not = icmp eq i64 %indvars.iv.next139, %wide.trip.count144
  br i1 %exitcond142.not, label %._crit_edge113, label %.lr.ph112.split.us, !llvm.loop !22

._crit_edge113:                                   ; preds = %.lr.ph112.split.us, %._crit_edge109.us, %.lr.ph112, %._crit_edge
  %indvars.iv.next137 = add nuw nsw i64 %indvars.iv136, 1
  %exitcond145.not = icmp eq i64 %indvars.iv.next, %wide.trip.count144
  br i1 %exitcond145.not, label %.preheader99, label %.preheader100, !llvm.loop !23

.preheader97:                                     ; preds = %.preheader97.lr.ph, %.loopexit98
  %indvars.iv146 = phi i64 [ 0, %.preheader97.lr.ph ], [ %indvars.iv.next147, %.loopexit98 ]
  %.089118 = phi i32 [ 0, %.preheader97.lr.ph ], [ %.190, %.loopexit98 ]
  %63 = icmp slt i64 %indvars.iv146, %12
  br i1 %63, label %.lr.ph117, label %.loopexit98

.lr.ph117:                                        ; preds = %.preheader97
  %64 = getelementptr inbounds ptr, ptr %0, i64 %indvars.iv146
  %65 = load ptr, ptr %64, align 8, !tbaa !5
  br label %68

.preheader96:                                     ; preds = %.loopexit98
  br i1 %4, label %.preheader.preheader, label %._crit_edge127

.preheader.preheader:                             ; preds = %.preheader96
  %66 = sext i32 %2 to i64
  %wide.trip.count164 = zext nneg i32 %1 to i64
  %wide.trip.count161 = zext i32 %2 to i64
  br label %.preheader

67:                                               ; preds = %68
  %indvars.iv.next149 = add nuw nsw i64 %indvars.iv148, 1
  %exitcond152.not = icmp eq i64 %indvars.iv.next149, %wide.trip.count151
  br i1 %exitcond152.not, label %.loopexit98, label %68, !llvm.loop !24

68:                                               ; preds = %.lr.ph117, %67
  %indvars.iv148 = phi i64 [ %indvars.iv146, %.lr.ph117 ], [ %indvars.iv.next149, %67 ]
  %69 = getelementptr inbounds double, ptr %65, i64 %indvars.iv148
  %70 = load double, ptr %69, align 8, !tbaa !9
  %71 = tail call double @llvm.fabs.f64(double %70)
  %72 = fcmp ogt double %71, 1.000000e-05
  br i1 %72, label %73, label %67

73:                                               ; preds = %68
  %74 = add nsw i32 %.089118, 1
  br label %.loopexit98

.loopexit98:                                      ; preds = %67, %.preheader97, %73
  %.190 = phi i32 [ %74, %73 ], [ %.089118, %.preheader97 ], [ %.089118, %67 ]
  %indvars.iv.next147 = add nuw nsw i64 %indvars.iv146, 1
  %exitcond155.not = icmp eq i64 %indvars.iv.next147, %wide.trip.count154
  br i1 %exitcond155.not, label %.preheader96, label %.preheader97, !llvm.loop !25

.preheader:                                       ; preds = %.preheader.preheader, %.loopexit
  %indvars.iv156 = phi i64 [ 0, %.preheader.preheader ], [ %indvars.iv.next157, %.loopexit ]
  %.087124 = phi i32 [ 0, %.preheader.preheader ], [ %.188, %.loopexit ]
  %75 = icmp slt i64 %indvars.iv156, %66
  br i1 %75, label %.lr.ph123, label %.loopexit

.lr.ph123:                                        ; preds = %.preheader
  %76 = getelementptr inbounds ptr, ptr %0, i64 %indvars.iv156
  %77 = load ptr, ptr %76, align 8, !tbaa !5
  br label %79

78:                                               ; preds = %79
  %indvars.iv.next159 = add nuw nsw i64 %indvars.iv158, 1
  %exitcond162.not = icmp eq i64 %indvars.iv.next159, %wide.trip.count161
  br i1 %exitcond162.not, label %.loopexit, label %79, !llvm.loop !26

79:                                               ; preds = %.lr.ph123, %78
  %indvars.iv158 = phi i64 [ %indvars.iv156, %.lr.ph123 ], [ %indvars.iv.next159, %78 ]
  %80 = getelementptr inbounds double, ptr %77, i64 %indvars.iv158
  %81 = load double, ptr %80, align 8, !tbaa !9
  %82 = tail call double @llvm.fabs.f64(double %81)
  %83 = fcmp ogt double %82, 1.000000e-05
  br i1 %83, label %84, label %78

84:                                               ; preds = %79
  %85 = add nsw i32 %.087124, 1
  br label %.loopexit

.loopexit:                                        ; preds = %78, %.preheader, %84
  %.188 = phi i32 [ %85, %84 ], [ %.087124, %.preheader ], [ %.087124, %78 ]
  %indvars.iv.next157 = add nuw nsw i64 %indvars.iv156, 1
  %exitcond165.not = icmp eq i64 %indvars.iv.next157, %wide.trip.count164
  br i1 %exitcond165.not, label %._crit_edge127, label %.preheader, !llvm.loop !27

._crit_edge127:                                   ; preds = %.loopexit, %.preheader96
  %.087.lcssa = phi i32 [ 0, %.preheader96 ], [ %.188, %.loopexit ]
  %.not = icmp eq i32 %.190, %.087.lcssa
  br i1 %.not, label %._crit_edge127.thread, label %86

86:                                               ; preds = %._crit_edge127
  %87 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  tail call void @_Z13show_solutionPPdii(ptr noundef %0, i32 noundef %1, i32 noundef %2)
  %88 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10)
  br label %96

._crit_edge127.thread:                            ; preds = %.preheader99, %3, %._crit_edge127
  %.089.lcssa167171 = phi i32 [ %.190, %._crit_edge127 ], [ 0, %3 ], [ 0, %.preheader99 ]
  %89 = add nsw i32 %2, -1
  %90 = icmp eq i32 %.089.lcssa167171, %89
  %91 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  tail call void @_Z13show_solutionPPdii(ptr noundef %0, i32 noundef %1, i32 noundef %2)
  br i1 %90, label %92, label %94

92:                                               ; preds = %._crit_edge127.thread
  %93 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  tail call void @_Z17back_substitutionPPdii(ptr noundef %0, i32 noundef %1, i32 noundef %89)
  br label %96

94:                                               ; preds = %._crit_edge127.thread
  %95 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12)
  tail call void @_Z17back_substitutionPPdiii(ptr noundef %0, i32 noundef %1, i32 noundef %89, i32 noundef %.089.lcssa167171)
  br label %96

96:                                               ; preds = %92, %94, %86
  ret void
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z12exchange_rowPPdiii(ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z13show_solutionPPdii(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z17back_substitutionPPdii(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z17back_substitutionPPdiii(ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #4

attributes #0 = { nofree nounwind "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 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 #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { mustprogress 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14}
!14 = distinct !{!14, !15}
!15 = distinct !{!15, !"LVerDomain"}
!16 = !{!17}
!17 = distinct !{!17, !15}
!18 = distinct !{!18, !12, !19, !20}
!19 = !{!"llvm.loop.isvectorized", i32 1}
!20 = !{!"llvm.loop.unroll.runtime.disable"}
!21 = distinct !{!21, !12, !19}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !12}
!24 = distinct !{!24, !12}
!25 = distinct !{!25, !12}
!26 = distinct !{!26, !12}
!27 = distinct !{!27, !12}


; Effective O3 passes: ADCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,SROAPass,SimplifyCFGPass,TailCallElimPass