; LLVM IR from EricZinda/InductorHtn :: src/FXPlatform/Prolog/HtnTerm.ll (ZNK7HtnTermeqERKS_)

; 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.HtnTerm = type { %"class.std::enable_shared_from_this", ptr, %"class.std::vector", i8, i8, %"class.std::weak_ptr" }
%"class.std::enable_shared_from_this" = type { %"class.std::weak_ptr.0" }
%"class.std::weak_ptr.0" = type { %"class.std::__weak_ptr.1" }
%"class.std::__weak_ptr.1" = type { ptr, %"class.std::__weak_count" }
%"class.std::__weak_count" = type { ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::shared_ptr<HtnTerm>, std::allocator<std::shared_ptr<HtnTerm>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::shared_ptr<HtnTerm>, std::allocator<std::shared_ptr<HtnTerm>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::shared_ptr<HtnTerm>, std::allocator<std::shared_ptr<HtnTerm>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::shared_ptr<HtnTerm>, std::allocator<std::shared_ptr<HtnTerm>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::weak_ptr" = type { %"class.std::__weak_ptr" }
%"class.std::__weak_ptr" = type { ptr, %"class.std::__weak_count" }

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK7HtnTermeqERKS_(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef nonnull align 8 dereferenceable(72) %1) #2 align 2 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %8 = load ptr, ptr %4, align 8
  %9 = getelementptr inbounds %class.HtnTerm, ptr %8, i32 0, i32 4
  %10 = load i8, ptr %9, align 1, !tbaa !9, !range !22, !noundef !23
  %11 = trunc i8 %10 to i1
  %12 = zext i1 %11 to i32
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = getelementptr inbounds %class.HtnTerm, ptr %13, i32 0, i32 4
  %15 = load i8, ptr %14, align 1, !tbaa !9, !range !22, !noundef !23
  %16 = trunc i8 %15 to i1
  %17 = zext i1 %16 to i32
  %18 = icmp eq i32 %12, %17
  br i1 %18, label %19, label %68

19:                                               ; preds = %2
  %20 = getelementptr inbounds %class.HtnTerm, ptr %8, i32 0, i32 1
  %21 = load ptr, ptr %20, align 8, !tbaa !24
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %class.HtnTerm, ptr %22, i32 0, i32 1
  %24 = load ptr, ptr %23, align 8, !tbaa !24
  %25 = icmp eq ptr %21, %24
  br i1 %25, label %26, label %68

26:                                               ; preds = %19
  %27 = getelementptr inbounds %class.HtnTerm, ptr %8, i32 0, i32 4
  %28 = load i8, ptr %27, align 1, !tbaa !9, !range !22, !noundef !23
  %29 = trunc i8 %28 to i1
  br i1 %29, label %30, label %31

30:                                               ; preds = %26
  store i1 true, ptr %3, align 1
  br label %69

31:                                               ; preds = %26
  %32 = getelementptr inbounds %class.HtnTerm, ptr %8, i32 0, i32 2
  %33 = call noundef i64 @_ZNKSt6vectorISt10shared_ptrI7HtnTermESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %32) #3
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = getelementptr inbounds %class.HtnTerm, ptr %34, i32 0, i32 2
  %36 = call noundef i64 @_ZNKSt6vectorISt10shared_ptrI7HtnTermESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %35) #3
  %37 = icmp ne i64 %33, %36
  br i1 %37, label %38, label %39

38:                                               ; preds = %31
  store i1 false, ptr %3, align 1
  br label %69

39:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 0, ptr %6, align 4, !tbaa !25
  br label %40

40:                                               ; preds = %62, %39
  %41 = load i32, ptr %6, align 4, !tbaa !25
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds %class.HtnTerm, ptr %8, i32 0, i32 2
  %44 = call noundef i64 @_ZNKSt6vectorISt10shared_ptrI7HtnTermESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %43) #3
  %45 = icmp ult i64 %42, %44
  br i1 %45, label %47, label %46

46:                                               ; preds = %40
  store i32 2, ptr %7, align 4
  br label %65

47:                                               ; preds = %40
  %48 = getelementptr inbounds %class.HtnTerm, ptr %8, i32 0, i32 2
  %49 = load i32, ptr %6, align 4, !tbaa !25
  %50 = sext i32 %49 to i64
  %51 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorISt10shared_ptrI7HtnTermESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %48, i64 noundef %50) #3
  %52 = call noundef nonnull align 8 dereferenceable(72) ptr @_ZNKSt19__shared_ptr_accessI7HtnTermLN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEdeEv(ptr noundef nonnull align 1 dereferenceable(1) %51) #3
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = getelementptr inbounds %class.HtnTerm, ptr %53, i32 0, i32 2
  %55 = load i32, ptr %6, align 4, !tbaa !25
  %56 = sext i32 %55 to i64
  %57 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorISt10shared_ptrI7HtnTermESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %54, i64 noundef %56) #3
  %58 = call noundef nonnull align 8 dereferenceable(72) ptr @_ZNKSt19__shared_ptr_accessI7HtnTermLN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEdeEv(ptr noundef nonnull align 1 dereferenceable(1) %57) #3
  %59 = call noundef zeroext i1 @_ZNK7HtnTermeqERKS_(ptr noundef nonnull align 8 dereferenceable(72) %52, ptr noundef nonnull align 8 dereferenceable(72) %58)
  br i1 %59, label %61, label %60

60:                                               ; preds = %47
  store i1 false, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %65

61:                                               ; preds = %47
  br label %62

62:                                               ; preds = %61
  %63 = load i32, ptr %6, align 4, !tbaa !25
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %6, align 4, !tbaa !25
  br label %40, !llvm.loop !27

65:                                               ; preds = %60, %46
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  %66 = load i32, ptr %7, align 4
  switch i32 %66, label %71 [
    i32 2, label %67
    i32 1, label %69
  ]

67:                                               ; preds = %65
  store i1 true, ptr %3, align 1
  br label %69

68:                                               ; preds = %19, %2
  store i1 false, ptr %3, align 1
  br label %69

69:                                               ; preds = %68, %67, %65, %38, %30
  %70 = load i1, ptr %3, align 1
  ret i1 %70

71:                                               ; preds = %65
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(72) ptr @_ZNKSt19__shared_ptr_accessI7HtnTermLN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEdeEv(ptr noundef nonnull align 1 dereferenceable(1)) #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, !19, i64 49}
!10 = !{!"_ZTS7HtnTerm", !11, i64 0, !6, i64 16, !15, i64 24, !19, i64 48, !19, i64 49, !20, i64 56}
!11 = !{!"_ZTSSt23enable_shared_from_thisI7HtnTermE", !12, i64 0}
!12 = !{!"_ZTSSt8weak_ptrI7HtnTermE", !13, i64 0}
!13 = !{!"_ZTSSt10__weak_ptrI7HtnTermLN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !14, i64 8}
!14 = !{!"_ZTSSt12__weak_countILN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0}
!15 = !{!"_ZTSSt6vectorISt10shared_ptrI7HtnTermESaIS2_EE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseISt10shared_ptrI7HtnTermESaIS2_EE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseISt10shared_ptrI7HtnTermESaIS2_EE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseISt10shared_ptrI7HtnTermESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!19 = !{!"bool", !7, i64 0}
!20 = !{!"_ZTSSt8weak_ptrI14HtnTermFactoryE", !21, i64 0}
!21 = !{!"_ZTSSt10__weak_ptrI14HtnTermFactoryLN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !14, i64 8}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = !{!10, !6, i64 16}
!25 = !{!26, !26, i64 0}
!26 = !{!"int", !7, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}


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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZNK7HtnTermeqERKS_(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef nonnull align 8 dereferenceable(72) %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 49
  %4 = load i8, ptr %3, align 1, !tbaa !5, !range !21, !noundef !22
  %5 = getelementptr inbounds i8, ptr %1, i64 49
  %6 = load i8, ptr %5, align 1, !tbaa !5, !range !21, !noundef !22
  %7 = icmp eq i8 %4, %6
  br i1 %7, label %8, label %.loopexit

8:                                                ; preds = %2
  %9 = trunc nuw i8 %4 to i1
  %10 = getelementptr inbounds i8, ptr %0, i64 16
  %11 = load ptr, ptr %10, align 8, !tbaa !23
  %12 = getelementptr inbounds i8, ptr %1, i64 16
  %13 = load ptr, ptr %12, align 8, !tbaa !23
  %14 = icmp ne ptr %11, %13
  %brmerge = select i1 %14, i1 true, i1 %9
  %not. = xor i1 %14, true
  br i1 %brmerge, label %.loopexit, label %15

15:                                               ; preds = %8
  %16 = getelementptr inbounds i8, ptr %0, i64 24
  %17 = tail call noundef i64 @_ZNKSt6vectorISt10shared_ptrI7HtnTermESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %16) #1
  %18 = getelementptr inbounds i8, ptr %1, i64 24
  %19 = tail call noundef i64 @_ZNKSt6vectorISt10shared_ptrI7HtnTermESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %18) #1
  %.not = icmp eq i64 %17, %19
  br i1 %.not, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %15
  %20 = tail call noundef i64 @_ZNKSt6vectorISt10shared_ptrI7HtnTermESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %16) #1
  %21 = icmp eq i64 %20, 0
  br i1 %21, label %.loopexit, label %.lr.ph

22:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %23 = tail call noundef i64 @_ZNKSt6vectorISt10shared_ptrI7HtnTermESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %16) #1
  %.not18 = icmp ugt i64 %23, %indvars.iv.next
  br i1 %.not18, label %.lr.ph, label %.loopexit, !llvm.loop !24

.lr.ph:                                           ; preds = %.preheader, %22
  %indvars.iv = phi i64 [ %indvars.iv.next, %22 ], [ 0, %.preheader ]
  %24 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorISt10shared_ptrI7HtnTermESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %16, i64 noundef %indvars.iv) #1
  %25 = tail call noundef nonnull align 8 dereferenceable(72) ptr @_ZNKSt19__shared_ptr_accessI7HtnTermLN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEdeEv(ptr noundef nonnull align 1 dereferenceable(1) %24) #1
  %26 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorISt10shared_ptrI7HtnTermESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %18, i64 noundef %indvars.iv) #1
  %27 = tail call noundef nonnull align 8 dereferenceable(72) ptr @_ZNKSt19__shared_ptr_accessI7HtnTermLN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEdeEv(ptr noundef nonnull align 1 dereferenceable(1) %26) #1
  %28 = tail call noundef zeroext i1 @_ZNK7HtnTermeqERKS_(ptr noundef nonnull align 8 dereferenceable(72) %25, ptr noundef nonnull align 8 dereferenceable(72) %27)
  br i1 %28, label %22, label %.loopexit

.loopexit:                                        ; preds = %.lr.ph, %22, %.preheader, %8, %2, %15
  %.1 = phi i1 [ false, %15 ], [ %not., %8 ], [ false, %2 ], [ true, %.preheader ], [ %28, %22 ], [ %28, %.lr.ph ]
  ret i1 %.1
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(72) ptr @_ZNKSt19__shared_ptr_accessI7HtnTermLN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEdeEv(ptr noundef nonnull align 1 dereferenceable(1)) 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, !18, i64 49}
!6 = !{!"_ZTS7HtnTerm", !7, i64 0, !10, i64 16, !14, i64 24, !18, i64 48, !18, i64 49, !19, i64 56}
!7 = !{!"_ZTSSt23enable_shared_from_thisI7HtnTermE", !8, i64 0}
!8 = !{!"_ZTSSt8weak_ptrI7HtnTermE", !9, i64 0}
!9 = !{!"_ZTSSt10__weak_ptrI7HtnTermLN9__gnu_cxx12_Lock_policyE2EE", !10, i64 0, !13, i64 8}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C++ TBAA"}
!13 = !{!"_ZTSSt12__weak_countILN9__gnu_cxx12_Lock_policyE2EE", !10, i64 0}
!14 = !{!"_ZTSSt6vectorISt10shared_ptrI7HtnTermESaIS2_EE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseISt10shared_ptrI7HtnTermESaIS2_EE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseISt10shared_ptrI7HtnTermESaIS2_EE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseISt10shared_ptrI7HtnTermESaIS2_EE17_Vector_impl_dataE", !10, i64 0, !10, i64 8, !10, i64 16}
!18 = !{!"bool", !11, i64 0}
!19 = !{!"_ZTSSt8weak_ptrI14HtnTermFactoryE", !20, i64 0}
!20 = !{!"_ZTSSt10__weak_ptrI14HtnTermFactoryLN9__gnu_cxx12_Lock_policyE2EE", !10, i64 0, !13, i64 8}
!21 = !{i8 0, i8 2}
!22 = !{}
!23 = !{!6, !10, i64 16}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: ConstraintEliminationPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass