; 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
define dso_local void @AbsoluteMatrix(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %8

8:                                                ; preds = %38, %2
  %9 = load i32, ptr %5, align 4, !tbaa !9
  %10 = icmp slt i32 %9, 5
  br i1 %10, label %12, label %11

11:                                               ; preds = %8
  store i32 2, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  br label %41

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

13:                                               ; preds = %34, %12
  %14 = load i32, ptr %7, align 4, !tbaa !9
  %15 = icmp slt i32 %14, 5
  br i1 %15, label %17, label %16

16:                                               ; preds = %13
  store i32 5, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  br label %37

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

34:                                               ; preds = %17
  %35 = load i32, ptr %7, align 4, !tbaa !9
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %7, align 4, !tbaa !9
  br label %13, !llvm.loop !13

37:                                               ; preds = %16
  br label %38

38:                                               ; preds = %37
  %39 = load i32, ptr %5, align 4, !tbaa !9
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %5, align 4, !tbaa !9
  br label %8, !llvm.loop !15

41:                                               ; preds = %11
  ret void
}

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

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

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

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) 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