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

%struct.libxsmm_generated_code = type { ptr, i32, i32, i32, i32, i32, i32 }
%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 [72 x i8], align 1
@.str.144 = external hidden unnamed_addr constant [54 x i8], align 1
@__PRETTY_FUNCTION__.libxsmm_mmfunction_signature = external hidden unnamed_addr constant [107 x i8], align 1
@.str.145 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.146 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.147 = external hidden unnamed_addr constant [128 x i8], align 1
@.str.148 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.149 = external hidden unnamed_addr constant [134 x i8], align 1
@.str.150 = external hidden unnamed_addr constant [19 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @libxsmm_append_code_as_string(ptr noundef, ptr noundef, i32 noundef) #0

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

; Function Attrs: nounwind
declare i32 @snprintf(ptr noundef, i64 noundef, ptr noundef, ...) #2

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @LIBXSMM_GEMM_GETENUM_AB_COMMON_PREC(ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local void @libxsmm_mmfunction_signature(ptr noundef %0, ptr noundef %1, ptr noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca [512 x i8], align 16
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 512, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 511, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !9
  %11 = load ptr, ptr %6, align 8, !tbaa !5
  %12 = icmp ne ptr null, %11
  br i1 %12, label %13, label %14

13:                                               ; preds = %3
  br label %15

14:                                               ; preds = %3
  call void @__assert_fail(ptr noundef @.str.144, ptr noundef @.str, i32 noundef 958, ptr noundef @__PRETTY_FUNCTION__.libxsmm_mmfunction_signature) #5
  unreachable

15:                                               ; preds = %13
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %16, i32 0, i32 3
  %18 = load i32, ptr %17, align 8, !tbaa !11
  %19 = icmp ugt i32 %18, 1
  br i1 %19, label %20, label %21

20:                                               ; preds = %15
  store i32 1, ptr %10, align 4
  br label %98

21:                                               ; preds = %15
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %22, i32 0, i32 3
  %24 = load i32, ptr %23, align 8, !tbaa !11
  %25 = icmp eq i32 %24, 1
  br i1 %25, label %26, label %34

26:                                               ; preds = %21
  %27 = getelementptr inbounds [512 x i8], ptr %7, i64 0, i64 0
  %28 = load i32, ptr %8, align 4, !tbaa !9
  %29 = sext i32 %28 to i64
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %27, i64 noundef %29, ptr noundef @.str.145, ptr noundef %30, ptr noundef %31, ptr noundef %32) #4
  store i32 %33, ptr %9, align 4, !tbaa !9
  br label %93

34:                                               ; preds = %21
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.libxsmm_gemm_descriptor, ptr %35, i32 0, i32 8
  %37 = getelementptr inbounds [3 x i8], ptr %36, i64 0, i64 0
  %38 = call i32 @LIBXSMM_GEMM_GETENUM_AB_COMMON_PREC(ptr noundef %37)
  %39 = icmp eq i32 1, %38
  br i1 %39, label %40, label %59

40:                                               ; preds = %34
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.libxsmm_gemm_descriptor, ptr %41, i32 0, i32 7
  %43 = load i8, ptr %42, align 1, !tbaa !13
  %44 = zext i8 %43 to i32
  %45 = icmp eq i32 0, %44
  br i1 %45, label %46, label %52

46:                                               ; preds = %40
  %47 = getelementptr inbounds [512 x i8], ptr %7, i64 0, i64 0
  %48 = load i32, ptr %8, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %47, i64 noundef %49, ptr noundef @.str.146, ptr noundef %50) #4
  store i32 %51, ptr %9, align 4, !tbaa !9
  br label %58

52:                                               ; preds = %40
  %53 = getelementptr inbounds [512 x i8], ptr %7, i64 0, i64 0
  %54 = load i32, ptr %8, align 4, !tbaa !9
  %55 = sext i32 %54 to i64
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %53, i64 noundef %55, ptr noundef @.str.147, ptr noundef %56) #4
  store i32 %57, ptr %9, align 4, !tbaa !9
  br label %58

58:                                               ; preds = %52, %46
  br label %92

59:                                               ; preds = %34
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.libxsmm_gemm_descriptor, ptr %60, i32 0, i32 8
  %62 = getelementptr inbounds [3 x i8], ptr %61, i64 0, i64 0
  %63 = call i32 @LIBXSMM_GEMM_GETENUM_AB_COMMON_PREC(ptr noundef %62)
  %64 = icmp eq i32 0, %63
  br i1 %64, label %65, label %84

65:                                               ; preds = %59
  %66 = load ptr, ptr %6, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.libxsmm_gemm_descriptor, ptr %66, i32 0, i32 7
  %68 = load i8, ptr %67, align 1, !tbaa !13
  %69 = zext i8 %68 to i32
  %70 = icmp eq i32 0, %69
  br i1 %70, label %71, label %77

71:                                               ; preds = %65
  %72 = getelementptr inbounds [512 x i8], ptr %7, i64 0, i64 0
  %73 = load i32, ptr %8, align 4, !tbaa !9
  %74 = sext i32 %73 to i64
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %72, i64 noundef %74, ptr noundef @.str.148, ptr noundef %75) #4
  store i32 %76, ptr %9, align 4, !tbaa !9
  br label %83

77:                                               ; preds = %65
  %78 = getelementptr inbounds [512 x i8], ptr %7, i64 0, i64 0
  %79 = load i32, ptr %8, align 4, !tbaa !9
  %80 = sext i32 %79 to i64
  %81 = load ptr, ptr %5, align 8, !tbaa !5
  %82 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %78, i64 noundef %80, ptr noundef @.str.149, ptr noundef %81) #4
  store i32 %82, ptr %9, align 4, !tbaa !9
  br label %83

83:                                               ; preds = %77, %71
  br label %91

84:                                               ; preds = %59
  %85 = load i32, ptr %9, align 4, !tbaa !9
  %86 = icmp eq i32 0, %85
  br i1 %86, label %87, label %88

87:                                               ; preds = %84
  br label %89

88:                                               ; preds = %84
  call void @__assert_fail(ptr noundef @.str.150, ptr noundef @.str, i32 noundef 978, ptr noundef @__PRETTY_FUNCTION__.libxsmm_mmfunction_signature) #5
  unreachable

89:                                               ; preds = %87
  %90 = getelementptr inbounds [512 x i8], ptr %7, i64 0, i64 0
  store i8 0, ptr %90, align 16, !tbaa !17
  br label %91

91:                                               ; preds = %89, %83
  br label %92

92:                                               ; preds = %91, %58
  br label %93

93:                                               ; preds = %92, %26
  br label %94

94:                                               ; preds = %93
  %95 = load ptr, ptr %4, align 8, !tbaa !5
  %96 = getelementptr inbounds [512 x i8], ptr %7, i64 0, i64 0
  %97 = load i32, ptr %9, align 4, !tbaa !9
  call void @libxsmm_append_code_as_string(ptr noundef %95, ptr noundef %96, i32 noundef %97)
  store i32 0, ptr %10, align 4
  br label %98

98:                                               ; preds = %94, %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 512, ptr %7) #4
  %99 = load i32, ptr %10, align 4
  switch i32 %99, label %101 [
    i32 0, label %100
    i32 1, label %100
  ]

100:                                              ; preds = %98, %98
  ret void

101:                                              ; preds = %98
  unreachable
}

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 = { 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 = { 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 = { nounwind }
attributes #5 = { 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 = !{!12, !10, i64 16}
!12 = !{!"libxsmm_generated_code", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28}
!13 = !{!14, !7, i64 28}
!14 = !{!"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, !15, i64 33, !15, i64 41, !7, i64 49, !10, i64 50, !10, i64 54, !10, i64 58, !16, i64 62, !16, i64 64, !7, i64 66, !7, i64 67, !7, i64 68, !7, i64 69, !16, i64 70, !16, i64 72, !16, i64 74, !16, i64 76, !16, i64 78, !16, i64 80, !10, i64 82, !10, i64 86, !10, i64 90, !7, i64 94}
!15 = !{!"long long", !7, i64 0}
!16 = !{!"short", !7, i64 0}
!17 = !{!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"

@.str = external hidden unnamed_addr constant [72 x i8], align 1
@.str.144 = external hidden unnamed_addr constant [54 x i8], align 1
@__PRETTY_FUNCTION__.libxsmm_mmfunction_signature = external hidden unnamed_addr constant [107 x i8], align 1
@.str.145 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.146 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.147 = external hidden unnamed_addr constant [128 x i8], align 1
@.str.148 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.149 = external hidden unnamed_addr constant [134 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @libxsmm_append_code_as_string(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nofree nounwind
declare noundef i32 @snprintf(ptr noalias nocapture noundef writeonly, i64 noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @LIBXSMM_GEMM_GETENUM_AB_COMMON_PREC(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @libxsmm_mmfunction_signature(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = alloca [512 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %4) #4
  %.not = icmp eq ptr %2, null
  br i1 %.not, label %5, label %6

5:                                                ; preds = %3
  tail call void @__assert_fail(ptr noundef nonnull @.str.144, ptr noundef nonnull @.str, i32 noundef 958, ptr noundef nonnull @__PRETTY_FUNCTION__.libxsmm_mmfunction_signature) #5
  unreachable

6:                                                ; preds = %3
  %7 = getelementptr inbounds i8, ptr %0, i64 16
  %8 = load i32, ptr %7, align 8, !tbaa !5
  %9 = icmp ugt i32 %8, 1
  br i1 %9, label %39, label %10

10:                                               ; preds = %6
  %11 = icmp eq i32 %8, 1
  br i1 %11, label %12, label %14

12:                                               ; preds = %10
  %13 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %4, i64 noundef 511, ptr noundef nonnull @.str.145, ptr noundef %1, ptr noundef %1, ptr noundef %1) #4
  br label %38

14:                                               ; preds = %10
  %15 = getelementptr inbounds i8, ptr %2, i64 29
  %16 = tail call i32 @LIBXSMM_GEMM_GETENUM_AB_COMMON_PREC(ptr noundef nonnull %15)
  %17 = icmp eq i32 %16, 1
  br i1 %17, label %18, label %26

18:                                               ; preds = %14
  %19 = getelementptr inbounds i8, ptr %2, i64 28
  %20 = load i8, ptr %19, align 1, !tbaa !11
  %21 = icmp eq i8 %20, 0
  br i1 %21, label %22, label %24

22:                                               ; preds = %18
  %23 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %4, i64 noundef 511, ptr noundef nonnull @.str.146, ptr noundef %1) #4
  br label %38

24:                                               ; preds = %18
  %25 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %4, i64 noundef 511, ptr noundef nonnull @.str.147, ptr noundef %1) #4
  br label %38

26:                                               ; preds = %14
  %27 = tail call i32 @LIBXSMM_GEMM_GETENUM_AB_COMMON_PREC(ptr noundef nonnull %15)
  %28 = icmp eq i32 %27, 0
  br i1 %28, label %29, label %37

29:                                               ; preds = %26
  %30 = getelementptr inbounds i8, ptr %2, i64 28
  %31 = load i8, ptr %30, align 1, !tbaa !11
  %32 = icmp eq i8 %31, 0
  br i1 %32, label %33, label %35

33:                                               ; preds = %29
  %34 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %4, i64 noundef 511, ptr noundef nonnull @.str.148, ptr noundef %1) #4
  br label %38

35:                                               ; preds = %29
  %36 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %4, i64 noundef 511, ptr noundef nonnull @.str.149, ptr noundef %1) #4
  br label %38

37:                                               ; preds = %26
  store i8 0, ptr %4, align 16, !tbaa !15
  br label %38

38:                                               ; preds = %12, %37, %35, %33, %22, %24
  %.0 = phi i32 [ %13, %12 ], [ %23, %22 ], [ %25, %24 ], [ %34, %33 ], [ %36, %35 ], [ 0, %37 ]
  call void @libxsmm_append_code_as_string(ptr noundef nonnull %0, ptr noundef nonnull %4, i32 noundef %.0)
  br label %39

39:                                               ; preds = %6, %38
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %4) #4
  ret void
}

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 = { nofree 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 = { 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 = { nounwind }
attributes #5 = { 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, !10, i64 16}
!6 = !{!"libxsmm_generated_code", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!12, !8, i64 28}
!12 = !{!"libxsmm_gemm_descriptor", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !8, i64 28, !8, i64 29, !8, i64 32, !13, i64 33, !13, i64 41, !8, i64 49, !10, i64 50, !10, i64 54, !10, i64 58, !14, i64 62, !14, i64 64, !8, i64 66, !8, i64 67, !8, i64 68, !8, i64 69, !14, i64 70, !14, i64 72, !14, i64 74, !14, i64 76, !14, i64 78, !14, i64 80, !10, i64 82, !10, i64 86, !10, i64 90, !8, i64 94}
!13 = !{!"long long", !8, i64 0}
!14 = !{!"short", !8, i64 0}
!15 = !{!8, !8, i64 0}


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