; LLVM IR from siconos/siconos :: externals/SOL/lumod-c (lumod_sparse)

; 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._sparseMatrix = type { i32, i32, i32, i32, ptr }

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

; Function Attrs: nounwind uwtable
define dso_local void @LUforw(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, double noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7) #1 {
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca double, 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 double, align 8
  %20 = alloca double, align 8
  %21 = alloca double, align 8
  store i32 %0, ptr %9, align 4, !tbaa !5
  store i32 %1, ptr %10, align 4, !tbaa !5
  store i32 %2, ptr %11, align 4, !tbaa !5
  store i32 %3, ptr %12, align 4, !tbaa !5
  store double %4, ptr %13, align 8, !tbaa !9
  store ptr %5, ptr %14, align 8, !tbaa !11
  store ptr %6, ptr %15, align 8, !tbaa !11
  store ptr %7, ptr %16, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  %22 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %22, ptr %17, align 4, !tbaa !5
  br label %23

23:                                               ; preds = %105, %8
  %24 = load i32, ptr %17, align 4, !tbaa !5
  %25 = load i32, ptr %10, align 4, !tbaa !5
  %26 = icmp slt i32 %24, %25
  br i1 %26, label %27, label %108

27:                                               ; preds = %23
  %28 = load ptr, ptr %15, align 8, !tbaa !11
  %29 = getelementptr inbounds %struct._sparseMatrix, ptr %28, i32 0, i32 4
  %30 = load ptr, ptr %29, align 8, !tbaa !13
  %31 = load i32, ptr %17, align 4, !tbaa !5
  %32 = sub nsw i32 %31, 1
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds ptr, ptr %30, i64 %33
  %35 = load ptr, ptr %34, align 8, !tbaa !11
  %36 = call double @getDiagonal(ptr noundef %35)
  store double %36, ptr %21, align 8, !tbaa !9
  %37 = load ptr, ptr %16, align 8, !tbaa !11
  %38 = load i32, ptr %17, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds double, ptr %37, i64 %39
  %41 = load double, ptr %40, align 8, !tbaa !9
  %42 = call double @llvm.fabs.f64(double %41)
  %43 = load double, ptr %13, align 8, !tbaa !9
  %44 = load double, ptr %21, align 8, !tbaa !9
  %45 = call double @llvm.fabs.f64(double %44)
  %46 = fmul double %43, %45
  %47 = fcmp ogt double %42, %46
  br i1 %47, label %48, label %104

48:                                               ; preds = %27
  %49 = load ptr, ptr %16, align 8, !tbaa !11
  %50 = load i32, ptr %17, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds double, ptr %49, i64 %51
  %53 = load double, ptr %13, align 8, !tbaa !9
  call void @elmgen(ptr noundef %21, ptr noundef %52, double noundef %53, ptr noundef %19, ptr noundef %20)
  %54 = load ptr, ptr %15, align 8, !tbaa !11
  %55 = getelementptr inbounds %struct._sparseMatrix, ptr %54, i32 0, i32 4
  %56 = load ptr, ptr %55, align 8, !tbaa !13
  %57 = load i32, ptr %17, align 4, !tbaa !5
  %58 = sub nsw i32 %57, 1
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds ptr, ptr %56, i64 %59
  %61 = load ptr, ptr %60, align 8, !tbaa !11
  %62 = load double, ptr %21, align 8, !tbaa !9
  %63 = call zeroext i8 @putDiagonal(ptr noundef %61, double noundef %62)
  %64 = load i32, ptr %12, align 4, !tbaa !5
  %65 = load i32, ptr %17, align 4, !tbaa !5
  %66 = sub nsw i32 %64, %65
  store i32 %66, ptr %18, align 4, !tbaa !5
  %67 = load i32, ptr %18, align 4, !tbaa !5
  %68 = icmp sgt i32 %67, 0
  br i1 %68, label %69, label %84

69:                                               ; preds = %48
  %70 = load i32, ptr %17, align 4, !tbaa !5
  %71 = add nsw i32 %70, 1
  %72 = load i32, ptr %12, align 4, !tbaa !5
  %73 = load ptr, ptr %15, align 8, !tbaa !11
  %74 = getelementptr inbounds %struct._sparseMatrix, ptr %73, i32 0, i32 4
  %75 = load ptr, ptr %74, align 8, !tbaa !13
  %76 = load i32, ptr %17, align 4, !tbaa !5
  %77 = sub nsw i32 %76, 1
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds ptr, ptr %75, i64 %78
  %80 = load ptr, ptr %79, align 8, !tbaa !11
  %81 = load ptr, ptr %16, align 8, !tbaa !11
  %82 = load double, ptr %19, align 8, !tbaa !9
  %83 = load double, ptr %20, align 8, !tbaa !9
  call void @elm1(i32 noundef %71, i32 noundef %72, ptr noundef %80, ptr noundef %81, double noundef %82, double noundef %83)
  br label %84

84:                                               ; preds = %69, %48
  %85 = load i32, ptr %11, align 4, !tbaa !5
  %86 = load ptr, ptr %14, align 8, !tbaa !11
  %87 = getelementptr inbounds %struct._sparseMatrix, ptr %86, i32 0, i32 4
  %88 = load ptr, ptr %87, align 8, !tbaa !13
  %89 = load i32, ptr %17, align 4, !tbaa !5
  %90 = sub nsw i32 %89, 1
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds ptr, ptr %88, i64 %91
  %93 = load ptr, ptr %92, align 8, !tbaa !11
  %94 = load ptr, ptr %14, align 8, !tbaa !11
  %95 = getelementptr inbounds %struct._sparseMatrix, ptr %94, i32 0, i32 4
  %96 = load ptr, ptr %95, align 8, !tbaa !13
  %97 = load i32, ptr %10, align 4, !tbaa !5
  %98 = sub nsw i32 %97, 1
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds ptr, ptr %96, i64 %99
  %101 = load ptr, ptr %100, align 8, !tbaa !11
  %102 = load double, ptr %19, align 8, !tbaa !9
  %103 = load double, ptr %20, align 8, !tbaa !9
  call void @elm3(i32 noundef 1, i32 noundef %85, ptr noundef %93, ptr noundef %101, double noundef %102, double noundef %103)
  br label %104

104:                                              ; preds = %84, %27
  br label %105

105:                                              ; preds = %104
  %106 = load i32, ptr %17, align 4, !tbaa !5
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr %17, align 4, !tbaa !5
  br label %23, !llvm.loop !15

108:                                              ; preds = %23
  %109 = load i32, ptr %12, align 4, !tbaa !5
  %110 = load i32, ptr %10, align 4, !tbaa !5
  %111 = sub nsw i32 %109, %110
  %112 = add nsw i32 %111, 1
  store i32 %112, ptr %18, align 4, !tbaa !5
  %113 = load i32, ptr %18, align 4, !tbaa !5
  %114 = icmp sgt i32 %113, 0
  br i1 %114, label %115, label %127

115:                                              ; preds = %108
  %116 = load ptr, ptr %15, align 8, !tbaa !11
  %117 = getelementptr inbounds %struct._sparseMatrix, ptr %116, i32 0, i32 4
  %118 = load ptr, ptr %117, align 8, !tbaa !13
  %119 = load i32, ptr %10, align 4, !tbaa !5
  %120 = sub nsw i32 %119, 1
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds ptr, ptr %118, i64 %121
  %123 = load ptr, ptr %122, align 8, !tbaa !11
  %124 = load ptr, ptr %16, align 8, !tbaa !11
  %125 = load i32, ptr %10, align 4, !tbaa !5
  %126 = load i32, ptr %12, align 4, !tbaa !5
  call void @putVector(ptr noundef %123, ptr noundef %124, i32 noundef %125, i32 noundef %126)
  br label %127

127:                                              ; preds = %115, %108
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  ret void
}

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

declare double @getDiagonal(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @elm1(i32 noundef, i32 noundef, ptr noundef, ptr noundef, double noundef, double noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @elm3(i32 noundef, i32 noundef, ptr noundef, ptr noundef, double noundef, double noundef) #1

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

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

declare zeroext i8 @putDiagonal(ptr noundef, double noundef) #2

declare void @putVector(ptr noundef, ptr noundef, i32 noundef, i32 noundef) #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 = { "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}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !12, i64 16}
!14 = !{!"_sparseMatrix", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !12, i64 16}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


; 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
define dso_local void @LUforw(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, double noundef %4, ptr nocapture noundef readonly %5, ptr nocapture noundef readonly %6, ptr noundef %7) local_unnamed_addr #1 {
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #4
  %12 = icmp slt i32 %0, %1
  br i1 %12, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %8
  %13 = getelementptr inbounds i8, ptr %6, i64 16
  %14 = getelementptr inbounds i8, ptr %5, i64 16
  %15 = sext i32 %1 to i64
  %16 = sext i32 %0 to i64
  %17 = sext i32 %3 to i64
  br label %18

18:                                               ; preds = %.lr.ph, %54
  %indvars.iv = phi i64 [ %16, %.lr.ph ], [ %indvars.iv.next, %54 ]
  %19 = load ptr, ptr %13, align 8, !tbaa !5
  %20 = add nsw i64 %indvars.iv, -1
  %21 = getelementptr inbounds ptr, ptr %19, i64 %20
  %22 = load ptr, ptr %21, align 8, !tbaa !11
  %23 = call double @getDiagonal(ptr noundef %22) #4
  store double %23, ptr %11, align 8, !tbaa !12
  %24 = getelementptr inbounds double, ptr %7, i64 %indvars.iv
  %25 = load double, ptr %24, align 8, !tbaa !12
  %26 = call double @llvm.fabs.f64(double %25)
  %27 = call double @llvm.fabs.f64(double %23)
  %28 = fmul double %27, %4
  %29 = fcmp ogt double %26, %28
  br i1 %29, label %30, label %54

30:                                               ; preds = %18
  call void @elmgen(ptr noundef nonnull %11, ptr noundef nonnull %24, double noundef %4, ptr noundef nonnull %9, ptr noundef nonnull %10)
  %31 = load ptr, ptr %13, align 8, !tbaa !5
  %32 = getelementptr inbounds ptr, ptr %31, i64 %20
  %33 = load ptr, ptr %32, align 8, !tbaa !11
  %34 = load double, ptr %11, align 8, !tbaa !12
  %35 = call zeroext i8 @putDiagonal(ptr noundef %33, double noundef %34) #4
  %36 = icmp slt i64 %indvars.iv, %17
  br i1 %36, label %37, label %45

37:                                               ; preds = %30
  %38 = load ptr, ptr %13, align 8, !tbaa !5
  %39 = getelementptr inbounds ptr, ptr %38, i64 %20
  %40 = load ptr, ptr %39, align 8, !tbaa !11
  %41 = load double, ptr %9, align 8, !tbaa !12
  %42 = load double, ptr %10, align 8, !tbaa !12
  %43 = trunc i64 %indvars.iv to i32
  %44 = add i32 %43, 1
  call void @elm1(i32 noundef %44, i32 noundef %3, ptr noundef %40, ptr noundef nonnull %7, double noundef %41, double noundef %42)
  br label %45

45:                                               ; preds = %37, %30
  %46 = load ptr, ptr %14, align 8, !tbaa !5
  %47 = getelementptr inbounds ptr, ptr %46, i64 %20
  %48 = load ptr, ptr %47, align 8, !tbaa !11
  %49 = getelementptr ptr, ptr %46, i64 %15
  %50 = getelementptr i8, ptr %49, i64 -8
  %51 = load ptr, ptr %50, align 8, !tbaa !11
  %52 = load double, ptr %9, align 8, !tbaa !12
  %53 = load double, ptr %10, align 8, !tbaa !12
  call void @elm3(i32 noundef 1, i32 noundef %2, ptr noundef %48, ptr noundef %51, double noundef %52, double noundef %53)
  br label %54

54:                                               ; preds = %18, %45
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
  %exitcond.not = icmp eq i32 %lftr.wideiv, %1
  br i1 %exitcond.not, label %._crit_edge, label %18, !llvm.loop !14

._crit_edge:                                      ; preds = %54, %8
  %.not = icmp slt i32 %3, %1
  br i1 %.not, label %62, label %55

55:                                               ; preds = %._crit_edge
  %56 = getelementptr inbounds i8, ptr %6, i64 16
  %57 = load ptr, ptr %56, align 8, !tbaa !5
  %58 = sext i32 %1 to i64
  %59 = getelementptr ptr, ptr %57, i64 %58
  %60 = getelementptr i8, ptr %59, i64 -8
  %61 = load ptr, ptr %60, align 8, !tbaa !11
  call void @putVector(ptr noundef %61, ptr noundef %7, i32 noundef %1, i32 noundef %3) #4
  br label %62

62:                                               ; preds = %55, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  ret void
}

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

declare double @getDiagonal(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @elm1(i32 noundef, i32 noundef, ptr noundef, ptr noundef, double noundef, double noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @elm3(i32 noundef, i32 noundef, ptr noundef, ptr noundef, double noundef, double noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @elmgen(ptr noundef, ptr noundef, double noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

declare zeroext i8 @putDiagonal(ptr noundef, double noundef) local_unnamed_addr #2

declare void @putVector(ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

attributes #0 = { mustprogress 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 = { "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 = { mustprogress 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, !10, i64 16}
!6 = !{!"_sparseMatrix", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !10, i64 16}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!10, !10, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"double", !8, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass