; LLVM IR from microsoft/Multiverso :: Applications/WordEmbedding/src (communicator)

; 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.wordembedding::Communicator" = type { ptr, ptr, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%"struct.wordembedding::Option" = type <{ ptr, ptr, ptr, ptr, ptr, i8, i8, i8, i8, i8, i8, [2 x i8], float, [4 x i8], i64, i32, i32, i32, i32, i32, i32, i64, i64, float, [4 x i8] }>

@_ZN13wordembedding14embedding_sizeE = external global i32, align 4

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN13wordembedding12CommunicatorC2EPNS_6OptionEPNS_13MemoryManagerE(ptr noundef nonnull align 8 dereferenceable(104) %0, ptr noundef %1, ptr noundef %2) unnamed_addr #0 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %7 = load ptr, ptr %4, align 8
  %8 = getelementptr inbounds %"class.wordembedding::Communicator", ptr %7, i32 0, i32 0
  store ptr null, ptr %8, align 8, !tbaa !9
  %9 = getelementptr inbounds %"class.wordembedding::Communicator", ptr %7, i32 0, i32 1
  store ptr null, ptr %9, align 8, !tbaa !12
  %10 = getelementptr inbounds %"class.wordembedding::Communicator", ptr %7, i32 0, i32 2
  store i32 -1, ptr %10, align 8, !tbaa !13
  %11 = getelementptr inbounds %"class.wordembedding::Communicator", ptr %7, i32 0, i32 3
  store i32 -1, ptr %11, align 4, !tbaa !14
  %12 = getelementptr inbounds %"class.wordembedding::Communicator", ptr %7, i32 0, i32 4
  store ptr null, ptr %12, align 8, !tbaa !15
  %13 = getelementptr inbounds %"class.wordembedding::Communicator", ptr %7, i32 0, i32 5
  store ptr null, ptr %13, align 8, !tbaa !16
  %14 = getelementptr inbounds %"class.wordembedding::Communicator", ptr %7, i32 0, i32 6
  store ptr null, ptr %14, align 8, !tbaa !17
  %15 = getelementptr inbounds %"class.wordembedding::Communicator", ptr %7, i32 0, i32 7
  store ptr null, ptr %15, align 8, !tbaa !18
  %16 = getelementptr inbounds %"class.wordembedding::Communicator", ptr %7, i32 0, i32 8
  store ptr null, ptr %16, align 8, !tbaa !19
  %17 = getelementptr inbounds %"class.wordembedding::Communicator", ptr %7, i32 0, i32 9
  store ptr null, ptr %17, align 8, !tbaa !20
  %18 = getelementptr inbounds %"class.wordembedding::Communicator", ptr %7, i32 0, i32 10
  store ptr null, ptr %18, align 8, !tbaa !21
  %19 = getelementptr inbounds %"class.wordembedding::Communicator", ptr %7, i32 0, i32 11
  store ptr null, ptr %19, align 8, !tbaa !22
  %20 = getelementptr inbounds %"class.wordembedding::Communicator", ptr %7, i32 0, i32 12
  store ptr null, ptr %20, align 8, !tbaa !23
  %21 = getelementptr inbounds %"class.wordembedding::Communicator", ptr %7, i32 0, i32 13
  store ptr null, ptr %21, align 8, !tbaa !24
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %"class.wordembedding::Communicator", ptr %7, i32 0, i32 0
  store ptr %22, ptr %23, align 8, !tbaa !9
  %24 = call noundef i32 @_ZN10multiverso7MV_RankEv()
  %25 = getelementptr inbounds %"class.wordembedding::Communicator", ptr %7, i32 0, i32 2
  store i32 %24, ptr %25, align 8, !tbaa !13
  %26 = call noundef i32 @_ZN10multiverso13MV_NumWorkersEv()
  %27 = getelementptr inbounds %"class.wordembedding::Communicator", ptr %7, i32 0, i32 3
  store i32 %26, ptr %27, align 4, !tbaa !14
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = getelementptr inbounds %"class.wordembedding::Communicator", ptr %7, i32 0, i32 1
  store ptr %28, ptr %29, align 8, !tbaa !12
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %"struct.wordembedding::Option", ptr %30, i32 0, i32 15
  %32 = load i32, ptr %31, align 8, !tbaa !25
  store i32 %32, ptr @_ZN13wordembedding14embedding_sizeE, align 4, !tbaa !30
  ret void
}

declare noundef i32 @_ZN10multiverso7MV_RankEv() #1

declare noundef i32 @_ZN10multiverso13MV_NumWorkersEv() #1

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" }
attributes #1 = { "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 0}
!10 = !{!"_ZTSN13wordembedding12CommunicatorE", !6, i64 0, !6, i64 8, !11, i64 16, !11, i64 20, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 8}
!13 = !{!10, !11, i64 16}
!14 = !{!10, !11, i64 20}
!15 = !{!10, !6, i64 24}
!16 = !{!10, !6, i64 32}
!17 = !{!10, !6, i64 40}
!18 = !{!10, !6, i64 48}
!19 = !{!10, !6, i64 56}
!20 = !{!10, !6, i64 64}
!21 = !{!10, !6, i64 72}
!22 = !{!10, !6, i64 80}
!23 = !{!10, !6, i64 88}
!24 = !{!10, !6, i64 96}
!25 = !{!26, !11, i64 64}
!26 = !{!"_ZTSN13wordembedding6OptionE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !27, i64 40, !27, i64 41, !27, i64 42, !27, i64 43, !27, i64 44, !27, i64 45, !28, i64 48, !29, i64 56, !11, i64 64, !11, i64 68, !11, i64 72, !11, i64 76, !11, i64 80, !11, i64 84, !29, i64 88, !29, i64 96, !28, i64 104}
!27 = !{!"bool", !7, i64 0}
!28 = !{!"float", !7, i64 0}
!29 = !{!"long", !7, i64 0}
!30 = !{!11, !11, i64 0}


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

@_ZN13wordembedding14embedding_sizeE = external local_unnamed_addr global i32, align 4

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN13wordembedding12CommunicatorC2EPNS_6OptionEPNS_13MemoryManagerE(ptr nocapture noundef nonnull writeonly align 8 dereferenceable(104) %0, ptr noundef %1, ptr noundef %2) unnamed_addr #0 align 2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  store i64 0, ptr %6, align 8
  store i32 -1, ptr %5, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 20
  store i32 -1, ptr %7, align 4, !tbaa !11
  %8 = getelementptr inbounds i8, ptr %0, i64 24
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(80) %8, i8 0, i64 80, i1 false)
  store ptr %1, ptr %0, align 8, !tbaa !12
  %9 = tail call noundef i32 @_ZN10multiverso7MV_RankEv()
  store i32 %9, ptr %5, align 8, !tbaa !5
  %10 = tail call noundef i32 @_ZN10multiverso13MV_NumWorkersEv()
  store i32 %10, ptr %7, align 4, !tbaa !11
  store ptr %2, ptr %4, align 8, !tbaa !13
  %11 = getelementptr inbounds i8, ptr %1, i64 64
  %12 = load i32, ptr %11, align 8, !tbaa !14
  store i32 %12, ptr @_ZN13wordembedding14embedding_sizeE, align 4, !tbaa !19
  ret void
}

declare noundef i32 @_ZN10multiverso7MV_RankEv() local_unnamed_addr #1

declare noundef i32 @_ZN10multiverso13MV_NumWorkersEv() local_unnamed_addr #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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" }
attributes #1 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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, !10, i64 16}
!6 = !{!"_ZTSN13wordembedding12CommunicatorE", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 20, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !10, i64 20}
!12 = !{!6, !7, i64 0}
!13 = !{!6, !7, i64 8}
!14 = !{!15, !10, i64 64}
!15 = !{!"_ZTSN13wordembedding6OptionE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !16, i64 40, !16, i64 41, !16, i64 42, !16, i64 43, !16, i64 44, !16, i64 45, !17, i64 48, !18, i64 56, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !18, i64 88, !18, i64 96, !17, i64 104}
!16 = !{!"bool", !8, i64 0}
!17 = !{!"float", !8, i64 0}
!18 = !{!"long", !8, i64 0}
!19 = !{!10, !10, i64 0}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass