; 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 = external hidden unnamed_addr constant [98 x i8], align 1
@__func__.libxsmm_aarch64_instruction_open_stream = external hidden unnamed_addr constant [40 x i8], align 1
@.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

; Function Attrs: nounwind uwtable
define dso_local void @libxsmm_aarch64_instruction_open_stream(ptr noundef %0, i16 noundef zeroext %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca i16, align 2
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i16 %1, ptr %4, align 2, !tbaa !9
  %5 = load ptr, ptr %3, align 8, !tbaa !5
  %6 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %5, i32 0, i32 6
  %7 = load i32, ptr %6, align 4, !tbaa !11
  %8 = icmp ult i32 %7, 2001
  br i1 %8, label %9, label %20

9:                                                ; preds = %2
  %10 = load ptr, ptr @stderr, align 8, !tbaa !5
  %11 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %10, ptr noundef @.str) #3
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !14
  %14 = icmp ult i32 1, %13
  br i1 %14, label %15, label %17

15:                                               ; preds = %9
  %16 = load i32, ptr @libxsmm_verbosity, align 4, !tbaa !14
  br label %18

17:                                               ; preds = %9
  br label %18

18:                                               ; preds = %17, %15
  %19 = phi i32 [ %16, %15 ], [ 1, %17 ]
  call void @libxsmm_handle_error(ptr noundef %12, i32 noundef 90000, ptr noundef @__func__.libxsmm_aarch64_instruction_open_stream, ptr noundef @.str.1, i32 noundef 20, i32 noundef %19)
  br label %105

20:                                               ; preds = %2
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  call void @libxsmm_aarch64_instruction_alu_compute_imm12(ptr noundef %21, i32 noundef 1358954502, i32 noundef 63, i32 noundef 63, i32 noundef 192, i8 noundef zeroext 0)
  %22 = load i16, ptr %4, align 2, !tbaa !9
  %23 = zext i16 %22 to i32
  %24 = and i32 %23, 1
  %25 = icmp eq i32 %24, 1
  br i1 %25, label %26, label %28

26:                                               ; preds = %20
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  call void @libxsmm_aarch64_instruction_asimd_pair_move(ptr noundef %27, i32 noundef 754974727, i32 noundef 63, i32 noundef 176, i32 noundef 8, i32 noundef 9, i32 noundef 6)
  br label %28

28:                                               ; preds = %26, %20
  %29 = load i16, ptr %4, align 2, !tbaa !9
  %30 = zext i16 %29 to i32
  %31 = and i32 %30, 2
  %32 = icmp eq i32 %31, 2
  br i1 %32, label %33, label %35

33:                                               ; preds = %28
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  call void @libxsmm_aarch64_instruction_asimd_pair_move(ptr noundef %34, i32 noundef 754974727, i32 noundef 63, i32 noundef 160, i32 noundef 10, i32 noundef 11, i32 noundef 6)
  br label %35

35:                                               ; preds = %33, %28
  %36 = load i16, ptr %4, align 2, !tbaa !9
  %37 = zext i16 %36 to i32
  %38 = and i32 %37, 4
  %39 = icmp eq i32 %38, 4
  br i1 %39, label %40, label %42

40:                                               ; preds = %35
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  call void @libxsmm_aarch64_instruction_asimd_pair_move(ptr noundef %41, i32 noundef 754974727, i32 noundef 63, i32 noundef 144, i32 noundef 12, i32 noundef 13, i32 noundef 6)
  br label %42

42:                                               ; preds = %40, %35
  %43 = load i16, ptr %4, align 2, !tbaa !9
  %44 = zext i16 %43 to i32
  %45 = and i32 %44, 8
  %46 = icmp eq i32 %45, 8
  br i1 %46, label %47, label %49

47:                                               ; preds = %42
  %48 = load ptr, ptr %3, align 8, !tbaa !5
  call void @libxsmm_aarch64_instruction_asimd_pair_move(ptr noundef %48, i32 noundef 754974727, i32 noundef 63, i32 noundef 128, i32 noundef 14, i32 noundef 15, i32 noundef 6)
  br label %49

49:                                               ; preds = %47, %42
  %50 = load i16, ptr %4, align 2, !tbaa !9
  %51 = zext i16 %50 to i32
  %52 = and i32 %51, 16
  %53 = icmp eq i32 %52, 16
  br i1 %53, label %54, label %56

54:                                               ; preds = %49
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  call void @libxsmm_aarch64_instruction_alu_pair_move(ptr noundef %55, i32 noundef 687865863, i32 noundef 63, i32 noundef 112, i32 noundef 48, i32 noundef 49)
  br label %56

56:                                               ; preds = %54, %49
  %57 = load i16, ptr %4, align 2, !tbaa !9
  %58 = zext i16 %57 to i32
  %59 = and i32 %58, 32
  %60 = icmp eq i32 %59, 32
  br i1 %60, label %61, label %63

61:                                               ; preds = %56
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  call void @libxsmm_aarch64_instruction_alu_pair_move(ptr noundef %62, i32 noundef 687865863, i32 noundef 63, i32 noundef 96, i32 noundef 50, i32 noundef 51)
  br label %63

63:                                               ; preds = %61, %56
  %64 = load i16, ptr %4, align 2, !tbaa !9
  %65 = zext i16 %64 to i32
  %66 = and i32 %65, 64
  %67 = icmp eq i32 %66, 64
  br i1 %67, label %68, label %70

68:                                               ; preds = %63
  %69 = load ptr, ptr %3, align 8, !tbaa !5
  call void @libxsmm_aarch64_instruction_alu_pair_move(ptr noundef %69, i32 noundef 687865863, i32 noundef 63, i32 noundef 80, i32 noundef 52, i32 noundef 53)
  br label %70

70:                                               ; preds = %68, %63
  %71 = load i16, ptr %4, align 2, !tbaa !9
  %72 = zext i16 %71 to i32
  %73 = and i32 %72, 128
  %74 = icmp eq i32 %73, 128
  br i1 %74, label %75, label %77

75:                                               ; preds = %70
  %76 = load ptr, ptr %3, align 8, !tbaa !5
  call void @libxsmm_aarch64_instruction_alu_pair_move(ptr noundef %76, i32 noundef 687865863, i32 noundef 63, i32 noundef 64, i32 noundef 54, i32 noundef 55)
  br label %77

77:                                               ; preds = %75, %70
  %78 = load i16, ptr %4, align 2, !tbaa !9
  %79 = zext i16 %78 to i32
  %80 = and i32 %79, 256
  %81 = icmp eq i32 %80, 256
  br i1 %81, label %82, label %84

82:                                               ; preds = %77
  %83 = load ptr, ptr %3, align 8, !tbaa !5
  call void @libxsmm_aarch64_instruction_alu_pair_move(ptr noundef %83, i32 noundef 687865863, i32 noundef 63, i32 noundef 48, i32 noundef 56, i32 noundef 57)
  br label %84

84:                                               ; preds = %82, %77
  %85 = load i16, ptr %4, align 2, !tbaa !9
  %86 = zext i16 %85 to i32
  %87 = and i32 %86, 512
  %88 = icmp eq i32 %87, 512
  br i1 %88, label %89, label %91

89:                                               ; preds = %84
  %90 = load ptr, ptr %3, align 8, !tbaa !5
  call void @libxsmm_aarch64_instruction_alu_pair_move(ptr noundef %90, i32 noundef 687865863, i32 noundef 63, i32 noundef 32, i32 noundef 58, i32 noundef 59)
  br label %91

91:                                               ; preds = %89, %84
  %92 = load i16, ptr %4, align 2, !tbaa !9
  %93 = zext i16 %92 to i32
  %94 = and i32 %93, 1024
  %95 = icmp eq i32 %94, 1024
  br i1 %95, label %96, label %98

96:                                               ; preds = %91
  %97 = load ptr, ptr %3, align 8, !tbaa !5
  call void @libxsmm_aarch64_instruction_alu_pair_move(ptr noundef %97, i32 noundef 687865863, i32 noundef 63, i32 noundef 16, i32 noundef 60, i32 noundef 61)
  br label %98

98:                                               ; preds = %96, %91
  %99 = load i16, ptr %4, align 2, !tbaa !9
  %100 = zext i16 %99 to i32
  %101 = and i32 %100, 2048
  %102 = icmp eq i32 %101, 2048
  br i1 %102, label %103, label %105

103:                                              ; preds = %98
  %104 = load ptr, ptr %3, align 8, !tbaa !5
  call void @libxsmm_aarch64_instruction_alu_move(ptr noundef %104, i32 noundef -1191182330, i32 noundef 63, i32 noundef 63, i32 noundef 0, i32 noundef 62)
  br label %105

105:                                              ; preds = %103, %98, %18
  ret void
}

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @libxsmm_aarch64_instruction_alu_compute_imm12(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i8 noundef zeroext) #0

; Function Attrs: nounwind uwtable
declare dso_local void @libxsmm_aarch64_instruction_asimd_pair_move(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @libxsmm_aarch64_instruction_alu_pair_move(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @libxsmm_aarch64_instruction_alu_move(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

attributes #0 = { 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 #1 = { 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 #2 = { "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 }

!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 = !{!"short", !7, i64 0}
!11 = !{!12, !13, i64 28}
!12 = !{!"libxsmm_generated_code", !6, i64 0, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28}
!13 = !{!"int", !7, i64 0}
!14 = !{!13, !13, 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"

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [98 x i8], align 1
@__func__.libxsmm_aarch64_instruction_open_stream = external hidden unnamed_addr constant [40 x i8], align 1
@.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

; Function Attrs: nounwind uwtable
define dso_local void @libxsmm_aarch64_instruction_open_stream(ptr noundef %0, i16 noundef zeroext %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 28
  %4 = load i32, ptr %3, align 4, !tbaa !5
  %5 = icmp ult i32 %4, 2001
  br i1 %5, label %6, label %13

6:                                                ; preds = %2
  %7 = load ptr, ptr @stderr, align 8, !tbaa !11
  %8 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %7, ptr noundef nonnull @.str) #3
  %9 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !12
  %10 = icmp ugt i32 %9, 1
  %11 = load i32, ptr @libxsmm_verbosity, align 4
  %12 = select i1 %10, i32 %11, i32 1
  tail call void @libxsmm_handle_error(ptr noundef nonnull %0, i32 noundef 90000, ptr noundef nonnull @__func__.libxsmm_aarch64_instruction_open_stream, ptr noundef nonnull @.str.1, i32 noundef 20, i32 noundef %12) #4
  br label %50

13:                                               ; preds = %2
  tail call void @libxsmm_aarch64_instruction_alu_compute_imm12(ptr noundef nonnull %0, i32 noundef 1358954502, i32 noundef 63, i32 noundef 63, i32 noundef 192, i8 noundef zeroext 0)
  %14 = zext i16 %1 to i32
  %15 = and i32 %14, 1
  %.not = icmp eq i32 %15, 0
  br i1 %.not, label %17, label %16

16:                                               ; preds = %13
  tail call void @libxsmm_aarch64_instruction_asimd_pair_move(ptr noundef nonnull %0, i32 noundef 754974727, i32 noundef 63, i32 noundef 176, i32 noundef 8, i32 noundef 9, i32 noundef 6)
  br label %17

17:                                               ; preds = %16, %13
  %18 = and i32 %14, 2
  %.not26 = icmp eq i32 %18, 0
  br i1 %.not26, label %20, label %19

19:                                               ; preds = %17
  tail call void @libxsmm_aarch64_instruction_asimd_pair_move(ptr noundef nonnull %0, i32 noundef 754974727, i32 noundef 63, i32 noundef 160, i32 noundef 10, i32 noundef 11, i32 noundef 6)
  br label %20

20:                                               ; preds = %19, %17
  %21 = and i32 %14, 4
  %.not27 = icmp eq i32 %21, 0
  br i1 %.not27, label %23, label %22

22:                                               ; preds = %20
  tail call void @libxsmm_aarch64_instruction_asimd_pair_move(ptr noundef nonnull %0, i32 noundef 754974727, i32 noundef 63, i32 noundef 144, i32 noundef 12, i32 noundef 13, i32 noundef 6)
  br label %23

23:                                               ; preds = %22, %20
  %24 = and i32 %14, 8
  %.not28 = icmp eq i32 %24, 0
  br i1 %.not28, label %26, label %25

25:                                               ; preds = %23
  tail call void @libxsmm_aarch64_instruction_asimd_pair_move(ptr noundef nonnull %0, i32 noundef 754974727, i32 noundef 63, i32 noundef 128, i32 noundef 14, i32 noundef 15, i32 noundef 6)
  br label %26

26:                                               ; preds = %25, %23
  %27 = and i32 %14, 16
  %.not29 = icmp eq i32 %27, 0
  br i1 %.not29, label %29, label %28

28:                                               ; preds = %26
  tail call void @libxsmm_aarch64_instruction_alu_pair_move(ptr noundef nonnull %0, i32 noundef 687865863, i32 noundef 63, i32 noundef 112, i32 noundef 48, i32 noundef 49)
  br label %29

29:                                               ; preds = %28, %26
  %30 = and i32 %14, 32
  %.not30 = icmp eq i32 %30, 0
  br i1 %.not30, label %32, label %31

31:                                               ; preds = %29
  tail call void @libxsmm_aarch64_instruction_alu_pair_move(ptr noundef nonnull %0, i32 noundef 687865863, i32 noundef 63, i32 noundef 96, i32 noundef 50, i32 noundef 51)
  br label %32

32:                                               ; preds = %31, %29
  %33 = and i32 %14, 64
  %.not31 = icmp eq i32 %33, 0
  br i1 %.not31, label %35, label %34

34:                                               ; preds = %32
  tail call void @libxsmm_aarch64_instruction_alu_pair_move(ptr noundef nonnull %0, i32 noundef 687865863, i32 noundef 63, i32 noundef 80, i32 noundef 52, i32 noundef 53)
  br label %35

35:                                               ; preds = %34, %32
  %36 = and i32 %14, 128
  %.not32 = icmp eq i32 %36, 0
  br i1 %.not32, label %38, label %37

37:                                               ; preds = %35
  tail call void @libxsmm_aarch64_instruction_alu_pair_move(ptr noundef nonnull %0, i32 noundef 687865863, i32 noundef 63, i32 noundef 64, i32 noundef 54, i32 noundef 55)
  br label %38

38:                                               ; preds = %37, %35
  %39 = and i32 %14, 256
  %.not33 = icmp eq i32 %39, 0
  br i1 %.not33, label %41, label %40

40:                                               ; preds = %38
  tail call void @libxsmm_aarch64_instruction_alu_pair_move(ptr noundef nonnull %0, i32 noundef 687865863, i32 noundef 63, i32 noundef 48, i32 noundef 56, i32 noundef 57)
  br label %41

41:                                               ; preds = %40, %38
  %42 = and i32 %14, 512
  %.not34 = icmp eq i32 %42, 0
  br i1 %.not34, label %44, label %43

43:                                               ; preds = %41
  tail call void @libxsmm_aarch64_instruction_alu_pair_move(ptr noundef nonnull %0, i32 noundef 687865863, i32 noundef 63, i32 noundef 32, i32 noundef 58, i32 noundef 59)
  br label %44

44:                                               ; preds = %43, %41
  %45 = and i32 %14, 1024
  %.not35 = icmp eq i32 %45, 0
  br i1 %.not35, label %47, label %46

46:                                               ; preds = %44
  tail call void @libxsmm_aarch64_instruction_alu_pair_move(ptr noundef nonnull %0, i32 noundef 687865863, i32 noundef 63, i32 noundef 16, i32 noundef 60, i32 noundef 61)
  br label %47

47:                                               ; preds = %46, %44
  %48 = and i32 %14, 2048
  %.not36 = icmp eq i32 %48, 0
  br i1 %.not36, label %50, label %49

49:                                               ; preds = %47
  tail call void @libxsmm_aarch64_instruction_alu_move(ptr noundef nonnull %0, i32 noundef -1191182330, i32 noundef 63, i32 noundef 63, i32 noundef 0, i32 noundef 62)
  br label %50

50:                                               ; preds = %49, %47, %6
  ret void
}

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @libxsmm_aarch64_instruction_alu_compute_imm12(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i8 noundef zeroext) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @libxsmm_aarch64_instruction_asimd_pair_move(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @libxsmm_aarch64_instruction_alu_pair_move(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @libxsmm_aarch64_instruction_alu_move(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

attributes #0 = { 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 #1 = { 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 #2 = { "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 28}
!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 = !{!7, !7, i64 0}
!12 = !{!10, !10, i64 0}


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