; LLVM IR from ubaldot/defrecs :: stm32f4x/ADC_Readings/Drivers/CMSIS/NN/Source/ConcatenationFunctions (z)

; 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"

; Function Attrs: nounwind uwtable
define dso_local void @arm_concatenation_s8_z(ptr noundef %0, i16 noundef zeroext %1, i16 noundef zeroext %2, i16 noundef zeroext %3, i16 noundef zeroext %4, ptr noundef %5, i16 noundef zeroext %6, i32 noundef %7) #0 {
  %9 = alloca ptr, align 8
  %10 = alloca i16, align 2
  %11 = alloca i16, align 2
  %12 = alloca i16, align 2
  %13 = alloca i16, align 2
  %14 = alloca ptr, align 8
  %15 = alloca i16, align 2
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store i16 %1, ptr %10, align 2, !tbaa !9
  store i16 %2, ptr %11, align 2, !tbaa !9
  store i16 %3, ptr %12, align 2, !tbaa !9
  store i16 %4, ptr %13, align 2, !tbaa !9
  store ptr %5, ptr %14, align 8, !tbaa !5
  store i16 %6, ptr %15, align 2, !tbaa !9
  store i32 %7, ptr %16, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %20 = load i16, ptr %10, align 2, !tbaa !9
  %21 = zext i16 %20 to i32
  %22 = load i16, ptr %11, align 2, !tbaa !9
  %23 = zext i16 %22 to i32
  %24 = mul nsw i32 %21, %23
  %25 = load i16, ptr %12, align 2, !tbaa !9
  %26 = zext i16 %25 to i32
  %27 = mul nsw i32 %24, %26
  store i32 %27, ptr %17, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  %28 = load i16, ptr %10, align 2, !tbaa !9
  %29 = zext i16 %28 to i32
  %30 = load i16, ptr %11, align 2, !tbaa !9
  %31 = zext i16 %30 to i32
  %32 = mul nsw i32 %29, %31
  %33 = load i16, ptr %15, align 2, !tbaa !9
  %34 = zext i16 %33 to i32
  %35 = mul nsw i32 %32, %34
  store i32 %35, ptr %18, align 4, !tbaa !11
  %36 = load i32, ptr %16, align 4, !tbaa !11
  %37 = load i16, ptr %10, align 2, !tbaa !9
  %38 = zext i16 %37 to i32
  %39 = load i16, ptr %11, align 2, !tbaa !9
  %40 = zext i16 %39 to i32
  %41 = mul nsw i32 %38, %40
  %42 = mul i32 %36, %41
  %43 = load ptr, ptr %14, align 8, !tbaa !5
  %44 = zext i32 %42 to i64
  %45 = getelementptr inbounds i8, ptr %43, i64 %44
  store ptr %45, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  store i32 0, ptr %19, align 4, !tbaa !11
  br label %46

46:                                               ; preds = %63, %8
  %47 = load i32, ptr %19, align 4, !tbaa !11
  %48 = load i16, ptr %13, align 2, !tbaa !9
  %49 = zext i16 %48 to i32
  %50 = icmp ult i32 %47, %49
  br i1 %50, label %51, label %66

51:                                               ; preds = %46
  %52 = load ptr, ptr %14, align 8, !tbaa !5
  %53 = load ptr, ptr %9, align 8, !tbaa !5
  %54 = load i32, ptr %17, align 4, !tbaa !11
  call void @arm_memcpy_q7(ptr noundef %52, ptr noundef %53, i32 noundef %54)
  %55 = load i32, ptr %17, align 4, !tbaa !11
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  %57 = zext i32 %55 to i64
  %58 = getelementptr inbounds i8, ptr %56, i64 %57
  store ptr %58, ptr %9, align 8, !tbaa !5
  %59 = load i32, ptr %18, align 4, !tbaa !11
  %60 = load ptr, ptr %14, align 8, !tbaa !5
  %61 = zext i32 %59 to i64
  %62 = getelementptr inbounds i8, ptr %60, i64 %61
  store ptr %62, ptr %14, align 8, !tbaa !5
  br label %63

63:                                               ; preds = %51
  %64 = load i32, ptr %19, align 4, !tbaa !11
  %65 = add i32 %64, 1
  store i32 %65, ptr %19, align 4, !tbaa !11
  br label %46, !llvm.loop !13

66:                                               ; preds = %46
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  ret void
}

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @arm_memcpy_q7(ptr noalias noundef, ptr noalias noundef, i32 noundef) #2

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

attributes #0 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { alwaysinline 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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: nounwind uwtable
define dso_local void @arm_concatenation_s8_z(ptr noundef %0, i16 noundef zeroext %1, i16 noundef zeroext %2, i16 noundef zeroext %3, i16 noundef zeroext %4, ptr noundef %5, i16 noundef zeroext %6, i32 noundef %7) local_unnamed_addr #0 {
  %9 = zext i16 %1 to i32
  %10 = zext i16 %2 to i32
  %11 = mul nuw nsw i32 %10, %9
  %12 = zext i16 %3 to i32
  %13 = mul nuw nsw i32 %11, %12
  %14 = zext i16 %4 to i32
  %.not = icmp eq i16 %4, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %8
  %15 = mul i32 %11, %7
  %16 = zext i32 %15 to i64
  %17 = getelementptr inbounds i8, ptr %5, i64 %16
  %18 = zext i16 %6 to i32
  %19 = mul nuw nsw i32 %11, %18
  %20 = zext nneg i32 %13 to i64
  %21 = zext nneg i32 %19 to i64
  br label %22

22:                                               ; preds = %.lr.ph, %22
  %.023 = phi i32 [ 0, %.lr.ph ], [ %25, %22 ]
  %.01922 = phi ptr [ %0, %.lr.ph ], [ %23, %22 ]
  %.02021 = phi ptr [ %17, %.lr.ph ], [ %24, %22 ]
  tail call void @arm_memcpy_q7(ptr noundef %.02021, ptr noundef %.01922, i32 noundef %13)
  %23 = getelementptr inbounds i8, ptr %.01922, i64 %20
  %24 = getelementptr inbounds i8, ptr %.02021, i64 %21
  %25 = add nuw nsw i32 %.023, 1
  %exitcond.not = icmp eq i32 %25, %14
  br i1 %exitcond.not, label %._crit_edge, label %22, !llvm.loop !5

._crit_edge:                                      ; preds = %22, %8
  ret void
}

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @arm_memcpy_q7(ptr noalias noundef, ptr noalias noundef, i32 noundef) local_unnamed_addr #1

attributes #0 = { 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 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass