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

; 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_meltw_descriptor = type <{ i32, i32, i32, i32, i32, i32, i8, i8, i8, i16, i16, i8 }>

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

; Function Attrs: nounwind uwtable
define dso_local i32 @libxsmm_is_transform_op(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #2
  store i32 0, ptr %3, align 4, !tbaa !9
  %4 = load ptr, ptr %2, align 8, !tbaa !5
  %5 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %4, i32 0, i32 10
  %6 = load i16, ptr %5, align 1, !tbaa !11
  %7 = zext i16 %6 to i32
  %8 = icmp eq i32 %7, 29
  br i1 %8, label %153, label %9

9:                                                ; preds = %1
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %10, i32 0, i32 10
  %12 = load i16, ptr %11, align 1, !tbaa !11
  %13 = zext i16 %12 to i32
  %14 = icmp eq i32 %13, 30
  br i1 %14, label %153, label %15

15:                                               ; preds = %9
  %16 = load ptr, ptr %2, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %16, i32 0, i32 10
  %18 = load i16, ptr %17, align 1, !tbaa !11
  %19 = zext i16 %18 to i32
  %20 = icmp eq i32 %19, 55
  br i1 %20, label %153, label %21

21:                                               ; preds = %15
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %22, i32 0, i32 10
  %24 = load i16, ptr %23, align 1, !tbaa !11
  %25 = zext i16 %24 to i32
  %26 = icmp eq i32 %25, 72
  br i1 %26, label %153, label %27

27:                                               ; preds = %21
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %28, i32 0, i32 10
  %30 = load i16, ptr %29, align 1, !tbaa !11
  %31 = zext i16 %30 to i32
  %32 = icmp eq i32 %31, 32
  br i1 %32, label %153, label %33

33:                                               ; preds = %27
  %34 = load ptr, ptr %2, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %34, i32 0, i32 10
  %36 = load i16, ptr %35, align 1, !tbaa !11
  %37 = zext i16 %36 to i32
  %38 = icmp eq i32 %37, 28
  br i1 %38, label %153, label %39

39:                                               ; preds = %33
  %40 = load ptr, ptr %2, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %40, i32 0, i32 10
  %42 = load i16, ptr %41, align 1, !tbaa !11
  %43 = zext i16 %42 to i32
  %44 = icmp eq i32 %43, 31
  br i1 %44, label %153, label %45

45:                                               ; preds = %39
  %46 = load ptr, ptr %2, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %46, i32 0, i32 10
  %48 = load i16, ptr %47, align 1, !tbaa !11
  %49 = zext i16 %48 to i32
  %50 = icmp eq i32 %49, 76
  br i1 %50, label %153, label %51

51:                                               ; preds = %45
  %52 = load ptr, ptr %2, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %52, i32 0, i32 10
  %54 = load i16, ptr %53, align 1, !tbaa !11
  %55 = zext i16 %54 to i32
  %56 = icmp eq i32 %55, 75
  br i1 %56, label %153, label %57

57:                                               ; preds = %51
  %58 = load ptr, ptr %2, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %58, i32 0, i32 10
  %60 = load i16, ptr %59, align 1, !tbaa !11
  %61 = zext i16 %60 to i32
  %62 = icmp eq i32 %61, 66
  br i1 %62, label %153, label %63

63:                                               ; preds = %57
  %64 = load ptr, ptr %2, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %64, i32 0, i32 10
  %66 = load i16, ptr %65, align 1, !tbaa !11
  %67 = zext i16 %66 to i32
  %68 = icmp eq i32 %67, 67
  br i1 %68, label %153, label %69

69:                                               ; preds = %63
  %70 = load ptr, ptr %2, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %70, i32 0, i32 10
  %72 = load i16, ptr %71, align 1, !tbaa !11
  %73 = zext i16 %72 to i32
  %74 = icmp eq i32 %73, 56
  br i1 %74, label %153, label %75

75:                                               ; preds = %69
  %76 = load ptr, ptr %2, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %76, i32 0, i32 10
  %78 = load i16, ptr %77, align 1, !tbaa !11
  %79 = zext i16 %78 to i32
  %80 = icmp eq i32 %79, 73
  br i1 %80, label %153, label %81

81:                                               ; preds = %75
  %82 = load ptr, ptr %2, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %82, i32 0, i32 10
  %84 = load i16, ptr %83, align 1, !tbaa !11
  %85 = zext i16 %84 to i32
  %86 = icmp eq i32 %85, 57
  br i1 %86, label %153, label %87

87:                                               ; preds = %81
  %88 = load ptr, ptr %2, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %88, i32 0, i32 10
  %90 = load i16, ptr %89, align 1, !tbaa !11
  %91 = zext i16 %90 to i32
  %92 = icmp eq i32 %91, 54
  br i1 %92, label %153, label %93

93:                                               ; preds = %87
  %94 = load ptr, ptr %2, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %94, i32 0, i32 10
  %96 = load i16, ptr %95, align 1, !tbaa !11
  %97 = zext i16 %96 to i32
  %98 = icmp eq i32 %97, 74
  br i1 %98, label %153, label %99

99:                                               ; preds = %93
  %100 = load ptr, ptr %2, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %100, i32 0, i32 10
  %102 = load i16, ptr %101, align 1, !tbaa !11
  %103 = zext i16 %102 to i32
  %104 = icmp eq i32 %103, 71
  br i1 %104, label %153, label %105

105:                                              ; preds = %99
  %106 = load ptr, ptr %2, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %106, i32 0, i32 10
  %108 = load i16, ptr %107, align 1, !tbaa !11
  %109 = zext i16 %108 to i32
  %110 = icmp eq i32 %109, 61
  br i1 %110, label %153, label %111

111:                                              ; preds = %105
  %112 = load ptr, ptr %2, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %112, i32 0, i32 10
  %114 = load i16, ptr %113, align 1, !tbaa !11
  %115 = zext i16 %114 to i32
  %116 = icmp eq i32 %115, 62
  br i1 %116, label %153, label %117

117:                                              ; preds = %111
  %118 = load ptr, ptr %2, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %118, i32 0, i32 10
  %120 = load i16, ptr %119, align 1, !tbaa !11
  %121 = zext i16 %120 to i32
  %122 = icmp eq i32 %121, 40
  br i1 %122, label %153, label %123

123:                                              ; preds = %117
  %124 = load ptr, ptr %2, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %124, i32 0, i32 10
  %126 = load i16, ptr %125, align 1, !tbaa !11
  %127 = zext i16 %126 to i32
  %128 = icmp eq i32 %127, 39
  br i1 %128, label %153, label %129

129:                                              ; preds = %123
  %130 = load ptr, ptr %2, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %130, i32 0, i32 10
  %132 = load i16, ptr %131, align 1, !tbaa !11
  %133 = zext i16 %132 to i32
  %134 = icmp eq i32 %133, 41
  br i1 %134, label %153, label %135

135:                                              ; preds = %129
  %136 = load ptr, ptr %2, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %136, i32 0, i32 10
  %138 = load i16, ptr %137, align 1, !tbaa !11
  %139 = zext i16 %138 to i32
  %140 = icmp eq i32 %139, 59
  br i1 %140, label %153, label %141

141:                                              ; preds = %135
  %142 = load ptr, ptr %2, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %142, i32 0, i32 10
  %144 = load i16, ptr %143, align 1, !tbaa !11
  %145 = zext i16 %144 to i32
  %146 = icmp eq i32 %145, 58
  br i1 %146, label %153, label %147

147:                                              ; preds = %141
  %148 = load ptr, ptr %2, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.libxsmm_meltw_descriptor, ptr %148, i32 0, i32 10
  %150 = load i16, ptr %149, align 1, !tbaa !11
  %151 = zext i16 %150 to i32
  %152 = icmp eq i32 %151, 60
  br i1 %152, label %153, label %154

153:                                              ; preds = %147, %141, %135, %129, %123, %117, %111, %105, %99, %93, %87, %81, %75, %69, %63, %57, %51, %45, %39, %33, %27, %21, %15, %9, %1
  store i32 1, ptr %3, align 4, !tbaa !9
  br label %154

154:                                              ; preds = %153, %147
  %155 = load i32, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #2
  ret i32 %155
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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, !13, i64 29}
!12 = !{!"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, !13, i64 27, !13, i64 29, !7, i64 31}
!13 = !{!"short", !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"

@switch.table.libxsmm_is_transform_op = private unnamed_addr constant [49 x i32] [i32 1, i32 1, i32 1, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 0, i32 0, i32 0, i32 1, i32 1, i32 0, i32 0, i32 0, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1], align 4

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local range(i32 0, 2) i32 @libxsmm_is_transform_op(ptr nocapture noundef readonly %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 29
  %3 = load i16, ptr %2, align 1, !tbaa !5
  %switch.tableidx = add i16 %3, -28
  %4 = icmp ult i16 %switch.tableidx, 49
  br i1 %4, label %switch.lookup, label %6

switch.lookup:                                    ; preds = %1
  %5 = zext nneg i16 %switch.tableidx to i64
  %switch.gep = getelementptr inbounds [49 x i32], ptr @switch.table.libxsmm_is_transform_op, i64 0, i64 %5
  %switch.load = load i32, ptr %switch.gep, align 4
  br label %6

6:                                                ; preds = %switch.lookup, %1
  %.0 = phi i32 [ 0, %1 ], [ %switch.load, %switch.lookup ]
  ret i32 %.0
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) 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" }

!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 29}
!6 = !{!"libxsmm_meltw_descriptor", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !8, i64 24, !8, i64 25, !8, i64 26, !10, i64 27, !10, i64 29, !8, i64 31}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"short", !8, i64 0}


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