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

; 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; 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
define dso_local void @LIBXSMM_GEMM_SET_DESC_DATATYPE(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %4) #1 {
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i8, align 1
  %12 = alloca i8, align 1
  %13 = alloca i8, align 1
  %14 = alloca i8, align 1
  %15 = alloca i8, align 1
  %16 = alloca i8, align 1
  %17 = alloca i8, align 1
  %18 = alloca i8, align 1
  %19 = alloca i8, align 1
  %20 = alloca i8, align 1
  store i32 %0, ptr %6, align 4, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !5
  store i32 %2, ptr %8, align 4, !tbaa !5
  store i32 %3, ptr %9, align 4, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #2
  %21 = load i32, ptr %6, align 4, !tbaa !5
  %22 = trunc i32 %21 to i8
  store i8 %22, ptr %11, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #2
  %23 = load i32, ptr %7, align 4, !tbaa !5
  %24 = trunc i32 %23 to i8
  store i8 %24, ptr %12, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #2
  %25 = load i32, ptr %8, align 4, !tbaa !5
  %26 = trunc i32 %25 to i8
  store i8 %26, ptr %13, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #2
  %27 = load i32, ptr %9, align 4, !tbaa !5
  %28 = trunc i32 %27 to i8
  store i8 %28, ptr %14, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #2
  %29 = load i8, ptr %11, align 1, !tbaa !11
  %30 = zext i8 %29 to i32
  %31 = and i32 %30, 207
  %32 = trunc i32 %31 to i8
  store i8 %32, ptr %15, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %16) #2
  %33 = load i8, ptr %12, align 1, !tbaa !11
  %34 = zext i8 %33 to i32
  %35 = shl i32 %34, 6
  %36 = trunc i32 %35 to i8
  store i8 %36, ptr %16, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %17) #2
  %37 = load i8, ptr %12, align 1, !tbaa !11
  %38 = zext i8 %37 to i32
  %39 = ashr i32 %38, 2
  %40 = trunc i32 %39 to i8
  store i8 %40, ptr %17, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %18) #2
  %41 = load i8, ptr %13, align 1, !tbaa !11
  %42 = zext i8 %41 to i32
  %43 = shl i32 %42, 4
  %44 = trunc i32 %43 to i8
  store i8 %44, ptr %18, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %19) #2
  %45 = load i8, ptr %13, align 1, !tbaa !11
  %46 = zext i8 %45 to i32
  %47 = ashr i32 %46, 4
  %48 = trunc i32 %47 to i8
  store i8 %48, ptr %19, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %20) #2
  %49 = load i8, ptr %14, align 1, !tbaa !11
  %50 = zext i8 %49 to i32
  %51 = shl i32 %50, 2
  %52 = trunc i32 %51 to i8
  store i8 %52, ptr %20, align 1, !tbaa !11
  %53 = load i8, ptr %15, align 1, !tbaa !11
  %54 = zext i8 %53 to i32
  %55 = load i8, ptr %16, align 1, !tbaa !11
  %56 = zext i8 %55 to i32
  %57 = or i32 %54, %56
  %58 = trunc i32 %57 to i8
  %59 = load ptr, ptr %10, align 8, !tbaa !9
  %60 = getelementptr inbounds i8, ptr %59, i64 0
  store i8 %58, ptr %60, align 1, !tbaa !11
  %61 = load i8, ptr %17, align 1, !tbaa !11
  %62 = zext i8 %61 to i32
  %63 = load i8, ptr %18, align 1, !tbaa !11
  %64 = zext i8 %63 to i32
  %65 = or i32 %62, %64
  %66 = trunc i32 %65 to i8
  %67 = load ptr, ptr %10, align 8, !tbaa !9
  %68 = getelementptr inbounds i8, ptr %67, i64 1
  store i8 %66, ptr %68, align 1, !tbaa !11
  %69 = load i8, ptr %19, align 1, !tbaa !11
  %70 = zext i8 %69 to i32
  %71 = load i8, ptr %20, align 1, !tbaa !11
  %72 = zext i8 %71 to i32
  %73 = or i32 %70, %72
  %74 = trunc i32 %73 to i8
  %75 = load ptr, ptr %10, align 8, !tbaa !9
  %76 = getelementptr inbounds i8, ptr %75, i64 2
  store i8 %74, ptr %76, align 1, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #2
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #2
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #2
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #2
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #2
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #2
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #2
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #2
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #2
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #2
  ret void
}

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

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @LIBXSMM_GEMM_SET_DESC_DATATYPE(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, ptr nocapture noundef writeonly %4) local_unnamed_addr #0 {
  %6 = and i32 %0, 207
  %7 = shl i32 %1, 6
  %8 = lshr i32 %1, 2
  %9 = shl i32 %2, 4
  %10 = lshr i32 %2, 4
  %11 = shl i32 %3, 2
  %12 = or i32 %7, %6
  %13 = trunc i32 %12 to i8
  store i8 %13, ptr %4, align 1, !tbaa !5
  %14 = and i32 %8, 63
  %15 = or i32 %14, %9
  %16 = trunc i32 %15 to i8
  %17 = getelementptr inbounds i8, ptr %4, i64 1
  store i8 %16, ptr %17, align 1, !tbaa !5
  %18 = and i32 %10, 15
  %19 = or i32 %18, %11
  %20 = trunc i32 %19 to i8
  %21 = getelementptr inbounds i8, ptr %4, i64 2
  store i8 %20, ptr %21, align 1, !tbaa !5
  ret void
}

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


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass