; LLVM IR from AllAlgorithms/c :: algorithms (lu_decomposition)

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @PrintVector(ptr noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local void @MatrixVector(ptr noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %10

10:                                               ; preds = %43, %3
  %11 = load i32, ptr %7, align 4, !tbaa !9
  %12 = icmp slt i32 %11, 5
  br i1 %12, label %14, label %13

13:                                               ; preds = %10
  store i32 2, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  br label %46

14:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %15

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

18:                                               ; preds = %15
  store i32 5, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  br label %42

19:                                               ; preds = %15
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = load i32, ptr %7, align 4, !tbaa !9
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [5 x double], ptr %20, i64 %22
  %24 = load i32, ptr %9, align 4, !tbaa !9
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [5 x double], ptr %23, i64 0, i64 %25
  %27 = load double, ptr %26, align 8, !tbaa !11
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = load i32, ptr %9, align 4, !tbaa !9
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds double, ptr %28, i64 %30
  %32 = load double, ptr %31, align 8, !tbaa !11
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = load i32, ptr %7, align 4, !tbaa !9
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds double, ptr %33, i64 %35
  %37 = load double, ptr %36, align 8, !tbaa !11
  %38 = call double @llvm.fmuladd.f64(double %27, double %32, double %37)
  store double %38, ptr %36, align 8, !tbaa !11
  br label %39

39:                                               ; preds = %19
  %40 = load i32, ptr %9, align 4, !tbaa !9
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %9, align 4, !tbaa !9
  br label %15, !llvm.loop !13

42:                                               ; preds = %18
  br label %43

43:                                               ; preds = %42
  %44 = load i32, ptr %7, align 4, !tbaa !9
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %7, align 4, !tbaa !9
  br label %10, !llvm.loop !15

46:                                               ; preds = %13
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  call void @PrintVector(ptr noundef %47)
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !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"

; Function Attrs: nounwind uwtable
declare dso_local void @PrintVector(ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local void @MatrixVector(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr noundef %2) local_unnamed_addr #0 {
.preheader:
  %.promoted = load double, ptr %2, align 8, !tbaa !5
  %3 = load double, ptr %0, align 8, !tbaa !5
  %4 = load double, ptr %1, align 8, !tbaa !5
  %5 = tail call double @llvm.fmuladd.f64(double %3, double %4, double %.promoted)
  store double %5, ptr %2, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = load double, ptr %6, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %1, i64 8
  %9 = load double, ptr %8, align 8, !tbaa !5
  %10 = tail call double @llvm.fmuladd.f64(double %7, double %9, double %5)
  store double %10, ptr %2, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %0, i64 16
  %12 = load double, ptr %11, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %1, i64 16
  %14 = load double, ptr %13, align 8, !tbaa !5
  %15 = tail call double @llvm.fmuladd.f64(double %12, double %14, double %10)
  store double %15, ptr %2, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %0, i64 24
  %17 = load double, ptr %16, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %1, i64 24
  %19 = load double, ptr %18, align 8, !tbaa !5
  %20 = tail call double @llvm.fmuladd.f64(double %17, double %19, double %15)
  store double %20, ptr %2, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %0, i64 32
  %22 = load double, ptr %21, align 8, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %1, i64 32
  %24 = load double, ptr %23, align 8, !tbaa !5
  %25 = tail call double @llvm.fmuladd.f64(double %22, double %24, double %20)
  store double %25, ptr %2, align 8, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %2, i64 8
  %.promoted.1 = load double, ptr %26, align 8, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %0, i64 40
  %28 = load double, ptr %27, align 8, !tbaa !5
  %29 = load double, ptr %1, align 8, !tbaa !5
  %30 = tail call double @llvm.fmuladd.f64(double %28, double %29, double %.promoted.1)
  store double %30, ptr %26, align 8, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %0, i64 48
  %32 = load double, ptr %31, align 8, !tbaa !5
  %33 = load double, ptr %8, align 8, !tbaa !5
  %34 = tail call double @llvm.fmuladd.f64(double %32, double %33, double %30)
  store double %34, ptr %26, align 8, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %0, i64 56
  %36 = load double, ptr %35, align 8, !tbaa !5
  %37 = load double, ptr %13, align 8, !tbaa !5
  %38 = tail call double @llvm.fmuladd.f64(double %36, double %37, double %34)
  store double %38, ptr %26, align 8, !tbaa !5
  %39 = getelementptr inbounds i8, ptr %0, i64 64
  %40 = load double, ptr %39, align 8, !tbaa !5
  %41 = load double, ptr %18, align 8, !tbaa !5
  %42 = tail call double @llvm.fmuladd.f64(double %40, double %41, double %38)
  store double %42, ptr %26, align 8, !tbaa !5
  %43 = getelementptr inbounds i8, ptr %0, i64 72
  %44 = load double, ptr %43, align 8, !tbaa !5
  %45 = load double, ptr %23, align 8, !tbaa !5
  %46 = tail call double @llvm.fmuladd.f64(double %44, double %45, double %42)
  store double %46, ptr %26, align 8, !tbaa !5
  %47 = getelementptr inbounds i8, ptr %2, i64 16
  %.promoted.2 = load double, ptr %47, align 8, !tbaa !5
  %48 = getelementptr inbounds i8, ptr %0, i64 80
  %49 = load double, ptr %48, align 8, !tbaa !5
  %50 = load double, ptr %1, align 8, !tbaa !5
  %51 = tail call double @llvm.fmuladd.f64(double %49, double %50, double %.promoted.2)
  store double %51, ptr %47, align 8, !tbaa !5
  %52 = getelementptr inbounds i8, ptr %0, i64 88
  %53 = load double, ptr %52, align 8, !tbaa !5
  %54 = load double, ptr %8, align 8, !tbaa !5
  %55 = tail call double @llvm.fmuladd.f64(double %53, double %54, double %51)
  store double %55, ptr %47, align 8, !tbaa !5
  %56 = getelementptr inbounds i8, ptr %0, i64 96
  %57 = load double, ptr %56, align 8, !tbaa !5
  %58 = load double, ptr %13, align 8, !tbaa !5
  %59 = tail call double @llvm.fmuladd.f64(double %57, double %58, double %55)
  store double %59, ptr %47, align 8, !tbaa !5
  %60 = getelementptr inbounds i8, ptr %0, i64 104
  %61 = load double, ptr %60, align 8, !tbaa !5
  %62 = load double, ptr %18, align 8, !tbaa !5
  %63 = tail call double @llvm.fmuladd.f64(double %61, double %62, double %59)
  store double %63, ptr %47, align 8, !tbaa !5
  %64 = getelementptr inbounds i8, ptr %0, i64 112
  %65 = load double, ptr %64, align 8, !tbaa !5
  %66 = load double, ptr %23, align 8, !tbaa !5
  %67 = tail call double @llvm.fmuladd.f64(double %65, double %66, double %63)
  store double %67, ptr %47, align 8, !tbaa !5
  %68 = getelementptr inbounds i8, ptr %2, i64 24
  %.promoted.3 = load double, ptr %68, align 8, !tbaa !5
  %69 = getelementptr inbounds i8, ptr %0, i64 120
  %70 = load double, ptr %69, align 8, !tbaa !5
  %71 = load double, ptr %1, align 8, !tbaa !5
  %72 = tail call double @llvm.fmuladd.f64(double %70, double %71, double %.promoted.3)
  store double %72, ptr %68, align 8, !tbaa !5
  %73 = getelementptr inbounds i8, ptr %0, i64 128
  %74 = load double, ptr %73, align 8, !tbaa !5
  %75 = load double, ptr %8, align 8, !tbaa !5
  %76 = tail call double @llvm.fmuladd.f64(double %74, double %75, double %72)
  store double %76, ptr %68, align 8, !tbaa !5
  %77 = getelementptr inbounds i8, ptr %0, i64 136
  %78 = load double, ptr %77, align 8, !tbaa !5
  %79 = load double, ptr %13, align 8, !tbaa !5
  %80 = tail call double @llvm.fmuladd.f64(double %78, double %79, double %76)
  store double %80, ptr %68, align 8, !tbaa !5
  %81 = getelementptr inbounds i8, ptr %0, i64 144
  %82 = load double, ptr %81, align 8, !tbaa !5
  %83 = load double, ptr %18, align 8, !tbaa !5
  %84 = tail call double @llvm.fmuladd.f64(double %82, double %83, double %80)
  store double %84, ptr %68, align 8, !tbaa !5
  %85 = getelementptr inbounds i8, ptr %0, i64 152
  %86 = load double, ptr %85, align 8, !tbaa !5
  %87 = load double, ptr %23, align 8, !tbaa !5
  %88 = tail call double @llvm.fmuladd.f64(double %86, double %87, double %84)
  store double %88, ptr %68, align 8, !tbaa !5
  %89 = getelementptr inbounds i8, ptr %2, i64 32
  %.promoted.4 = load double, ptr %89, align 8, !tbaa !5
  %90 = getelementptr inbounds i8, ptr %0, i64 160
  %91 = load double, ptr %90, align 8, !tbaa !5
  %92 = load double, ptr %1, align 8, !tbaa !5
  %93 = tail call double @llvm.fmuladd.f64(double %91, double %92, double %.promoted.4)
  store double %93, ptr %89, align 8, !tbaa !5
  %94 = getelementptr inbounds i8, ptr %0, i64 168
  %95 = load double, ptr %94, align 8, !tbaa !5
  %96 = load double, ptr %8, align 8, !tbaa !5
  %97 = tail call double @llvm.fmuladd.f64(double %95, double %96, double %93)
  store double %97, ptr %89, align 8, !tbaa !5
  %98 = getelementptr inbounds i8, ptr %0, i64 176
  %99 = load double, ptr %98, align 8, !tbaa !5
  %100 = load double, ptr %13, align 8, !tbaa !5
  %101 = tail call double @llvm.fmuladd.f64(double %99, double %100, double %97)
  store double %101, ptr %89, align 8, !tbaa !5
  %102 = getelementptr inbounds i8, ptr %0, i64 184
  %103 = load double, ptr %102, align 8, !tbaa !5
  %104 = load double, ptr %18, align 8, !tbaa !5
  %105 = tail call double @llvm.fmuladd.f64(double %103, double %104, double %101)
  store double %105, ptr %89, align 8, !tbaa !5
  %106 = getelementptr inbounds i8, ptr %0, i64 192
  %107 = load double, ptr %106, align 8, !tbaa !5
  %108 = load double, ptr %23, align 8, !tbaa !5
  %109 = tail call double @llvm.fmuladd.f64(double %107, double %108, double %105)
  store double %109, ptr %89, align 8, !tbaa !5
  tail call void @PrintVector(ptr noundef nonnull %2)
  ret void
}

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 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass