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

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

%struct.libxsmm_tile_config = type { i8, i16, i8, i16, i8, i16, i8, i16, i8, i16, i8, i16, i8, i16, i8, i16, i8 }

@.str = external hidden unnamed_addr constant [24 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [74 x i8], align 1
@__PRETTY_FUNCTION__.libxsmm_get_tileinfo = external hidden unnamed_addr constant [95 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @libxsmm_get_tileinfo(i32 noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #0 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  store i32 %0, ptr %5, align 4, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !9
  %9 = load ptr, ptr %6, align 8, !tbaa !9
  store i32 0, ptr %9, align 4, !tbaa !5
  %10 = load ptr, ptr %7, align 8, !tbaa !9
  store i32 0, ptr %10, align 4, !tbaa !5
  %11 = load i32, ptr %5, align 4, !tbaa !5
  switch i32 %11, label %108 [
    i32 0, label %12
    i32 1, label %24
    i32 2, label %36
    i32 3, label %48
    i32 4, label %60
    i32 5, label %72
    i32 6, label %84
    i32 7, label %96
  ]

12:                                               ; preds = %4
  %13 = load ptr, ptr %8, align 8, !tbaa !9
  %14 = getelementptr inbounds %struct.libxsmm_tile_config, ptr %13, i32 0, i32 1
  %15 = load i16, ptr %14, align 2, !tbaa !11
  %16 = zext i16 %15 to i32
  %17 = sdiv i32 %16, 4
  %18 = load ptr, ptr %6, align 8, !tbaa !9
  store i32 %17, ptr %18, align 4, !tbaa !5
  %19 = load ptr, ptr %8, align 8, !tbaa !9
  %20 = getelementptr inbounds %struct.libxsmm_tile_config, ptr %19, i32 0, i32 2
  %21 = load i8, ptr %20, align 2, !tbaa !14
  %22 = zext i8 %21 to i32
  %23 = load ptr, ptr %7, align 8, !tbaa !9
  store i32 %22, ptr %23, align 4, !tbaa !5
  br label %109

24:                                               ; preds = %4
  %25 = load ptr, ptr %8, align 8, !tbaa !9
  %26 = getelementptr inbounds %struct.libxsmm_tile_config, ptr %25, i32 0, i32 3
  %27 = load i16, ptr %26, align 2, !tbaa !15
  %28 = zext i16 %27 to i32
  %29 = sdiv i32 %28, 4
  %30 = load ptr, ptr %6, align 8, !tbaa !9
  store i32 %29, ptr %30, align 4, !tbaa !5
  %31 = load ptr, ptr %8, align 8, !tbaa !9
  %32 = getelementptr inbounds %struct.libxsmm_tile_config, ptr %31, i32 0, i32 4
  %33 = load i8, ptr %32, align 2, !tbaa !16
  %34 = zext i8 %33 to i32
  %35 = load ptr, ptr %7, align 8, !tbaa !9
  store i32 %34, ptr %35, align 4, !tbaa !5
  br label %109

36:                                               ; preds = %4
  %37 = load ptr, ptr %8, align 8, !tbaa !9
  %38 = getelementptr inbounds %struct.libxsmm_tile_config, ptr %37, i32 0, i32 5
  %39 = load i16, ptr %38, align 2, !tbaa !17
  %40 = zext i16 %39 to i32
  %41 = sdiv i32 %40, 4
  %42 = load ptr, ptr %6, align 8, !tbaa !9
  store i32 %41, ptr %42, align 4, !tbaa !5
  %43 = load ptr, ptr %8, align 8, !tbaa !9
  %44 = getelementptr inbounds %struct.libxsmm_tile_config, ptr %43, i32 0, i32 6
  %45 = load i8, ptr %44, align 2, !tbaa !18
  %46 = zext i8 %45 to i32
  %47 = load ptr, ptr %7, align 8, !tbaa !9
  store i32 %46, ptr %47, align 4, !tbaa !5
  br label %109

48:                                               ; preds = %4
  %49 = load ptr, ptr %8, align 8, !tbaa !9
  %50 = getelementptr inbounds %struct.libxsmm_tile_config, ptr %49, i32 0, i32 7
  %51 = load i16, ptr %50, align 2, !tbaa !19
  %52 = zext i16 %51 to i32
  %53 = sdiv i32 %52, 4
  %54 = load ptr, ptr %6, align 8, !tbaa !9
  store i32 %53, ptr %54, align 4, !tbaa !5
  %55 = load ptr, ptr %8, align 8, !tbaa !9
  %56 = getelementptr inbounds %struct.libxsmm_tile_config, ptr %55, i32 0, i32 8
  %57 = load i8, ptr %56, align 2, !tbaa !20
  %58 = zext i8 %57 to i32
  %59 = load ptr, ptr %7, align 8, !tbaa !9
  store i32 %58, ptr %59, align 4, !tbaa !5
  br label %109

60:                                               ; preds = %4
  %61 = load ptr, ptr %8, align 8, !tbaa !9
  %62 = getelementptr inbounds %struct.libxsmm_tile_config, ptr %61, i32 0, i32 9
  %63 = load i16, ptr %62, align 2, !tbaa !21
  %64 = zext i16 %63 to i32
  %65 = sdiv i32 %64, 4
  %66 = load ptr, ptr %6, align 8, !tbaa !9
  store i32 %65, ptr %66, align 4, !tbaa !5
  %67 = load ptr, ptr %8, align 8, !tbaa !9
  %68 = getelementptr inbounds %struct.libxsmm_tile_config, ptr %67, i32 0, i32 10
  %69 = load i8, ptr %68, align 2, !tbaa !22
  %70 = zext i8 %69 to i32
  %71 = load ptr, ptr %7, align 8, !tbaa !9
  store i32 %70, ptr %71, align 4, !tbaa !5
  br label %109

72:                                               ; preds = %4
  %73 = load ptr, ptr %8, align 8, !tbaa !9
  %74 = getelementptr inbounds %struct.libxsmm_tile_config, ptr %73, i32 0, i32 11
  %75 = load i16, ptr %74, align 2, !tbaa !23
  %76 = zext i16 %75 to i32
  %77 = sdiv i32 %76, 4
  %78 = load ptr, ptr %6, align 8, !tbaa !9
  store i32 %77, ptr %78, align 4, !tbaa !5
  %79 = load ptr, ptr %8, align 8, !tbaa !9
  %80 = getelementptr inbounds %struct.libxsmm_tile_config, ptr %79, i32 0, i32 12
  %81 = load i8, ptr %80, align 2, !tbaa !24
  %82 = zext i8 %81 to i32
  %83 = load ptr, ptr %7, align 8, !tbaa !9
  store i32 %82, ptr %83, align 4, !tbaa !5
  br label %109

84:                                               ; preds = %4
  %85 = load ptr, ptr %8, align 8, !tbaa !9
  %86 = getelementptr inbounds %struct.libxsmm_tile_config, ptr %85, i32 0, i32 13
  %87 = load i16, ptr %86, align 2, !tbaa !25
  %88 = zext i16 %87 to i32
  %89 = sdiv i32 %88, 4
  %90 = load ptr, ptr %6, align 8, !tbaa !9
  store i32 %89, ptr %90, align 4, !tbaa !5
  %91 = load ptr, ptr %8, align 8, !tbaa !9
  %92 = getelementptr inbounds %struct.libxsmm_tile_config, ptr %91, i32 0, i32 14
  %93 = load i8, ptr %92, align 2, !tbaa !26
  %94 = zext i8 %93 to i32
  %95 = load ptr, ptr %7, align 8, !tbaa !9
  store i32 %94, ptr %95, align 4, !tbaa !5
  br label %109

96:                                               ; preds = %4
  %97 = load ptr, ptr %8, align 8, !tbaa !9
  %98 = getelementptr inbounds %struct.libxsmm_tile_config, ptr %97, i32 0, i32 15
  %99 = load i16, ptr %98, align 2, !tbaa !27
  %100 = zext i16 %99 to i32
  %101 = sdiv i32 %100, 4
  %102 = load ptr, ptr %6, align 8, !tbaa !9
  store i32 %101, ptr %102, align 4, !tbaa !5
  %103 = load ptr, ptr %8, align 8, !tbaa !9
  %104 = getelementptr inbounds %struct.libxsmm_tile_config, ptr %103, i32 0, i32 16
  %105 = load i8, ptr %104, align 2, !tbaa !28
  %106 = zext i8 %105 to i32
  %107 = load ptr, ptr %7, align 8, !tbaa !9
  store i32 %106, ptr %107, align 4, !tbaa !5
  br label %109

108:                                              ; preds = %4
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 1016, ptr noundef @__PRETTY_FUNCTION__.libxsmm_get_tileinfo) #2
  unreachable

109:                                              ; preds = %96, %84, %72, %60, %48, %36, %24, %12
  ret void
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #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 = { noreturn nounwind "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 = { noreturn 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 = !{!12, !13, i64 2}
!12 = !{!"libxsmm_tile_config", !7, i64 0, !13, i64 2, !7, i64 4, !13, i64 6, !7, i64 8, !13, i64 10, !7, i64 12, !13, i64 14, !7, i64 16, !13, i64 18, !7, i64 20, !13, i64 22, !7, i64 24, !13, i64 26, !7, i64 28, !13, i64 30, !7, i64 32}
!13 = !{!"short", !7, i64 0}
!14 = !{!12, !7, i64 4}
!15 = !{!12, !13, i64 6}
!16 = !{!12, !7, i64 8}
!17 = !{!12, !13, i64 10}
!18 = !{!12, !7, i64 12}
!19 = !{!12, !13, i64 14}
!20 = !{!12, !7, i64 16}
!21 = !{!12, !13, i64 18}
!22 = !{!12, !7, i64 20}
!23 = !{!12, !13, i64 22}
!24 = !{!12, !7, i64 24}
!25 = !{!12, !13, i64 26}
!26 = !{!12, !7, i64 28}
!27 = !{!12, !13, i64 30}
!28 = !{!12, !7, i64 32}


; 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 [24 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [74 x i8], align 1
@__PRETTY_FUNCTION__.libxsmm_get_tileinfo = external hidden unnamed_addr constant [95 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @libxsmm_get_tileinfo(i32 noundef %0, ptr nocapture noundef writeonly %1, ptr nocapture noundef writeonly %2, ptr nocapture noundef readonly %3) local_unnamed_addr #0 {
  store i32 0, ptr %1, align 4, !tbaa !5
  store i32 0, ptr %2, align 4, !tbaa !5
  %5 = icmp ult i32 %0, 8
  br i1 %5, label %switch.lookup, label %6

6:                                                ; preds = %4
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 1016, ptr noundef nonnull @__PRETTY_FUNCTION__.libxsmm_get_tileinfo) #2
  unreachable

switch.lookup:                                    ; preds = %4
  %7 = shl nuw nsw i32 %0, 2
  %8 = or disjoint i32 %7, 2
  %switch.offset = zext nneg i32 %8 to i64
  %9 = shl nuw nsw i32 %0, 2
  %10 = getelementptr inbounds i8, ptr %3, i64 %switch.offset
  %11 = load i16, ptr %10, align 2, !tbaa !9
  %12 = lshr i16 %11, 2
  %13 = zext nneg i16 %12 to i32
  store i32 %13, ptr %1, align 4, !tbaa !5
  %14 = zext nneg i32 %9 to i64
  %15 = getelementptr inbounds i8, ptr %3, i64 %14
  %16 = getelementptr inbounds i8, ptr %15, i64 4
  %17 = load i8, ptr %16, align 2, !tbaa !11
  %18 = zext i8 %17 to i32
  store i32 %18, ptr %2, align 4, !tbaa !5
  ret void
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr 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 = { noreturn nounwind "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 = { noreturn 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 = !{!"short", !7, i64 0}
!11 = !{!7, !7, i64 0}


; Effective O3 passes: GlobalOptPass,IPSCCPPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass