; LLVM IR from stonne-simulator/omega :: omega-code/stonne/src (ASwitch)

; 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.Config = type { i32, %class.DSNetworkConfig, %class.DSwitchConfig, %class.MSNetworkConfig, %class.MSwitchConfig, %class.ASNetworkConfig, %class.ASwitchConfig, %class.LookUpTableConfig, %class.SDMemoryConfig }
%class.DSNetworkConfig = type { i32 }
%class.DSwitchConfig = type { i32, i32, i32, i32 }
%class.MSNetworkConfig = type { i32, i32, i32, i32 }
%class.MSwitchConfig = type { i32, i32, i32, i32, i32, i32 }
%class.ASNetworkConfig = type { i32, i32 }
%class.ASwitchConfig = type { i32, i32, i32, i32, i32, i32 }
%class.LookUpTableConfig = type { i32, i32 }
%class.SDMemoryConfig = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%"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] }

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7ASwitchC2EjNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEjj6Config(ptr noundef nonnull align 8 dereferenceable(288), i32 noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef byval(%class.Config) align 8) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7ASwitchC2EjNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEjj6ConfigP10ConnectionS8_S8_S8_S8_(ptr noundef nonnull align 8 dereferenceable(288) %0, i32 noundef %1, ptr noundef %2, i32 noundef %3, i32 noundef %4, ptr noundef byval(%class.Config) align 8 %5, ptr noundef %6, ptr noundef %7, ptr noundef %8, ptr noundef %9, ptr noundef %10) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca %"class.std::__cxx11::basic_string", align 8
  %23 = alloca %class.Config, align 8
  %24 = alloca ptr, align 8
  %25 = alloca i32, align 4
  store ptr %0, ptr %12, align 8, !tbaa !5
  store i32 %1, ptr %13, align 4, !tbaa !9
  store ptr %2, ptr %14, align 8, !tbaa !5
  store i32 %3, ptr %15, align 4, !tbaa !9
  store i32 %4, ptr %16, align 4, !tbaa !9
  store ptr %6, ptr %17, align 8, !tbaa !5
  store ptr %7, ptr %18, align 8, !tbaa !5
  store ptr %8, ptr %19, align 8, !tbaa !5
  store ptr %9, ptr %20, align 8, !tbaa !5
  store ptr %10, ptr %21, align 8, !tbaa !5
  %26 = load ptr, ptr %12, align 8
  %27 = load i32, ptr %13, align 4, !tbaa !9
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %22, ptr noundef nonnull align 8 dereferenceable(32) %2)
  %28 = load i32, ptr %15, align 4, !tbaa !9
  %29 = load i32, ptr %16, align 4, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %23, ptr align 8 %5, i64 160, i1 false), !tbaa.struct !11
  invoke void @_ZN7ASwitchC2EjNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEjj6Config(ptr noundef nonnull align 8 dereferenceable(288) %26, i32 noundef %27, ptr noundef %22, i32 noundef %28, i32 noundef %29, ptr noundef byval(%class.Config) align 8 %23)
          to label %30 unwind label %39

30:                                               ; preds = %11
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %22) #3
  %31 = load ptr, ptr %17, align 8, !tbaa !5
  invoke void @_ZN7ASwitch22setInputLeftConnectionEP10Connection(ptr noundef nonnull align 8 dereferenceable(288) %26, ptr noundef %31)
          to label %32 unwind label %43

32:                                               ; preds = %30
  %33 = load ptr, ptr %18, align 8, !tbaa !5
  invoke void @_ZN7ASwitch23setInputRightConnectionEP10Connection(ptr noundef nonnull align 8 dereferenceable(288) %26, ptr noundef %33)
          to label %34 unwind label %43

34:                                               ; preds = %32
  %35 = load ptr, ptr %19, align 8, !tbaa !5
  invoke void @_ZN7ASwitch23setForwardingConnectionEP10Connection(ptr noundef nonnull align 8 dereferenceable(288) %26, ptr noundef %35)
          to label %36 unwind label %43

36:                                               ; preds = %34
  %37 = load ptr, ptr %20, align 8, !tbaa !5
  invoke void @_ZN7ASwitch19setOutputConnectionEP10Connection(ptr noundef nonnull align 8 dereferenceable(288) %26, ptr noundef %37)
          to label %38 unwind label %43

38:                                               ; preds = %36
  ret void

39:                                               ; preds = %11
  %40 = landingpad { ptr, i32 }
          cleanup
  %41 = extractvalue { ptr, i32 } %40, 0
  store ptr %41, ptr %24, align 8
  %42 = extractvalue { ptr, i32 } %40, 1
  store i32 %42, ptr %25, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %22) #3
  br label %47

43:                                               ; preds = %36, %34, %32, %30
  %44 = landingpad { ptr, i32 }
          cleanup
  %45 = extractvalue { ptr, i32 } %44, 0
  store ptr %45, ptr %24, align 8
  %46 = extractvalue { ptr, i32 } %44, 1
  store i32 %46, ptr %25, align 4
  call void @_ZN7ASwitchD2Ev(ptr noundef nonnull align 8 dereferenceable(288) %26) #3
  br label %47

47:                                               ; preds = %43, %39
  %48 = load ptr, ptr %24, align 8
  %49 = load i32, ptr %25, align 4
  %50 = insertvalue { ptr, i32 } poison, ptr %48, 0
  %51 = insertvalue { ptr, i32 } %50, i32 %49, 1
  resume { ptr, i32 } %51
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7ASwitchD2Ev(ptr noundef nonnull align 8 dereferenceable(288)) unnamed_addr #1 align 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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 = !{i64 0, i64 4, !9, i64 4, i64 4, !9, i64 8, i64 4, !9, i64 12, i64 4, !9, i64 16, i64 4, !9, i64 20, i64 4, !9, i64 24, i64 4, !12, i64 28, i64 4, !9, i64 32, i64 4, !9, i64 36, i64 4, !9, i64 40, i64 4, !9, i64 44, i64 4, !9, i64 48, i64 4, !9, i64 52, i64 4, !9, i64 56, i64 4, !9, i64 60, i64 4, !9, i64 64, i64 4, !14, i64 68, i64 4, !9, i64 72, i64 4, !9, i64 76, i64 4, !9, i64 80, i64 4, !9, i64 84, i64 4, !9, i64 88, i64 4, !9, i64 92, i64 4, !9, i64 96, i64 4, !9, i64 100, i64 4, !9, i64 104, i64 4, !16, i64 108, i64 4, !9, i64 112, i64 4, !9, i64 116, i64 4, !9, i64 120, i64 4, !9, i64 124, i64 4, !9, i64 128, i64 4, !9, i64 132, i64 4, !18, i64 136, i64 4, !9, i64 140, i64 4, !9, i64 144, i64 4, !9, i64 148, i64 4, !9, i64 152, i64 4, !9, i64 156, i64 4, !9}
!12 = !{!13, !13, i64 0}
!13 = !{!"_ZTS19MultiplierNetwork_t", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"_ZTS15ReduceNetwork_t", !7, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"_ZTS18MemoryController_t", !7, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"_ZTS17MemoryHierarchy_t", !7, 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"

%class.Config = type { i32, %class.DSNetworkConfig, %class.DSwitchConfig, %class.MSNetworkConfig, %class.MSwitchConfig, %class.ASNetworkConfig, %class.ASwitchConfig, %class.LookUpTableConfig, %class.SDMemoryConfig }
%class.DSNetworkConfig = type { i32 }
%class.DSwitchConfig = type { i32, i32, i32, i32 }
%class.MSNetworkConfig = type { i32, i32, i32, i32 }
%class.MSwitchConfig = type { i32, i32, i32, i32, i32, i32 }
%class.ASNetworkConfig = type { i32, i32 }
%class.ASwitchConfig = type { i32, i32, i32, i32, i32, i32 }
%class.LookUpTableConfig = type { i32, i32 }
%class.SDMemoryConfig = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%"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] }

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7ASwitchC2EjNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEjj6Config(ptr noundef nonnull align 8 dereferenceable(288), i32 noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef byval(%class.Config) align 8) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7ASwitchC2EjNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEjj6ConfigP10ConnectionS8_S8_S8_S8_(ptr noundef nonnull align 8 dereferenceable(288) %0, i32 noundef %1, ptr noundef nonnull %2, i32 noundef %3, i32 noundef %4, ptr nocapture noundef readonly byval(%class.Config) align 8 %5, ptr noundef %6, ptr noundef %7, ptr noundef %8, ptr noundef %9, ptr nocapture noundef readnone %10) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %12 = alloca %"class.std::__cxx11::basic_string", align 8
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %12, ptr noundef nonnull align 8 dereferenceable(32) %2)
  invoke void @_ZN7ASwitchC2EjNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEjj6Config(ptr noundef nonnull align 8 dereferenceable(288) %0, i32 noundef %1, ptr noundef nonnull %12, i32 noundef %3, i32 noundef %4, ptr noundef nonnull byval(%class.Config) align 8 %5)
          to label %13 unwind label %14

13:                                               ; preds = %11
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #2
  call void @_ZN7ASwitch22setInputLeftConnectionEP10Connection(ptr noundef nonnull align 8 dereferenceable(288) %0, ptr noundef %6)
  call void @_ZN7ASwitch23setInputRightConnectionEP10Connection(ptr noundef nonnull align 8 dereferenceable(288) %0, ptr noundef %7)
  call void @_ZN7ASwitch23setForwardingConnectionEP10Connection(ptr noundef nonnull align 8 dereferenceable(288) %0, ptr noundef %8)
  call void @_ZN7ASwitch19setOutputConnectionEP10Connection(ptr noundef nonnull align 8 dereferenceable(288) %0, ptr noundef %9)
  ret void

14:                                               ; preds = %11
  %15 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #2
  resume { ptr, i32 } %15
}

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7ASwitch19setOutputConnectionEP10Connection(ptr noundef nonnull align 8 dereferenceable(288), ptr noundef) local_unnamed_addr #1 align 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 = { 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 }

!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)"}


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