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

; 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_y(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
  %20 = 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
  %21 = load i16, ptr %12, align 2, !tbaa !9
  %22 = zext i16 %21 to i32
  %23 = load i16, ptr %13, align 2, !tbaa !9
  %24 = zext i16 %23 to i32
  %25 = mul nsw i32 %22, %24
  store i32 %25, ptr %17, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  %26 = load i16, ptr %10, align 2, !tbaa !9
  %27 = zext i16 %26 to i32
  %28 = load i16, ptr %11, align 2, !tbaa !9
  %29 = zext i16 %28 to i32
  %30 = mul nsw i32 %27, %29
  store i32 %30, ptr %18, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  %31 = load i16, ptr %10, align 2, !tbaa !9
  %32 = zext i16 %31 to i32
  %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 %19, 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 = mul i32 %36, %38
  %40 = load ptr, ptr %14, align 8, !tbaa !5
  %41 = zext i32 %39 to i64
  %42 = getelementptr inbounds i8, ptr %40, i64 %41
  store ptr %42, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #3
  store i32 0, ptr %20, align 4, !tbaa !11
  br label %43

43:                                               ; preds = %59, %8
  %44 = load i32, ptr %20, align 4, !tbaa !11
  %45 = load i32, ptr %17, align 4, !tbaa !11
  %46 = icmp ult i32 %44, %45
  br i1 %46, label %47, label %62

47:                                               ; preds = %43
  %48 = load ptr, ptr %14, align 8, !tbaa !5
  %49 = load ptr, ptr %9, align 8, !tbaa !5
  %50 = load i32, ptr %18, align 4, !tbaa !11
  call void @arm_memcpy_q7(ptr noundef %48, ptr noundef %49, i32 noundef %50)
  %51 = load i32, ptr %18, align 4, !tbaa !11
  %52 = load ptr, ptr %9, align 8, !tbaa !5
  %53 = zext i32 %51 to i64
  %54 = getelementptr inbounds i8, ptr %52, i64 %53
  store ptr %54, ptr %9, align 8, !tbaa !5
  %55 = load i32, ptr %19, align 4, !tbaa !11
  %56 = load ptr, ptr %14, align 8, !tbaa !5
  %57 = zext i32 %55 to i64
  %58 = getelementptr inbounds i8, ptr %56, i64 %57
  store ptr %58, ptr %14, align 8, !tbaa !5
  br label %59

59:                                               ; preds = %47
  %60 = load i32, ptr %20, align 4, !tbaa !11
  %61 = add i32 %60, 1
  store i32 %61, ptr %20, align 4, !tbaa !11
  br label %43, !llvm.loop !13

62:                                               ; preds = %43
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #3
  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_y(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 %3 to i32
  %10 = zext i16 %4 to i32
  %11 = mul nuw nsw i32 %10, %9
  %12 = zext i16 %1 to i32
  %13 = zext i16 %2 to i32
  %14 = mul nuw nsw i32 %13, %12
  %.not = icmp eq i32 %11, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %8
  %15 = mul i32 %12, %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 %18, %12
  %20 = zext nneg i32 %14 to i64
  %21 = zext nneg i32 %19 to i64
  br label %22

22:                                               ; preds = %.lr.ph, %22
  %.022 = phi i32 [ 0, %.lr.ph ], [ %25, %22 ]
  %.01821 = phi ptr [ %0, %.lr.ph ], [ %23, %22 ]
  %.01920 = phi ptr [ %17, %.lr.ph ], [ %24, %22 ]
  tail call void @arm_memcpy_q7(ptr noundef %.01920, ptr noundef %.01821, i32 noundef %14)
  %23 = getelementptr inbounds i8, ptr %.01821, i64 %20
  %24 = getelementptr inbounds i8, ptr %.01920, i64 %21
  %25 = add nuw i32 %.022, 1
  %exitcond.not = icmp eq i32 %25, %11
  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