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

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

@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [86 x i8], align 1
@libxsmm_ninit = external global i32, align 4
@libxsmm_verbosity = external global i32, align 4
@.str.93 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.94 = external hidden unnamed_addr constant [67 x i8], align 1
@__func__.libxsmm_aarch64_instruction_sme_mov = external hidden unnamed_addr constant [36 x i8], align 1

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #0

declare void @libxsmm_handle_error(ptr noundef, i32 noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef) #1

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

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

; Function Attrs: nounwind uwtable
define dso_local void @libxsmm_aarch64_instruction_sme_mov(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5) #3 {
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store i32 %2, ptr %9, align 4, !tbaa !9
  store i32 %3, ptr %10, align 4, !tbaa !9
  store i32 %4, ptr %11, align 4, !tbaa !9
  store i32 %5, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %16 = load ptr, ptr %7, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %16, i32 0, i32 2
  %18 = load i32, ptr %17, align 4, !tbaa !11
  %19 = udiv i32 %18, 4
  store i32 %19, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %20, i32 0, i32 0
  %22 = load ptr, ptr %21, align 8, !tbaa !13
  store ptr %22, ptr %14, align 8, !tbaa !5
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %23, i32 0, i32 6
  %25 = load i32, ptr %24, align 4, !tbaa !14
  %26 = icmp ne i32 %25, 2501
  br i1 %26, label %27, label %38

27:                                               ; preds = %6
  %28 = load ptr, ptr @stderr, align 8, !tbaa !5
  %29 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %28, ptr noundef @.str.94) #4
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !9
  %32 = icmp ult i32 1, %31
  br i1 %32, label %33, label %35

33:                                               ; preds = %27
  %34 = load i32, ptr @libxsmm_verbosity, align 4, !tbaa !9
  br label %36

35:                                               ; preds = %27
  br label %36

36:                                               ; preds = %35, %33
  %37 = phi i32 [ %34, %33 ], [ 1, %35 ]
  call void @libxsmm_handle_error(ptr noundef %30, i32 noundef 90000, ptr noundef @__func__.libxsmm_aarch64_instruction_sme_mov, ptr noundef @.str.1, i32 noundef 2260, i32 noundef %37)
  store i32 1, ptr %15, align 4
  br label %116

38:                                               ; preds = %6
  %39 = load i32, ptr %8, align 4, !tbaa !9
  switch i32 %39, label %41 [
    i32 -1589624832, label %40
    i32 -1587527680, label %40
    i32 -1589592064, label %40
    i32 -1587494912, label %40
    i32 -1606402048, label %40
    i32 -1606369280, label %40
  ]

40:                                               ; preds = %38, %38, %38, %38, %38, %38
  br label %53

41:                                               ; preds = %38
  %42 = load ptr, ptr @stderr, align 8, !tbaa !5
  %43 = load i32, ptr %8, align 4, !tbaa !9
  %44 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %42, ptr noundef @.str.93, i32 noundef %43) #4
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !9
  %47 = icmp ult i32 1, %46
  br i1 %47, label %48, label %50

48:                                               ; preds = %41
  %49 = load i32, ptr @libxsmm_verbosity, align 4, !tbaa !9
  br label %51

50:                                               ; preds = %41
  br label %51

51:                                               ; preds = %50, %48
  %52 = phi i32 [ %49, %48 ], [ 1, %50 ]
  call void @libxsmm_handle_error(ptr noundef %45, i32 noundef 90000, ptr noundef @__func__.libxsmm_aarch64_instruction_sme_mov, ptr noundef @.str.1, i32 noundef 2273, i32 noundef %52)
  store i32 1, ptr %15, align 4
  br label %116

53:                                               ; preds = %40
  %54 = load ptr, ptr %7, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %54, i32 0, i32 1
  %56 = load i32, ptr %55, align 8, !tbaa !15
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %57, i32 0, i32 2
  %59 = load i32, ptr %58, align 4, !tbaa !11
  %60 = sub i32 %56, %59
  %61 = icmp ult i32 %60, 4
  br i1 %61, label %62, label %71

62:                                               ; preds = %53
  %63 = load ptr, ptr %7, align 8, !tbaa !5
  %64 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !9
  %65 = icmp ult i32 1, %64
  br i1 %65, label %66, label %68

66:                                               ; preds = %62
  %67 = load i32, ptr @libxsmm_verbosity, align 4, !tbaa !9
  br label %69

68:                                               ; preds = %62
  br label %69

69:                                               ; preds = %68, %66
  %70 = phi i32 [ %67, %66 ], [ 1, %68 ]
  call void @libxsmm_handle_error(ptr noundef %63, i32 noundef 90002, ptr noundef @__func__.libxsmm_aarch64_instruction_sme_mov, ptr noundef @.str.1, i32 noundef 2278, i32 noundef %70)
  store i32 1, ptr %15, align 4
  br label %116

71:                                               ; preds = %53
  %72 = load i32, ptr %8, align 4, !tbaa !9
  %73 = load ptr, ptr %14, align 8, !tbaa !5
  %74 = load i32, ptr %13, align 4, !tbaa !9
  %75 = zext i32 %74 to i64
  %76 = getelementptr inbounds i32, ptr %73, i64 %75
  store i32 %72, ptr %76, align 4, !tbaa !9
  %77 = load i32, ptr %9, align 4, !tbaa !9
  %78 = and i32 31, %77
  %79 = load ptr, ptr %14, align 8, !tbaa !5
  %80 = load i32, ptr %13, align 4, !tbaa !9
  %81 = zext i32 %80 to i64
  %82 = getelementptr inbounds i32, ptr %79, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !9
  %84 = or i32 %83, %78
  store i32 %84, ptr %82, align 4, !tbaa !9
  %85 = load i32, ptr %10, align 4, !tbaa !9
  %86 = and i32 31, %85
  %87 = shl i32 %86, 5
  %88 = load ptr, ptr %14, align 8, !tbaa !5
  %89 = load i32, ptr %13, align 4, !tbaa !9
  %90 = zext i32 %89 to i64
  %91 = getelementptr inbounds i32, ptr %88, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !9
  %93 = or i32 %92, %87
  store i32 %93, ptr %91, align 4, !tbaa !9
  %94 = load i32, ptr %11, align 4, !tbaa !9
  %95 = and i32 15, %94
  %96 = shl i32 %95, 16
  %97 = load ptr, ptr %14, align 8, !tbaa !5
  %98 = load i32, ptr %13, align 4, !tbaa !9
  %99 = zext i32 %98 to i64
  %100 = getelementptr inbounds i32, ptr %97, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !9
  %102 = or i32 %101, %96
  store i32 %102, ptr %100, align 4, !tbaa !9
  %103 = load i32, ptr %12, align 4, !tbaa !9
  %104 = and i32 7, %103
  %105 = shl i32 %104, 10
  %106 = load ptr, ptr %14, align 8, !tbaa !5
  %107 = load i32, ptr %13, align 4, !tbaa !9
  %108 = zext i32 %107 to i64
  %109 = getelementptr inbounds i32, ptr %106, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !9
  %111 = or i32 %110, %105
  store i32 %111, ptr %109, align 4, !tbaa !9
  %112 = load ptr, ptr %7, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %112, i32 0, i32 2
  %114 = load i32, ptr %113, align 4, !tbaa !11
  %115 = add i32 %114, 4
  store i32 %115, ptr %113, align 4, !tbaa !11
  store i32 1, ptr %15, align 4
  br label %116

116:                                              ; preds = %71, %69, %51, %36
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  ret void
}

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

!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 12}
!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 = !{!12, !6, i64 0}
!14 = !{!12, !10, i64 28}
!15 = !{!12, !10, i64 8}


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

@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [86 x i8], align 1
@libxsmm_ninit = external local_unnamed_addr global i32, align 4
@libxsmm_verbosity = external local_unnamed_addr global i32, align 4
@.str.93 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.94 = external hidden unnamed_addr constant [67 x i8], align 1
@__func__.libxsmm_aarch64_instruction_sme_mov = external hidden unnamed_addr constant [36 x i8], align 1

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #0

declare void @libxsmm_handle_error(ptr noundef, i32 noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @libxsmm_aarch64_instruction_sme_mov(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5) local_unnamed_addr #2 {
  %7 = getelementptr inbounds i8, ptr %0, i64 12
  %8 = load i32, ptr %7, align 4, !tbaa !5
  %9 = lshr i32 %8, 2
  %10 = load ptr, ptr %0, align 8, !tbaa !11
  %11 = getelementptr inbounds i8, ptr %0, i64 28
  %12 = load i32, ptr %11, align 4, !tbaa !12
  %.not = icmp eq i32 %12, 2501
  br i1 %.not, label %20, label %13

13:                                               ; preds = %6
  %14 = load ptr, ptr @stderr, align 8, !tbaa !13
  %15 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %14, ptr noundef nonnull @.str.94) #3
  %16 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !14
  %17 = icmp ugt i32 %16, 1
  %18 = load i32, ptr @libxsmm_verbosity, align 4
  %19 = select i1 %17, i32 %18, i32 1
  tail call void @libxsmm_handle_error(ptr noundef nonnull %0, i32 noundef 90000, ptr noundef nonnull @__func__.libxsmm_aarch64_instruction_sme_mov, ptr noundef nonnull @.str.1, i32 noundef 2260, i32 noundef %19) #4
  br label %54

20:                                               ; preds = %6
  switch i32 %1, label %21 [
    i32 -1589624832, label %28
    i32 -1587527680, label %28
    i32 -1589592064, label %28
    i32 -1587494912, label %28
    i32 -1606402048, label %28
    i32 -1606369280, label %28
  ]

21:                                               ; preds = %20
  %22 = load ptr, ptr @stderr, align 8, !tbaa !13
  %23 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %22, ptr noundef nonnull @.str.93, i32 noundef %1) #3
  %24 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !14
  %25 = icmp ugt i32 %24, 1
  %26 = load i32, ptr @libxsmm_verbosity, align 4
  %27 = select i1 %25, i32 %26, i32 1
  tail call void @libxsmm_handle_error(ptr noundef nonnull %0, i32 noundef 90000, ptr noundef nonnull @__func__.libxsmm_aarch64_instruction_sme_mov, ptr noundef nonnull @.str.1, i32 noundef 2273, i32 noundef %27) #4
  br label %54

28:                                               ; preds = %20, %20, %20, %20, %20, %20
  %29 = getelementptr inbounds i8, ptr %0, i64 8
  %30 = load i32, ptr %29, align 8, !tbaa !15
  %31 = sub i32 %30, %8
  %32 = icmp ult i32 %31, 4
  br i1 %32, label %33, label %38

33:                                               ; preds = %28
  %34 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !14
  %35 = icmp ugt i32 %34, 1
  %36 = load i32, ptr @libxsmm_verbosity, align 4
  %37 = select i1 %35, i32 %36, i32 1
  tail call void @libxsmm_handle_error(ptr noundef nonnull %0, i32 noundef 90002, ptr noundef nonnull @__func__.libxsmm_aarch64_instruction_sme_mov, ptr noundef nonnull @.str.1, i32 noundef 2278, i32 noundef %37) #4
  br label %54

38:                                               ; preds = %28
  %39 = zext nneg i32 %9 to i64
  %40 = getelementptr inbounds i32, ptr %10, i64 %39
  %41 = and i32 %2, 31
  %42 = shl i32 %3, 5
  %43 = and i32 %42, 992
  %44 = shl i32 %4, 16
  %45 = and i32 %44, 983040
  %46 = shl i32 %5, 10
  %47 = and i32 %46, 7168
  %48 = or disjoint i32 %41, %43
  %49 = or disjoint i32 %48, %45
  %50 = or disjoint i32 %49, %47
  %51 = or i32 %50, %1
  store i32 %51, ptr %40, align 4, !tbaa !14
  %52 = load i32, ptr %7, align 4, !tbaa !5
  %53 = add i32 %52, 4
  store i32 %53, ptr %7, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %38, %33, %21, %13
  ret void
}

attributes #0 = { 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 #1 = { "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 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 #3 = { cold nounwind }
attributes #4 = { 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 12}
!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 = !{!6, !7, i64 0}
!12 = !{!6, !10, i64 28}
!13 = !{!7, !7, i64 0}
!14 = !{!10, !10, i64 0}
!15 = !{!6, !10, i64 8}


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