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

; 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_08way_permute128_network_avx = external hidden unnamed_addr constant [57 x i8], align 1
@.str = external hidden unnamed_addr constant [90 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_08way_permute128_network_avx(ptr noundef %0, i8 noundef signext %1, i32 noundef %2, ptr noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, ptr noundef %7) #0 {
  %9 = alloca ptr, align 8
  %10 = alloca i8, align 1
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %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 i8 %1, ptr %10, align 1, !tbaa !9
  store i32 %2, ptr %11, align 4, !tbaa !10
  store ptr %3, ptr %12, align 8, !tbaa !5
  store i32 %4, ptr %13, align 4, !tbaa !10
  store i32 %5, ptr %14, align 4, !tbaa !10
  store i32 %6, ptr %15, align 4, !tbaa !10
  store ptr %7, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  store i32 0, ptr %17, align 4, !tbaa !10
  %21 = load i32, ptr %11, align 4, !tbaa !10
  %22 = icmp ne i32 %21, 0
  br i1 %22, label %23, label %26

23:                                               ; preds = %8
  %24 = load i32, ptr %11, align 4, !tbaa !10
  %25 = icmp ne i32 %24, 8
  br i1 %25, label %32, label %26

26:                                               ; preds = %23, %8
  %27 = load i32, ptr %14, align 4, !tbaa !10
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %29, label %41

29:                                               ; preds = %26
  %30 = load i32, ptr %14, align 4, !tbaa !10
  %31 = icmp ne i32 %30, 8
  br i1 %31, label %32, label %41

32:                                               ; preds = %29, %23
  %33 = load ptr, ptr %9, align 8, !tbaa !5
  %34 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !10
  %35 = icmp ult i32 1, %34
  br i1 %35, label %36, label %38

36:                                               ; preds = %32
  %37 = load i32, ptr @libxsmm_verbosity, align 4, !tbaa !10
  br label %39

38:                                               ; preds = %32
  br label %39

39:                                               ; preds = %38, %36
  %40 = phi i32 [ %37, %36 ], [ 1, %38 ]
  call void @libxsmm_handle_error(ptr noundef %33, i32 noundef 90000, ptr noundef @__func__.libxsmm_generator_transform_08way_permute128_network_avx, ptr noundef @.str, i32 noundef 33, i32 noundef %40)
  store i32 1, ptr %18, align 4
  br label %75

41:                                               ; preds = %29, %26
  store i32 0, ptr %17, align 4, !tbaa !10
  br label %42

42:                                               ; preds = %71, %41
  %43 = load i32, ptr %17, align 4, !tbaa !10
  %44 = icmp ult i32 %43, 8
  br i1 %44, label %45, label %74

45:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  %46 = load i32, ptr %11, align 4, !tbaa !10
  %47 = load ptr, ptr %12, align 8, !tbaa !5
  %48 = load i32, ptr %17, align 4, !tbaa !10
  %49 = zext i32 %48 to i64
  %50 = getelementptr inbounds i8, ptr %47, i64 %49
  %51 = load i8, ptr %50, align 1, !tbaa !9
  %52 = zext i8 %51 to i32
  %53 = add i32 %46, %52
  store i32 %53, ptr %19, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #3
  %54 = load i32, ptr %19, align 4, !tbaa !10
  %55 = load i32, ptr %13, align 4, !tbaa !10
  %56 = add i32 %54, %55
  store i32 %56, ptr %20, align 4, !tbaa !10
  %57 = load ptr, ptr %9, align 8, !tbaa !5
  %58 = load i32, ptr %15, align 4, !tbaa !10
  %59 = load i8, ptr %10, align 1, !tbaa !9
  %60 = load i32, ptr %20, align 4, !tbaa !10
  %61 = load i32, ptr %19, align 4, !tbaa !10
  %62 = load i32, ptr %14, align 4, !tbaa !10
  %63 = load i32, ptr %17, align 4, !tbaa !10
  %64 = add i32 %62, %63
  %65 = load ptr, ptr %16, align 8, !tbaa !5
  %66 = load i32, ptr %17, align 4, !tbaa !10
  %67 = zext i32 %66 to i64
  %68 = getelementptr inbounds i8, ptr %65, i64 %67
  %69 = load i8, ptr %68, align 1, !tbaa !9
  %70 = zext i8 %69 to i32
  call void @libxsmm_x86_instruction_vec_compute_3reg_imm8(ptr noundef %57, i32 noundef %58, i8 noundef signext %59, i32 noundef %60, i32 noundef %61, i32 noundef %64, i32 noundef %70)
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  br label %71

71:                                               ; preds = %45
  %72 = load i32, ptr %17, align 4, !tbaa !10
  %73 = add i32 %72, 1
  store i32 %73, ptr %17, align 4, !tbaa !10
  br label %42, !llvm.loop !12

74:                                               ; preds = %42
  store i32 0, ptr %18, align 4
  br label %75

75:                                               ; preds = %74, %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  %76 = load i32, ptr %18, align 4
  switch i32 %76, label %78 [
    i32 0, label %77
    i32 1, label %77
  ]

77:                                               ; preds = %75, %75
  ret void

78:                                               ; preds = %75
  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_x86_instruction_vec_compute_3reg_imm8(ptr noundef, i32 noundef, i8 noundef signext, i32 noundef, i32 noundef, 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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !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_08way_permute128_network_avx = external hidden unnamed_addr constant [57 x i8], align 1
@.str = external hidden unnamed_addr constant [90 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_08way_permute128_network_avx(ptr noundef %0, i8 noundef signext %1, i32 noundef %2, ptr nocapture noundef readonly %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, ptr nocapture noundef readonly %7) local_unnamed_addr #0 {
  %9 = or i32 %5, %2
  %10 = and i32 %9, -9
  %or.cond = icmp eq i32 %10, 0
  br i1 %or.cond, label %.preheader.preheader, label %80

.preheader.preheader:                             ; preds = %8
  %11 = load i8, ptr %3, align 1, !tbaa !5
  %12 = zext i8 %11 to i32
  %13 = add nuw nsw i32 %12, %2
  %14 = add i32 %13, %4
  %15 = load i8, ptr %7, align 1, !tbaa !5
  %16 = zext i8 %15 to i32
  tail call void @libxsmm_x86_instruction_vec_compute_3reg_imm8(ptr noundef %0, i32 noundef %6, i8 noundef signext %1, i32 noundef %14, i32 noundef %13, i32 noundef %5, i32 noundef %16) #2
  %17 = getelementptr inbounds i8, ptr %3, i64 1
  %18 = load i8, ptr %17, align 1, !tbaa !5
  %19 = zext i8 %18 to i32
  %20 = add nuw nsw i32 %19, %2
  %21 = add i32 %20, %4
  %22 = or i32 %5, 1
  %23 = getelementptr inbounds i8, ptr %7, i64 1
  %24 = load i8, ptr %23, align 1, !tbaa !5
  %25 = zext i8 %24 to i32
  tail call void @libxsmm_x86_instruction_vec_compute_3reg_imm8(ptr noundef %0, i32 noundef %6, i8 noundef signext %1, i32 noundef %21, i32 noundef %20, i32 noundef %22, i32 noundef %25) #2
  %26 = getelementptr inbounds i8, ptr %3, i64 2
  %27 = load i8, ptr %26, align 1, !tbaa !5
  %28 = zext i8 %27 to i32
  %29 = add nuw nsw i32 %28, %2
  %30 = add i32 %29, %4
  %31 = or i32 %5, 2
  %32 = getelementptr inbounds i8, ptr %7, i64 2
  %33 = load i8, ptr %32, align 1, !tbaa !5
  %34 = zext i8 %33 to i32
  tail call void @libxsmm_x86_instruction_vec_compute_3reg_imm8(ptr noundef %0, i32 noundef %6, i8 noundef signext %1, i32 noundef %30, i32 noundef %29, i32 noundef %31, i32 noundef %34) #2
  %35 = getelementptr inbounds i8, ptr %3, i64 3
  %36 = load i8, ptr %35, align 1, !tbaa !5
  %37 = zext i8 %36 to i32
  %38 = add nuw nsw i32 %37, %2
  %39 = add i32 %38, %4
  %40 = or i32 %5, 3
  %41 = getelementptr inbounds i8, ptr %7, i64 3
  %42 = load i8, ptr %41, align 1, !tbaa !5
  %43 = zext i8 %42 to i32
  tail call void @libxsmm_x86_instruction_vec_compute_3reg_imm8(ptr noundef %0, i32 noundef %6, i8 noundef signext %1, i32 noundef %39, i32 noundef %38, i32 noundef %40, i32 noundef %43) #2
  %44 = getelementptr inbounds i8, ptr %3, i64 4
  %45 = load i8, ptr %44, align 1, !tbaa !5
  %46 = zext i8 %45 to i32
  %47 = add nuw nsw i32 %46, %2
  %48 = add i32 %47, %4
  %49 = or i32 %5, 4
  %50 = getelementptr inbounds i8, ptr %7, i64 4
  %51 = load i8, ptr %50, align 1, !tbaa !5
  %52 = zext i8 %51 to i32
  tail call void @libxsmm_x86_instruction_vec_compute_3reg_imm8(ptr noundef %0, i32 noundef %6, i8 noundef signext %1, i32 noundef %48, i32 noundef %47, i32 noundef %49, i32 noundef %52) #2
  %53 = getelementptr inbounds i8, ptr %3, i64 5
  %54 = load i8, ptr %53, align 1, !tbaa !5
  %55 = zext i8 %54 to i32
  %56 = add nuw nsw i32 %55, %2
  %57 = add i32 %56, %4
  %58 = or i32 %5, 5
  %59 = getelementptr inbounds i8, ptr %7, i64 5
  %60 = load i8, ptr %59, align 1, !tbaa !5
  %61 = zext i8 %60 to i32
  tail call void @libxsmm_x86_instruction_vec_compute_3reg_imm8(ptr noundef %0, i32 noundef %6, i8 noundef signext %1, i32 noundef %57, i32 noundef %56, i32 noundef %58, i32 noundef %61) #2
  %62 = getelementptr inbounds i8, ptr %3, i64 6
  %63 = load i8, ptr %62, align 1, !tbaa !5
  %64 = zext i8 %63 to i32
  %65 = add nuw nsw i32 %64, %2
  %66 = add i32 %65, %4
  %67 = or i32 %5, 6
  %68 = getelementptr inbounds i8, ptr %7, i64 6
  %69 = load i8, ptr %68, align 1, !tbaa !5
  %70 = zext i8 %69 to i32
  tail call void @libxsmm_x86_instruction_vec_compute_3reg_imm8(ptr noundef %0, i32 noundef %6, i8 noundef signext %1, i32 noundef %66, i32 noundef %65, i32 noundef %67, i32 noundef %70) #2
  %71 = getelementptr inbounds i8, ptr %3, i64 7
  %72 = load i8, ptr %71, align 1, !tbaa !5
  %73 = zext i8 %72 to i32
  %74 = add nuw nsw i32 %73, %2
  %75 = add i32 %74, %4
  %76 = or i32 %5, 7
  %77 = getelementptr inbounds i8, ptr %7, i64 7
  %78 = load i8, ptr %77, align 1, !tbaa !5
  %79 = zext i8 %78 to i32
  tail call void @libxsmm_x86_instruction_vec_compute_3reg_imm8(ptr noundef %0, i32 noundef %6, i8 noundef signext %1, i32 noundef %75, i32 noundef %74, i32 noundef %76, i32 noundef %79) #2
  br label %.loopexit

80:                                               ; preds = %8
  %81 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !8
  %82 = icmp ugt i32 %81, 1
  %83 = load i32, ptr @libxsmm_verbosity, align 4
  %84 = select i1 %82, i32 %83, i32 1
  tail call void @libxsmm_handle_error(ptr noundef %0, i32 noundef 90000, ptr noundef nonnull @__func__.libxsmm_generator_transform_08way_permute128_network_avx, ptr noundef nonnull @.str, i32 noundef 33, i32 noundef %84) #2
  br label %.loopexit

.loopexit:                                        ; preds = %.preheader.preheader, %80
  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_x86_instruction_vec_compute_3reg_imm8(ptr noundef, i32 noundef, i8 noundef signext, i32 noundef, i32 noundef, i32 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 = { "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 }

!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 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass