; LLVM IR from facebookresearch/StarSpace :: src/data.ll (ZN9starspace17InternDataHandler17initWordNegativesEv)

; 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.std::pair" = type { i32, float }
%"class.starspace::InternDataHandler" = type { ptr, %"class.std::shared_ptr", %"class.std::vector", i32, i32, i32, %"class.std::vector.0" }
%"class.std::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<starspace::ParseResults, std::allocator<starspace::ParseResults>>::_Vector_impl" }
%"struct.std::_Vector_base<starspace::ParseResults, std::allocator<starspace::ParseResults>>::_Vector_impl" = type { %"struct.std::_Vector_base<starspace::ParseResults, std::allocator<starspace::ParseResults>>::_Vector_impl_data" }
%"struct.std::_Vector_base<starspace::ParseResults, std::allocator<starspace::ParseResults>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::pair<int, float>, std::allocator<std::pair<int, float>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, float>, std::allocator<std::pair<int, float>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, float>, std::allocator<std::pair<int, float>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, float>, std::allocator<std::pair<int, float>>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@.str.13 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [10 x i8], align 1
@__PRETTY_FUNCTION__._ZN9starspace17InternDataHandler17initWordNegativesEv = external hidden unnamed_addr constant [55 x i8], align 1

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9starspace17InternDataHandler17initWordNegativesEv(ptr noundef nonnull align 8 dereferenceable(88) %0) #3 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca %"struct.std::pair", align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  %6 = getelementptr inbounds %"class.starspace::InternDataHandler", ptr %5, i32 0, i32 5
  store i32 0, ptr %6, align 8, !tbaa !9
  %7 = getelementptr inbounds %"class.starspace::InternDataHandler", ptr %5, i32 0, i32 6
  call void @_ZNSt6vectorISt4pairIifESaIS1_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #4
  %8 = getelementptr inbounds %"class.starspace::InternDataHandler", ptr %5, i32 0, i32 4
  %9 = load i32, ptr %8, align 4, !tbaa !23
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %11, label %12

11:                                               ; preds = %1
  br label %14

12:                                               ; preds = %1
  call void @__assert_fail(ptr noundef @.str.17, ptr noundef @.str.13, i32 noundef 240, ptr noundef @__PRETTY_FUNCTION__._ZN9starspace17InternDataHandler17initWordNegativesEv) #5
  unreachable

13:                                               ; No predecessors!
  br label %14

14:                                               ; preds = %13, %11
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 0, ptr %3, align 4, !tbaa !24
  br label %15

15:                                               ; preds = %26, %14
  %16 = load i32, ptr %3, align 4, !tbaa !24
  %17 = icmp slt i32 %16, 10000000
  br i1 %17, label %19, label %18

18:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %29

19:                                               ; preds = %15
  %20 = getelementptr inbounds %"class.starspace::InternDataHandler", ptr %5, i32 0, i32 6
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %21 = load ptr, ptr %5, align 8, !tbaa !25
  %22 = getelementptr inbounds ptr, ptr %21, i64 5
  %23 = load ptr, ptr %22, align 8
  %24 = call i64 %23(ptr noundef nonnull align 8 dereferenceable(88) %5)
  store i64 %24, ptr %4, align 4
  %25 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIifESaIS1_EE12emplace_backIJS1_EEERS1_DpOT_(ptr noundef nonnull align 8 dereferenceable(24) %20, ptr noundef nonnull align 4 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  br label %26

26:                                               ; preds = %19
  %27 = load i32, ptr %3, align 4, !tbaa !24
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %3, align 4, !tbaa !24
  br label %15, !llvm.loop !27

29:                                               ; preds = %18
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIifESaIS1_EE12emplace_backIJS1_EEERS1_DpOT_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(8)) #3 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 = { noreturn nounwind "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 = { 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 #4 = { nounwind }
attributes #5 = { noreturn 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, !18, i64 56}
!10 = !{!"_ZTSN9starspace17InternDataHandlerE", !11, i64 8, !14, i64 24, !18, i64 48, !18, i64 52, !18, i64 56, !19, i64 64}
!11 = !{!"_ZTSSt10shared_ptrIN9starspace4ArgsEE", !12, i64 0}
!12 = !{!"_ZTSSt12__shared_ptrIN9starspace4ArgsELN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !13, i64 8}
!13 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0}
!14 = !{!"_ZTSSt6vectorIN9starspace12ParseResultsESaIS1_EE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseIN9starspace12ParseResultsESaIS1_EE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIN9starspace12ParseResultsESaIS1_EE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIN9starspace12ParseResultsESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!18 = !{!"int", !7, i64 0}
!19 = !{!"_ZTSSt6vectorISt4pairIifESaIS1_EE", !20, i64 0}
!20 = !{!"_ZTSSt12_Vector_baseISt4pairIifESaIS1_EE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseISt4pairIifESaIS1_EE12_Vector_implE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseISt4pairIifESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!23 = !{!10, !18, i64 52}
!24 = !{!18, !18, i64 0}
!25 = !{!26, !26, i64 0}
!26 = !{!"vtable pointer", !8, 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"

%"struct.std::pair" = type { i32, float }

@.str.13 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [10 x i8], align 1
@__PRETTY_FUNCTION__._ZN9starspace17InternDataHandler17initWordNegativesEv = external hidden unnamed_addr constant [55 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress 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 void @_ZNSt6vectorISt4pairIifESaIS1_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9starspace17InternDataHandler17initWordNegativesEv(ptr noundef nonnull align 8 dereferenceable(88) %0) local_unnamed_addr #3 align 2 {
  %2 = alloca %"struct.std::pair", align 8
  %3 = getelementptr inbounds i8, ptr %0, i64 56
  store i32 0, ptr %3, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 64
  tail call void @_ZNSt6vectorISt4pairIifESaIS1_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #4
  %5 = getelementptr inbounds i8, ptr %0, i64 52
  %6 = load i32, ptr %5, align 4, !tbaa !22
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.preheader, label %8

8:                                                ; preds = %1
  tail call void @__assert_fail(ptr noundef nonnull @.str.17, ptr noundef nonnull @.str.13, i32 noundef 240, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN9starspace17InternDataHandler17initWordNegativesEv) #5
  unreachable

9:                                                ; preds = %.preheader
  ret void

.preheader:                                       ; preds = %1, %.preheader
  %.02 = phi i32 [ %15, %.preheader ], [ 0, %1 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  %10 = load ptr, ptr %0, align 8, !tbaa !23
  %11 = getelementptr inbounds i8, ptr %10, i64 40
  %12 = load ptr, ptr %11, align 8
  %13 = call i64 %12(ptr noundef nonnull align 8 dereferenceable(88) %0)
  store i64 %13, ptr %2, align 8
  %14 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIifESaIS1_EE12emplace_backIJS1_EEERS1_DpOT_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 4 dereferenceable(8) %2)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  %15 = add nuw nsw i32 %.02, 1
  %exitcond.not = icmp eq i32 %15, 10000000
  br i1 %exitcond.not, label %9, label %.preheader, !llvm.loop !25
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIifESaIS1_EE12emplace_backIJS1_EEERS1_DpOT_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #3 align 2

attributes #0 = { mustprogress 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 = { noreturn nounwind "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 = { 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 #4 = { nounwind }
attributes #5 = { noreturn 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, !17, i64 56}
!6 = !{!"_ZTSN9starspace17InternDataHandlerE", !7, i64 8, !13, i64 24, !17, i64 48, !17, i64 52, !17, i64 56, !18, i64 64}
!7 = !{!"_ZTSSt10shared_ptrIN9starspace4ArgsEE", !8, i64 0}
!8 = !{!"_ZTSSt12__shared_ptrIN9starspace4ArgsELN9__gnu_cxx12_Lock_policyE2EE", !9, i64 0, !12, i64 8}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !9, i64 0}
!13 = !{!"_ZTSSt6vectorIN9starspace12ParseResultsESaIS1_EE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseIN9starspace12ParseResultsESaIS1_EE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIN9starspace12ParseResultsESaIS1_EE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIN9starspace12ParseResultsESaIS1_EE17_Vector_impl_dataE", !9, i64 0, !9, i64 8, !9, i64 16}
!17 = !{!"int", !10, i64 0}
!18 = !{!"_ZTSSt6vectorISt4pairIifESaIS1_EE", !19, i64 0}
!19 = !{!"_ZTSSt12_Vector_baseISt4pairIifESaIS1_EE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseISt4pairIifESaIS1_EE12_Vector_implE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseISt4pairIifESaIS1_EE17_Vector_impl_dataE", !9, i64 0, !9, i64 8, !9, i64 16}
!22 = !{!6, !17, i64 52}
!23 = !{!24, !24, i64 0}
!24 = !{!"vtable pointer", !11, i64 0}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass