; LLVM IR from CRAFT-THU/BSim :: src/neuron/poisson/PoissonNeuron.ll (ZN13PoissonNeuron5resetER7SimInfo)

; 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.PoissonNeuron = type { %class.NeuronBase.base, %"class.std::vector", %"class.std::linear_congruential_engine", %"class.std::poisson_distribution", float, float, float, float, i8, i8, i32, i32, i32, i32, ptr }
%class.NeuronBase.base = type <{ %class.Base, %"class.std::vector", i8, i8, [2 x i8], i32, float }>
%class.Base = type { ptr, i32, i32 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<SynapseBase *, std::allocator<SynapseBase *>>::_Vector_impl" }
%"struct.std::_Vector_base<SynapseBase *, std::allocator<SynapseBase *>>::_Vector_impl" = type { %"struct.std::_Vector_base<SynapseBase *, std::allocator<SynapseBase *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<SynapseBase *, std::allocator<SynapseBase *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::linear_congruential_engine" = type { i64 }
%"class.std::poisson_distribution" = type { %"struct.std::poisson_distribution<>::param_type", %"class.std::normal_distribution" }
%"struct.std::poisson_distribution<>::param_type" = type { double, double, double, double, double, double, double, double, double }
%"class.std::normal_distribution" = type <{ %"struct.std::normal_distribution<>::param_type", double, i8, [7 x i8] }>
%"struct.std::normal_distribution<>::param_type" = type { double, double }
%struct.SimInfo = type { i32, float, %"class.std::vector.0", %"class.std::vector.5" }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl" }
%"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl" = type { %"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl_data" }
%"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN13PoissonNeuron5resetER7SimInfo(ptr noundef nonnull align 8 dereferenceable(240) %0, ptr noundef nonnull align 8 dereferenceable(56) %1) unnamed_addr #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8
  %6 = getelementptr inbounds %class.PoissonNeuron, ptr %5, i32 0, i32 8
  store i8 0, ptr %6, align 8, !tbaa !9
  %7 = getelementptr inbounds %class.PoissonNeuron, ptr %5, i32 0, i32 6
  %8 = load float, ptr %7, align 8, !tbaa !27
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.SimInfo, ptr %9, i32 0, i32 1
  %11 = load float, ptr %10, align 4, !tbaa !28
  %12 = fdiv float %8, %11
  %13 = fptosi float %12 to i32
  %14 = getelementptr inbounds %class.PoissonNeuron, ptr %5, i32 0, i32 10
  store i32 %13, ptr %14, align 4, !tbaa !38
  %15 = getelementptr inbounds %class.PoissonNeuron, ptr %5, i32 0, i32 3
  %16 = getelementptr inbounds %class.PoissonNeuron, ptr %5, i32 0, i32 2
  %17 = call noundef i32 @_ZNSt20poisson_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_(ptr noundef nonnull align 8 dereferenceable(104) %15, ptr noundef nonnull align 8 dereferenceable(8) %16)
  %18 = getelementptr inbounds %class.PoissonNeuron, ptr %5, i32 0, i32 10
  %19 = load i32, ptr %18, align 4, !tbaa !38
  %20 = add nsw i32 %19, %17
  store i32 %20, ptr %18, align 4, !tbaa !38
  %21 = getelementptr inbounds %class.PoissonNeuron, ptr %5, i32 0, i32 10
  %22 = load i32, ptr %21, align 4, !tbaa !38
  %23 = getelementptr inbounds %class.PoissonNeuron, ptr %5, i32 0, i32 11
  store i32 %22, ptr %23, align 8, !tbaa !39
  %24 = getelementptr inbounds %class.PoissonNeuron, ptr %5, i32 0, i32 7
  %25 = load float, ptr %24, align 4, !tbaa !40
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.SimInfo, ptr %26, i32 0, i32 1
  %28 = load float, ptr %27, align 4, !tbaa !28
  %29 = fdiv float %25, %28
  %30 = fptosi float %29 to i32
  %31 = getelementptr inbounds %class.PoissonNeuron, ptr %5, i32 0, i32 12
  store i32 %30, ptr %31, align 4, !tbaa !41
  %32 = getelementptr inbounds %class.PoissonNeuron, ptr %5, i32 0, i32 5
  %33 = load float, ptr %32, align 4, !tbaa !42
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.SimInfo, ptr %34, i32 0, i32 1
  %36 = load float, ptr %35, align 4, !tbaa !28
  %37 = fdiv float %33, %36
  %38 = fptosi float %37 to i32
  %39 = getelementptr inbounds %class.PoissonNeuron, ptr %5, i32 0, i32 13
  store i32 %38, ptr %39, align 8, !tbaa !43
  ret i32 0
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZNSt20poisson_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_(ptr noundef nonnull align 8 dereferenceable(104), ptr noundef nonnull align 8 dereferenceable(8)) #0 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" }

!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, !18, i64 208}
!10 = !{!"_ZTS13PoissonNeuron", !11, i64 0, !14, i64 56, !20, i64 80, !22, i64 88, !19, i64 192, !19, i64 196, !19, i64 200, !19, i64 204, !18, i64 208, !18, i64 209, !13, i64 212, !13, i64 216, !13, i64 220, !13, i64 224, !6, i64 232}
!11 = !{!"_ZTS10NeuronBase", !12, i64 0, !14, i64 16, !18, i64 40, !18, i64 41, !13, i64 44, !19, i64 48}
!12 = !{!"_ZTS4Base", !13, i64 8, !13, i64 12}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTSSt6vectorIP11SynapseBaseSaIS1_EE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseIP11SynapseBaseSaIS1_EE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIP11SynapseBaseSaIS1_EE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIP11SynapseBaseSaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!18 = !{!"bool", !7, i64 0}
!19 = !{!"float", !7, i64 0}
!20 = !{!"_ZTSSt26linear_congruential_engineImLm16807ELm0ELm2147483647EE", !21, i64 0}
!21 = !{!"long", !7, i64 0}
!22 = !{!"_ZTSSt20poisson_distributionIiE", !23, i64 0, !25, i64 72}
!23 = !{!"_ZTSNSt20poisson_distributionIiE10param_typeE", !24, i64 0, !24, i64 8, !24, i64 16, !24, i64 24, !24, i64 32, !24, i64 40, !24, i64 48, !24, i64 56, !24, i64 64}
!24 = !{!"double", !7, i64 0}
!25 = !{!"_ZTSSt19normal_distributionIdE", !26, i64 0, !24, i64 16, !18, i64 24}
!26 = !{!"_ZTSNSt19normal_distributionIdE10param_typeE", !24, i64 0, !24, i64 8}
!27 = !{!10, !19, i64 200}
!28 = !{!29, !19, i64 4}
!29 = !{!"_ZTS7SimInfo", !13, i64 0, !19, i64 4, !30, i64 8, !34, i64 32}
!30 = !{!"_ZTSSt6vectorIiSaIiEE", !31, i64 0}
!31 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !32, i64 0}
!32 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !33, i64 0}
!33 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!34 = !{!"_ZTSSt6vectorIfSaIfEE", !35, i64 0}
!35 = !{!"_ZTSSt12_Vector_baseIfSaIfEE", !36, i64 0}
!36 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE12_Vector_implE", !37, i64 0}
!37 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!38 = !{!10, !13, i64 212}
!39 = !{!10, !13, i64 216}
!40 = !{!10, !19, i64 204}
!41 = !{!10, !13, i64 220}
!42 = !{!10, !19, i64 196}
!43 = !{!10, !13, i64 224}


