; 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.0 = type { ptr }
%struct.libxsmm_meltw_descriptor = type <{ i32, i32, i32, i32, i32, i32, i8, i8, i8, i16, i16, i8 }>

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

; 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

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

; 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 ptr @libxsmm_meltw_descriptor_init(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, i16 noundef zeroext %7, i16 noundef zeroext %8, i8 noundef zeroext %9) #3 {
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i16, align 2
  %19 = alloca i16, align 2
  %20 = alloca i8, align 1
  %21 = alloca %union.anon.0, align 8
  %22 = alloca i8, align 1
  %23 = alloca ptr, align 8
  %24 = alloca i8, align 1
  store ptr %0, ptr %11, align 8, !tbaa !5
  store i32 %1, ptr %12, align 4, !tbaa !9
  store i32 %2, ptr %13, align 4, !tbaa !9
  store i32 %3, ptr %14, align 4, !tbaa !9
  store i32 %4, ptr %15, align 4, !tbaa !9
  store i32 %5, ptr %16, align 4, !tbaa !9
  store i32 %6, ptr %17, align 4, !tbaa !9
  store i16 %7, ptr %18, align 2, !tbaa !11
  store i16 %8, ptr %19, align 2, !tbaa !11
  store i8 %9, ptr %20, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  call void @llvm.memset.p0.i64(ptr align 8 %21, i8 0, i64 8, i1 false)
  br label %25

25:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 1, ptr %22) #4
  store i8 96, ptr %22, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #4
  %26 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %26, ptr %23, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %24) #4
  store i8 0, ptr %24, align 1, !tbaa !13
  br label %27

27:                                               ; preds = %38, %25
  %28 = load i8, ptr %24, align 1, !tbaa !13
  %29 = sext i8 %28 to i32
  %30 = load i8, ptr %22, align 1, !tbaa !13
  %31 = sext i8 %30 to i32
  %32 = icmp slt i32 %29, %31
  br i1 %32, label %33, label %41

33:                                               ; preds = %27
  %34 = load ptr, ptr %23, align 8, !tbaa !5
  %35 = load i8, ptr %24, align 1, !tbaa !13
  %36 = sext i8 %35 to i64
  %37 = getelementptr inbounds i8, ptr %34, i64 %36
  store i8 0, ptr %37, align 1, !tbaa !13
  br label %38

38:                                               ; preds = %33
  %39 = load i8, ptr %24, align 1, !tbaa !13
  %40 = add i8 %39, 1
  store i8 %40, ptr %24, align 1, !tbaa !13
  br label %27, !llvm.loop !14

41:                                               ; preds = %27
  call void @llvm.lifetime.end.p0(i64 1, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %22) #4
  br label %42

42:                                               ; preds = %41
  br label %43

43:                                               ; preds = %42
  %44 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %44, ptr %21, align 8, !tbaa !13
  %45 = load ptr, ptr %21, align 8, !tbaa !13
  %46 = icmp ne ptr null, %45
  br i1 %46, label %47, label %48

47:                                               ; preds = %43
  br label %49

48:                                               ; preds = %43
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 73, ptr noundef @__PRETTY_FUNCTION__.libxsmm_meltw_descriptor_init) #5
  unreachable

49:                                               ; preds = %47
  %50 = load i32, ptr %12, align 4, !tbaa !9
  %51 = load i32, ptr %13, align 4, !tbaa !9
  %52 = icmp eq i32 %50, %51
  br i1 %52, label %53, label %57

53:                                               ; preds = %49
  %54 = load i32, ptr %12, align 4, !tbaa !9
  %55 = trunc i32 %54 to i8
  %56 = zext i8 %55 to i32
  br label %66

57:                                               ; preds = %49
  %58 = load i32, ptr %12, align 4, !tbaa !9
  %59 = load i32, ptr %13, align 4, !tbaa !9
  %60 = shl i32 %59, 4
  %61 = trunc i32 %60 to i8
  %62 = zext i8 %61 to i32
  %63 = or i32 %58, %62
  %64 = trunc i32 %63 to i8
  %65 = zext i8 %64 to i32
  br label %66

66:                                               ; preds = %57, %53
  %67 = phi i32 [ %56, %53 ], [ %65, %57 ]
  %68 = trunc i32 %67 to i8
  %69 = load ptr, ptr %21, align 8, !tbaa !13
  %70 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %69, i32 0, i32 6
  store i8 %68, ptr %70, align 1, !tbaa !17
  %71 = load ptr, ptr %21, align 8, !tbaa !13
  %72 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %71, i32 0, i32 8
  store i8 0, ptr %72, align 1, !tbaa !19
  %73 = load i16, ptr %18, align 2, !tbaa !11
  %74 = load ptr, ptr %21, align 8, !tbaa !13
  %75 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %74, i32 0, i32 9
  store i16 %73, ptr %75, align 1, !tbaa !20
  %76 = load i8, ptr %20, align 1, !tbaa !13
  %77 = load ptr, ptr %21, align 8, !tbaa !13
  %78 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %77, i32 0, i32 11
  store i8 %76, ptr %78, align 1, !tbaa !21
  %79 = load i16, ptr %19, align 2, !tbaa !11
  %80 = load ptr, ptr %21, align 8, !tbaa !13
  %81 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %80, i32 0, i32 10
  store i16 %79, ptr %81, align 1, !tbaa !22
  %82 = load i32, ptr %16, align 4, !tbaa !9
  %83 = load ptr, ptr %21, align 8, !tbaa !13
  %84 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %83, i32 0, i32 2
  store i32 %82, ptr %84, align 1, !tbaa !23
  %85 = load i32, ptr %17, align 4, !tbaa !9
  %86 = load ptr, ptr %21, align 8, !tbaa !13
  %87 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %86, i32 0, i32 3
  store i32 %85, ptr %87, align 1, !tbaa !24
  %88 = load ptr, ptr %21, align 8, !tbaa !13
  %89 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %88, i32 0, i32 4
  store i32 0, ptr %89, align 1, !tbaa !25
  %90 = load ptr, ptr %21, align 8, !tbaa !13
  %91 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %90, i32 0, i32 5
  store i32 0, ptr %91, align 1, !tbaa !26
  %92 = load i32, ptr %14, align 4, !tbaa !9
  %93 = load ptr, ptr %21, align 8, !tbaa !13
  %94 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %93, i32 0, i32 0
  store i32 %92, ptr %94, align 1, !tbaa !27
  %95 = load i32, ptr %15, align 4, !tbaa !9
  %96 = load ptr, ptr %21, align 8, !tbaa !13
  %97 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %96, i32 0, i32 1
  store i32 %95, ptr %97, align 1, !tbaa !28
  %98 = load ptr, ptr %21, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  ret ptr %98
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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 #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, !12, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15, !16}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!"llvm.loop.unroll.count", i32 4}
!17 = !{!18, !7, i64 24}
!18 = !{!"libxsmm_meltw_descriptor", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !7, i64 24, !7, i64 25, !7, i64 26, !12, i64 27, !12, i64 29, !7, i64 31}
!19 = !{!18, !7, i64 26}
!20 = !{!18, !12, i64 27}
!21 = !{!18, !7, i64 31}
!22 = !{!18, !12, i64 29}
!23 = !{!18, !10, i64 8}
!24 = !{!18, !10, i64 12}
!25 = !{!18, !10, i64 16}
!26 = !{!18, !10, i64 20}
!27 = !{!18, !10, i64 0}
!28 = !{!18, !10, i64 4}


; 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 noundef ptr @libxsmm_meltw_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, i16 noundef zeroext %7, i16 noundef zeroext %8, i8 noundef zeroext %9) local_unnamed_addr #0 {
  %11 = getelementptr inbounds i8, ptr %0, i64 25
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(96) %11, i8 0, i64 71, i1 false), !tbaa !5
  %12 = icmp eq i32 %1, %2
  %13 = shl i32 %2, 4
  %14 = select i1 %12, i32 0, i32 %13
  %.in = or i32 %14, %1
  %15 = trunc i32 %.in to i8
  %16 = getelementptr inbounds i8, ptr %0, i64 24
  store i8 %15, ptr %16, align 1, !tbaa !8
  %17 = getelementptr inbounds i8, ptr %0, i64 27
  store i16 %7, ptr %17, align 1, !tbaa !12
  %18 = getelementptr inbounds i8, ptr %0, i64 31
  store i8 %9, ptr %18, align 1, !tbaa !13
  %19 = getelementptr inbounds i8, ptr %0, i64 29
  store i16 %8, ptr %19, align 1, !tbaa !14
  %20 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %5, ptr %20, align 1, !tbaa !15
  %21 = getelementptr inbounds i8, ptr %0, i64 12
  store i32 %6, ptr %21, align 1, !tbaa !16
  %22 = getelementptr inbounds i8, ptr %0, i64 16
  store i32 0, ptr %22, align 1, !tbaa !17
  %23 = getelementptr inbounds i8, ptr %0, i64 20
  store i32 0, ptr %23, align 1, !tbaa !18
  store i32 %3, ptr %0, align 1, !tbaa !19
  %24 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 %4, ptr %24, align 1, !tbaa !20
  ret ptr %0
}

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

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" }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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 24}
!9 = !{!"libxsmm_meltw_descriptor", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !6, i64 24, !6, i64 25, !6, i64 26, !11, i64 27, !11, i64 29, !6, i64 31}
!10 = !{!"int", !6, i64 0}
!11 = !{!"short", !6, i64 0}
!12 = !{!9, !11, i64 27}
!13 = !{!9, !6, i64 31}
!14 = !{!9, !11, i64 29}
!15 = !{!9, !10, i64 8}
!16 = !{!9, !10, i64 12}
!17 = !{!9, !10, i64 16}
!18 = !{!9, !10, i64 20}
!19 = !{!9, !10, i64 0}
!20 = !{!9, !10, i64 4}


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