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

; 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::Trainer" = type { i64, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, i32, i64 }
%"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] }>

@.str.8 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [97 x i8], align 1
@__PRETTY_FUNCTION__._ZN13wordembedding7TrainerC2EiPNS_6OptionEPNS_10DictionaryEPNS_13WordEmbeddingE = external hidden unnamed_addr constant [78 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [23 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN13wordembedding7TrainerC2EiPNS_6OptionEPNS_10DictionaryEPNS_13WordEmbeddingE(ptr noundef nonnull align 8 dereferenceable(80) %0, i32 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) unnamed_addr #0 align 2 {
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  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
  %11 = load ptr, ptr %6, align 8
  %12 = load i32, ptr %7, align 4, !tbaa !9
  %13 = getelementptr inbounds %"class.wordembedding::Trainer", ptr %11, i32 0, i32 3
  store i32 %12, ptr %13, align 8, !tbaa !11
  %14 = load ptr, ptr %8, align 8, !tbaa !5
  %15 = getelementptr inbounds %"class.wordembedding::Trainer", ptr %11, i32 0, i32 4
  store ptr %14, ptr %15, align 8, !tbaa !14
  %16 = getelementptr inbounds %"class.wordembedding::Trainer", ptr %11, i32 0, i32 0
  store i64 0, ptr %16, align 8, !tbaa !15
  %17 = load ptr, ptr %10, align 8, !tbaa !5
  %18 = getelementptr inbounds %"class.wordembedding::Trainer", ptr %11, i32 0, i32 7
  store ptr %17, ptr %18, align 8, !tbaa !16
  %19 = load ptr, ptr %9, align 8, !tbaa !5
  %20 = getelementptr inbounds %"class.wordembedding::Trainer", ptr %11, i32 0, i32 8
  store ptr %19, ptr %20, align 8, !tbaa !17
  %21 = getelementptr inbounds %"class.wordembedding::Trainer", ptr %11, i32 0, i32 4
  %22 = load ptr, ptr %21, align 8, !tbaa !14
  %23 = getelementptr inbounds %"struct.wordembedding::Option", ptr %22, i32 0, i32 15
  %24 = load i32, ptr %23, align 8, !tbaa !18
  %25 = sext i32 %24 to i64
  %26 = call noalias ptr @calloc(i64 noundef %25, i64 noundef 4) #3
  %27 = getelementptr inbounds %"class.wordembedding::Trainer", ptr %11, i32 0, i32 5
  store ptr %26, ptr %27, align 8, !tbaa !22
  %28 = getelementptr inbounds %"class.wordembedding::Trainer", ptr %11, i32 0, i32 4
  %29 = load ptr, ptr %28, align 8, !tbaa !14
  %30 = getelementptr inbounds %"struct.wordembedding::Option", ptr %29, i32 0, i32 15
  %31 = load i32, ptr %30, align 8, !tbaa !18
  %32 = sext i32 %31 to i64
  %33 = call noalias ptr @calloc(i64 noundef %32, i64 noundef 4) #3
  %34 = getelementptr inbounds %"class.wordembedding::Trainer", ptr %11, i32 0, i32 6
  store ptr %33, ptr %34, align 8, !tbaa !23
  %35 = getelementptr inbounds %"class.wordembedding::Trainer", ptr %11, i32 0, i32 1
  store i32 -1, ptr %35, align 8, !tbaa !24
  %36 = getelementptr inbounds %"class.wordembedding::Trainer", ptr %11, i32 0, i32 2
  store i32 -1, ptr %36, align 4, !tbaa !25
  %37 = getelementptr inbounds %"class.wordembedding::Trainer", ptr %11, i32 0, i32 5
  %38 = load ptr, ptr %37, align 8, !tbaa !22
  %39 = icmp ne ptr %38, null
  br i1 %39, label %40, label %41

40:                                               ; preds = %5
  br label %43

41:                                               ; preds = %5
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str.9, i32 noundef 16, ptr noundef @__PRETTY_FUNCTION__._ZN13wordembedding7TrainerC2EiPNS_6OptionEPNS_10DictionaryEPNS_13WordEmbeddingE) #4
  unreachable

42:                                               ; No predecessors!
  br label %43

43:                                               ; preds = %42, %40
  %44 = getelementptr inbounds %"class.wordembedding::Trainer", ptr %11, i32 0, i32 6
  %45 = load ptr, ptr %44, align 8, !tbaa !23
  %46 = icmp ne ptr %45, null
  br i1 %46, label %47, label %48

47:                                               ; preds = %43
  br label %50

48:                                               ; preds = %43
  call void @__assert_fail(ptr noundef @.str.10, ptr noundef @.str.9, i32 noundef 17, ptr noundef @__PRETTY_FUNCTION__._ZN13wordembedding7TrainerC2EiPNS_6OptionEPNS_10DictionaryEPNS_13WordEmbeddingE) #4
  unreachable

49:                                               ; No predecessors!
  br label %50

50:                                               ; preds = %49, %47
  %51 = getelementptr inbounds %"class.wordembedding::Trainer", ptr %11, i32 0, i32 10
  store i64 0, ptr %51, align 8, !tbaa !26
  %52 = getelementptr inbounds %"class.wordembedding::Trainer", ptr %11, i32 0, i32 9
  store i32 0, ptr %52, align 8, !tbaa !27
  ret void
}

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #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 allocsize(0,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 = { 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 = { nounwind allocsize(0,1) }
attributes #4 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 16}
!12 = !{!"_ZTSN13wordembedding7TrainerE", !13, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !10, i64 64, !13, i64 72}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !6, i64 24}
!15 = !{!12, !13, i64 0}
!16 = !{!12, !6, i64 48}
!17 = !{!12, !6, i64 56}
!18 = !{!19, !10, i64 64}
!19 = !{!"_ZTSN13wordembedding6OptionE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !20, i64 40, !20, i64 41, !20, i64 42, !20, i64 43, !20, i64 44, !20, i64 45, !21, i64 48, !13, i64 56, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !13, i64 88, !13, i64 96, !21, i64 104}
!20 = !{!"bool", !7, i64 0}
!21 = !{!"float", !7, i64 0}
!22 = !{!12, !6, i64 32}
!23 = !{!12, !6, i64 40}
!24 = !{!12, !10, i64 8}
!25 = !{!12, !10, i64 12}
!26 = !{!12, !13, i64 72}
!27 = !{!12, !10, i64 64}


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

@.str.8 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [97 x i8], align 1
@__PRETTY_FUNCTION__._ZN13wordembedding7TrainerC2EiPNS_6OptionEPNS_10DictionaryEPNS_13WordEmbeddingE = external hidden unnamed_addr constant [78 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [23 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN13wordembedding7TrainerC2EiPNS_6OptionEPNS_10DictionaryEPNS_13WordEmbeddingE(ptr nocapture noundef nonnull writeonly align 8 dereferenceable(80) %0, i32 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) unnamed_addr #0 align 2 {
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  store i32 %1, ptr %6, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  store ptr %2, ptr %7, align 8, !tbaa !12
  store i64 0, ptr %0, align 8, !tbaa !13
  %8 = getelementptr inbounds i8, ptr %0, i64 48
  store ptr %4, ptr %8, align 8, !tbaa !14
  %9 = getelementptr inbounds i8, ptr %0, i64 56
  store ptr %3, ptr %9, align 8, !tbaa !15
  %10 = getelementptr inbounds i8, ptr %2, i64 64
  %11 = load i32, ptr %10, align 8, !tbaa !16
  %12 = sext i32 %11 to i64
  %13 = tail call noalias ptr @calloc(i64 noundef %12, i64 noundef 4) #3
  %14 = getelementptr inbounds i8, ptr %0, i64 32
  store ptr %13, ptr %14, align 8, !tbaa !20
  %15 = tail call noalias ptr @calloc(i64 noundef %12, i64 noundef 4) #3
  %16 = getelementptr inbounds i8, ptr %0, i64 40
  store ptr %15, ptr %16, align 8, !tbaa !21
  %17 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 -1, ptr %17, align 8, !tbaa !22
  %18 = getelementptr inbounds i8, ptr %0, i64 12
  store i32 -1, ptr %18, align 4, !tbaa !23
  %.not = icmp eq ptr %13, null
  br i1 %.not, label %19, label %20

19:                                               ; preds = %5
  tail call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.9, i32 noundef 16, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN13wordembedding7TrainerC2EiPNS_6OptionEPNS_10DictionaryEPNS_13WordEmbeddingE) #4
  unreachable

20:                                               ; preds = %5
  %.not4 = icmp eq ptr %15, null
  br i1 %.not4, label %21, label %22

21:                                               ; preds = %20
  tail call void @__assert_fail(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.9, i32 noundef 17, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN13wordembedding7TrainerC2EiPNS_6OptionEPNS_10DictionaryEPNS_13WordEmbeddingE) #4
  unreachable

22:                                               ; preds = %20
  %23 = getelementptr inbounds i8, ptr %0, i64 72
  store i64 0, ptr %23, align 8, !tbaa !24
  %24 = getelementptr inbounds i8, ptr %0, i64 64
  store i32 0, ptr %24, align 8, !tbaa !25
  ret void
}

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #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 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { nounwind allocsize(0,1) }
attributes #4 = { 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, !10, i64 16}
!6 = !{!"_ZTSN13wordembedding7TrainerE", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !10, i64 64, !7, i64 72}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!6, !11, i64 24}
!13 = !{!6, !7, i64 0}
!14 = !{!6, !11, i64 48}
!15 = !{!6, !11, i64 56}
!16 = !{!17, !10, i64 64}
!17 = !{!"_ZTSN13wordembedding6OptionE", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !18, i64 40, !18, i64 41, !18, i64 42, !18, i64 43, !18, i64 44, !18, i64 45, !19, i64 48, !7, i64 56, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !7, i64 88, !7, i64 96, !19, i64 104}
!18 = !{!"bool", !8, i64 0}
!19 = !{!"float", !8, i64 0}
!20 = !{!6, !11, i64 32}
!21 = !{!6, !11, i64 40}
!22 = !{!6, !10, i64 8}
!23 = !{!6, !10, i64 12}
!24 = !{!6, !7, i64 72}
!25 = !{!6, !10, i64 64}


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