; LLVM IR from ERGO-Code/HiGHS :: src/ipm/basiclu (basiclu_solve_dense)

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

; Function Attrs: nounwind uwtable
define dso_local i32 @basiclu_solve_dense(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, ptr noundef %9, i8 noundef signext %10) #0 {
  %12 = alloca i32, align 4
  %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 ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca ptr, align 8
  %23 = alloca i8, align 1
  %24 = alloca %struct.lu, align 8
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  store ptr %0, ptr %13, align 8, !tbaa !5
  store ptr %1, ptr %14, align 8, !tbaa !5
  store ptr %2, ptr %15, align 8, !tbaa !5
  store ptr %3, ptr %16, align 8, !tbaa !5
  store ptr %4, ptr %17, align 8, !tbaa !5
  store ptr %5, ptr %18, align 8, !tbaa !5
  store ptr %6, ptr %19, align 8, !tbaa !5
  store ptr %7, ptr %20, align 8, !tbaa !5
  store ptr %8, ptr %21, align 8, !tbaa !5
  store ptr %9, ptr %22, align 8, !tbaa !5
  store i8 %10, ptr %23, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 696, ptr %24) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #3
  %27 = load ptr, ptr %13, align 8, !tbaa !5
  %28 = load ptr, ptr %14, align 8, !tbaa !5
  %29 = load ptr, ptr %15, align 8, !tbaa !5
  %30 = load ptr, ptr %16, align 8, !tbaa !5
  %31 = load ptr, ptr %17, align 8, !tbaa !5
  %32 = load ptr, ptr %18, align 8, !tbaa !5
  %33 = load ptr, ptr %19, align 8, !tbaa !5
  %34 = load ptr, ptr %20, align 8, !tbaa !5
  %35 = call i32 @lu_load(ptr noundef %24, ptr noundef %27, ptr noundef %28, ptr noundef %29, ptr noundef %30, ptr noundef %31, ptr noundef %32, ptr noundef %33, ptr noundef %34)
  store i32 %35, ptr %25, align 4, !tbaa !10
  %36 = load i32, ptr %25, align 4, !tbaa !10
  %37 = icmp ne i32 %36, 0
  br i1 %37, label %38, label %40

38:                                               ; preds = %11
  %39 = load i32, ptr %25, align 4, !tbaa !10
  store i32 %39, ptr %12, align 4
  store i32 1, ptr %26, align 4
  br label %80

40:                                               ; preds = %11
  %41 = load ptr, ptr %15, align 8, !tbaa !5
  %42 = icmp ne ptr %41, null
  br i1 %42, label %43, label %64

43:                                               ; preds = %40
  %44 = load ptr, ptr %16, align 8, !tbaa !5
  %45 = icmp ne ptr %44, null
  br i1 %45, label %46, label %64

46:                                               ; preds = %43
  %47 = load ptr, ptr %17, align 8, !tbaa !5
  %48 = icmp ne ptr %47, null
  br i1 %48, label %49, label %64

49:                                               ; preds = %46
  %50 = load ptr, ptr %18, align 8, !tbaa !5
  %51 = icmp ne ptr %50, null
  br i1 %51, label %52, label %64

52:                                               ; preds = %49
  %53 = load ptr, ptr %19, align 8, !tbaa !5
  %54 = icmp ne ptr %53, null
  br i1 %54, label %55, label %64

55:                                               ; preds = %52
  %56 = load ptr, ptr %20, align 8, !tbaa !5
  %57 = icmp ne ptr %56, null
  br i1 %57, label %58, label %64

58:                                               ; preds = %55
  %59 = load ptr, ptr %21, align 8, !tbaa !5
  %60 = icmp ne ptr %59, null
  br i1 %60, label %61, label %64

61:                                               ; preds = %58
  %62 = load ptr, ptr %22, align 8, !tbaa !5
  %63 = icmp ne ptr %62, null
  br i1 %63, label %65, label %64

64:                                               ; preds = %61, %58, %55, %52, %49, %46, %43, %40
  store i32 -3, ptr %25, align 4, !tbaa !10
  br label %75

65:                                               ; preds = %61
  %66 = getelementptr inbounds %struct.lu, ptr %24, i32 0, i32 17
  %67 = load i32, ptr %66, align 4, !tbaa !12
  %68 = icmp slt i32 %67, 0
  br i1 %68, label %69, label %70

69:                                               ; preds = %65
  store i32 -2, ptr %25, align 4, !tbaa !10
  br label %74

70:                                               ; preds = %65
  %71 = load ptr, ptr %21, align 8, !tbaa !5
  %72 = load ptr, ptr %22, align 8, !tbaa !5
  %73 = load i8, ptr %23, align 1, !tbaa !9
  call void @lu_solve_dense(ptr noundef %24, ptr noundef %71, ptr noundef %72, i8 noundef signext %73)
  br label %74

74:                                               ; preds = %70, %69
  br label %75

75:                                               ; preds = %74, %64
  %76 = load ptr, ptr %13, align 8, !tbaa !5
  %77 = load ptr, ptr %14, align 8, !tbaa !5
  %78 = load i32, ptr %25, align 4, !tbaa !10
  %79 = call i32 @lu_save(ptr noundef %24, ptr noundef %76, ptr noundef %77, i32 noundef %78)
  store i32 %79, ptr %12, align 4
  store i32 1, ptr %26, align 4
  br label %80

80:                                               ; preds = %75, %38
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #3
  call void @llvm.lifetime.end.p0(i64 696, ptr %24) #3
  %81 = load i32, ptr %12, align 4
  ret i32 %81
}

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

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

declare void @lu_solve_dense(ptr noundef, ptr noundef, ptr noundef, i8 noundef signext) #2

declare i32 @lu_save(ptr noundef, ptr noundef, ptr noundef, i32 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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !11, i64 100}
!13 = !{!"lu", !11, i64 0, !11, i64 4, !11, i64 8, !14, i64 16, !14, i64 24, !14, i64 32, !11, i64 40, !11, i64 44, !11, i64 48, !14, i64 56, !14, i64 64, !14, i64 72, !11, i64 80, !11, i64 84, !11, i64 88, !11, i64 92, !11, i64 96, !11, i64 100, !11, i64 104, !11, i64 108, !11, i64 112, !11, i64 116, !11, i64 120, !11, i64 124, !11, i64 128, !11, i64 132, !14, i64 136, !14, i64 144, !14, i64 152, !14, i64 160, !14, i64 168, !14, i64 176, !14, i64 184, !14, i64 192, !14, i64 200, !14, i64 208, !14, i64 216, !11, i64 224, !11, i64 228, !11, i64 232, !14, i64 240, !14, i64 248, !14, i64 256, !14, i64 264, !14, i64 272, !14, i64 280, !14, i64 288, !14, i64 296, !14, i64 304, !11, i64 312, !11, i64 316, !11, i64 320, !11, i64 324, !11, i64 328, !11, i64 332, !11, i64 336, !11, i64 340, !14, i64 344, !14, i64 352, !14, i64 360, !14, i64 368, !11, i64 376, !11, i64 380, !11, i64 384, !11, i64 388, !11, i64 392, !11, i64 396, !11, i64 400, !11, i64 404, !11, i64 408, !11, i64 412, !6, i64 416, !6, i64 424, !6, i64 432, !6, i64 440, !6, i64 448, !6, i64 456, !6, i64 464, !6, i64 472, !6, i64 480, !6, i64 488, !6, i64 496, !6, i64 504, !6, i64 512, !6, i64 520, !6, i64 528, !6, i64 536, !6, i64 544, !6, i64 552, !6, i64 560, !6, i64 568, !6, i64 576, !6, i64 584, !6, i64 592, !6, i64 600, !6, i64 608, !6, i64 616, !6, i64 624, !6, i64 632, !6, i64 640, !6, i64 648, !6, i64 656, !6, i64 664, !6, i64 672, !6, i64 680, !6, i64 688}
!14 = !{!"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"

%struct.lu = type { i32, i32, i32, double, double, double, i32, i32, i32, double, double, double, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, double, double, double, double, double, double, double, double, double, double, double, i32, i32, i32, double, double, double, double, double, double, double, double, double, i32, i32, i32, i32, i32, i32, i32, i32, double, double, double, double, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

; Function Attrs: nounwind uwtable
define dso_local i32 @basiclu_solve_dense(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, ptr noundef %9, i8 noundef signext %10) local_unnamed_addr #0 {
  %12 = alloca %struct.lu, align 8
  call void @llvm.lifetime.start.p0(i64 696, ptr nonnull %12) #3
  %13 = call i32 @lu_load(ptr noundef nonnull %12, ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7) #3
  %.not = icmp eq i32 %13, 0
  br i1 %.not, label %14, label %33

14:                                               ; preds = %11
  %15 = insertelement <8 x ptr> poison, ptr %2, i64 0
  %16 = insertelement <8 x ptr> %15, ptr %3, i64 1
  %17 = insertelement <8 x ptr> %16, ptr %4, i64 2
  %18 = insertelement <8 x ptr> %17, ptr %5, i64 3
  %19 = insertelement <8 x ptr> %18, ptr %6, i64 4
  %20 = insertelement <8 x ptr> %19, ptr %7, i64 5
  %21 = insertelement <8 x ptr> %20, ptr %8, i64 6
  %22 = insertelement <8 x ptr> %21, ptr %9, i64 7
  %23 = icmp eq <8 x ptr> %22, zeroinitializer
  %24 = bitcast <8 x i1> %23 to i8
  %25 = icmp eq i8 %24, 0
  br i1 %25, label %26, label %31

26:                                               ; preds = %14
  %27 = getelementptr inbounds i8, ptr %12, i64 100
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = icmp slt i32 %28, 0
  br i1 %29, label %31, label %30

30:                                               ; preds = %26
  call void @lu_solve_dense(ptr noundef nonnull %12, ptr noundef nonnull %8, ptr noundef nonnull %9, i8 noundef signext %10) #3
  br label %31

31:                                               ; preds = %26, %14, %30
  %.0 = phi i32 [ 0, %30 ], [ -3, %14 ], [ -2, %26 ]
  %32 = call i32 @lu_save(ptr noundef nonnull %12, ptr noundef %0, ptr noundef %1, i32 noundef %.0) #3
  br label %33

33:                                               ; preds = %11, %31
  %.037 = phi i32 [ %32, %31 ], [ %13, %11 ]
  call void @llvm.lifetime.end.p0(i64 696, ptr nonnull %12) #3
  ret i32 %.037
}

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

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

declare void @lu_solve_dense(ptr noundef, ptr noundef, ptr noundef, i8 noundef signext) local_unnamed_addr #2

declare i32 @lu_save(ptr noundef, ptr noundef, ptr noundef, i32 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

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 = { 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, !7, i64 100}
!6 = !{!"lu", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !7, i64 40, !7, i64 44, !7, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !7, i64 80, !7, i64 84, !7, i64 88, !7, i64 92, !7, i64 96, !7, i64 100, !7, i64 104, !7, i64 108, !7, i64 112, !7, i64 116, !7, i64 120, !7, i64 124, !7, i64 128, !7, i64 132, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176, !10, i64 184, !10, i64 192, !10, i64 200, !10, i64 208, !10, i64 216, !7, i64 224, !7, i64 228, !7, i64 232, !10, i64 240, !10, i64 248, !10, i64 256, !10, i64 264, !10, i64 272, !10, i64 280, !10, i64 288, !10, i64 296, !10, i64 304, !7, i64 312, !7, i64 316, !7, i64 320, !7, i64 324, !7, i64 328, !7, i64 332, !7, i64 336, !7, i64 340, !10, i64 344, !10, i64 352, !10, i64 360, !10, i64 368, !7, i64 376, !7, i64 380, !7, i64 384, !7, i64 388, !7, i64 392, !7, i64 396, !7, i64 400, !7, i64 404, !7, i64 408, !7, i64 412, !11, i64 416, !11, i64 424, !11, i64 432, !11, i64 440, !11, i64 448, !11, i64 456, !11, i64 464, !11, i64 472, !11, i64 480, !11, i64 488, !11, i64 496, !11, i64 504, !11, i64 512, !11, i64 520, !11, i64 528, !11, i64 536, !11, i64 544, !11, i64 552, !11, i64 560, !11, i64 568, !11, i64 576, !11, i64 584, !11, i64 592, !11, i64 600, !11, i64 608, !11, i64 616, !11, i64 624, !11, i64 632, !11, i64 640, !11, i64 648, !11, i64 656, !11, i64 664, !11, i64 672, !11, i64 680, !11, i64 688}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}


; Effective O3 passes: GlobalDCEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass