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

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

@.str = external hidden unnamed_addr constant [93 x i8], align 1
@libxsmm_ninit = external global i32, align 4
@libxsmm_verbosity = external global i32, align 4
@__func__.libxsmm_generator_transform_two_8x8_32bit_norm_to_normt_avx512 = external hidden unnamed_addr constant [63 x i8], align 1
@__const.libxsmm_generator_transform_two_8x8_32bit_norm_to_normt_avx512.l_in_idx = external hidden unnamed_addr constant [8 x i8], align 1
@__const.libxsmm_generator_transform_two_8x8_32bit_norm_to_normt_avx512.l_in_idx.4 = external hidden unnamed_addr constant [8 x i8], align 1
@__const.libxsmm_generator_transform_two_8x8_32bit_norm_to_normt_avx512.l_perm_imm = external hidden unnamed_addr constant [2 x i8], align 1

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @libxsmm_generator_transform_Xway_permute_network_avx512(ptr noundef, i8 noundef signext, ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

declare void @libxsmm_generator_transform_Xway_unpack_network_avx_avx512(ptr noundef, i8 noundef signext, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @libxsmm_generator_transform_two_8x8_32bit_norm_to_normt_avx512(ptr noundef %0, i8 noundef signext %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5) #2 {
  %7 = alloca ptr, align 8
  %8 = alloca i8, align 1
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca [8 x i8], align 1
  %14 = alloca [8 x i8], align 1
  %15 = alloca [2 x i8], align 1
  %16 = alloca [2 x i8], align 1
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i8 %1, ptr %8, align 1, !tbaa !9
  store i32 %2, ptr %9, align 4, !tbaa !10
  store i32 %3, ptr %10, align 4, !tbaa !10
  store i32 %4, ptr %11, align 4, !tbaa !10
  store i32 %5, ptr %12, align 4, !tbaa !10
  %17 = load i32, ptr %9, align 4, !tbaa !10
  %18 = add i32 %17, 8
  %19 = load i32, ptr %10, align 4, !tbaa !10
  %20 = icmp ugt i32 %18, %19
  br i1 %20, label %21, label %35

21:                                               ; preds = %6
  %22 = load i32, ptr %10, align 4, !tbaa !10
  %23 = add i32 %22, 8
  %24 = load i32, ptr %9, align 4, !tbaa !10
  %25 = icmp ugt i32 %23, %24
  br i1 %25, label %26, label %35

26:                                               ; preds = %21
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  %28 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !10
  %29 = icmp ult i32 1, %28
  br i1 %29, label %30, label %32

30:                                               ; preds = %26
  %31 = load i32, ptr @libxsmm_verbosity, align 4, !tbaa !10
  br label %33

32:                                               ; preds = %26
  br label %33

33:                                               ; preds = %32, %30
  %34 = phi i32 [ %31, %30 ], [ 1, %32 ]
  call void @libxsmm_handle_error(ptr noundef %27, i32 noundef 90000, ptr noundef @__func__.libxsmm_generator_transform_two_8x8_32bit_norm_to_normt_avx512, ptr noundef @.str, i32 noundef 758, i32 noundef %34)
  br label %57

35:                                               ; preds = %21, %6
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %13, ptr align 1 @__const.libxsmm_generator_transform_two_8x8_32bit_norm_to_normt_avx512.l_in_idx, i64 8, i1 false)
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = load i8, ptr %8, align 1, !tbaa !9
  %38 = getelementptr inbounds [8 x i8], ptr %13, i64 0, i64 0
  %39 = load i32, ptr %9, align 4, !tbaa !10
  %40 = load i32, ptr %10, align 4, !tbaa !10
  call void @libxsmm_generator_transform_Xway_unpack_network_avx_avx512(ptr noundef %36, i8 noundef signext %37, ptr noundef %38, i32 noundef %39, i32 noundef %40, i32 noundef 1, i32 noundef 805639778, i32 noundef 805639786, i32 noundef 8)
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %14, ptr align 1 @__const.libxsmm_generator_transform_two_8x8_32bit_norm_to_normt_avx512.l_in_idx.4, i64 8, i1 false)
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = load i8, ptr %8, align 1, !tbaa !9
  %43 = getelementptr inbounds [8 x i8], ptr %14, i64 0, i64 0
  %44 = load i32, ptr %10, align 4, !tbaa !10
  %45 = load i32, ptr %9, align 4, !tbaa !10
  call void @libxsmm_generator_transform_Xway_unpack_network_avx_avx512(ptr noundef %41, i8 noundef signext %42, ptr noundef %43, i32 noundef %44, i32 noundef %45, i32 noundef 2, i32 noundef 814028396, i32 noundef 814028397, i32 noundef 8)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 2, ptr %15) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %15, ptr align 1 @__const.libxsmm_generator_transform_two_8x8_32bit_norm_to_normt_avx512.l_perm_imm, i64 2, i1 false)
  call void @llvm.lifetime.start.p0(i64 2, ptr %16) #4
  %46 = load i32, ptr %11, align 4, !tbaa !10
  %47 = trunc i32 %46 to i8
  %48 = getelementptr inbounds [2 x i8], ptr %16, i64 0, i64 0
  store i8 %47, ptr %48, align 1, !tbaa !9
  %49 = load i32, ptr %12, align 4, !tbaa !10
  %50 = trunc i32 %49 to i8
  %51 = getelementptr inbounds [2 x i8], ptr %16, i64 0, i64 1
  store i8 %50, ptr %51, align 1, !tbaa !9
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  %53 = load i8, ptr %8, align 1, !tbaa !9
  %54 = getelementptr inbounds [2 x i8], ptr %16, i64 0, i64 0
  %55 = getelementptr inbounds [2 x i8], ptr %15, i64 0, i64 0
  %56 = load i32, ptr %9, align 4, !tbaa !10
  call void @libxsmm_generator_transform_Xway_permute_network_avx512(ptr noundef %52, i8 noundef signext %53, ptr noundef %54, ptr noundef %55, i32 noundef %56, i32 noundef 546127360, i32 noundef 8)
  call void @llvm.lifetime.end.p0(i64 2, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %15) #4
  br label %57

57:                                               ; preds = %35, %33
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}


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

@.str = external hidden unnamed_addr constant [93 x i8], align 1
@libxsmm_ninit = external local_unnamed_addr global i32, align 4
@libxsmm_verbosity = external local_unnamed_addr global i32, align 4
@__func__.libxsmm_generator_transform_two_8x8_32bit_norm_to_normt_avx512 = external hidden unnamed_addr constant [63 x i8], align 1
@__const.libxsmm_generator_transform_two_8x8_32bit_norm_to_normt_avx512.l_in_idx = external hidden unnamed_addr constant [8 x i8], align 1
@__const.libxsmm_generator_transform_two_8x8_32bit_norm_to_normt_avx512.l_in_idx.4 = external hidden unnamed_addr constant [8 x i8], align 1
@__const.libxsmm_generator_transform_two_8x8_32bit_norm_to_normt_avx512.l_perm_imm = external hidden unnamed_addr constant [2 x i8], align 1

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @libxsmm_generator_transform_Xway_permute_network_avx512(ptr noundef, i8 noundef signext, ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

declare void @libxsmm_generator_transform_Xway_unpack_network_avx_avx512(ptr noundef, i8 noundef signext, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @libxsmm_generator_transform_two_8x8_32bit_norm_to_normt_avx512(ptr noundef %0, i8 noundef signext %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5) local_unnamed_addr #2 {
  %7 = alloca [8 x i8], align 8
  %8 = alloca [8 x i8], align 8
  %9 = alloca [2 x i8], align 2
  %10 = alloca [2 x i8], align 1
  %11 = add i32 %2, 8
  %12 = icmp ugt i32 %11, %3
  %13 = add i32 %3, 8
  %14 = icmp ugt i32 %13, %2
  %or.cond = and i1 %12, %14
  br i1 %or.cond, label %15, label %20

15:                                               ; preds = %6
  %16 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !5
  %17 = icmp ugt i32 %16, 1
  %18 = load i32, ptr @libxsmm_verbosity, align 4
  %19 = select i1 %17, i32 %18, i32 1
  tail call void @libxsmm_handle_error(ptr noundef %0, i32 noundef 90000, ptr noundef nonnull @__func__.libxsmm_generator_transform_two_8x8_32bit_norm_to_normt_avx512, ptr noundef nonnull @.str, i32 noundef 758, i32 noundef %19) #3
  br label %27

20:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #3
  %21 = load i64, ptr @__const.libxsmm_generator_transform_two_8x8_32bit_norm_to_normt_avx512.l_in_idx, align 1
  store i64 %21, ptr %7, align 8
  call void @libxsmm_generator_transform_Xway_unpack_network_avx_avx512(ptr noundef %0, i8 noundef signext %1, ptr noundef nonnull %7, i32 noundef %2, i32 noundef %3, i32 noundef 1, i32 noundef 805639778, i32 noundef 805639786, i32 noundef 8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #3
  %22 = load i64, ptr @__const.libxsmm_generator_transform_two_8x8_32bit_norm_to_normt_avx512.l_in_idx.4, align 1
  store i64 %22, ptr %8, align 8
  call void @libxsmm_generator_transform_Xway_unpack_network_avx_avx512(ptr noundef %0, i8 noundef signext %1, ptr noundef nonnull %8, i32 noundef %3, i32 noundef %2, i32 noundef 2, i32 noundef 814028396, i32 noundef 814028397, i32 noundef 8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %9) #3
  %23 = load i16, ptr @__const.libxsmm_generator_transform_two_8x8_32bit_norm_to_normt_avx512.l_perm_imm, align 1
  store i16 %23, ptr %9, align 2
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %10) #3
  %24 = trunc i32 %4 to i8
  store i8 %24, ptr %10, align 1, !tbaa !9
  %25 = trunc i32 %5 to i8
  %26 = getelementptr inbounds i8, ptr %10, i64 1
  store i8 %25, ptr %26, align 1, !tbaa !9
  call void @libxsmm_generator_transform_Xway_permute_network_avx512(ptr noundef %0, i8 noundef signext %1, ptr noundef nonnull %10, ptr noundef nonnull %9, i32 noundef %2, i32 noundef 546127360, i32 noundef 8)
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %10) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %9) #3
  br label %27

27:                                               ; preds = %20, %15
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass