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

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

%union.anon = type { ptr }
%struct.libxsmm_gemm_descriptor = type <{ i32, i32, i32, i32, i32, i32, i32, i8, [3 x i8], i8, i64, i64, i8, i32, i32, i32, i16, i16, i8, i8, i8, i8, i16, i16, i16, i16, i16, i16, i32, i32, i32, i8 }>

@.str = external hidden unnamed_addr constant [25 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [73 x i8], align 1
@__PRETTY_FUNCTION__.libxsmm_gemm_descriptor_init = external hidden unnamed_addr constant [265 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [25 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local ptr @libxsmm_gemm_descriptor_init(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, i32 noundef %7, i32 noundef %8, i32 noundef %9, i32 noundef %10, i32 noundef %11, i32 noundef %12) #0 {
  %14 = alloca ptr, align 8
  %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
  %27 = alloca i32, align 4
  %28 = alloca %union.anon, align 8
  %29 = alloca [3 x i8], align 1
  %30 = alloca i8, align 1
  %31 = alloca ptr, align 8
  %32 = alloca i8, align 1
  store ptr %0, ptr %14, align 8, !tbaa !5
  store i32 %1, ptr %15, align 4, !tbaa !9
  store i32 %2, ptr %16, align 4, !tbaa !9
  store i32 %3, ptr %17, align 4, !tbaa !9
  store i32 %4, ptr %18, align 4, !tbaa !9
  store i32 %5, ptr %19, align 4, !tbaa !9
  store i32 %6, ptr %20, align 4, !tbaa !9
  store i32 %7, ptr %21, align 4, !tbaa !9
  store i32 %8, ptr %22, align 4, !tbaa !9
  store i32 %9, ptr %23, align 4, !tbaa !9
  store i32 %10, ptr %24, align 4, !tbaa !9
  store i32 %11, ptr %25, align 4, !tbaa !9
  store i32 %12, ptr %26, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #5
  store i32 1, ptr %27, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #5
  call void @llvm.memset.p0.i64(ptr align 8 %28, i8 0, i64 8, i1 false)
  %33 = load ptr, ptr %28, align 8, !tbaa !11
  %34 = icmp eq ptr null, %33
  br i1 %34, label %35, label %36

35:                                               ; preds = %13
  br label %37

36:                                               ; preds = %13
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 46, ptr noundef @__PRETTY_FUNCTION__.libxsmm_gemm_descriptor_init) #6
  unreachable

37:                                               ; preds = %35
  %38 = load i32, ptr %27, align 4, !tbaa !9
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %40, label %111

40:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 3, ptr %29) #5
  %41 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %41, ptr %28, align 8, !tbaa !11
  %42 = load ptr, ptr %28, align 8, !tbaa !11
  %43 = icmp ne ptr null, %42
  br i1 %43, label %44, label %45

44:                                               ; preds = %40
  br label %46

45:                                               ; preds = %40
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 50, ptr noundef @__PRETTY_FUNCTION__.libxsmm_gemm_descriptor_init) #6
  unreachable

46:                                               ; preds = %44
  %47 = load i32, ptr %15, align 4, !tbaa !9
  %48 = load i32, ptr %16, align 4, !tbaa !9
  %49 = load i32, ptr %18, align 4, !tbaa !9
  %50 = load i32, ptr %17, align 4, !tbaa !9
  %51 = getelementptr inbounds [3 x i8], ptr %29, i64 0, i64 0
  call void @LIBXSMM_GEMM_SET_DESC_DATATYPE(i32 noundef %47, i32 noundef %48, i32 noundef %49, i32 noundef %50, ptr noundef %51)
  br label %52

52:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 1, ptr %30) #5
  store i8 95, ptr %30, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #5
  %53 = load ptr, ptr %28, align 8, !tbaa !11
  store ptr %53, ptr %31, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %32) #5
  store i8 0, ptr %32, align 1, !tbaa !11
  br label %54

54:                                               ; preds = %65, %52
  %55 = load i8, ptr %32, align 1, !tbaa !11
  %56 = sext i8 %55 to i32
  %57 = load i8, ptr %30, align 1, !tbaa !11
  %58 = sext i8 %57 to i32
  %59 = icmp slt i32 %56, %58
  br i1 %59, label %60, label %68

60:                                               ; preds = %54
  %61 = load ptr, ptr %31, align 8, !tbaa !5
  %62 = load i8, ptr %32, align 1, !tbaa !11
  %63 = sext i8 %62 to i64
  %64 = getelementptr inbounds i8, ptr %61, i64 %63
  store i8 0, ptr %64, align 1, !tbaa !11
  br label %65

65:                                               ; preds = %60
  %66 = load i8, ptr %32, align 1, !tbaa !11
  %67 = add i8 %66, 1
  store i8 %67, ptr %32, align 1, !tbaa !11
  br label %54, !llvm.loop !12

68:                                               ; preds = %54
  call void @llvm.lifetime.end.p0(i64 1, ptr %32) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %30) #5
  br label %69

69:                                               ; preds = %68
  br label %70

70:                                               ; preds = %69
  %71 = getelementptr inbounds [3 x i8], ptr %29, i64 0, i64 0
  %72 = load i8, ptr %71, align 1, !tbaa !11
  %73 = load ptr, ptr %28, align 8, !tbaa !11
  %74 = getelementptr inbounds %struct.libxsmm_gemm_descriptor, ptr %73, i32 0, i32 8
  %75 = getelementptr inbounds [3 x i8], ptr %74, i64 0, i64 0
  store i8 %72, ptr %75, align 1, !tbaa !11
  %76 = getelementptr inbounds [3 x i8], ptr %29, i64 0, i64 1
  %77 = load i8, ptr %76, align 1, !tbaa !11
  %78 = load ptr, ptr %28, align 8, !tbaa !11
  %79 = getelementptr inbounds %struct.libxsmm_gemm_descriptor, ptr %78, i32 0, i32 8
  %80 = getelementptr inbounds [3 x i8], ptr %79, i64 0, i64 1
  store i8 %77, ptr %80, align 1, !tbaa !11
  %81 = getelementptr inbounds [3 x i8], ptr %29, i64 0, i64 2
  %82 = load i8, ptr %81, align 1, !tbaa !11
  %83 = load ptr, ptr %28, align 8, !tbaa !11
  %84 = getelementptr inbounds %struct.libxsmm_gemm_descriptor, ptr %83, i32 0, i32 8
  %85 = getelementptr inbounds [3 x i8], ptr %84, i64 0, i64 2
  store i8 %82, ptr %85, align 1, !tbaa !11
  %86 = load i32, ptr %26, align 4, !tbaa !9
  %87 = trunc i32 %86 to i8
  %88 = load ptr, ptr %28, align 8, !tbaa !11
  %89 = getelementptr inbounds %struct.libxsmm_gemm_descriptor, ptr %88, i32 0, i32 7
  store i8 %87, ptr %89, align 1, !tbaa !15
  %90 = load i32, ptr %25, align 4, !tbaa !9
  %91 = load ptr, ptr %28, align 8, !tbaa !11
  %92 = getelementptr inbounds %struct.libxsmm_gemm_descriptor, ptr %91, i32 0, i32 6
  store i32 %90, ptr %92, align 1, !tbaa !19
  %93 = load i32, ptr %19, align 4, !tbaa !9
  %94 = load ptr, ptr %28, align 8, !tbaa !11
  %95 = getelementptr inbounds %struct.libxsmm_gemm_descriptor, ptr %94, i32 0, i32 0
  store i32 %93, ptr %95, align 1, !tbaa !20
  %96 = load i32, ptr %20, align 4, !tbaa !9
  %97 = load ptr, ptr %28, align 8, !tbaa !11
  %98 = getelementptr inbounds %struct.libxsmm_gemm_descriptor, ptr %97, i32 0, i32 1
  store i32 %96, ptr %98, align 1, !tbaa !21
  %99 = load i32, ptr %21, align 4, !tbaa !9
  %100 = load ptr, ptr %28, align 8, !tbaa !11
  %101 = getelementptr inbounds %struct.libxsmm_gemm_descriptor, ptr %100, i32 0, i32 2
  store i32 %99, ptr %101, align 1, !tbaa !22
  %102 = load i32, ptr %22, align 4, !tbaa !9
  %103 = load ptr, ptr %28, align 8, !tbaa !11
  %104 = getelementptr inbounds %struct.libxsmm_gemm_descriptor, ptr %103, i32 0, i32 3
  store i32 %102, ptr %104, align 1, !tbaa !23
  %105 = load i32, ptr %23, align 4, !tbaa !9
  %106 = load ptr, ptr %28, align 8, !tbaa !11
  %107 = getelementptr inbounds %struct.libxsmm_gemm_descriptor, ptr %106, i32 0, i32 4
  store i32 %105, ptr %107, align 1, !tbaa !24
  %108 = load i32, ptr %24, align 4, !tbaa !9
  %109 = load ptr, ptr %28, align 8, !tbaa !11
  %110 = getelementptr inbounds %struct.libxsmm_gemm_descriptor, ptr %109, i32 0, i32 5
  store i32 %108, ptr %110, align 1, !tbaa !25
  call void @llvm.lifetime.end.p0(i64 3, ptr %29) #5
  br label %111

111:                                              ; preds = %70, %37
  %112 = load ptr, ptr %28, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #5
  ret ptr %112
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

declare void @LIBXSMM_GEMM_SET_DESC_DATATYPE(i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) #4

; 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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 #4 = { "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 #5 = { nounwind }
attributes #6 = { 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 = !{!"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, !14}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!"llvm.loop.unroll.count", i32 4}
!15 = !{!16, !7, i64 28}
!16 = !{!"libxsmm_gemm_descriptor", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !7, i64 28, !7, i64 29, !7, i64 32, !17, i64 33, !17, i64 41, !7, i64 49, !10, i64 50, !10, i64 54, !10, i64 58, !18, i64 62, !18, i64 64, !7, i64 66, !7, i64 67, !7, i64 68, !7, i64 69, !18, i64 70, !18, i64 72, !18, i64 74, !18, i64 76, !18, i64 78, !18, i64 80, !10, i64 82, !10, i64 86, !10, i64 90, !7, i64 94}
!17 = !{!"long long", !7, i64 0}
!18 = !{!"short", !7, i64 0}
!19 = !{!16, !10, i64 24}
!20 = !{!16, !10, i64 0}
!21 = !{!16, !10, i64 4}
!22 = !{!16, !10, i64 8}
!23 = !{!16, !10, i64 12}
!24 = !{!16, !10, i64 16}
!25 = !{!16, !10, i64 20}


; 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.1 = external hidden unnamed_addr constant [73 x i8], align 1
@__PRETTY_FUNCTION__.libxsmm_gemm_descriptor_init = external hidden unnamed_addr constant [265 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [25 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef ptr @libxsmm_gemm_descriptor_init(ptr noundef returned writeonly %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, i32 noundef %7, i32 noundef %8, i32 noundef %9, i32 noundef %10, i32 noundef %11, i32 noundef %12) local_unnamed_addr #0 {
  %14 = alloca [3 x i8], align 1
  call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %14) #5
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %15, label %16

15:                                               ; preds = %13
  tail call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 50, ptr noundef nonnull @__PRETTY_FUNCTION__.libxsmm_gemm_descriptor_init) #6
  unreachable

16:                                               ; preds = %13
  call void @LIBXSMM_GEMM_SET_DESC_DATATYPE(i32 noundef %1, i32 noundef %2, i32 noundef %4, i32 noundef %3, ptr noundef nonnull %14) #5
  %17 = getelementptr inbounds i8, ptr %0, i64 32
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(95) %17, i8 0, i64 63, i1 false), !tbaa !5
  %18 = load i8, ptr %14, align 1, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %0, i64 29
  store i8 %18, ptr %19, align 1, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %14, i64 1
  %21 = load i8, ptr %20, align 1, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %0, i64 30
  store i8 %21, ptr %22, align 1, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %14, i64 2
  %24 = load i8, ptr %23, align 1, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %0, i64 31
  store i8 %24, ptr %25, align 1, !tbaa !5
  %26 = trunc i32 %12 to i8
  %27 = getelementptr inbounds i8, ptr %0, i64 28
  store i8 %26, ptr %27, align 1, !tbaa !8
  %28 = getelementptr inbounds i8, ptr %0, i64 24
  store i32 %11, ptr %28, align 1, !tbaa !13
  store i32 %5, ptr %0, align 1, !tbaa !14
  %29 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 %6, ptr %29, align 1, !tbaa !15
  %30 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %7, ptr %30, align 1, !tbaa !16
  %31 = getelementptr inbounds i8, ptr %0, i64 12
  store i32 %8, ptr %31, align 1, !tbaa !17
  %32 = getelementptr inbounds i8, ptr %0, i64 16
  store i32 %9, ptr %32, align 1, !tbaa !18
  %33 = getelementptr inbounds i8, ptr %0, i64 20
  store i32 %10, ptr %33, align 1, !tbaa !19
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %14) #5
  ret ptr %0
}

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

declare void @LIBXSMM_GEMM_SET_DESC_DATATYPE(i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "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 #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
attributes #6 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !6, i64 28}
!9 = !{!"libxsmm_gemm_descriptor", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !6, i64 28, !6, i64 29, !6, i64 32, !11, i64 33, !11, i64 41, !6, i64 49, !10, i64 50, !10, i64 54, !10, i64 58, !12, i64 62, !12, i64 64, !6, i64 66, !6, i64 67, !6, i64 68, !6, i64 69, !12, i64 70, !12, i64 72, !12, i64 74, !12, i64 76, !12, i64 78, !12, i64 80, !10, i64 82, !10, i64 86, !10, i64 90, !6, i64 94}
!10 = !{!"int", !6, i64 0}
!11 = !{!"long long", !6, i64 0}
!12 = !{!"short", !6, i64 0}
!13 = !{!9, !10, i64 24}
!14 = !{!9, !10, i64 0}
!15 = !{!9, !10, i64 4}
!16 = !{!9, !10, i64 8}
!17 = !{!9, !10, i64 12}
!18 = !{!9, !10, i64 16}
!19 = !{!9, !10, i64 20}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopIdiomRecognizePass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass