; 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 }
%struct.libxsmm_const_data_tracker = type { [81920 x i8], i32, [128 x 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
@__func__.libxsmm_aarch64_instruction_adr_data = external hidden unnamed_addr constant [37 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [84 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_adr_data(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3) #3 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %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 ptr %3, ptr %8, align 8, !tbaa !5
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %12, i32 0, i32 3
  %14 = load i32, ptr %13, align 8, !tbaa !11
  %15 = icmp ugt i32 %14, 1
  br i1 %15, label %16, label %86

16:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %17, i32 0, i32 2
  %19 = load i32, ptr %18, align 4, !tbaa !13
  %20 = udiv i32 %19, 4
  store i32 %20, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %21, i32 0, i32 0
  %23 = load ptr, ptr %22, align 8, !tbaa !14
  store ptr %23, ptr %10, align 8, !tbaa !5
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %24, i32 0, i32 1
  %26 = load i32, ptr %25, align 8, !tbaa !15
  %27 = add i32 %26, 4
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %28, i32 0, i32 2
  %30 = load i32, ptr %29, align 4, !tbaa !13
  %31 = icmp ult i32 %27, %30
  br i1 %31, label %32, label %41

32:                                               ; preds = %16
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !9
  %35 = icmp ult i32 1, %34
  br i1 %35, label %36, label %38

36:                                               ; preds = %32
  %37 = load i32, ptr @libxsmm_verbosity, align 4, !tbaa !9
  br label %39

38:                                               ; preds = %32
  br label %39

39:                                               ; preds = %38, %36
  %40 = phi i32 [ %37, %36 ], [ 1, %38 ]
  call void @libxsmm_handle_error(ptr noundef %33, i32 noundef 90002, ptr noundef @__func__.libxsmm_aarch64_instruction_adr_data, ptr noundef @.str.1, i32 noundef 251, i32 noundef %40)
  store i32 1, ptr %11, align 4
  br label %83

41:                                               ; preds = %16
  %42 = load ptr, ptr %8, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.libxsmm_const_data_tracker, ptr %42, i32 0, i32 3
  %44 = load i32, ptr %43, align 4, !tbaa !16
  %45 = icmp ule i32 128, %44
  br i1 %45, label %46, label %57

46:                                               ; preds = %41
  %47 = load ptr, ptr @stderr, align 8, !tbaa !5
  %48 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %47, ptr noundef @.str.4) #4
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !9
  %51 = icmp ult i32 1, %50
  br i1 %51, label %52, label %54

52:                                               ; preds = %46
  %53 = load i32, ptr @libxsmm_verbosity, align 4, !tbaa !9
  br label %55

54:                                               ; preds = %46
  br label %55

55:                                               ; preds = %54, %52
  %56 = phi i32 [ %53, %52 ], [ 1, %54 ]
  call void @libxsmm_handle_error(ptr noundef %49, i32 noundef 90000, ptr noundef @__func__.libxsmm_aarch64_instruction_adr_data, ptr noundef @.str.1, i32 noundef 258, i32 noundef %56)
  store i32 1, ptr %11, align 4
  br label %83

57:                                               ; preds = %41
  %58 = load i32, ptr %6, align 4, !tbaa !9
  %59 = and i32 31, %58
  %60 = shl i32 %59, 27
  %61 = load i32, ptr %7, align 4, !tbaa !9
  %62 = and i32 2097151, %61
  %63 = or i32 %60, %62
  %64 = load ptr, ptr %10, align 8, !tbaa !5
  %65 = load i32, ptr %9, align 4, !tbaa !9
  %66 = zext i32 %65 to i64
  %67 = getelementptr inbounds i32, ptr %64, i64 %66
  store i32 %63, ptr %67, align 4, !tbaa !9
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %68, i32 0, i32 2
  %70 = load i32, ptr %69, align 4, !tbaa !13
  %71 = load ptr, ptr %8, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.libxsmm_const_data_tracker, ptr %71, i32 0, i32 2
  %73 = load ptr, ptr %8, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.libxsmm_const_data_tracker, ptr %73, i32 0, i32 3
  %75 = load i32, ptr %74, align 4, !tbaa !16
  %76 = add i32 %75, 1
  store i32 %76, ptr %74, align 4, !tbaa !16
  %77 = zext i32 %75 to i64
  %78 = getelementptr inbounds [128 x i32], ptr %72, i64 0, i64 %77
  store i32 %70, ptr %78, align 4, !tbaa !9
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %79, i32 0, i32 2
  %81 = load i32, ptr %80, align 4, !tbaa !13
  %82 = add i32 %81, 4
  store i32 %82, ptr %80, align 4, !tbaa !13
  store i32 0, ptr %11, align 4
  br label %83

83:                                               ; preds = %57, %55, %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  %84 = load i32, ptr %11, align 4
  switch i32 %84, label %98 [
    i32 0, label %85
    i32 1, label %97
  ]

85:                                               ; preds = %83
  br label %97

86:                                               ; preds = %4
  %87 = load ptr, ptr @stderr, align 8, !tbaa !5
  %88 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %87, ptr noundef @.str.5) #4
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !9
  %91 = icmp ult i32 1, %90
  br i1 %91, label %92, label %94

92:                                               ; preds = %86
  %93 = load i32, ptr @libxsmm_verbosity, align 4, !tbaa !9
  br label %95

94:                                               ; preds = %86
  br label %95

95:                                               ; preds = %94, %92
  %96 = phi i32 [ %93, %92 ], [ 1, %94 ]
  call void @libxsmm_handle_error(ptr noundef %89, i32 noundef 90000, ptr noundef @__func__.libxsmm_aarch64_instruction_adr_data, ptr noundef @.str.1, i32 noundef 272, i32 noundef %96)
  br label %97

97:                                               ; preds = %95, %85, %83
  ret void

98:                                               ; preds = %83
  unreachable
}

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 16}
!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, !10, i64 12}
!14 = !{!12, !6, i64 0}
!15 = !{!12, !10, i64 8}
!16 = !{!17, !10, i64 82436}
!17 = !{!"libxsmm_const_data_tracker", !7, i64 0, !10, i64 81920, !7, i64 81924, !10, i64 82436}


; 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
@__func__.libxsmm_aarch64_instruction_adr_data = external hidden unnamed_addr constant [37 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [84 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_adr_data(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr nocapture noundef %3) local_unnamed_addr #2 {
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  %6 = load i32, ptr %5, align 8, !tbaa !5
  %7 = icmp ugt i32 %6, 1
  br i1 %7, label %8, label %46

8:                                                ; preds = %4
  %9 = getelementptr inbounds i8, ptr %0, i64 12
  %10 = load i32, ptr %9, align 4, !tbaa !11
  %11 = lshr i32 %10, 2
  %12 = load ptr, ptr %0, align 8, !tbaa !12
  %13 = getelementptr inbounds i8, ptr %0, i64 8
  %14 = load i32, ptr %13, align 8, !tbaa !13
  %15 = add i32 %14, 4
  %16 = icmp ult i32 %15, %10
  br i1 %16, label %17, label %22

17:                                               ; preds = %8
  %18 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !14
  %19 = icmp ugt i32 %18, 1
  %20 = load i32, ptr @libxsmm_verbosity, align 4
  %21 = select i1 %19, i32 %20, i32 1
  tail call void @libxsmm_handle_error(ptr noundef nonnull %0, i32 noundef 90002, ptr noundef nonnull @__func__.libxsmm_aarch64_instruction_adr_data, ptr noundef nonnull @.str.1, i32 noundef 251, i32 noundef %21) #3
  br label %53

22:                                               ; preds = %8
  %23 = getelementptr inbounds i8, ptr %3, i64 82436
  %24 = load i32, ptr %23, align 4, !tbaa !15
  %25 = icmp ugt i32 %24, 127
  br i1 %25, label %26, label %33

26:                                               ; preds = %22
  %27 = load ptr, ptr @stderr, align 8, !tbaa !17
  %28 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %27, ptr noundef nonnull @.str.4) #4
  %29 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !14
  %30 = icmp ugt i32 %29, 1
  %31 = load i32, ptr @libxsmm_verbosity, align 4
  %32 = select i1 %30, i32 %31, i32 1
  tail call void @libxsmm_handle_error(ptr noundef nonnull %0, i32 noundef 90000, ptr noundef nonnull @__func__.libxsmm_aarch64_instruction_adr_data, ptr noundef nonnull @.str.1, i32 noundef 258, i32 noundef %32) #3
  br label %53

33:                                               ; preds = %22
  %34 = shl i32 %1, 27
  %35 = and i32 %2, 2097151
  %36 = or disjoint i32 %35, %34
  %37 = zext nneg i32 %11 to i64
  %38 = getelementptr inbounds i32, ptr %12, i64 %37
  store i32 %36, ptr %38, align 4, !tbaa !14
  %39 = load i32, ptr %9, align 4, !tbaa !11
  %40 = getelementptr inbounds i8, ptr %3, i64 81924
  %41 = load i32, ptr %23, align 4, !tbaa !15
  %42 = add i32 %41, 1
  store i32 %42, ptr %23, align 4, !tbaa !15
  %43 = zext i32 %41 to i64
  %44 = getelementptr inbounds [128 x i32], ptr %40, i64 0, i64 %43
  store i32 %39, ptr %44, align 4, !tbaa !14
  %45 = add i32 %39, 4
  store i32 %45, ptr %9, align 4, !tbaa !11
  br label %53

46:                                               ; preds = %4
  %47 = load ptr, ptr @stderr, align 8, !tbaa !17
  %48 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %47, ptr noundef nonnull @.str.5) #4
  %49 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !14
  %50 = icmp ugt i32 %49, 1
  %51 = load i32, ptr @libxsmm_verbosity, align 4
  %52 = select i1 %50, i32 %51, i32 1
  tail call void @libxsmm_handle_error(ptr noundef nonnull %0, i32 noundef 90000, ptr noundef nonnull @__func__.libxsmm_aarch64_instruction_adr_data, ptr noundef nonnull @.str.1, i32 noundef 272, i32 noundef %52) #3
  br label %53

53:                                               ; preds = %17, %26, %33, %46
  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 = { nounwind }
attributes #4 = { cold 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 16}
!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, !10, i64 12}
!12 = !{!6, !7, i64 0}
!13 = !{!6, !10, i64 8}
!14 = !{!10, !10, i64 0}
!15 = !{!16, !10, i64 82436}
!16 = !{!"libxsmm_const_data_tracker", !8, i64 0, !10, i64 81920, !8, i64 81924, !10, i64 82436}
!17 = !{!7, !7, i64 0}


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