; LLVM IR from ERGO-Code/HiGHS :: src/interfaces (highs_c_api)

; 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.HighsSolution = type { i8, i8, %"class.std::vector", %"class.std::vector", %"class.std::vector", %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; 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: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(104) ptr @_ZNK5Highs11getSolutionEv(ptr noundef nonnull align 8 dereferenceable(20928)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local i32 @Highs_getSolution(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = call noundef nonnull align 8 dereferenceable(104) ptr @_ZNK5Highs11getSolutionEv(ptr noundef nonnull align 8 dereferenceable(20928) %16)
  store ptr %17, ptr %11, align 8, !tbaa !5
  %18 = load ptr, ptr %7, align 8, !tbaa !5
  %19 = icmp ne ptr %18, null
  br i1 %19, label %20, label %41

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

21:                                               ; preds = %37, %20
  %22 = load i64, ptr %12, align 8, !tbaa !9
  %23 = load ptr, ptr %11, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.HighsSolution, ptr %23, i32 0, i32 2
  %25 = call noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %24) #3
  %26 = icmp ult i64 %22, %25
  br i1 %26, label %28, label %27

27:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  br label %40

28:                                               ; preds = %21
  %29 = load ptr, ptr %11, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.HighsSolution, ptr %29, i32 0, i32 2
  %31 = load i64, ptr %12, align 8, !tbaa !9
  %32 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %30, i64 noundef %31) #3
  %33 = load double, ptr %32, align 8, !tbaa !11
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = load i64, ptr %12, align 8, !tbaa !9
  %36 = getelementptr inbounds double, ptr %34, i64 %35
  store double %33, ptr %36, align 8, !tbaa !11
  br label %37

37:                                               ; preds = %28
  %38 = load i64, ptr %12, align 8, !tbaa !9
  %39 = add i64 %38, 1
  store i64 %39, ptr %12, align 8, !tbaa !9
  br label %21, !llvm.loop !13

40:                                               ; preds = %27
  br label %41

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

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

45:                                               ; preds = %61, %44
  %46 = load i64, ptr %13, align 8, !tbaa !9
  %47 = load ptr, ptr %11, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.HighsSolution, ptr %47, i32 0, i32 3
  %49 = call noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %48) #3
  %50 = icmp ult i64 %46, %49
  br i1 %50, label %52, label %51

51:                                               ; preds = %45
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  br label %64

52:                                               ; preds = %45
  %53 = load ptr, ptr %11, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.HighsSolution, ptr %53, i32 0, i32 3
  %55 = load i64, ptr %13, align 8, !tbaa !9
  %56 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %54, i64 noundef %55) #3
  %57 = load double, ptr %56, align 8, !tbaa !11
  %58 = load ptr, ptr %8, align 8, !tbaa !5
  %59 = load i64, ptr %13, align 8, !tbaa !9
  %60 = getelementptr inbounds double, ptr %58, i64 %59
  store double %57, ptr %60, align 8, !tbaa !11
  br label %61

61:                                               ; preds = %52
  %62 = load i64, ptr %13, align 8, !tbaa !9
  %63 = add i64 %62, 1
  store i64 %63, ptr %13, align 8, !tbaa !9
  br label %45, !llvm.loop !15

64:                                               ; preds = %51
  br label %65

65:                                               ; preds = %64, %41
  %66 = load ptr, ptr %9, align 8, !tbaa !5
  %67 = icmp ne ptr %66, null
  br i1 %67, label %68, label %89

68:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  store i64 0, ptr %14, align 8, !tbaa !9
  br label %69

69:                                               ; preds = %85, %68
  %70 = load i64, ptr %14, align 8, !tbaa !9
  %71 = load ptr, ptr %11, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.HighsSolution, ptr %71, i32 0, i32 4
  %73 = call noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %72) #3
  %74 = icmp ult i64 %70, %73
  br i1 %74, label %76, label %75

75:                                               ; preds = %69
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  br label %88

76:                                               ; preds = %69
  %77 = load ptr, ptr %11, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.HighsSolution, ptr %77, i32 0, i32 4
  %79 = load i64, ptr %14, align 8, !tbaa !9
  %80 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %78, i64 noundef %79) #3
  %81 = load double, ptr %80, align 8, !tbaa !11
  %82 = load ptr, ptr %9, align 8, !tbaa !5
  %83 = load i64, ptr %14, align 8, !tbaa !9
  %84 = getelementptr inbounds double, ptr %82, i64 %83
  store double %81, ptr %84, align 8, !tbaa !11
  br label %85

85:                                               ; preds = %76
  %86 = load i64, ptr %14, align 8, !tbaa !9
  %87 = add i64 %86, 1
  store i64 %87, ptr %14, align 8, !tbaa !9
  br label %69, !llvm.loop !16

88:                                               ; preds = %75
  br label %89

89:                                               ; preds = %88, %65
  %90 = load ptr, ptr %10, align 8, !tbaa !5
  %91 = icmp ne ptr %90, null
  br i1 %91, label %92, label %113

92:                                               ; preds = %89
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  store i64 0, ptr %15, align 8, !tbaa !9
  br label %93

93:                                               ; preds = %109, %92
  %94 = load i64, ptr %15, align 8, !tbaa !9
  %95 = load ptr, ptr %11, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.HighsSolution, ptr %95, i32 0, i32 5
  %97 = call noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %96) #3
  %98 = icmp ult i64 %94, %97
  br i1 %98, label %100, label %99

99:                                               ; preds = %93
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  br label %112

100:                                              ; preds = %93
  %101 = load ptr, ptr %11, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.HighsSolution, ptr %101, i32 0, i32 5
  %103 = load i64, ptr %15, align 8, !tbaa !9
  %104 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %102, i64 noundef %103) #3
  %105 = load double, ptr %104, align 8, !tbaa !11
  %106 = load ptr, ptr %10, align 8, !tbaa !5
  %107 = load i64, ptr %15, align 8, !tbaa !9
  %108 = getelementptr inbounds double, ptr %106, i64 %107
  store double %105, ptr %108, align 8, !tbaa !11
  br label %109

109:                                              ; preds = %100
  %110 = load i64, ptr %15, align 8, !tbaa !9
  %111 = add i64 %110, 1
  store i64 %111, ptr %15, align 8, !tbaa !9
  br label %93, !llvm.loop !17

112:                                              ; preds = %99
  br label %113

113:                                              ; preds = %112, %89
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  ret i32 0
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 = { 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" }
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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !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}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !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 nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(104) ptr @_ZNK5Highs11getSolutionEv(ptr noundef nonnull align 8 dereferenceable(20928)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @Highs_getSolution(ptr noundef nonnull %0, ptr noundef writeonly %1, ptr noundef writeonly %2, ptr noundef writeonly %3, ptr noundef writeonly %4) local_unnamed_addr #0 {
  %6 = tail call noundef nonnull align 8 dereferenceable(104) ptr @_ZNK5Highs11getSolutionEv(ptr noundef nonnull align 8 dereferenceable(20928) %0)
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %.loopexit47, label %.preheader46

.preheader46:                                     ; preds = %5
  %7 = getelementptr inbounds i8, ptr %6, i64 8
  %8 = tail call noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #1
  %.not55 = icmp eq i64 %8, 0
  br i1 %.not55, label %.loopexit47, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader46, %.lr.ph
  %.03448 = phi i64 [ %12, %.lr.ph ], [ 0, %.preheader46 ]
  %9 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %.03448) #1
  %10 = load double, ptr %9, align 8, !tbaa !5
  %11 = getelementptr inbounds double, ptr %1, i64 %.03448
  store double %10, ptr %11, align 8, !tbaa !5
  %12 = add nuw i64 %.03448, 1
  %13 = tail call noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #1
  %14 = icmp ult i64 %12, %13
  br i1 %14, label %.lr.ph, label %.loopexit47, !llvm.loop !9

.loopexit47:                                      ; preds = %.lr.ph, %.preheader46, %5
  %.not39 = icmp eq ptr %2, null
  br i1 %.not39, label %.loopexit45, label %.preheader44

.preheader44:                                     ; preds = %.loopexit47
  %15 = getelementptr inbounds i8, ptr %6, i64 32
  %16 = tail call noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %15) #1
  %.not56 = icmp eq i64 %16, 0
  br i1 %.not56, label %.loopexit45, label %.lr.ph50

.lr.ph50:                                         ; preds = %.preheader44, %.lr.ph50
  %.03349 = phi i64 [ %20, %.lr.ph50 ], [ 0, %.preheader44 ]
  %17 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %15, i64 noundef %.03349) #1
  %18 = load double, ptr %17, align 8, !tbaa !5
  %19 = getelementptr inbounds double, ptr %2, i64 %.03349
  store double %18, ptr %19, align 8, !tbaa !5
  %20 = add nuw i64 %.03349, 1
  %21 = tail call noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %15) #1
  %22 = icmp ult i64 %20, %21
  br i1 %22, label %.lr.ph50, label %.loopexit45, !llvm.loop !11

.loopexit45:                                      ; preds = %.lr.ph50, %.preheader44, %.loopexit47
  %.not40 = icmp eq ptr %3, null
  br i1 %.not40, label %.loopexit43, label %.preheader42

.preheader42:                                     ; preds = %.loopexit45
  %23 = getelementptr inbounds i8, ptr %6, i64 56
  %24 = tail call noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %23) #1
  %.not57 = icmp eq i64 %24, 0
  br i1 %.not57, label %.loopexit43, label %.lr.ph52

.lr.ph52:                                         ; preds = %.preheader42, %.lr.ph52
  %.03251 = phi i64 [ %28, %.lr.ph52 ], [ 0, %.preheader42 ]
  %25 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %23, i64 noundef %.03251) #1
  %26 = load double, ptr %25, align 8, !tbaa !5
  %27 = getelementptr inbounds double, ptr %3, i64 %.03251
  store double %26, ptr %27, align 8, !tbaa !5
  %28 = add nuw i64 %.03251, 1
  %29 = tail call noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %23) #1
  %30 = icmp ult i64 %28, %29
  br i1 %30, label %.lr.ph52, label %.loopexit43, !llvm.loop !12

.loopexit43:                                      ; preds = %.lr.ph52, %.preheader42, %.loopexit45
  %.not41 = icmp eq ptr %4, null
  br i1 %.not41, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %.loopexit43
  %31 = getelementptr inbounds i8, ptr %6, i64 80
  %32 = tail call noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %31) #1
  %.not58 = icmp eq i64 %32, 0
  br i1 %.not58, label %.loopexit, label %.lr.ph54

.lr.ph54:                                         ; preds = %.preheader, %.lr.ph54
  %.053 = phi i64 [ %36, %.lr.ph54 ], [ 0, %.preheader ]
  %33 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %31, i64 noundef %.053) #1
  %34 = load double, ptr %33, align 8, !tbaa !5
  %35 = getelementptr inbounds double, ptr %4, i64 %.053
  store double %34, ptr %35, align 8, !tbaa !5
  %36 = add nuw i64 %.053, 1
  %37 = tail call noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %31) #1
  %38 = icmp ult i64 %36, %37
  br i1 %38, label %.lr.ph54, label %.loopexit, !llvm.loop !13

.loopexit:                                        ; preds = %.lr.ph54, %.preheader, %.loopexit43
  ret i32 0
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

attributes #0 = { mustprogress 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 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}


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