; LLVM IR from ERGO-Code/HiGHS :: src/mip/HighsDomain.ll (ZN11HighsDomain23ConflictPoolPropagation20unlinkWatchedLiteralEi)

; 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.HighsDomain::ConflictPoolPropagation" = type { i32, ptr, ptr, %"class.std::vector.3", %"class.std::vector.3", %"class.std::vector", %"class.std::vector.3", %"class.std::vector.142" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.142" = type { %"struct.std::_Vector_base.143" }
%"struct.std::_Vector_base.143" = type { %"struct.std::_Vector_base<HighsDomain::ConflictPoolPropagation::WatchedLiteral, std::allocator<HighsDomain::ConflictPoolPropagation::WatchedLiteral>>::_Vector_impl" }
%"struct.std::_Vector_base<HighsDomain::ConflictPoolPropagation::WatchedLiteral, std::allocator<HighsDomain::ConflictPoolPropagation::WatchedLiteral>>::_Vector_impl" = type { %"struct.std::_Vector_base<HighsDomain::ConflictPoolPropagation::WatchedLiteral, std::allocator<HighsDomain::ConflictPoolPropagation::WatchedLiteral>>::_Vector_impl_data" }
%"struct.std::_Vector_base<HighsDomain::ConflictPoolPropagation::WatchedLiteral, std::allocator<HighsDomain::ConflictPoolPropagation::WatchedLiteral>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.HighsDomain::ConflictPoolPropagation::WatchedLiteral" = type { %struct.HighsDomainChange, i32, i32 }
%struct.HighsDomainChange = type { double, i32, i32 }

; 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(24) ptr @_ZNSt6vectorIN11HighsDomain23ConflictPoolPropagation14WatchedLiteralESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN11HighsDomain23ConflictPoolPropagation20unlinkWatchedLiteralEi(ptr noundef nonnull align 8 dereferenceable(144) %0, i32 noundef %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %8 = load ptr, ptr %3, align 8
  %9 = getelementptr inbounds %"struct.HighsDomain::ConflictPoolPropagation", ptr %8, i32 0, i32 7
  %10 = load i32, ptr %4, align 4, !tbaa !9
  %11 = sext i32 %10 to i64
  %12 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN11HighsDomain23ConflictPoolPropagation14WatchedLiteralESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %11) #2
  %13 = getelementptr inbounds %"struct.HighsDomain::ConflictPoolPropagation::WatchedLiteral", ptr %12, i32 0, i32 0
  %14 = getelementptr inbounds %struct.HighsDomainChange, ptr %13, i32 0, i32 1
  %15 = load i32, ptr %14, align 8, !tbaa !11
  %16 = icmp eq i32 %15, -1
  br i1 %16, label %17, label %18

17:                                               ; preds = %2
  br label %92

18:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #2
  %19 = getelementptr inbounds %"struct.HighsDomain::ConflictPoolPropagation", ptr %8, i32 0, i32 7
  %20 = load i32, ptr %4, align 4, !tbaa !9
  %21 = sext i32 %20 to i64
  %22 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN11HighsDomain23ConflictPoolPropagation14WatchedLiteralESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %19, i64 noundef %21) #2
  %23 = getelementptr inbounds %"struct.HighsDomain::ConflictPoolPropagation::WatchedLiteral", ptr %22, i32 0, i32 0
  %24 = getelementptr inbounds %struct.HighsDomainChange, ptr %23, i32 0, i32 2
  %25 = load i32, ptr %24, align 4, !tbaa !16
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %27, label %38

27:                                               ; preds = %18
  %28 = getelementptr inbounds %"struct.HighsDomain::ConflictPoolPropagation", ptr %8, i32 0, i32 3
  %29 = getelementptr inbounds %"struct.HighsDomain::ConflictPoolPropagation", ptr %8, i32 0, i32 7
  %30 = load i32, ptr %4, align 4, !tbaa !9
  %31 = sext i32 %30 to i64
  %32 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN11HighsDomain23ConflictPoolPropagation14WatchedLiteralESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %29, i64 noundef %31) #2
  %33 = getelementptr inbounds %"struct.HighsDomain::ConflictPoolPropagation::WatchedLiteral", ptr %32, i32 0, i32 0
  %34 = getelementptr inbounds %struct.HighsDomainChange, ptr %33, i32 0, i32 1
  %35 = load i32, ptr %34, align 8, !tbaa !11
  %36 = sext i32 %35 to i64
  %37 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %28, i64 noundef %36) #2
  br label %49

38:                                               ; preds = %18
  %39 = getelementptr inbounds %"struct.HighsDomain::ConflictPoolPropagation", ptr %8, i32 0, i32 4
  %40 = getelementptr inbounds %"struct.HighsDomain::ConflictPoolPropagation", ptr %8, i32 0, i32 7
  %41 = load i32, ptr %4, align 4, !tbaa !9
  %42 = sext i32 %41 to i64
  %43 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN11HighsDomain23ConflictPoolPropagation14WatchedLiteralESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %40, i64 noundef %42) #2
  %44 = getelementptr inbounds %"struct.HighsDomain::ConflictPoolPropagation::WatchedLiteral", ptr %43, i32 0, i32 0
  %45 = getelementptr inbounds %struct.HighsDomainChange, ptr %44, i32 0, i32 1
  %46 = load i32, ptr %45, align 8, !tbaa !11
  %47 = sext i32 %46 to i64
  %48 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %39, i64 noundef %47) #2
  br label %49

49:                                               ; preds = %38, %27
  %50 = phi ptr [ %37, %27 ], [ %48, %38 ]
  store ptr %50, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %"struct.HighsDomain::ConflictPoolPropagation", ptr %8, i32 0, i32 7
  %52 = load i32, ptr %4, align 4, !tbaa !9
  %53 = sext i32 %52 to i64
  %54 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN11HighsDomain23ConflictPoolPropagation14WatchedLiteralESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %51, i64 noundef %53) #2
  %55 = getelementptr inbounds %"struct.HighsDomain::ConflictPoolPropagation::WatchedLiteral", ptr %54, i32 0, i32 0
  %56 = getelementptr inbounds %struct.HighsDomainChange, ptr %55, i32 0, i32 1
  store i32 -1, ptr %56, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  %57 = getelementptr inbounds %"struct.HighsDomain::ConflictPoolPropagation", ptr %8, i32 0, i32 7
  %58 = load i32, ptr %4, align 4, !tbaa !9
  %59 = sext i32 %58 to i64
  %60 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN11HighsDomain23ConflictPoolPropagation14WatchedLiteralESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %57, i64 noundef %59) #2
  %61 = getelementptr inbounds %"struct.HighsDomain::ConflictPoolPropagation::WatchedLiteral", ptr %60, i32 0, i32 1
  %62 = load i32, ptr %61, align 8, !tbaa !17
  store i32 %62, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #2
  %63 = getelementptr inbounds %"struct.HighsDomain::ConflictPoolPropagation", ptr %8, i32 0, i32 7
  %64 = load i32, ptr %4, align 4, !tbaa !9
  %65 = sext i32 %64 to i64
  %66 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN11HighsDomain23ConflictPoolPropagation14WatchedLiteralESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %63, i64 noundef %65) #2
  %67 = getelementptr inbounds %"struct.HighsDomain::ConflictPoolPropagation::WatchedLiteral", ptr %66, i32 0, i32 2
  %68 = load i32, ptr %67, align 4, !tbaa !18
  store i32 %68, ptr %7, align 4, !tbaa !9
  %69 = load i32, ptr %6, align 4, !tbaa !9
  %70 = icmp ne i32 %69, -1
  br i1 %70, label %71, label %78

71:                                               ; preds = %49
  %72 = load i32, ptr %7, align 4, !tbaa !9
  %73 = getelementptr inbounds %"struct.HighsDomain::ConflictPoolPropagation", ptr %8, i32 0, i32 7
  %74 = load i32, ptr %6, align 4, !tbaa !9
  %75 = sext i32 %74 to i64
  %76 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN11HighsDomain23ConflictPoolPropagation14WatchedLiteralESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %73, i64 noundef %75) #2
  %77 = getelementptr inbounds %"struct.HighsDomain::ConflictPoolPropagation::WatchedLiteral", ptr %76, i32 0, i32 2
  store i32 %72, ptr %77, align 4, !tbaa !18
  br label %81

78:                                               ; preds = %49
  %79 = load i32, ptr %7, align 4, !tbaa !9
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  store i32 %79, ptr %80, align 4, !tbaa !9
  br label %81

81:                                               ; preds = %78, %71
  %82 = load i32, ptr %7, align 4, !tbaa !9
  %83 = icmp ne i32 %82, -1
  br i1 %83, label %84, label %91

84:                                               ; preds = %81
  %85 = load i32, ptr %6, align 4, !tbaa !9
  %86 = getelementptr inbounds %"struct.HighsDomain::ConflictPoolPropagation", ptr %8, i32 0, i32 7
  %87 = load i32, ptr %7, align 4, !tbaa !9
  %88 = sext i32 %87 to i64
  %89 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN11HighsDomain23ConflictPoolPropagation14WatchedLiteralESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %86, i64 noundef %88) #2
  %90 = getelementptr inbounds %"struct.HighsDomain::ConflictPoolPropagation::WatchedLiteral", ptr %89, i32 0, i32 1
  store i32 %85, ptr %90, align 8, !tbaa !17
  br label %91

91:                                               ; preds = %84, %81
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  br label %92

92:                                               ; preds = %91, %17
  ret void
}

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 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"_ZTSN11HighsDomain23ConflictPoolPropagation14WatchedLiteralE", !13, i64 0, !10, i64 16, !10, i64 20}
!13 = !{!"_ZTS17HighsDomainChange", !14, i64 0, !10, i64 8, !15, i64 12}
!14 = !{!"double", !7, i64 0}
!15 = !{!"_ZTS14HighsBoundType", !7, i64 0}
!16 = !{!12, !15, i64 12}
!17 = !{!12, !10, i64 16}
!18 = !{!12, !10, i64 20}


; 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(24) ptr @_ZNSt6vectorIN11HighsDomain23ConflictPoolPropagation14WatchedLiteralESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN11HighsDomain23ConflictPoolPropagation20unlinkWatchedLiteralEi(ptr noundef nonnull align 8 dereferenceable(144) %0, i32 noundef %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 120
  %4 = sext i32 %1 to i64
  %5 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN11HighsDomain23ConflictPoolPropagation14WatchedLiteralESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %4) #1
  %6 = getelementptr inbounds i8, ptr %5, i64 8
  %7 = load i32, ptr %6, align 8, !tbaa !5
  %8 = icmp eq i32 %7, -1
  br i1 %8, label %37, label %9

9:                                                ; preds = %2
  %10 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN11HighsDomain23ConflictPoolPropagation14WatchedLiteralESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %4) #1
  %11 = getelementptr inbounds i8, ptr %10, i64 12
  %12 = load i32, ptr %11, align 4, !tbaa !13
  %13 = icmp eq i32 %12, 0
  %14 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN11HighsDomain23ConflictPoolPropagation14WatchedLiteralESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %4) #1
  %15 = getelementptr inbounds i8, ptr %14, i64 8
  %16 = load i32, ptr %15, align 8, !tbaa !5
  %17 = sext i32 %16 to i64
  %. = select i1 %13, i64 24, i64 48
  %18 = getelementptr inbounds i8, ptr %0, i64 %.
  %19 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %18, i64 noundef %17) #1
  %20 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN11HighsDomain23ConflictPoolPropagation14WatchedLiteralESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %4) #1
  %21 = getelementptr inbounds i8, ptr %20, i64 8
  store i32 -1, ptr %21, align 8, !tbaa !5
  %22 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN11HighsDomain23ConflictPoolPropagation14WatchedLiteralESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %4) #1
  %23 = getelementptr inbounds i8, ptr %22, i64 16
  %24 = load i32, ptr %23, align 8, !tbaa !14
  %25 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN11HighsDomain23ConflictPoolPropagation14WatchedLiteralESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %4) #1
  %26 = getelementptr inbounds i8, ptr %25, i64 20
  %27 = load i32, ptr %26, align 4, !tbaa !15
  %.not = icmp eq i32 %24, -1
  br i1 %.not, label %32, label %28

28:                                               ; preds = %9
  %29 = sext i32 %24 to i64
  %30 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN11HighsDomain23ConflictPoolPropagation14WatchedLiteralESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %29) #1
  %31 = getelementptr inbounds i8, ptr %30, i64 20
  br label %32

32:                                               ; preds = %9, %28
  %.sink = phi ptr [ %31, %28 ], [ %19, %9 ]
  store i32 %27, ptr %.sink, align 4, !tbaa !16
  %.not16 = icmp eq i32 %27, -1
  br i1 %.not16, label %37, label %33

33:                                               ; preds = %32
  %34 = sext i32 %27 to i64
  %35 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIN11HighsDomain23ConflictPoolPropagation14WatchedLiteralESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %34) #1
  %36 = getelementptr inbounds i8, ptr %35, i64 16
  store i32 %24, ptr %36, align 8, !tbaa !14
  br label %37

37:                                               ; preds = %32, %33, %2
  ret void
}

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, !11, i64 8}
!6 = !{!"_ZTSN11HighsDomain23ConflictPoolPropagation14WatchedLiteralE", !7, i64 0, !11, i64 16, !11, i64 20}
!7 = !{!"_ZTS17HighsDomainChange", !8, i64 0, !11, i64 8, !12, i64 12}
!8 = !{!"double", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!"_ZTS14HighsBoundType", !9, i64 0}
!13 = !{!6, !12, i64 12}
!14 = !{!6, !11, i64 16}
!15 = !{!6, !11, i64 20}
!16 = !{!11, !11, i64 0}


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