; LLVM IR from EbTech/Elo-MMR :: deprecated/cpp/trueskill/src/trueskill.ll (ZN9SumFactorD2Ev)

; 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.SumFactor = type { %class.Factor.base, ptr, ptr, ptr }
%class.Factor.base = type <{ ptr, i32 }>
%class.Factor = type <{ ptr, i32, [4 x i8] }>

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6FactorD2Ev(ptr noundef nonnull align 8 dereferenceable(12)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6vectorIP8VariableSaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIP8VariableSaIS1_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIP8VariableSaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN9SumFactorD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %0) unnamed_addr #1 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  br label %4

4:                                                ; preds = %9, %1
  %5 = getelementptr inbounds %class.SumFactor, ptr %3, i32 0, i32 2
  %6 = load ptr, ptr %5, align 8, !tbaa !9
  %7 = call noundef zeroext i1 @_ZNKSt6vectorIP8VariableSaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #2
  %8 = xor i1 %7, true
  br i1 %8, label %9, label %12

9:                                                ; preds = %4
  %10 = getelementptr inbounds %class.SumFactor, ptr %3, i32 0, i32 2
  %11 = load ptr, ptr %10, align 8, !tbaa !9
  call void @_ZNSt6vectorIP8VariableSaIS1_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %11) #2
  br label %4, !llvm.loop !13

12:                                               ; preds = %4
  %13 = getelementptr inbounds %class.SumFactor, ptr %3, i32 0, i32 2
  %14 = load ptr, ptr %13, align 8, !tbaa !9
  %15 = icmp eq ptr %14, null
  br i1 %15, label %17, label %16

16:                                               ; preds = %12
  call void @_ZNSt6vectorIP8VariableSaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %14) #2
  call void @_ZdlPvm(ptr noundef %14, i64 noundef 24) #3
  br label %17

17:                                               ; preds = %16, %12
  br label %18

18:                                               ; preds = %23, %17
  %19 = getelementptr inbounds %class.SumFactor, ptr %3, i32 0, i32 3
  %20 = load ptr, ptr %19, align 8, !tbaa !15
  %21 = call noundef zeroext i1 @_ZNKSt6vectorIdSaIdEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #2
  %22 = xor i1 %21, true
  br i1 %22, label %23, label %26

23:                                               ; preds = %18
  %24 = getelementptr inbounds %class.SumFactor, ptr %3, i32 0, i32 3
  %25 = load ptr, ptr %24, align 8, !tbaa !15
  call void @_ZNSt6vectorIdSaIdEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %25) #2
  br label %18, !llvm.loop !16

26:                                               ; preds = %18
  %27 = getelementptr inbounds %class.SumFactor, ptr %3, i32 0, i32 3
  %28 = load ptr, ptr %27, align 8, !tbaa !15
  %29 = icmp eq ptr %28, null
  br i1 %29, label %31, label %30

30:                                               ; preds = %26
  call void @_ZNSt6vectorIdSaIdEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %28) #2
  call void @_ZdlPvm(ptr noundef %28, i64 noundef 24) #3
  br label %31

31:                                               ; preds = %30, %26
  br label %32

32:                                               ; preds = %37, %31
  %33 = getelementptr inbounds %class.Factor, ptr %3, i32 0, i32 0
  %34 = load ptr, ptr %33, align 8, !tbaa !17
  %35 = call noundef zeroext i1 @_ZNKSt6vectorIP8VariableSaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %34) #2
  %36 = xor i1 %35, true
  br i1 %36, label %37, label %40

37:                                               ; preds = %32
  %38 = getelementptr inbounds %class.Factor, ptr %3, i32 0, i32 0
  %39 = load ptr, ptr %38, align 8, !tbaa !17
  call void @_ZNSt6vectorIP8VariableSaIS1_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %39) #2
  br label %32, !llvm.loop !18

40:                                               ; preds = %32
  %41 = getelementptr inbounds %class.Factor, ptr %3, i32 0, i32 0
  %42 = load ptr, ptr %41, align 8, !tbaa !17
  %43 = icmp eq ptr %42, null
  br i1 %43, label %45, label %44

44:                                               ; preds = %40
  call void @_ZNSt6vectorIP8VariableSaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %42) #2
  call void @_ZdlPvm(ptr noundef %42, i64 noundef 24) #3
  br label %45

45:                                               ; preds = %44, %40
  call void @_ZN6FactorD2Ev(ptr noundef nonnull align 8 dereferenceable(12) %3) #2
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6vectorIdSaIdEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIdSaIdEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIdSaIdEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

attributes #0 = { nobuiltin 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 #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 }
attributes #3 = { builtin 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, !6, i64 24}
!10 = !{!"_ZTS9SumFactor", !11, i64 0, !6, i64 16, !6, i64 24, !6, i64 32}
!11 = !{!"_ZTS6Factor", !6, i64 0, !12, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!10, !6, i64 32}
!16 = distinct !{!16, !14}
!17 = !{!11, !6, i64 0}
!18 = distinct !{!18, !14}


; 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: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6FactorD2Ev(ptr noundef nonnull align 8 dereferenceable(12)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6vectorIP8VariableSaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIP8VariableSaIS1_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIP8VariableSaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN9SumFactorD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %0) unnamed_addr #1 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 24
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = tail call noundef zeroext i1 @_ZNKSt6vectorIP8VariableSaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #2
  br i1 %4, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %1, %.lr.ph
  %5 = load ptr, ptr %2, align 8, !tbaa !5
  tail call void @_ZNSt6vectorIP8VariableSaIS1_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #2
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = tail call noundef zeroext i1 @_ZNKSt6vectorIP8VariableSaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #2
  br i1 %7, label %._crit_edge, label %.lr.ph, !llvm.loop !12

._crit_edge:                                      ; preds = %.lr.ph, %1
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = icmp eq ptr %8, null
  br i1 %9, label %11, label %10

10:                                               ; preds = %._crit_edge
  tail call void @_ZNSt6vectorIP8VariableSaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #2
  tail call void @_ZdlPvm(ptr noundef nonnull %8, i64 noundef 24) #3
  br label %11

11:                                               ; preds = %10, %._crit_edge
  %12 = getelementptr inbounds i8, ptr %0, i64 32
  %13 = load ptr, ptr %12, align 8, !tbaa !14
  %14 = tail call noundef zeroext i1 @_ZNKSt6vectorIdSaIdEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %13) #2
  br i1 %14, label %._crit_edge6, label %.lr.ph5

.lr.ph5:                                          ; preds = %11, %.lr.ph5
  %15 = load ptr, ptr %12, align 8, !tbaa !14
  tail call void @_ZNSt6vectorIdSaIdEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %15) #2
  %16 = load ptr, ptr %12, align 8, !tbaa !14
  %17 = tail call noundef zeroext i1 @_ZNKSt6vectorIdSaIdEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %16) #2
  br i1 %17, label %._crit_edge6, label %.lr.ph5, !llvm.loop !15

._crit_edge6:                                     ; preds = %.lr.ph5, %11
  %18 = load ptr, ptr %12, align 8, !tbaa !14
  %19 = icmp eq ptr %18, null
  br i1 %19, label %21, label %20

20:                                               ; preds = %._crit_edge6
  tail call void @_ZNSt6vectorIdSaIdEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %18) #2
  tail call void @_ZdlPvm(ptr noundef nonnull %18, i64 noundef 24) #3
  br label %21

21:                                               ; preds = %20, %._crit_edge6
  %22 = load ptr, ptr %0, align 8, !tbaa !16
  %23 = tail call noundef zeroext i1 @_ZNKSt6vectorIP8VariableSaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %22) #2
  br i1 %23, label %._crit_edge10, label %.lr.ph9

.lr.ph9:                                          ; preds = %21, %.lr.ph9
  %24 = load ptr, ptr %0, align 8, !tbaa !16
  tail call void @_ZNSt6vectorIP8VariableSaIS1_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %24) #2
  %25 = load ptr, ptr %0, align 8, !tbaa !16
  %26 = tail call noundef zeroext i1 @_ZNKSt6vectorIP8VariableSaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %25) #2
  br i1 %26, label %._crit_edge10, label %.lr.ph9, !llvm.loop !17

._crit_edge10:                                    ; preds = %.lr.ph9, %21
  %27 = load ptr, ptr %0, align 8, !tbaa !16
  %28 = icmp eq ptr %27, null
  br i1 %28, label %30, label %29

29:                                               ; preds = %._crit_edge10
  tail call void @_ZNSt6vectorIP8VariableSaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %27) #2
  tail call void @_ZdlPvm(ptr noundef nonnull %27, i64 noundef 24) #3
  br label %30

30:                                               ; preds = %29, %._crit_edge10
  tail call void @_ZN6FactorD2Ev(ptr noundef nonnull align 8 dereferenceable(12) %0) #2
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6vectorIdSaIdEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIdSaIdEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIdSaIdEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

attributes #0 = { nobuiltin 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 #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 }
attributes #3 = { builtin 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, !8, i64 24}
!6 = !{!"_ZTS9SumFactor", !7, i64 0, !8, i64 16, !8, i64 24, !8, i64 32}
!7 = !{!"_ZTS6Factor", !8, i64 0, !11, i64 8}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!6, !8, i64 32}
!15 = distinct !{!15, !13}
!16 = !{!7, !8, i64 0}
!17 = distinct !{!17, !13}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass