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

; 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::SynetMergedConvolution8i" = type { %"class.Simd::SynetMergedConvolution8i", %"struct.Simd::MergConvParam8i", i8, i8, i8, i8, i64, i64, [2 x i64], [5 x i64], [3 x %"struct.Simd::CvtParam"], %"struct.Simd::Array", [2 x %"struct.Simd::Array.1"], %"struct.Simd::Array.0", [2 x %"struct.Simd::Array.0"], [3 x %"struct.Simd::Array.0"], [3 x %"struct.Simd::Array.0"], %"struct.Simd::Base::SynetMergedConvolution8i::AlgParam", ptr, ptr, ptr, ptr, [2 x ptr], %"class.std::__cxx11::basic_string" }
%"class.Simd::SynetMergedConvolution8i" = type { %"struct.Simd::Deletable" }
%"struct.Simd::Deletable" = type { ptr }
%"struct.Simd::MergConvParam8i" = type { i64, [3 x %"struct.Simd::ConvParam"] }
%"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::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" = type { ptr, i64 }
%"struct.Simd::Array.1" = type { ptr, i64 }
%"struct.Simd::Array.0" = type { ptr, i64 }
%"struct.Simd::Base::SynetMergedConvolution8i::AlgParam" = type { i64, i64, [3 x i64], [3 x i64], [3 x i64], [2 x i64], [3 x i64], i64, 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: 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
define dso_local noundef i64 @_ZNK4Simd4Base24SynetMergedConvolution8i18InternalBufferSizeEv(ptr noundef nonnull align 8 dereferenceable(1376) %0) unnamed_addr #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %6 = getelementptr inbounds %"class.Simd::Base::SynetMergedConvolution8i", ptr %5, i32 0, i32 11
  %7 = call noundef i64 @_ZNK4Simd5ArrayIhE7RawSizeEv(ptr noundef nonnull align 8 dereferenceable(16) %6)
  %8 = getelementptr inbounds %"class.Simd::Base::SynetMergedConvolution8i", ptr %5, i32 0, i32 13
  %9 = call noundef i64 @_ZNK4Simd5ArrayIfE7RawSizeEv(ptr noundef nonnull align 8 dereferenceable(16) %8)
  %10 = add i64 %7, %9
  store i64 %10, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  store i64 0, ptr %4, align 8, !tbaa !9
  br label %11

11:                                               ; preds = %47, %1
  %12 = load i64, ptr %4, align 8, !tbaa !9
  %13 = icmp ult i64 %12, 3
  br i1 %13, label %15, label %14

14:                                               ; preds = %11
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  br label %50

15:                                               ; preds = %11
  %16 = load i64, ptr %4, align 8, !tbaa !9
  %17 = icmp ult i64 %16, 2
  br i1 %17, label %18, label %30

18:                                               ; preds = %15
  %19 = getelementptr inbounds %"class.Simd::Base::SynetMergedConvolution8i", ptr %5, i32 0, i32 14
  %20 = load i64, ptr %4, align 8, !tbaa !9
  %21 = getelementptr inbounds [2 x %"struct.Simd::Array.0"], ptr %19, i64 0, i64 %20
  %22 = call noundef i64 @_ZNK4Simd5ArrayIfE7RawSizeEv(ptr noundef nonnull align 8 dereferenceable(16) %21)
  %23 = getelementptr inbounds %"class.Simd::Base::SynetMergedConvolution8i", ptr %5, i32 0, i32 12
  %24 = load i64, ptr %4, align 8, !tbaa !9
  %25 = getelementptr inbounds [2 x %"struct.Simd::Array.1"], ptr %23, i64 0, i64 %24
  %26 = call noundef i64 @_ZNK4Simd5ArrayIaE7RawSizeEv(ptr noundef nonnull align 8 dereferenceable(16) %25)
  %27 = add i64 %22, %26
  %28 = load i64, ptr %3, align 8, !tbaa !9
  %29 = add i64 %28, %27
  store i64 %29, ptr %3, align 8, !tbaa !9
  br label %30

30:                                               ; preds = %18, %15
  %31 = getelementptr inbounds %"class.Simd::Base::SynetMergedConvolution8i", ptr %5, i32 0, i32 15
  %32 = load i64, ptr %4, align 8, !tbaa !9
  %33 = getelementptr inbounds [3 x %"struct.Simd::Array.0"], ptr %31, i64 0, i64 %32
  %34 = call noundef i64 @_ZNK4Simd5ArrayIfE7RawSizeEv(ptr noundef nonnull align 8 dereferenceable(16) %33)
  %35 = getelementptr inbounds %"class.Simd::Base::SynetMergedConvolution8i", ptr %5, i32 0, i32 16
  %36 = load i64, ptr %4, align 8, !tbaa !9
  %37 = getelementptr inbounds [3 x %"struct.Simd::Array.0"], ptr %35, i64 0, i64 %36
  %38 = call noundef i64 @_ZNK4Simd5ArrayIfE7RawSizeEv(ptr noundef nonnull align 8 dereferenceable(16) %37)
  %39 = add i64 %34, %38
  %40 = getelementptr inbounds %"class.Simd::Base::SynetMergedConvolution8i", ptr %5, i32 0, i32 10
  %41 = load i64, ptr %4, align 8, !tbaa !9
  %42 = getelementptr inbounds [3 x %"struct.Simd::CvtParam"], ptr %40, i64 0, i64 %41
  %43 = call noundef i64 @_ZNK4Simd8CvtParam4SizeEv(ptr noundef nonnull align 8 dereferenceable(100) %42)
  %44 = add i64 %39, %43
  %45 = load i64, ptr %3, align 8, !tbaa !9
  %46 = add i64 %45, %44
  store i64 %46, ptr %3, align 8, !tbaa !9
  br label %47

47:                                               ; preds = %30
  %48 = load i64, ptr %4, align 8, !tbaa !9
  %49 = add i64 %48, 1
  store i64 %49, ptr %4, align 8, !tbaa !9
  br label %11, !llvm.loop !11

50:                                               ; preds = %14
  %51 = load i64, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  ret i64 %51
}

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK4Simd5ArrayIhE7RawSizeEv(ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK4Simd5ArrayIfE7RawSizeEv(ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK4Simd5ArrayIaE7RawSizeEv(ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK4Simd8CvtParam4SizeEv(ptr noundef nonnull align 8 dereferenceable(100)) #3 align 2

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 = { 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 #4 = { 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; 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 nounwind uwtable
define dso_local noundef i64 @_ZNK4Simd4Base24SynetMergedConvolution8i18InternalBufferSizeEv(ptr noundef nonnull align 8 dereferenceable(1376) %0) unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 960
  %3 = tail call noundef i64 @_ZNK4Simd5ArrayIhE7RawSizeEv(ptr noundef nonnull align 8 dereferenceable(16) %2)
  %4 = getelementptr inbounds i8, ptr %0, i64 1008
  %5 = tail call noundef i64 @_ZNK4Simd5ArrayIfE7RawSizeEv(ptr noundef nonnull align 8 dereferenceable(16) %4)
  %6 = getelementptr inbounds i8, ptr %0, i64 1056
  %7 = getelementptr inbounds i8, ptr %0, i64 1104
  %8 = getelementptr inbounds i8, ptr %0, i64 648
  %9 = getelementptr inbounds i8, ptr %0, i64 976
  %10 = getelementptr inbounds i8, ptr %0, i64 1024
  %11 = tail call noundef i64 @_ZNK4Simd5ArrayIfE7RawSizeEv(ptr noundef nonnull align 8 dereferenceable(16) %10)
  %12 = tail call noundef i64 @_ZNK4Simd5ArrayIaE7RawSizeEv(ptr noundef nonnull align 8 dereferenceable(16) %9)
  %13 = tail call noundef i64 @_ZNK4Simd5ArrayIfE7RawSizeEv(ptr noundef nonnull align 8 dereferenceable(16) %6)
  %14 = tail call noundef i64 @_ZNK4Simd5ArrayIfE7RawSizeEv(ptr noundef nonnull align 8 dereferenceable(16) %7)
  %15 = tail call noundef i64 @_ZNK4Simd8CvtParam4SizeEv(ptr noundef nonnull align 8 dereferenceable(100) %8)
  %16 = getelementptr inbounds i8, ptr %0, i64 1040
  %17 = tail call noundef i64 @_ZNK4Simd5ArrayIfE7RawSizeEv(ptr noundef nonnull align 8 dereferenceable(16) %16)
  %18 = getelementptr inbounds i8, ptr %0, i64 992
  %19 = tail call noundef i64 @_ZNK4Simd5ArrayIaE7RawSizeEv(ptr noundef nonnull align 8 dereferenceable(16) %18)
  %20 = getelementptr inbounds i8, ptr %0, i64 1072
  %21 = tail call noundef i64 @_ZNK4Simd5ArrayIfE7RawSizeEv(ptr noundef nonnull align 8 dereferenceable(16) %20)
  %22 = getelementptr inbounds i8, ptr %0, i64 1120
  %23 = tail call noundef i64 @_ZNK4Simd5ArrayIfE7RawSizeEv(ptr noundef nonnull align 8 dereferenceable(16) %22)
  %24 = getelementptr inbounds i8, ptr %0, i64 752
  %25 = tail call noundef i64 @_ZNK4Simd8CvtParam4SizeEv(ptr noundef nonnull align 8 dereferenceable(100) %24)
  %26 = add i64 %5, %3
  %27 = add i64 %11, %26
  %28 = add i64 %27, %12
  %29 = add i64 %13, %28
  %30 = add i64 %29, %14
  %31 = add i64 %30, %15
  %32 = add i64 %17, %31
  %33 = add i64 %32, %19
  %34 = add i64 %21, %33
  %35 = add i64 %34, %23
  %36 = add i64 %35, %25
  %37 = getelementptr inbounds i8, ptr %0, i64 1088
  %38 = tail call noundef i64 @_ZNK4Simd5ArrayIfE7RawSizeEv(ptr noundef nonnull align 8 dereferenceable(16) %37)
  %39 = getelementptr inbounds i8, ptr %0, i64 1136
  %40 = tail call noundef i64 @_ZNK4Simd5ArrayIfE7RawSizeEv(ptr noundef nonnull align 8 dereferenceable(16) %39)
  %41 = getelementptr inbounds i8, ptr %0, i64 856
  %42 = tail call noundef i64 @_ZNK4Simd8CvtParam4SizeEv(ptr noundef nonnull align 8 dereferenceable(100) %41)
  %43 = add i64 %38, %36
  %44 = add i64 %43, %40
  %45 = add i64 %44, %42
  ret i64 %45
}

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK4Simd5ArrayIhE7RawSizeEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK4Simd5ArrayIfE7RawSizeEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK4Simd5ArrayIaE7RawSizeEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK4Simd8CvtParam4SizeEv(ptr noundef nonnull align 8 dereferenceable(100)) local_unnamed_addr #0 align 2

attributes #0 = { 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 #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)"}


; Effective O3 passes: GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass