; LLVM IR from stonne-simulator/omega :: omega-code/stonne/src/MultiplierOS.ll (ZN12MultiplierOS5cycleEv)

; 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.MultiplierOS = type <{ %class.Unit, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %class.MultiplierOSStats, i32, i8, i8, [2 x i8] }>
%class.Unit = type { ptr, i32, %"class.std::__cxx11::basic_string" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%class.MultiplierOSStats = type <{ %class.Stats, i32, i32, i32, i32, i32, i32, i32, [4 x i8] }>
%class.Stats = type { ptr }

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

declare noundef zeroext i1 @_ZN4Fifo7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(120)) #1

declare noundef ptr @_ZN4Fifo3popEv(ptr noundef nonnull align 8 dereferenceable(120)) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN12MultiplierOS4sendEv(ptr noundef nonnull align 8 dereferenceable(222)) #2 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN12MultiplierOS7receiveEv(ptr noundef nonnull align 8 dereferenceable(222)) #2 align 2

declare void @_ZN4Fifo4pushEP11DataPackage(ptr noundef nonnull align 8 dereferenceable(120), ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN12MultiplierOS28perform_operation_2_operandsEP11DataPackageS1_(ptr noundef nonnull align 8 dereferenceable(222), ptr noundef, ptr noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN12MultiplierOS5cycleEv(ptr noundef nonnull align 8 dereferenceable(222) %0) unnamed_addr #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %6 = load ptr, ptr %2, align 8
  %7 = getelementptr inbounds %class.MultiplierOS, ptr %6, i32 0, i32 22
  %8 = load i32, ptr %7, align 4, !tbaa !9
  %9 = add i32 %8, 1
  store i32 %9, ptr %7, align 4, !tbaa !9
  %10 = getelementptr inbounds %class.MultiplierOS, ptr %6, i32 0, i32 23
  %11 = getelementptr inbounds %class.MultiplierOSStats, ptr %10, i32 0, i32 1
  %12 = load i32, ptr %11, align 8, !tbaa !19
  %13 = add i32 %12, 1
  store i32 %13, ptr %11, align 8, !tbaa !19
  call void @_ZN12MultiplierOS7receiveEv(ptr noundef nonnull align 8 dereferenceable(222) %6)
  %14 = getelementptr inbounds %class.MultiplierOS, ptr %6, i32 0, i32 2
  %15 = load ptr, ptr %14, align 8, !tbaa !20
  %16 = call noundef zeroext i1 @_ZN4Fifo7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(120) %15)
  br i1 %16, label %60, label %17

17:                                               ; preds = %1
  %18 = getelementptr inbounds %class.MultiplierOS, ptr %6, i32 0, i32 1
  %19 = load ptr, ptr %18, align 8, !tbaa !21
  %20 = call noundef zeroext i1 @_ZN4Fifo7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(120) %19)
  br i1 %20, label %60, label %21

21:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %22 = getelementptr inbounds %class.MultiplierOS, ptr %6, i32 0, i32 2
  %23 = load ptr, ptr %22, align 8, !tbaa !20
  %24 = call noundef ptr @_ZN4Fifo3popEv(ptr noundef nonnull align 8 dereferenceable(120) %23)
  store ptr %24, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %25 = getelementptr inbounds %class.MultiplierOS, ptr %6, i32 0, i32 1
  %26 = load ptr, ptr %25, align 8, !tbaa !21
  %27 = call noundef ptr @_ZN4Fifo3popEv(ptr noundef nonnull align 8 dereferenceable(120) %26)
  store ptr %27, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = call noundef ptr @_ZN12MultiplierOS28perform_operation_2_operandsEP11DataPackageS1_(ptr noundef nonnull align 8 dereferenceable(222) %6, ptr noundef %28, ptr noundef %29)
  store ptr %30, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %class.MultiplierOS, ptr %6, i32 0, i32 5
  %32 = load ptr, ptr %31, align 8, !tbaa !22
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN4Fifo4pushEP11DataPackage(ptr noundef nonnull align 8 dereferenceable(120) %32, ptr noundef %33)
  %34 = getelementptr inbounds %class.MultiplierOS, ptr %6, i32 0, i32 25
  %35 = load i8, ptr %34, align 4, !tbaa !23, !range !24, !noundef !25
  %36 = trunc i8 %35 to i1
  br i1 %36, label %37, label %41

37:                                               ; preds = %21
  %38 = getelementptr inbounds %class.MultiplierOS, ptr %6, i32 0, i32 3
  %39 = load ptr, ptr %38, align 8, !tbaa !26
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  call void @_ZN4Fifo4pushEP11DataPackage(ptr noundef nonnull align 8 dereferenceable(120) %39, ptr noundef %40)
  br label %46

41:                                               ; preds = %21
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = icmp eq ptr %42, null
  br i1 %43, label %45, label %44

44:                                               ; preds = %41
  call void @_ZN11DataPackageD1Ev(ptr noundef nonnull align 8 dereferenceable(64) %42) #5
  call void @_ZdlPvm(ptr noundef %42, i64 noundef 64) #6
  br label %45

45:                                               ; preds = %44, %41
  br label %46

46:                                               ; preds = %45, %37
  %47 = getelementptr inbounds %class.MultiplierOS, ptr %6, i32 0, i32 26
  %48 = load i8, ptr %47, align 1, !tbaa !27, !range !24, !noundef !25
  %49 = trunc i8 %48 to i1
  br i1 %49, label %50, label %54

50:                                               ; preds = %46
  %51 = getelementptr inbounds %class.MultiplierOS, ptr %6, i32 0, i32 4
  %52 = load ptr, ptr %51, align 8, !tbaa !28
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN4Fifo4pushEP11DataPackage(ptr noundef nonnull align 8 dereferenceable(120) %52, ptr noundef %53)
  br label %59

54:                                               ; preds = %46
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = icmp eq ptr %55, null
  br i1 %56, label %58, label %57

57:                                               ; preds = %54
  call void @_ZN11DataPackageD1Ev(ptr noundef nonnull align 8 dereferenceable(64) %55) #5
  call void @_ZdlPvm(ptr noundef %55, i64 noundef 64) #6
  br label %58

58:                                               ; preds = %57, %54
  br label %59

59:                                               ; preds = %58, %50
  call void @_ZN12MultiplierOS4sendEv(ptr noundef nonnull align 8 dereferenceable(222) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  br label %60

60:                                               ; preds = %59, %17, %1
  ret void
}

; Function Attrs: nounwind
declare void @_ZN11DataPackageD1Ev(ptr noundef nonnull align 8 dereferenceable(64)) unnamed_addr #4

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 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { nounwind }
attributes #6 = { 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, !12, i64 172}
!10 = !{!"_ZTS12MultiplierOS", !11, i64 0, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !12, i64 128, !12, i64 132, !12, i64 136, !12, i64 140, !12, i64 144, !12, i64 148, !12, i64 152, !12, i64 156, !12, i64 160, !12, i64 164, !12, i64 168, !12, i64 172, !16, i64 176, !12, i64 216, !18, i64 220, !18, i64 221}
!11 = !{!"_ZTS4Unit", !12, i64 8, !13, i64 16}
!12 = !{!"int", !7, i64 0}
!13 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !14, i64 0, !15, i64 8, !7, i64 16}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!"_ZTS17MultiplierOSStats", !17, i64 0, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32}
!17 = !{!"_ZTS5Stats"}
!18 = !{!"bool", !7, i64 0}
!19 = !{!10, !12, i64 184}
!20 = !{!10, !6, i64 56}
!21 = !{!10, !6, i64 48}
!22 = !{!10, !6, i64 80}
!23 = !{!10, !18, i64 220}
!24 = !{i8 0, i8 2}
!25 = !{}
!26 = !{!10, !6, i64 64}
!27 = !{!10, !18, i64 221}
!28 = !{!10, !6, i64 72}


; 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

declare noundef zeroext i1 @_ZN4Fifo7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(120)) local_unnamed_addr #1

declare noundef ptr @_ZN4Fifo3popEv(ptr noundef nonnull align 8 dereferenceable(120)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN12MultiplierOS4sendEv(ptr noundef nonnull align 8 dereferenceable(222)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN12MultiplierOS7receiveEv(ptr noundef nonnull align 8 dereferenceable(222)) local_unnamed_addr #2 align 2

declare void @_ZN4Fifo4pushEP11DataPackage(ptr noundef nonnull align 8 dereferenceable(120), ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN12MultiplierOS28perform_operation_2_operandsEP11DataPackageS1_(ptr noundef nonnull align 8 dereferenceable(222), ptr noundef, ptr noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN12MultiplierOS5cycleEv(ptr noundef nonnull align 8 dereferenceable(222) %0) unnamed_addr #2 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 172
  %3 = load i32, ptr %2, align 4, !tbaa !5
  %4 = add i32 %3, 1
  store i32 %4, ptr %2, align 4, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 184
  %6 = load i32, ptr %5, align 8, !tbaa !18
  %7 = add i32 %6, 1
  store i32 %7, ptr %5, align 8, !tbaa !18
  tail call void @_ZN12MultiplierOS7receiveEv(ptr noundef nonnull align 8 dereferenceable(222) %0)
  %8 = getelementptr inbounds i8, ptr %0, i64 56
  %9 = load ptr, ptr %8, align 8, !tbaa !19
  %10 = tail call noundef zeroext i1 @_ZN4Fifo7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(120) %9)
  br i1 %10, label %43, label %11

11:                                               ; preds = %1
  %12 = getelementptr inbounds i8, ptr %0, i64 48
  %13 = load ptr, ptr %12, align 8, !tbaa !20
  %14 = tail call noundef zeroext i1 @_ZN4Fifo7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(120) %13)
  br i1 %14, label %43, label %15

15:                                               ; preds = %11
  %16 = load ptr, ptr %8, align 8, !tbaa !19
  %17 = tail call noundef ptr @_ZN4Fifo3popEv(ptr noundef nonnull align 8 dereferenceable(120) %16)
  %18 = load ptr, ptr %12, align 8, !tbaa !20
  %19 = tail call noundef ptr @_ZN4Fifo3popEv(ptr noundef nonnull align 8 dereferenceable(120) %18)
  %20 = tail call noundef ptr @_ZN12MultiplierOS28perform_operation_2_operandsEP11DataPackageS1_(ptr noundef nonnull align 8 dereferenceable(222) %0, ptr noundef %17, ptr noundef %19)
  %21 = getelementptr inbounds i8, ptr %0, i64 80
  %22 = load ptr, ptr %21, align 8, !tbaa !21
  tail call void @_ZN4Fifo4pushEP11DataPackage(ptr noundef nonnull align 8 dereferenceable(120) %22, ptr noundef %20)
  %23 = getelementptr inbounds i8, ptr %0, i64 220
  %24 = load i8, ptr %23, align 4, !tbaa !22, !range !23, !noundef !24
  %25 = trunc nuw i8 %24 to i1
  br i1 %25, label %26, label %29

26:                                               ; preds = %15
  %27 = getelementptr inbounds i8, ptr %0, i64 64
  %28 = load ptr, ptr %27, align 8, !tbaa !25
  tail call void @_ZN4Fifo4pushEP11DataPackage(ptr noundef nonnull align 8 dereferenceable(120) %28, ptr noundef %17)
  br label %32

29:                                               ; preds = %15
  %30 = icmp eq ptr %17, null
  br i1 %30, label %32, label %31

31:                                               ; preds = %29
  tail call void @_ZN11DataPackageD1Ev(ptr noundef nonnull align 8 dereferenceable(64) %17) #4
  tail call void @_ZdlPvm(ptr noundef nonnull %17, i64 noundef 64) #5
  br label %32

32:                                               ; preds = %29, %31, %26
  %33 = getelementptr inbounds i8, ptr %0, i64 221
  %34 = load i8, ptr %33, align 1, !tbaa !26, !range !23, !noundef !24
  %35 = trunc nuw i8 %34 to i1
  br i1 %35, label %36, label %39

36:                                               ; preds = %32
  %37 = getelementptr inbounds i8, ptr %0, i64 72
  %38 = load ptr, ptr %37, align 8, !tbaa !27
  tail call void @_ZN4Fifo4pushEP11DataPackage(ptr noundef nonnull align 8 dereferenceable(120) %38, ptr noundef %19)
  br label %42

39:                                               ; preds = %32
  %40 = icmp eq ptr %19, null
  br i1 %40, label %42, label %41

41:                                               ; preds = %39
  tail call void @_ZN11DataPackageD1Ev(ptr noundef nonnull align 8 dereferenceable(64) %19) #4
  tail call void @_ZdlPvm(ptr noundef nonnull %19, i64 noundef 64) #5
  br label %42

42:                                               ; preds = %39, %41, %36
  tail call void @_ZN12MultiplierOS4sendEv(ptr noundef nonnull align 8 dereferenceable(222) %0)
  br label %43

43:                                               ; preds = %42, %11, %1
  ret void
}

; Function Attrs: nounwind
declare void @_ZN11DataPackageD1Ev(ptr noundef nonnull align 8 dereferenceable(64)) unnamed_addr #3

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 = { "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 "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 = { 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 172}
!6 = !{!"_ZTS12MultiplierOS", !7, i64 0, !13, i64 48, !13, i64 56, !13, i64 64, !13, i64 72, !13, i64 80, !13, i64 88, !13, i64 96, !13, i64 104, !13, i64 112, !13, i64 120, !8, i64 128, !8, i64 132, !8, i64 136, !8, i64 140, !8, i64 144, !8, i64 148, !8, i64 152, !8, i64 156, !8, i64 160, !8, i64 164, !8, i64 168, !8, i64 172, !15, i64 176, !8, i64 216, !17, i64 220, !17, i64 221}
!7 = !{!"_ZTS4Unit", !8, i64 8, !11, i64 16}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !12, i64 0, !14, i64 8, !9, i64 16}
!12 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !13, i64 0}
!13 = !{!"any pointer", !9, i64 0}
!14 = !{!"long", !9, i64 0}
!15 = !{!"_ZTS17MultiplierOSStats", !16, i64 0, !8, i64 8, !8, i64 12, !8, i64 16, !8, i64 20, !8, i64 24, !8, i64 28, !8, i64 32}
!16 = !{!"_ZTS5Stats"}
!17 = !{!"bool", !9, i64 0}
!18 = !{!6, !8, i64 184}
!19 = !{!6, !13, i64 56}
!20 = !{!6, !13, i64 48}
!21 = !{!6, !13, i64 80}
!22 = !{!6, !17, i64 220}
!23 = !{i8 0, i8 2}
!24 = !{}
!25 = !{!6, !13, i64 64}
!26 = !{!6, !17, i64 221}
!27 = !{!6, !13, i64 72}


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