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

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

34:                                               ; preds = %9
  %35 = load i32, ptr %21, align 4, !tbaa !11
  store i32 %35, ptr %10, align 4
  store i32 1, ptr %22, align 4
  br label %77

36:                                               ; preds = %9
  %37 = load ptr, ptr %13, align 8, !tbaa !5
  %38 = icmp ne ptr %37, null
  br i1 %38, label %39, label %54

39:                                               ; preds = %36
  %40 = load ptr, ptr %14, align 8, !tbaa !5
  %41 = icmp ne ptr %40, null
  br i1 %41, label %42, label %54

42:                                               ; preds = %39
  %43 = load ptr, ptr %15, align 8, !tbaa !5
  %44 = icmp ne ptr %43, null
  br i1 %44, label %45, label %54

45:                                               ; preds = %42
  %46 = load ptr, ptr %16, align 8, !tbaa !5
  %47 = icmp ne ptr %46, null
  br i1 %47, label %48, label %54

48:                                               ; preds = %45
  %49 = load ptr, ptr %17, align 8, !tbaa !5
  %50 = icmp ne ptr %49, null
  br i1 %50, label %51, label %54

51:                                               ; preds = %48
  %52 = load ptr, ptr %18, align 8, !tbaa !5
  %53 = icmp ne ptr %52, null
  br i1 %53, label %55, label %54

54:                                               ; preds = %51, %48, %45, %42, %39, %36
  store i32 -3, ptr %21, align 4, !tbaa !11
  br label %72

55:                                               ; preds = %51
  %56 = getelementptr inbounds %struct.lu, ptr %20, i32 0, i32 17
  %57 = load i32, ptr %56, align 4, !tbaa !13
  %58 = icmp slt i32 %57, 0
  br i1 %58, label %67, label %59

59:                                               ; preds = %55
  %60 = getelementptr inbounds %struct.lu, ptr %20, i32 0, i32 64
  %61 = load i32, ptr %60, align 4, !tbaa !15
  %62 = icmp slt i32 %61, 0
  br i1 %62, label %67, label %63

63:                                               ; preds = %59
  %64 = getelementptr inbounds %struct.lu, ptr %20, i32 0, i32 65
  %65 = load i32, ptr %64, align 8, !tbaa !16
  %66 = icmp slt i32 %65, 0
  br i1 %66, label %67, label %68

67:                                               ; preds = %63, %59, %55
  store i32 -2, ptr %21, align 4, !tbaa !11
  br label %71

68:                                               ; preds = %63
  %69 = load double, ptr %19, align 8, !tbaa !9
  %70 = call i32 @lu_update(ptr noundef %20, double noundef %69)
  store i32 %70, ptr %21, align 4, !tbaa !11
  br label %71

71:                                               ; preds = %68, %67
  br label %72

72:                                               ; preds = %71, %54
  %73 = load ptr, ptr %11, align 8, !tbaa !5
  %74 = load ptr, ptr %12, align 8, !tbaa !5
  %75 = load i32, ptr %21, align 4, !tbaa !11
  %76 = call i32 @lu_save(ptr noundef %20, ptr noundef %73, ptr noundef %74, i32 noundef %75)
  store i32 %76, ptr %10, align 4
  store i32 1, ptr %22, align 4
  br label %77

77:                                               ; preds = %72, %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 696, ptr %20) #3
  %78 = load i32, ptr %10, align 4
  ret i32 %78
}

; 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 i32 @lu_update(ptr noundef, double noundef) #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 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 100}
!14 = !{!"lu", !12, i64 0, !12, i64 4, !12, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !12, i64 40, !12, i64 44, !12, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !12, i64 80, !12, i64 84, !12, i64 88, !12, i64 92, !12, i64 96, !12, i64 100, !12, i64 104, !12, i64 108, !12, i64 112, !12, i64 116, !12, i64 120, !12, i64 124, !12, i64 128, !12, 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, !12, i64 224, !12, i64 228, !12, 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, !12, i64 312, !12, i64 316, !12, i64 320, !12, i64 324, !12, i64 328, !12, i64 332, !12, i64 336, !12, i64 340, !10, i64 344, !10, i64 352, !10, i64 360, !10, i64 368, !12, i64 376, !12, i64 380, !12, i64 384, !12, i64 388, !12, i64 392, !12, i64 396, !12, i64 400, !12, i64 404, !12, i64 408, !12, 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}
!15 = !{!14, !12, i64 388}
!16 = !{!14, !12, i64 392}


; 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_update(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7, double noundef %8) local_unnamed_addr #0 {
  %10 = alloca %struct.lu, align 8
  call void @llvm.lifetime.start.p0(i64 696, ptr nonnull %10) #3
  %11 = call i32 @lu_load(ptr noundef nonnull %10, 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 %11, 0
  br i1 %.not, label %12, label %36

12:                                               ; preds = %9
  %13 = insertelement <4 x ptr> poison, ptr %2, i64 0
  %14 = insertelement <4 x ptr> %13, ptr %3, i64 1
  %15 = insertelement <4 x ptr> %14, ptr %4, i64 2
  %16 = insertelement <4 x ptr> %15, ptr %5, i64 3
  %17 = icmp ne ptr %6, null
  %18 = icmp ne ptr %7, null
  %19 = icmp eq <4 x ptr> %16, zeroinitializer
  %20 = bitcast <4 x i1> %19 to i4
  %21 = icmp eq i4 %20, 0
  %op.rdx = and i1 %21, %17
  %op.rdx37 = and i1 %op.rdx, %18
  br i1 %op.rdx37, label %22, label %34

22:                                               ; preds = %12
  %23 = getelementptr inbounds i8, ptr %10, i64 100
  %24 = load i32, ptr %23, align 4, !tbaa !5
  %25 = icmp slt i32 %24, 0
  %26 = getelementptr inbounds i8, ptr %10, i64 388
  %27 = load i32, ptr %26, align 4
  %28 = icmp slt i32 %27, 0
  %or.cond12 = select i1 %25, i1 true, i1 %28
  %29 = getelementptr inbounds i8, ptr %10, i64 392
  %30 = load i32, ptr %29, align 8
  %31 = icmp slt i32 %30, 0
  %or.cond15 = select i1 %or.cond12, i1 true, i1 %31
  br i1 %or.cond15, label %34, label %32

32:                                               ; preds = %22
  %33 = call i32 @lu_update(ptr noundef nonnull %10, double noundef %8) #3
  br label %34

34:                                               ; preds = %22, %12, %32
  %.0 = phi i32 [ %33, %32 ], [ -3, %12 ], [ -2, %22 ]
  %35 = call i32 @lu_save(ptr noundef nonnull %10, ptr noundef %0, ptr noundef %1, i32 noundef %.0) #3
  br label %36

36:                                               ; preds = %9, %34
  %.035 = phi i32 [ %35, %34 ], [ %11, %9 ]
  call void @llvm.lifetime.end.p0(i64 696, ptr nonnull %10) #3
  ret i32 %.035
}

; 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 i32 @lu_update(ptr noundef, double noundef) 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,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass