; LLVM IR from libxsmm/libxsmm :: src (generator_mateltwise_transform_aarch64_asimd)

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

@__func__.libxsmm_generator_transform_Xway_unpack_network_aarch64_asimd = external hidden unnamed_addr constant [62 x i8], align 1
@.str = external hidden unnamed_addr constant [100 x i8], align 1
@libxsmm_ninit = external global i32, align 4
@libxsmm_verbosity = external global i32, align 4

; Function Attrs: nounwind uwtable
define dso_local void @libxsmm_generator_transform_Xway_unpack_network_aarch64_asimd(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, i32 noundef %7, i32 noundef %8, i32 noundef %9) #0 {
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %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
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  store ptr %0, ptr %11, align 8, !tbaa !5
  store ptr %1, ptr %12, align 8, !tbaa !5
  store ptr %2, ptr %13, align 8, !tbaa !5
  store i32 %3, ptr %14, align 4, !tbaa !9
  store i32 %4, ptr %15, align 4, !tbaa !9
  store i32 %5, ptr %16, align 4, !tbaa !9
  store i32 %6, ptr %17, align 4, !tbaa !9
  store i32 %7, ptr %18, align 4, !tbaa !9
  store i32 %8, ptr %19, align 4, !tbaa !9
  store i32 %9, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #3
  store i32 0, ptr %21, align 4, !tbaa !9
  %27 = load i32, ptr %19, align 4, !tbaa !9
  %28 = icmp ne i32 %27, 2
  br i1 %28, label %29, label %47

29:                                               ; preds = %10
  %30 = load i32, ptr %19, align 4, !tbaa !9
  %31 = icmp ne i32 %30, 4
  br i1 %31, label %32, label %47

32:                                               ; preds = %29
  %33 = load i32, ptr %19, align 4, !tbaa !9
  %34 = icmp ne i32 %33, 8
  br i1 %34, label %35, label %47

35:                                               ; preds = %32
  %36 = load i32, ptr %19, align 4, !tbaa !9
  %37 = icmp ne i32 %36, 16
  br i1 %37, label %38, label %47

38:                                               ; preds = %35
  %39 = load ptr, ptr %11, align 8, !tbaa !5
  %40 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !9
  %41 = icmp ult i32 1, %40
  br i1 %41, label %42, label %44

42:                                               ; preds = %38
  %43 = load i32, ptr @libxsmm_verbosity, align 4, !tbaa !9
  br label %45

44:                                               ; preds = %38
  br label %45

45:                                               ; preds = %44, %42
  %46 = phi i32 [ %43, %42 ], [ 1, %44 ]
  call void @libxsmm_handle_error(ptr noundef %39, i32 noundef 90000, ptr noundef @__func__.libxsmm_generator_transform_Xway_unpack_network_aarch64_asimd, ptr noundef @.str, i32 noundef 32, i32 noundef %46)
  store i32 1, ptr %22, align 4
  br label %110

47:                                               ; preds = %35, %32, %29, %10
  %48 = load i32, ptr %14, align 4, !tbaa !9
  %49 = load i32, ptr %19, align 4, !tbaa !9
  %50 = urem i32 %48, %49
  %51 = icmp ne i32 %50, 0
  br i1 %51, label %57, label %52

52:                                               ; preds = %47
  %53 = load i32, ptr %15, align 4, !tbaa !9
  %54 = load i32, ptr %19, align 4, !tbaa !9
  %55 = urem i32 %53, %54
  %56 = icmp ne i32 %55, 0
  br i1 %56, label %57, label %66

57:                                               ; preds = %52, %47
  %58 = load ptr, ptr %11, align 8, !tbaa !5
  %59 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !9
  %60 = icmp ult i32 1, %59
  br i1 %60, label %61, label %63

61:                                               ; preds = %57
  %62 = load i32, ptr @libxsmm_verbosity, align 4, !tbaa !9
  br label %64

63:                                               ; preds = %57
  br label %64

64:                                               ; preds = %63, %61
  %65 = phi i32 [ %62, %61 ], [ 1, %63 ]
  call void @libxsmm_handle_error(ptr noundef %58, i32 noundef 90000, ptr noundef @__func__.libxsmm_generator_transform_Xway_unpack_network_aarch64_asimd, ptr noundef @.str, i32 noundef 38, i32 noundef %65)
  store i32 1, ptr %22, align 4
  br label %110

66:                                               ; preds = %52
  store i32 0, ptr %21, align 4, !tbaa !9
  br label %67

67:                                               ; preds = %106, %66
  %68 = load i32, ptr %21, align 4, !tbaa !9
  %69 = load i32, ptr %19, align 4, !tbaa !9
  %70 = icmp ult i32 %68, %69
  br i1 %70, label %71, label %109

71:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #3
  %72 = load i32, ptr %21, align 4, !tbaa !9
  %73 = urem i32 %72, 2
  %74 = icmp eq i32 %73, 0
  br i1 %74, label %75, label %77

75:                                               ; preds = %71
  %76 = load i32, ptr %17, align 4, !tbaa !9
  br label %79

77:                                               ; preds = %71
  %78 = load i32, ptr %18, align 4, !tbaa !9
  br label %79

79:                                               ; preds = %77, %75
  %80 = phi i32 [ %76, %75 ], [ %78, %77 ]
  store i32 %80, ptr %23, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #3
  %81 = load ptr, ptr %12, align 8, !tbaa !5
  %82 = load i32, ptr %21, align 4, !tbaa !9
  %83 = zext i32 %82 to i64
  %84 = getelementptr inbounds i8, ptr %81, i64 %83
  %85 = load i8, ptr %84, align 1, !tbaa !11
  %86 = zext i8 %85 to i32
  %87 = load i32, ptr %14, align 4, !tbaa !9
  %88 = add i32 %86, %87
  store i32 %88, ptr %24, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #3
  %89 = load i32, ptr %24, align 4, !tbaa !9
  %90 = load i32, ptr %16, align 4, !tbaa !9
  %91 = add i32 %89, %90
  store i32 %91, ptr %25, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #3
  %92 = load ptr, ptr %13, align 8, !tbaa !5
  %93 = load i32, ptr %21, align 4, !tbaa !9
  %94 = zext i32 %93 to i64
  %95 = getelementptr inbounds i8, ptr %92, i64 %94
  %96 = load i8, ptr %95, align 1, !tbaa !11
  %97 = zext i8 %96 to i32
  %98 = load i32, ptr %15, align 4, !tbaa !9
  %99 = add i32 %97, %98
  store i32 %99, ptr %26, align 4, !tbaa !9
  %100 = load ptr, ptr %11, align 8, !tbaa !5
  %101 = load i32, ptr %23, align 4, !tbaa !9
  %102 = load i32, ptr %24, align 4, !tbaa !9
  %103 = load i32, ptr %25, align 4, !tbaa !9
  %104 = load i32, ptr %26, align 4, !tbaa !9
  %105 = load i32, ptr %20, align 4, !tbaa !9
  call void @libxsmm_aarch64_instruction_asimd_compute(ptr noundef %100, i32 noundef %101, i32 noundef %102, i32 noundef %103, i8 noundef zeroext 0, i32 noundef %104, i32 noundef %105)
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #3
  br label %106

106:                                              ; preds = %79
  %107 = load i32, ptr %21, align 4, !tbaa !9
  %108 = add i32 %107, 1
  store i32 %108, ptr %21, align 4, !tbaa !9
  br label %67, !llvm.loop !12

109:                                              ; preds = %67
  store i32 0, ptr %22, align 4
  br label %110

110:                                              ; preds = %109, %64, %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #3
  %111 = load i32, ptr %22, align 4
  switch i32 %111, label %113 [
    i32 0, label %112
    i32 1, label %112
  ]

112:                                              ; preds = %110, %110
  ret void

113:                                              ; preds = %110
  unreachable
}

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

declare void @libxsmm_handle_error(ptr noundef, i32 noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef) #2

declare void @libxsmm_aarch64_instruction_asimd_compute(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i8 noundef zeroext, i32 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 = { "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 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"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"

@__func__.libxsmm_generator_transform_Xway_unpack_network_aarch64_asimd = external hidden unnamed_addr constant [62 x i8], align 1
@.str = external hidden unnamed_addr constant [100 x i8], align 1
@libxsmm_ninit = external local_unnamed_addr global i32, align 4
@libxsmm_verbosity = external local_unnamed_addr global i32, align 4

; Function Attrs: nounwind uwtable
define dso_local void @libxsmm_generator_transform_Xway_unpack_network_aarch64_asimd(ptr noundef %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, i32 noundef %7, i32 noundef %8, i32 noundef %9) local_unnamed_addr #0 {
  %11 = add i32 %8, -2
  %12 = tail call i32 @llvm.fshl.i32(i32 %11, i32 %11, i32 31)
  switch i32 %12, label %.loopexit.sink.split [
    i32 7, label %13
    i32 3, label %13
    i32 1, label %13
    i32 0, label %13
  ]

13:                                               ; preds = %10, %10, %10, %10
  %14 = urem i32 %3, %8
  %.not = icmp eq i32 %14, 0
  br i1 %.not, label %15, label %.loopexit.sink.split

15:                                               ; preds = %13
  %16 = urem i32 %4, %8
  %.not34 = icmp eq i32 %16, 0
  br i1 %.not34, label %.preheader.preheader, label %.loopexit.sink.split

.preheader.preheader:                             ; preds = %15
  %umax = tail call i32 @llvm.umax.i32(i32 %8, i32 1)
  %wide.trip.count = zext i32 %umax to i64
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %.preheader
  %indvars.iv = phi i64 [ 0, %.preheader.preheader ], [ %indvars.iv.next, %.preheader ]
  %17 = and i64 %indvars.iv, 1
  %18 = icmp eq i64 %17, 0
  %19 = select i1 %18, i32 %6, i32 %7
  %20 = getelementptr inbounds i8, ptr %1, i64 %indvars.iv
  %21 = load i8, ptr %20, align 1, !tbaa !5
  %22 = zext i8 %21 to i32
  %23 = add i32 %22, %3
  %24 = add i32 %23, %5
  %25 = getelementptr inbounds i8, ptr %2, i64 %indvars.iv
  %26 = load i8, ptr %25, align 1, !tbaa !5
  %27 = zext i8 %26 to i32
  %28 = add i32 %27, %4
  tail call void @libxsmm_aarch64_instruction_asimd_compute(ptr noundef %0, i32 noundef %19, i32 noundef %23, i32 noundef %24, i8 noundef zeroext 0, i32 noundef %28, i32 noundef %9) #3
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.loopexit, label %.preheader, !llvm.loop !8

.loopexit.sink.split:                             ; preds = %13, %15, %10
  %.sink = phi i32 [ 32, %10 ], [ 38, %15 ], [ 38, %13 ]
  %29 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !10
  %30 = icmp ugt i32 %29, 1
  %31 = load i32, ptr @libxsmm_verbosity, align 4
  %32 = select i1 %30, i32 %31, i32 1
  tail call void @libxsmm_handle_error(ptr noundef %0, i32 noundef 90000, ptr noundef nonnull @__func__.libxsmm_generator_transform_Xway_unpack_network_aarch64_asimd, ptr noundef nonnull @.str, i32 noundef %.sink, i32 noundef %32) #3
  br label %.loopexit

.loopexit:                                        ; preds = %.preheader, %.loopexit.sink.split
  ret void
}

declare void @libxsmm_handle_error(ptr noundef, i32 noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

declare void @libxsmm_aarch64_instruction_asimd_compute(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i8 noundef zeroext, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.fshl.i32(i32, i32, i32) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #2

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 = { "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !6, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass