; LLVM IR from ERGO-Code/HiGHS :: src/ipm/ipx/ipm.ll (ZN3ipx3IPM13StartingPointEPNS_9KKTSolverEPNS_7IterateEPNS_4InfoE)

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

%"class.ipx::IPM" = type <{ ptr, ptr, ptr, ptr, double, double, i32, [4 x i8], double, i32, [4 x i8], double, i32, [4 x i8] }>
%struct.ipx_info = type { i32, i32, i32, i32, i32, i32, 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, double, double, double, i32, i32, i32, i32, i32, i32, i32, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, i32, i32, i32, i32, double, double, double, double }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3ipx3IPM13StartingPointEPNS_9KKTSolverEPNS_7IterateEPNS_4InfoE(ptr noundef nonnull align 8 dereferenceable(84) %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #0 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  %9 = load ptr, ptr %5, align 8
  %10 = load ptr, ptr %6, align 8, !tbaa !5
  %11 = getelementptr inbounds %"class.ipx::IPM", ptr %9, i32 0, i32 1
  store ptr %10, ptr %11, align 8, !tbaa !9
  %12 = load ptr, ptr %7, align 8, !tbaa !5
  %13 = getelementptr inbounds %"class.ipx::IPM", ptr %9, i32 0, i32 2
  store ptr %12, ptr %13, align 8, !tbaa !13
  %14 = load ptr, ptr %8, align 8, !tbaa !5
  %15 = getelementptr inbounds %"class.ipx::IPM", ptr %9, i32 0, i32 3
  store ptr %14, ptr %15, align 8, !tbaa !14
  call void @_ZN3ipx3IPM11PrintHeaderEv(ptr noundef nonnull align 8 dereferenceable(84) %9)
  call void @_ZN3ipx3IPM20ComputeStartingPointEv(ptr noundef nonnull align 8 dereferenceable(84) %9)
  %16 = load ptr, ptr %8, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.ipx_info, ptr %16, i32 0, i32 3
  %18 = load i32, ptr %17, align 4, !tbaa !15
  %19 = icmp eq i32 %18, 0
  br i1 %19, label %20, label %21

20:                                               ; preds = %4
  call void @_ZN3ipx3IPM11PrintOutputEv(ptr noundef nonnull align 8 dereferenceable(84) %9)
  br label %21

21:                                               ; preds = %20, %4
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.ipx_info, ptr %22, i32 0, i32 3
  %24 = load i32, ptr %23, align 4, !tbaa !15
  %25 = icmp eq i32 %24, 998
  br i1 %25, label %26, label %31

26:                                               ; preds = %21
  %27 = load ptr, ptr %8, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.ipx_info, ptr %27, i32 0, i32 3
  store i32 0, ptr %28, align 4, !tbaa !15
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.ipx_info, ptr %29, i32 0, i32 1
  store i32 5, ptr %30, align 4, !tbaa !17
  br label %54

31:                                               ; preds = %21
  %32 = load ptr, ptr %8, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.ipx_info, ptr %32, i32 0, i32 3
  %34 = load i32, ptr %33, align 4, !tbaa !15
  %35 = icmp eq i32 %34, 999
  br i1 %35, label %36, label %41

36:                                               ; preds = %31
  %37 = load ptr, ptr %8, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.ipx_info, ptr %37, i32 0, i32 3
  store i32 0, ptr %38, align 4, !tbaa !15
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.ipx_info, ptr %39, i32 0, i32 1
  store i32 6, ptr %40, align 4, !tbaa !17
  br label %53

41:                                               ; preds = %31
  %42 = load ptr, ptr %8, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.ipx_info, ptr %42, i32 0, i32 3
  %44 = load i32, ptr %43, align 4, !tbaa !15
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %46, label %49

46:                                               ; preds = %41
  %47 = load ptr, ptr %8, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.ipx_info, ptr %47, i32 0, i32 1
  store i32 9, ptr %48, align 4, !tbaa !17
  br label %52

49:                                               ; preds = %41
  %50 = load ptr, ptr %8, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.ipx_info, ptr %50, i32 0, i32 1
  store i32 0, ptr %51, align 4, !tbaa !17
  br label %52

52:                                               ; preds = %49, %46
  br label %53

53:                                               ; preds = %52, %36
  br label %54

54:                                               ; preds = %53, %26
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3ipx3IPM11PrintHeaderEv(ptr noundef nonnull align 8 dereferenceable(84)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3ipx3IPM20ComputeStartingPointEv(ptr noundef nonnull align 8 dereferenceable(84)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3ipx3IPM11PrintOutputEv(ptr noundef nonnull align 8 dereferenceable(84)) #0 align 2

attributes #0 = { mustprogress 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" }

!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++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"_ZTSN3ipx3IPME", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !11, i64 32, !11, i64 40, !12, i64 48, !11, i64 56, !12, i64 64, !11, i64 72, !12, i64 80}
!11 = !{!"double", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!10, !6, i64 16}
!14 = !{!10, !6, i64 24}
!15 = !{!16, !12, i64 12}
!16 = !{!"_ZTS8ipx_info", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 40, !12, i64 44, !12, i64 48, !12, i64 52, !12, i64 56, !12, i64 60, !12, i64 64, !12, i64 68, !12, i64 72, !12, i64 76, !11, i64 80, !11, i64 88, !11, i64 96, !11, i64 104, !11, i64 112, !11, i64 120, !11, i64 128, !11, i64 136, !11, i64 144, !11, i64 152, !11, i64 160, !11, i64 168, !11, i64 176, !11, i64 184, !12, i64 192, !12, i64 196, !12, i64 200, !12, i64 204, !12, i64 208, !12, i64 212, !12, i64 216, !11, i64 224, !11, i64 232, !11, i64 240, !11, i64 248, !11, i64 256, !11, i64 264, !11, i64 272, !11, i64 280, !11, i64 288, !11, i64 296, !11, i64 304, !11, i64 312, !11, i64 320, !11, i64 328, !11, i64 336, !11, i64 344, !11, i64 352, !11, i64 360, !11, i64 368, !11, i64 376, !11, i64 384, !11, i64 392, !11, i64 400, !11, i64 408, !12, i64 416, !12, i64 420, !12, i64 424, !12, i64 428, !11, i64 432, !11, i64 440, !11, i64 448, !11, i64 456}
!17 = !{!16, !12, i64 4}


; 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 uwtable
define dso_local void @_ZN3ipx3IPM13StartingPointEPNS_9KKTSolverEPNS_7IterateEPNS_4InfoE(ptr noundef nonnull align 8 dereferenceable(84) %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #0 align 2 {
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  store ptr %2, ptr %6, align 8, !tbaa !12
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  store ptr %3, ptr %7, align 8, !tbaa !13
  tail call void @_ZN3ipx3IPM11PrintHeaderEv(ptr noundef nonnull align 8 dereferenceable(84) %0)
  tail call void @_ZN3ipx3IPM20ComputeStartingPointEv(ptr noundef nonnull align 8 dereferenceable(84) %0)
  %8 = getelementptr inbounds i8, ptr %3, i64 12
  %9 = load i32, ptr %8, align 4, !tbaa !14
  %10 = icmp eq i32 %9, 0
  br i1 %10, label %11, label %12

11:                                               ; preds = %4
  tail call void @_ZN3ipx3IPM11PrintOutputEv(ptr noundef nonnull align 8 dereferenceable(84) %0)
  %.pr = load i32, ptr %8, align 4, !tbaa !14
  br label %12

12:                                               ; preds = %11, %4
  %13 = phi i32 [ %.pr, %11 ], [ %9, %4 ]
  switch i32 %13, label %17 [
    i32 998, label %14
    i32 999, label %15
    i32 0, label %16
  ]

14:                                               ; preds = %12
  store i32 0, ptr %8, align 4, !tbaa !14
  br label %17

15:                                               ; preds = %12
  store i32 0, ptr %8, align 4, !tbaa !14
  br label %17

16:                                               ; preds = %12
  br label %17

17:                                               ; preds = %12, %15, %16, %14
  %.sink = phi i32 [ 6, %15 ], [ 0, %16 ], [ 5, %14 ], [ 9, %12 ]
  %18 = getelementptr inbounds i8, ptr %3, i64 4
  store i32 %.sink, ptr %18, align 4, !tbaa !16
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3ipx3IPM11PrintHeaderEv(ptr noundef nonnull align 8 dereferenceable(84)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3ipx3IPM20ComputeStartingPointEv(ptr noundef nonnull align 8 dereferenceable(84)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3ipx3IPM11PrintOutputEv(ptr noundef nonnull align 8 dereferenceable(84)) local_unnamed_addr #0 align 2

attributes #0 = { mustprogress 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" }

!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 8}
!6 = !{!"_ZTSN3ipx3IPME", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !10, i64 40, !11, i64 48, !10, i64 56, !11, i64 64, !10, i64 72, !11, i64 80}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!6, !7, i64 16}
!13 = !{!6, !7, i64 24}
!14 = !{!15, !11, i64 12}
!15 = !{!"_ZTS8ipx_info", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !11, i64 64, !11, i64 68, !11, i64 72, !11, i64 76, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176, !10, i64 184, !11, i64 192, !11, i64 196, !11, i64 200, !11, i64 204, !11, i64 208, !11, i64 212, !11, i64 216, !10, i64 224, !10, 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, !10, i64 312, !10, i64 320, !10, i64 328, !10, i64 336, !10, i64 344, !10, i64 352, !10, i64 360, !10, i64 368, !10, i64 376, !10, i64 384, !10, i64 392, !10, i64 400, !10, i64 408, !11, i64 416, !11, i64 420, !11, i64 424, !11, i64 428, !10, i64 432, !10, i64 440, !10, i64 448, !10, i64 456}
!16 = !{!15, !11, i64 4}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass,TailCallElimPass