; 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: mustprogress uwtable
define dso_local noundef i32 @_ZN13PoissonNeuron5resetER7SimInfo(ptr noundef nonnull align 8 dereferenceable(240) %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(56) %1) unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 208
  store i8 0, ptr %3, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 200
  %5 = load float, ptr %4, align 8, !tbaa !26
  %6 = getelementptr inbounds i8, ptr %1, i64 4
  %7 = load float, ptr %6, align 4, !tbaa !27
  %8 = fdiv float %5, %7
  %9 = fptosi float %8 to i32
  %10 = getelementptr inbounds i8, ptr %0, i64 212
  store i32 %9, ptr %10, align 4, !tbaa !37
  %11 = getelementptr inbounds i8, ptr %0, i64 88
  %12 = getelementptr inbounds i8, ptr %0, i64 80
  %13 = tail call noundef i32 @_ZNSt20poisson_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_(ptr noundef nonnull align 8 dereferenceable(104) %11, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %14 = load i32, ptr %10, align 4, !tbaa !37
  %15 = add nsw i32 %14, %13
  store i32 %15, ptr %10, align 4, !tbaa !37
  %16 = getelementptr inbounds i8, ptr %0, i64 216
  store i32 %15, ptr %16, align 8, !tbaa !38
  %17 = getelementptr inbounds i8, ptr %0, i64 204
  %18 = load <4 x float>, ptr %17, align 4
  %19 = shufflevector <4 x float> %18, <4 x float> poison, <2 x i32> <i32 0, i32 poison>
  %20 = load <4 x float>, ptr %6, align 4
  %21 = getelementptr inbounds i8, ptr %0, i64 220
  %22 = getelementptr inbounds i8, ptr %0, i64 196
  %23 = load float, ptr %22, align 4, !tbaa !39
  %24 = insertelement <2 x float> %19, float %23, i64 1
  %25 = shufflevector <4 x float> %20, <4 x float> poison, <2 x i32> zeroinitializer
  %26 = fdiv <2 x float> %24, %25
  %27 = fptosi <2 x float> %26 to <2 x i32>
  store <2 x i32> %27, ptr %21, align 4, !tbaa !40
  ret i32 0
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZNSt20poisson_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_(ptr noundef nonnull align 8 dereferenceable(104), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 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" }

!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, !17, i64 208}
!6 = !{!"_ZTS13PoissonNeuron", !7, i64 0, !12, i64 56, !19, i64 80, !21, i64 88, !18, i64 192, !18, i64 196, !18, i64 200, !18, i64 204, !17, i64 208, !17, i64 209, !9, i64 212, !9, i64 216, !9, i64 220, !9, i64 224, !16, i64 232}
!7 = !{!"_ZTS10NeuronBase", !8, i64 0, !12, i64 16, !17, i64 40, !17, i64 41, !9, i64 44, !18, i64 48}
!8 = !{!"_ZTS4Base", !9, i64 8, !9, i64 12}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"_ZTSSt6vectorIP11SynapseBaseSaIS1_EE", !13, i64 0}
!13 = !{!"_ZTSSt12_Vector_baseIP11SynapseBaseSaIS1_EE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIP11SynapseBaseSaIS1_EE12_Vector_implE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIP11SynapseBaseSaIS1_EE17_Vector_impl_dataE", !16, i64 0, !16, i64 8, !16, i64 16}
!16 = !{!"any pointer", !10, i64 0}
!17 = !{!"bool", !10, i64 0}
!18 = !{!"float", !10, i64 0}
!19 = !{!"_ZTSSt26linear_congruential_engineImLm16807ELm0ELm2147483647EE", !20, i64 0}
!20 = !{!"long", !10, i64 0}
!21 = !{!"_ZTSSt20poisson_distributionIiE", !22, i64 0, !24, i64 72}
!22 = !{!"_ZTSNSt20poisson_distributionIiE10param_typeE", !23, i64 0, !23, i64 8, !23, i64 16, !23, i64 24, !23, i64 32, !23, i64 40, !23, i64 48, !23, i64 56, !23, i64 64}
!23 = !{!"double", !10, i64 0}
!24 = !{!"_ZTSSt19normal_distributionIdE", !25, i64 0, !23, i64 16, !17, i64 24}
!25 = !{!"_ZTSNSt19normal_distributionIdE10param_typeE", !23, i64 0, !23, i64 8}
!26 = !{!6, !18, i64 200}
!27 = !{!28, !18, i64 4}
!28 = !{!"_ZTS7SimInfo", !9, i64 0, !18, i64 4, !29, i64 8, !33, i64 32}
!29 = !{!"_ZTSSt6vectorIiSaIiEE", !30, i64 0}
!30 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !31, i64 0}
!31 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !32, i64 0}
!32 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !16, i64 0, !16, i64 8, !16, i64 16}
!33 = !{!"_ZTSSt6vectorIfSaIfEE", !34, i64 0}
!34 = !{!"_ZTSSt12_Vector_baseIfSaIfEE", !35, i64 0}
!35 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE12_Vector_implE", !36, i64 0}
!36 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE17_Vector_impl_dataE", !16, i64 0, !16, i64 8, !16, i64 16}
!37 = !{!6, !9, i64 212}
!38 = !{!6, !9, i64 216}
!39 = !{!6, !18, i64 196}
!40 = !{!9, !9, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,TailCallElimPass,VectorCombinePass