; LLVM IR from ermig1979/Simd :: src/Simd (SimdBaseSynetConvolution8i)

; 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.Simd::Base::SynetConvolution8iGemmNN" = type { %"class.Simd::SynetConvolution8i", i8, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 }
%"class.Simd::SynetConvolution8i" = type { %"struct.Simd::Deletable", %"struct.Simd::ConvParam", %"struct.Simd::Array", %"class.std::__cxx11::basic_string", ptr, %"struct.Simd::CvtParam", %"struct.Simd::CvtParam", %"struct.Simd::Array.1", %"struct.Simd::Array.0", %"struct.Simd::Array.0", %"struct.Simd::Array.0", i8, i8, i64, i64, i64 }
%"struct.Simd::Deletable" = type { ptr }
%"struct.Simd::ConvParam" = type <{ %struct.SimdConvolutionParameters, i32, [4 x i8], i64, i32, [4 x i8] }>
%struct.SimdConvolutionParameters = type { i64, i64, i64, i32, i32, i64, i64, i64, i32, i32, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i32 }
%"struct.Simd::Array" = type { ptr, i64 }
%"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] }
%"struct.Simd::CvtParam" = type <{ %"struct.Simd::Array", %"struct.Simd::Array.0", %"struct.Simd::Array.0", %"struct.Simd::Array.0", %"struct.Simd::Array.0", i8, [3 x i8], i32, i32, i32, i32, [4 x i8] }>
%"struct.Simd::Array.1" = type { ptr, i64 }
%"struct.Simd::Array.0" = type { ptr, i64 }

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNK4Simd18SynetConvolution8i18ExternalBufferSizeEv(ptr noundef nonnull align 8 dereferenceable(552)) unnamed_addr #1 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN4Simd7AlignHiEmm(i64 noundef, i64 noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZNK4Simd4Base24SynetConvolution8iGemmNN18ExternalBufferSizeEv(ptr noundef nonnull align 8 dereferenceable(648) %0) unnamed_addr #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %5 = call noundef i64 @_ZNK4Simd18SynetConvolution8i18ExternalBufferSizeEv(ptr noundef nonnull align 8 dereferenceable(552) %4)
  store i64 %5, ptr %3, align 8, !tbaa !9
  %6 = getelementptr inbounds %"class.Simd::Base::SynetConvolution8iGemmNN", ptr %4, i32 0, i32 1
  %7 = load i8, ptr %6, align 8, !tbaa !11, !range !30, !noundef !31
  %8 = trunc i8 %7 to i1
  br i1 %8, label %19, label %9

9:                                                ; preds = %1
  %10 = getelementptr inbounds %"class.Simd::Base::SynetConvolution8iGemmNN", ptr %4, i32 0, i32 12
  %11 = load i64, ptr %10, align 8, !tbaa !32
  %12 = getelementptr inbounds %"class.Simd::SynetConvolution8i", ptr %4, i32 0, i32 13
  %13 = load i64, ptr %12, align 8, !tbaa !33
  %14 = mul i64 %11, %13
  %15 = mul i64 %14, 1
  %16 = call noundef i64 @_ZN4Simd7AlignHiEmm(i64 noundef %15, i64 noundef 8)
  %17 = load i64, ptr %3, align 8, !tbaa !9
  %18 = add i64 %17, %16
  store i64 %18, ptr %3, align 8, !tbaa !9
  br label %19

19:                                               ; preds = %9, %1
  %20 = getelementptr inbounds %"class.Simd::SynetConvolution8i", ptr %4, i32 0, i32 15
  %21 = load i64, ptr %20, align 8, !tbaa !34
  %22 = getelementptr inbounds %"class.Simd::SynetConvolution8i", ptr %4, i32 0, i32 13
  %23 = load i64, ptr %22, align 8, !tbaa !33
  %24 = mul i64 %21, %23
  %25 = mul i64 %24, 4
  %26 = call noundef i64 @_ZN4Simd7AlignHiEmm(i64 noundef %25, i64 noundef 8)
  %27 = load i64, ptr %3, align 8, !tbaa !9
  %28 = add i64 %27, %26
  store i64 %28, ptr %3, align 8, !tbaa !9
  %29 = getelementptr inbounds %"class.Simd::SynetConvolution8i", ptr %4, i32 0, i32 12
  %30 = load i8, ptr %29, align 1, !tbaa !35, !range !30, !noundef !31
  %31 = trunc i8 %30 to i1
  br i1 %31, label %32, label %42

32:                                               ; preds = %19
  %33 = getelementptr inbounds %"class.Simd::SynetConvolution8i", ptr %4, i32 0, i32 15
  %34 = load i64, ptr %33, align 8, !tbaa !34
  %35 = getelementptr inbounds %"class.Simd::SynetConvolution8i", ptr %4, i32 0, i32 13
  %36 = load i64, ptr %35, align 8, !tbaa !33
  %37 = mul i64 %34, %36
  %38 = mul i64 %37, 4
  %39 = call noundef i64 @_ZN4Simd7AlignHiEmm(i64 noundef %38, i64 noundef 8)
  %40 = load i64, ptr %3, align 8, !tbaa !9
  %41 = add i64 %40, %39
  store i64 %41, ptr %3, align 8, !tbaa !9
  br label %42

42:                                               ; preds = %32, %19
  %43 = load i64, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  ret i64 %43
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { alwaysinline 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 #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 = !{!"long", !7, i64 0}
!11 = !{!12, !27, i64 552}
!12 = !{!"_ZTSN4Simd4Base24SynetConvolution8iGemmNNE", !13, i64 0, !27, i64 552, !10, i64 560, !10, i64 568, !10, i64 576, !10, i64 584, !10, i64 592, !10, i64 600, !10, i64 608, !10, i64 616, !10, i64 624, !10, i64 632, !10, i64 640}
!13 = !{!"_ZTSN4Simd18SynetConvolution8iE", !14, i64 0, !15, i64 8, !22, i64 192, !23, i64 208, !6, i64 240, !25, i64 248, !25, i64 352, !29, i64 456, !26, i64 472, !26, i64 488, !26, i64 504, !27, i64 520, !27, i64 521, !10, i64 528, !10, i64 536, !10, i64 544}
!14 = !{!"_ZTSN4Simd9DeletableE"}
!15 = !{!"_ZTSN4Simd9ConvParamE", !16, i64 0, !20, i64 160, !10, i64 168, !21, i64 176}
!16 = !{!"_ZTS25SimdConvolutionParameters", !10, i64 0, !10, i64 8, !10, i64 16, !17, i64 24, !18, i64 28, !10, i64 32, !10, i64 40, !10, i64 48, !17, i64 56, !18, i64 60, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !19, i64 152}
!17 = !{!"_ZTS18SimdTensorDataType", !7, i64 0}
!18 = !{!"_ZTS20SimdTensorFormatType", !7, i64 0}
!19 = !{!"_ZTS29SimdConvolutionActivationType", !7, i64 0}
!20 = !{!"_ZTS8SimdBool", !7, i64 0}
!21 = !{!"_ZTS26SimdSynetCompatibilityType", !7, i64 0}
!22 = !{!"_ZTSN4Simd5ArrayIhEE", !6, i64 0, !10, i64 8}
!23 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !24, i64 0, !10, i64 8, !7, i64 16}
!24 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!25 = !{!"_ZTSN4Simd8CvtParamE", !22, i64 0, !26, i64 16, !26, i64 32, !26, i64 48, !26, i64 64, !27, i64 80, !28, i64 84, !28, i64 88, !28, i64 92, !28, i64 96}
!26 = !{!"_ZTSN4Simd5ArrayIfEE", !6, i64 0, !10, i64 8}
!27 = !{!"bool", !7, i64 0}
!28 = !{!"int", !7, i64 0}
!29 = !{!"_ZTSN4Simd5ArrayIaEE", !6, i64 0, !10, i64 8}
!30 = !{i8 0, i8 2}
!31 = !{}
!32 = !{!12, !10, i64 640}
!33 = !{!13, !10, i64 528}
!34 = !{!13, !10, i64 544}
!35 = !{!13, !27, i64 521}


; 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
declare dso_local noundef i64 @_ZNK4Simd18SynetConvolution8i18ExternalBufferSizeEv(ptr noundef nonnull align 8 dereferenceable(552)) unnamed_addr #0 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN4Simd7AlignHiEmm(i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZNK4Simd4Base24SynetConvolution8iGemmNN18ExternalBufferSizeEv(ptr noundef nonnull align 8 dereferenceable(648) %0) unnamed_addr #0 align 2 {
  %2 = tail call noundef i64 @_ZNK4Simd18SynetConvolution8i18ExternalBufferSizeEv(ptr noundef nonnull align 8 dereferenceable(552) %0)
  %3 = getelementptr inbounds i8, ptr %0, i64 552
  %4 = load i8, ptr %3, align 8, !tbaa !5, !range !28, !noundef !29
  %5 = trunc nuw i8 %4 to i1
  br i1 %5, label %14, label %6

6:                                                ; preds = %1
  %7 = getelementptr inbounds i8, ptr %0, i64 640
  %8 = load i64, ptr %7, align 8, !tbaa !30
  %9 = getelementptr inbounds i8, ptr %0, i64 528
  %10 = load i64, ptr %9, align 8, !tbaa !31
  %11 = mul i64 %10, %8
  %12 = tail call noundef i64 @_ZN4Simd7AlignHiEmm(i64 noundef %11, i64 noundef 8)
  %13 = add i64 %12, %2
  br label %14

14:                                               ; preds = %6, %1
  %.0 = phi i64 [ %2, %1 ], [ %13, %6 ]
  %15 = getelementptr inbounds i8, ptr %0, i64 544
  %16 = load i64, ptr %15, align 8, !tbaa !32
  %17 = getelementptr inbounds i8, ptr %0, i64 528
  %18 = load i64, ptr %17, align 8, !tbaa !31
  %19 = shl i64 %16, 2
  %20 = mul i64 %19, %18
  %21 = tail call noundef i64 @_ZN4Simd7AlignHiEmm(i64 noundef %20, i64 noundef 8)
  %22 = add i64 %21, %.0
  %23 = getelementptr inbounds i8, ptr %0, i64 521
  %24 = load i8, ptr %23, align 1, !tbaa !33, !range !28, !noundef !29
  %25 = trunc nuw i8 %24 to i1
  br i1 %25, label %26, label %33

26:                                               ; preds = %14
  %27 = load i64, ptr %15, align 8, !tbaa !32
  %28 = load i64, ptr %17, align 8, !tbaa !31
  %29 = shl i64 %27, 2
  %30 = mul i64 %29, %28
  %31 = tail call noundef i64 @_ZN4Simd7AlignHiEmm(i64 noundef %30, i64 noundef 8)
  %32 = add i64 %31, %22
  br label %33

33:                                               ; preds = %26, %14
  %.1 = phi i64 [ %32, %26 ], [ %22, %14 ]
  ret i64 %.1
}

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 = { alwaysinline 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" }

!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, !25, i64 552}
!6 = !{!"_ZTSN4Simd4Base24SynetConvolution8iGemmNNE", !7, i64 0, !25, i64 552, !11, i64 560, !11, i64 568, !11, i64 576, !11, i64 584, !11, i64 592, !11, i64 600, !11, i64 608, !11, i64 616, !11, i64 624, !11, i64 632, !11, i64 640}
!7 = !{!"_ZTSN4Simd18SynetConvolution8iE", !8, i64 0, !9, i64 8, !19, i64 192, !21, i64 208, !20, i64 240, !23, i64 248, !23, i64 352, !27, i64 456, !24, i64 472, !24, i64 488, !24, i64 504, !25, i64 520, !25, i64 521, !11, i64 528, !11, i64 536, !11, i64 544}
!8 = !{!"_ZTSN4Simd9DeletableE"}
!9 = !{!"_ZTSN4Simd9ConvParamE", !10, i64 0, !17, i64 160, !11, i64 168, !18, i64 176}
!10 = !{!"_ZTS25SimdConvolutionParameters", !11, i64 0, !11, i64 8, !11, i64 16, !14, i64 24, !15, i64 28, !11, i64 32, !11, i64 40, !11, i64 48, !14, i64 56, !15, i64 60, !11, i64 64, !11, i64 72, !11, i64 80, !11, i64 88, !11, i64 96, !11, i64 104, !11, i64 112, !11, i64 120, !11, i64 128, !11, i64 136, !11, i64 144, !16, i64 152}
!11 = !{!"long", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C++ TBAA"}
!14 = !{!"_ZTS18SimdTensorDataType", !12, i64 0}
!15 = !{!"_ZTS20SimdTensorFormatType", !12, i64 0}
!16 = !{!"_ZTS29SimdConvolutionActivationType", !12, i64 0}
!17 = !{!"_ZTS8SimdBool", !12, i64 0}
!18 = !{!"_ZTS26SimdSynetCompatibilityType", !12, i64 0}
!19 = !{!"_ZTSN4Simd5ArrayIhEE", !20, i64 0, !11, i64 8}
!20 = !{!"any pointer", !12, i64 0}
!21 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !22, i64 0, !11, i64 8, !12, i64 16}
!22 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !20, i64 0}
!23 = !{!"_ZTSN4Simd8CvtParamE", !19, i64 0, !24, i64 16, !24, i64 32, !24, i64 48, !24, i64 64, !25, i64 80, !26, i64 84, !26, i64 88, !26, i64 92, !26, i64 96}
!24 = !{!"_ZTSN4Simd5ArrayIfEE", !20, i64 0, !11, i64 8}
!25 = !{!"bool", !12, i64 0}
!26 = !{!"int", !12, i64 0}
!27 = !{!"_ZTSN4Simd5ArrayIaEE", !20, i64 0, !11, i64 8}
!28 = !{i8 0, i8 2}
!29 = !{}
!30 = !{!6, !11, i64 640}
!31 = !{!7, !11, i64 528}
!32 = !{!7, !11, i64 544}
!33 = !{!7, !25, i64 521}


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