; 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.1 = 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_init2 = external hidden unnamed_addr constant [323 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_init2(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, i16 noundef zeroext %12, i16 noundef zeroext %13, i8 noundef zeroext %14) #3 {
  %16 = alloca ptr, align 8
  %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 i16, align 2
  %29 = alloca i16, align 2
  %30 = alloca i8, align 1
  %31 = alloca %union.anon.1, align 8
  %32 = alloca i8, align 1
  %33 = alloca ptr, align 8
  %34 = alloca i8, align 1
  store ptr %0, ptr %16, align 8, !tbaa !5
  store i32 %1, ptr %17, align 4, !tbaa !9
  store i32 %2, ptr %18, align 4, !tbaa !9
  store i32 %3, ptr %19, align 4, !tbaa !9
  store i32 %4, ptr %20, align 4, !tbaa !9
  store i32 %5, ptr %21, align 4, !tbaa !9
  store i32 %6, ptr %22, align 4, !tbaa !9
  store i32 %7, ptr %23, align 4, !tbaa !9
  store i32 %8, ptr %24, align 4, !tbaa !9
  store i32 %9, ptr %25, align 4, !tbaa !9
  store i32 %10, ptr %26, align 4, !tbaa !9
  store i32 %11, ptr %27, align 4, !tbaa !9
  store i16 %12, ptr %28, align 2, !tbaa !11
  store i16 %13, ptr %29, align 2, !tbaa !11
  store i8 %14, ptr %30, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #4
  call void @llvm.memset.p0.i64(ptr align 8 %31, i8 0, i64 8, i1 false)
  br label %35

35:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 1, ptr %32) #4
  store i8 96, ptr %32, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %33) #4
  %36 = load ptr, ptr %16, align 8, !tbaa !5
  store ptr %36, ptr %33, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %34) #4
  store i8 0, ptr %34, align 1, !tbaa !13
  br label %37

37:                                               ; preds = %48, %35
  %38 = load i8, ptr %34, align 1, !tbaa !13
  %39 = sext i8 %38 to i32
  %40 = load i8, ptr %32, align 1, !tbaa !13
  %41 = sext i8 %40 to i32
  %42 = icmp slt i32 %39, %41
  br i1 %42, label %43, label %51

43:                                               ; preds = %37
  %44 = load ptr, ptr %33, align 8, !tbaa !5
  %45 = load i8, ptr %34, align 1, !tbaa !13
  %46 = sext i8 %45 to i64
  %47 = getelementptr inbounds i8, ptr %44, i64 %46
  store i8 0, ptr %47, align 1, !tbaa !13
  br label %48

48:                                               ; preds = %43
  %49 = load i8, ptr %34, align 1, !tbaa !13
  %50 = add i8 %49, 1
  store i8 %50, ptr %34, align 1, !tbaa !13
  br label %37, !llvm.loop !14

51:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 1, ptr %34) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %33) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %32) #4
  br label %52

52:                                               ; preds = %51
  br label %53

53:                                               ; preds = %52
  %54 = load ptr, ptr %16, align 8, !tbaa !5
  store ptr %54, ptr %31, align 8, !tbaa !13
  %55 = load ptr, ptr %31, align 8, !tbaa !13
  %56 = icmp ne ptr null, %55
  br i1 %56, label %57, label %58

57:                                               ; preds = %53
  br label %59

58:                                               ; preds = %53
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 101, ptr noundef @__PRETTY_FUNCTION__.libxsmm_meltw_descriptor_init2) #5
  unreachable

59:                                               ; preds = %57
  %60 = load i32, ptr %17, align 4, !tbaa !9
  %61 = load i32, ptr %21, align 4, !tbaa !9
  %62 = icmp eq i32 %60, %61
  br i1 %62, label %63, label %67

63:                                               ; preds = %59
  %64 = load i32, ptr %17, align 4, !tbaa !9
  %65 = trunc i32 %64 to i8
  %66 = zext i8 %65 to i32
  br label %76

67:                                               ; preds = %59
  %68 = load i32, ptr %17, align 4, !tbaa !9
  %69 = load i32, ptr %21, align 4, !tbaa !9
  %70 = shl i32 %69, 4
  %71 = trunc i32 %70 to i8
  %72 = zext i8 %71 to i32
  %73 = or i32 %68, %72
  %74 = trunc i32 %73 to i8
  %75 = zext i8 %74 to i32
  br label %76

76:                                               ; preds = %67, %63
  %77 = phi i32 [ %66, %63 ], [ %75, %67 ]
  %78 = trunc i32 %77 to i8
  %79 = load ptr, ptr %31, align 8, !tbaa !13
  %80 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %79, i32 0, i32 6
  store i8 %78, ptr %80, align 1, !tbaa !17
  %81 = load i32, ptr %18, align 4, !tbaa !9
  %82 = load i32, ptr %19, align 4, !tbaa !9
  %83 = icmp eq i32 %81, %82
  br i1 %83, label %84, label %88

84:                                               ; preds = %76
  %85 = load i32, ptr %18, align 4, !tbaa !9
  %86 = trunc i32 %85 to i8
  %87 = zext i8 %86 to i32
  br label %97

88:                                               ; preds = %76
  %89 = load i32, ptr %18, align 4, !tbaa !9
  %90 = load i32, ptr %19, align 4, !tbaa !9
  %91 = shl i32 %90, 4
  %92 = trunc i32 %91 to i8
  %93 = zext i8 %92 to i32
  %94 = or i32 %89, %93
  %95 = trunc i32 %94 to i8
  %96 = zext i8 %95 to i32
  br label %97

97:                                               ; preds = %88, %84
  %98 = phi i32 [ %87, %84 ], [ %96, %88 ]
  %99 = trunc i32 %98 to i8
  %100 = load ptr, ptr %31, align 8, !tbaa !13
  %101 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %100, i32 0, i32 7
  store i8 %99, ptr %101, align 1, !tbaa !19
  %102 = load i32, ptr %20, align 4, !tbaa !9
  %103 = load i32, ptr %21, align 4, !tbaa !9
  %104 = icmp eq i32 %102, %103
  br i1 %104, label %105, label %109

105:                                              ; preds = %97
  %106 = load i32, ptr %20, align 4, !tbaa !9
  %107 = trunc i32 %106 to i8
  %108 = zext i8 %107 to i32
  br label %118

109:                                              ; preds = %97
  %110 = load i32, ptr %20, align 4, !tbaa !9
  %111 = load i32, ptr %21, align 4, !tbaa !9
  %112 = shl i32 %111, 4
  %113 = trunc i32 %112 to i8
  %114 = zext i8 %113 to i32
  %115 = or i32 %110, %114
  %116 = trunc i32 %115 to i8
  %117 = zext i8 %116 to i32
  br label %118

118:                                              ; preds = %109, %105
  %119 = phi i32 [ %108, %105 ], [ %117, %109 ]
  %120 = trunc i32 %119 to i8
  %121 = load ptr, ptr %31, align 8, !tbaa !13
  %122 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %121, i32 0, i32 8
  store i8 %120, ptr %122, align 1, !tbaa !20
  %123 = load i16, ptr %28, align 2, !tbaa !11
  %124 = load ptr, ptr %31, align 8, !tbaa !13
  %125 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %124, i32 0, i32 9
  store i16 %123, ptr %125, align 1, !tbaa !21
  %126 = load i8, ptr %30, align 1, !tbaa !13
  %127 = load ptr, ptr %31, align 8, !tbaa !13
  %128 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %127, i32 0, i32 11
  store i8 %126, ptr %128, align 1, !tbaa !22
  %129 = load i16, ptr %29, align 2, !tbaa !11
  %130 = load ptr, ptr %31, align 8, !tbaa !13
  %131 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %130, i32 0, i32 10
  store i16 %129, ptr %131, align 1, !tbaa !23
  %132 = load i32, ptr %24, align 4, !tbaa !9
  %133 = load ptr, ptr %31, align 8, !tbaa !13
  %134 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %133, i32 0, i32 2
  store i32 %132, ptr %134, align 1, !tbaa !24
  %135 = load i32, ptr %25, align 4, !tbaa !9
  %136 = load ptr, ptr %31, align 8, !tbaa !13
  %137 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %136, i32 0, i32 3
  store i32 %135, ptr %137, align 1, !tbaa !25
  %138 = load i32, ptr %26, align 4, !tbaa !9
  %139 = load ptr, ptr %31, align 8, !tbaa !13
  %140 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %139, i32 0, i32 4
  store i32 %138, ptr %140, align 1, !tbaa !26
  %141 = load i32, ptr %27, align 4, !tbaa !9
  %142 = load ptr, ptr %31, align 8, !tbaa !13
  %143 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %142, i32 0, i32 5
  store i32 %141, ptr %143, align 1, !tbaa !27
  %144 = load i32, ptr %22, align 4, !tbaa !9
  %145 = load ptr, ptr %31, align 8, !tbaa !13
  %146 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %145, i32 0, i32 0
  store i32 %144, ptr %146, align 1, !tbaa !28
  %147 = load i32, ptr %23, align 4, !tbaa !9
  %148 = load ptr, ptr %31, align 8, !tbaa !13
  %149 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %148, i32 0, i32 1
  store i32 %147, ptr %149, align 1, !tbaa !29
  %150 = load ptr, ptr %31, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #4
  ret ptr %150
}

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


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