; 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.99 = external hidden unnamed_addr constant [68 x i8], align 1
@__func__.libxsmm_aarch64_instruction_sme_fmax = external hidden unnamed_addr constant [37 x i8], align 1
@.str.100 = external hidden unnamed_addr constant [73 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_fmax(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #3 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %12, i32 0, i32 2
  %14 = load i32, ptr %13, align 4, !tbaa !11
  %15 = udiv i32 %14, 4
  store i32 %15, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %16, i32 0, i32 0
  %18 = load ptr, ptr %17, align 8, !tbaa !13
  store ptr %18, ptr %10, align 8, !tbaa !5
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %19, i32 0, i32 6
  %21 = load i32, ptr %20, align 4, !tbaa !14
  %22 = icmp ne i32 %21, 2501
  br i1 %22, label %23, label %34

23:                                               ; preds = %4
  %24 = load ptr, ptr @stderr, align 8, !tbaa !5
  %25 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %24, ptr noundef @.str.99) #4
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !9
  %28 = icmp ult i32 1, %27
  br i1 %28, label %29, label %31

29:                                               ; preds = %23
  %30 = load i32, ptr @libxsmm_verbosity, align 4, !tbaa !9
  br label %32

31:                                               ; preds = %23
  br label %32

32:                                               ; preds = %31, %29
  %33 = phi i32 [ %30, %29 ], [ 1, %31 ]
  call void @libxsmm_handle_error(ptr noundef %26, i32 noundef 90000, ptr noundef @__func__.libxsmm_aarch64_instruction_sme_fmax, ptr noundef @.str.1, i32 noundef 2429, i32 noundef %33)
  store i32 1, ptr %11, align 4
  br label %108

34:                                               ; preds = %4
  %35 = load i32, ptr %6, align 4, !tbaa !9
  switch i32 %35, label %37 [
    i32 -1046437632, label %36
    i32 -1046435584, label %36
  ]

36:                                               ; preds = %34, %34
  br label %49

37:                                               ; preds = %34
  %38 = load ptr, ptr @stderr, align 8, !tbaa !5
  %39 = load i32, ptr %6, align 4, !tbaa !9
  %40 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef @.str.100, i32 noundef %39) #4
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !9
  %43 = icmp ult i32 1, %42
  br i1 %43, label %44, label %46

44:                                               ; preds = %37
  %45 = load i32, ptr @libxsmm_verbosity, align 4, !tbaa !9
  br label %47

46:                                               ; preds = %37
  br label %47

47:                                               ; preds = %46, %44
  %48 = phi i32 [ %45, %44 ], [ 1, %46 ]
  call void @libxsmm_handle_error(ptr noundef %41, i32 noundef 90000, ptr noundef @__func__.libxsmm_aarch64_instruction_sme_fmax, ptr noundef @.str.1, i32 noundef 2438, i32 noundef %48)
  store i32 1, ptr %11, align 4
  br label %108

49:                                               ; preds = %36
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %50, i32 0, i32 1
  %52 = load i32, ptr %51, align 8, !tbaa !15
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %53, i32 0, i32 2
  %55 = load i32, ptr %54, align 4, !tbaa !11
  %56 = sub i32 %52, %55
  %57 = icmp ult i32 %56, 4
  br i1 %57, label %58, label %67

58:                                               ; preds = %49
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !9
  %61 = icmp ult i32 1, %60
  br i1 %61, label %62, label %64

62:                                               ; preds = %58
  %63 = load i32, ptr @libxsmm_verbosity, align 4, !tbaa !9
  br label %65

64:                                               ; preds = %58
  br label %65

65:                                               ; preds = %64, %62
  %66 = phi i32 [ %63, %62 ], [ 1, %64 ]
  call void @libxsmm_handle_error(ptr noundef %59, i32 noundef 90002, ptr noundef @__func__.libxsmm_aarch64_instruction_sme_fmax, ptr noundef @.str.1, i32 noundef 2443, i32 noundef %66)
  store i32 1, ptr %11, align 4
  br label %108

67:                                               ; preds = %49
  %68 = load i32, ptr %6, align 4, !tbaa !9
  %69 = load ptr, ptr %10, align 8, !tbaa !5
  %70 = load i32, ptr %9, align 4, !tbaa !9
  %71 = zext i32 %70 to i64
  %72 = getelementptr inbounds i32, ptr %69, i64 %71
  store i32 %68, ptr %72, align 4, !tbaa !9
  %73 = load i32, ptr %6, align 4, !tbaa !9
  %74 = and i32 %73, 256
  %75 = icmp eq i32 %74, 256
  br i1 %75, label %76, label %85

76:                                               ; preds = %67
  %77 = load i32, ptr %8, align 4, !tbaa !9
  %78 = and i32 30, %77
  %79 = load ptr, ptr %10, align 8, !tbaa !5
  %80 = load i32, ptr %9, 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
  br label %94

85:                                               ; preds = %67
  %86 = load i32, ptr %8, align 4, !tbaa !9
  %87 = and i32 28, %86
  %88 = load ptr, ptr %10, align 8, !tbaa !5
  %89 = load i32, ptr %9, 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
  br label %94

94:                                               ; preds = %85, %76
  %95 = load i32, ptr %7, align 4, !tbaa !9
  %96 = and i32 15, %95
  %97 = shl i32 %96, 16
  %98 = load ptr, ptr %10, align 8, !tbaa !5
  %99 = load i32, ptr %9, align 4, !tbaa !9
  %100 = zext i32 %99 to i64
  %101 = getelementptr inbounds i32, ptr %98, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !9
  %103 = or i32 %102, %97
  store i32 %103, ptr %101, align 4, !tbaa !9
  %104 = load ptr, ptr %5, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %104, i32 0, i32 2
  %106 = load i32, ptr %105, align 4, !tbaa !11
  %107 = add i32 %106, 4
  store i32 %107, ptr %105, align 4, !tbaa !11
  store i32 1, ptr %11, align 4
  br label %108

108:                                              ; preds = %94, %65, %47, %32
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #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.99 = external hidden unnamed_addr constant [68 x i8], align 1
@__func__.libxsmm_aarch64_instruction_sme_fmax = external hidden unnamed_addr constant [37 x i8], align 1
@.str.100 = external hidden unnamed_addr constant [73 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_fmax(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #2 {
  %5 = getelementptr inbounds i8, ptr %0, i64 12
  %6 = load i32, ptr %5, align 4, !tbaa !5
  %7 = lshr i32 %6, 2
  %8 = load ptr, ptr %0, align 8, !tbaa !11
  %9 = getelementptr inbounds i8, ptr %0, i64 28
  %10 = load i32, ptr %9, align 4, !tbaa !12
  %.not = icmp eq i32 %10, 2501
  br i1 %.not, label %18, label %11

11:                                               ; preds = %4
  %12 = load ptr, ptr @stderr, align 8, !tbaa !13
  %13 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %12, ptr noundef nonnull @.str.99) #3
  %14 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !14
  %15 = icmp ugt i32 %14, 1
  %16 = load i32, ptr @libxsmm_verbosity, align 4
  %17 = select i1 %15, i32 %16, i32 1
  tail call void @libxsmm_handle_error(ptr noundef nonnull %0, i32 noundef 90000, ptr noundef nonnull @__func__.libxsmm_aarch64_instruction_sme_fmax, ptr noundef nonnull @.str.1, i32 noundef 2429, i32 noundef %17) #4
  br label %46

18:                                               ; preds = %4
  switch i32 %1, label %19 [
    i32 -1046437632, label %26
    i32 -1046435584, label %26
  ]

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

26:                                               ; preds = %18, %18
  %27 = getelementptr inbounds i8, ptr %0, i64 8
  %28 = load i32, ptr %27, align 8, !tbaa !15
  %29 = sub i32 %28, %6
  %30 = icmp ult i32 %29, 4
  br i1 %30, label %31, label %36

31:                                               ; preds = %26
  %32 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !14
  %33 = icmp ugt i32 %32, 1
  %34 = load i32, ptr @libxsmm_verbosity, align 4
  %35 = select i1 %33, i32 %34, i32 1
  tail call void @libxsmm_handle_error(ptr noundef nonnull %0, i32 noundef 90002, ptr noundef nonnull @__func__.libxsmm_aarch64_instruction_sme_fmax, ptr noundef nonnull @.str.1, i32 noundef 2443, i32 noundef %35) #4
  br label %46

36:                                               ; preds = %26
  %37 = zext nneg i32 %7 to i64
  %38 = getelementptr inbounds i32, ptr %8, i64 %37
  %39 = and i32 %1, 256
  %.not23 = icmp eq i32 %39, 0
  %.pn.v = select i1 %.not23, i32 28, i32 30
  %.pn = and i32 %.pn.v, %3
  %40 = shl i32 %2, 16
  %41 = and i32 %40, 983040
  %42 = or disjoint i32 %41, %.pn
  %43 = or i32 %42, %1
  store i32 %43, ptr %38, align 4, !tbaa !14
  %44 = load i32, ptr %5, align 4, !tbaa !5
  %45 = add i32 %44, 4
  store i32 %45, ptr %5, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %36, %31, %19, %11
  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