; LLVM IR from libxsmm/libxsmm :: src (generator_x86_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 }

@.str = external hidden unnamed_addr constant [82 x i8], align 1
@libxsmm_ninit = external global i32, align 4
@libxsmm_verbosity = external global i32, align 4
@__func__.libxsmm_x86_instruction_vex_evex_mask_mov = external hidden unnamed_addr constant [42 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare dso_local void @libxsmm_x86_instruction_vec_mask_move(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i8 noundef signext, i32 noundef, i32 noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @libxsmm_x86_instruction_vec_move(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i8 noundef signext, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @libxsmm_x86_instruction_vex_evex_mask_mov(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i8 noundef signext %6, i32 noundef %7, i32 noundef %8, i32 noundef %9, i32 noundef %10) #1 {
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i8, align 1
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  store ptr %0, ptr %12, align 8, !tbaa !5
  store i32 %1, ptr %13, align 4, !tbaa !9
  store i32 %2, ptr %14, align 4, !tbaa !9
  store i32 %3, ptr %15, align 4, !tbaa !9
  store i32 %4, ptr %16, align 4, !tbaa !9
  store i32 %5, ptr %17, align 4, !tbaa !9
  store i8 %6, ptr %18, align 1, !tbaa !11
  store i32 %7, ptr %19, align 4, !tbaa !9
  store i32 %8, ptr %20, align 4, !tbaa !9
  store i32 %9, ptr %21, align 4, !tbaa !9
  store i32 %10, ptr %22, align 4, !tbaa !9
  %23 = load ptr, ptr %12, 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 !12
  %26 = icmp uge i32 %25, 1041
  br i1 %26, label %27, label %66

27:                                               ; preds = %11
  %28 = load i32, ptr %20, align 4, !tbaa !9
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %30, label %48

30:                                               ; preds = %27
  %31 = load ptr, ptr %12, align 8, !tbaa !5
  %32 = load ptr, ptr %12, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %32, i32 0, i32 6
  %34 = load i32, ptr %33, align 4, !tbaa !12
  %35 = load i32, ptr %13, align 4, !tbaa !9
  %36 = load i32, ptr %14, align 4, !tbaa !9
  %37 = load i32, ptr %15, align 4, !tbaa !9
  %38 = load i32, ptr %16, align 4, !tbaa !9
  %39 = load i32, ptr %17, align 4, !tbaa !9
  %40 = load i8, ptr %18, align 1, !tbaa !11
  %41 = load i32, ptr %19, align 4, !tbaa !9
  %42 = load i32, ptr %21, align 4, !tbaa !9
  %43 = load i32, ptr %22, align 4, !tbaa !9
  %44 = icmp ne i32 %43, 0
  %45 = zext i1 %44 to i64
  %46 = select i1 %44, i32 0, i32 1
  %47 = load i32, ptr %22, align 4, !tbaa !9
  call void @libxsmm_x86_instruction_vec_move(ptr noundef %31, i32 noundef %34, i32 noundef %35, i32 noundef %36, i32 noundef %37, i32 noundef %38, i32 noundef %39, i8 noundef signext %40, i32 noundef %41, i32 noundef %42, i32 noundef %46, i32 noundef %47)
  br label %65

48:                                               ; preds = %27
  %49 = load ptr, ptr %12, align 8, !tbaa !5
  %50 = load ptr, ptr %12, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %50, i32 0, i32 6
  %52 = load i32, ptr %51, align 4, !tbaa !12
  %53 = load i32, ptr %13, align 4, !tbaa !9
  %54 = load i32, ptr %14, align 4, !tbaa !9
  %55 = load i32, ptr %15, align 4, !tbaa !9
  %56 = load i32, ptr %16, align 4, !tbaa !9
  %57 = load i32, ptr %17, align 4, !tbaa !9
  %58 = load i8, ptr %18, align 1, !tbaa !11
  %59 = load i32, ptr %19, align 4, !tbaa !9
  %60 = load i32, ptr %22, align 4, !tbaa !9
  %61 = icmp ne i32 %60, 0
  %62 = zext i1 %61 to i64
  %63 = select i1 %61, i32 0, i32 1
  %64 = load i32, ptr %22, align 4, !tbaa !9
  call void @libxsmm_x86_instruction_vec_move(ptr noundef %49, i32 noundef %52, i32 noundef %53, i32 noundef %54, i32 noundef %55, i32 noundef %56, i32 noundef %57, i8 noundef signext %58, i32 noundef %59, i32 noundef 0, i32 noundef %63, i32 noundef %64)
  br label %65

65:                                               ; preds = %48, %30
  br label %109

66:                                               ; preds = %11
  %67 = load ptr, ptr %12, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %67, i32 0, i32 6
  %69 = load i32, ptr %68, align 4, !tbaa !12
  %70 = icmp uge i32 %69, 1005
  br i1 %70, label %71, label %99

71:                                               ; preds = %66
  %72 = load i32, ptr %20, align 4, !tbaa !9
  %73 = icmp ne i32 %72, 0
  br i1 %73, label %74, label %85

74:                                               ; preds = %71
  %75 = load ptr, ptr %12, align 8, !tbaa !5
  %76 = load i32, ptr %13, align 4, !tbaa !9
  %77 = load i32, ptr %14, align 4, !tbaa !9
  %78 = load i32, ptr %15, align 4, !tbaa !9
  %79 = load i32, ptr %16, align 4, !tbaa !9
  %80 = load i32, ptr %17, align 4, !tbaa !9
  %81 = load i8, ptr %18, align 1, !tbaa !11
  %82 = load i32, ptr %19, align 4, !tbaa !9
  %83 = load i32, ptr %21, align 4, !tbaa !9
  %84 = load i32, ptr %22, align 4, !tbaa !9
  call void @libxsmm_x86_instruction_vec_mask_move(ptr noundef %75, i32 noundef %76, i32 noundef %77, i32 noundef %78, i32 noundef %79, i32 noundef %80, i8 noundef signext %81, i32 noundef %82, i32 noundef %83, i32 noundef %84)
  br label %98

85:                                               ; preds = %71
  %86 = load ptr, ptr %12, align 8, !tbaa !5
  %87 = load ptr, ptr %12, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %87, i32 0, i32 6
  %89 = load i32, ptr %88, align 4, !tbaa !12
  %90 = load i32, ptr %13, align 4, !tbaa !9
  %91 = load i32, ptr %14, align 4, !tbaa !9
  %92 = load i32, ptr %15, align 4, !tbaa !9
  %93 = load i32, ptr %16, align 4, !tbaa !9
  %94 = load i32, ptr %17, align 4, !tbaa !9
  %95 = load i8, ptr %18, align 1, !tbaa !11
  %96 = load i32, ptr %19, align 4, !tbaa !9
  %97 = load i32, ptr %22, align 4, !tbaa !9
  call void @libxsmm_x86_instruction_vec_move(ptr noundef %86, i32 noundef %89, i32 noundef %90, i32 noundef %91, i32 noundef %92, i32 noundef %93, i32 noundef %94, i8 noundef signext %95, i32 noundef %96, i32 noundef 0, i32 noundef 1, i32 noundef %97)
  br label %98

98:                                               ; preds = %85, %74
  br label %108

99:                                               ; preds = %66
  %100 = load ptr, ptr %12, align 8, !tbaa !5
  %101 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !9
  %102 = icmp ult i32 1, %101
  br i1 %102, label %103, label %105

103:                                              ; preds = %99
  %104 = load i32, ptr @libxsmm_verbosity, align 4, !tbaa !9
  br label %106

105:                                              ; preds = %99
  br label %106

106:                                              ; preds = %105, %103
  %107 = phi i32 [ %104, %103 ], [ 1, %105 ]
  call void @libxsmm_handle_error(ptr noundef %100, i32 noundef 90000, ptr noundef @__func__.libxsmm_x86_instruction_vex_evex_mask_mov, ptr noundef @.str, i32 noundef 2586, i32 noundef %107)
  br label %109

108:                                              ; preds = %98
  br label %109

109:                                              ; preds = %108, %106, %65
  ret void
}

attributes #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 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, !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 = !{!7, !7, i64 0}
!12 = !{!13, !10, i64 28}
!13 = !{!"libxsmm_generated_code", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28}


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

@.str = external hidden unnamed_addr constant [82 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_x86_instruction_vex_evex_mask_mov = external hidden unnamed_addr constant [42 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare dso_local void @libxsmm_x86_instruction_vec_mask_move(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i8 noundef signext, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @libxsmm_x86_instruction_vec_move(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i8 noundef signext, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @libxsmm_x86_instruction_vex_evex_mask_mov(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i8 noundef signext %6, i32 noundef %7, i32 noundef %8, i32 noundef %9, i32 noundef %10) local_unnamed_addr #1 {
  %12 = getelementptr inbounds i8, ptr %0, i64 28
  %13 = load i32, ptr %12, align 4, !tbaa !5
  %14 = icmp ugt i32 %13, 1040
  br i1 %14, label %15, label %19

15:                                               ; preds = %11
  %.not47 = icmp eq i32 %8, 0
  %.not48 = icmp eq i32 %10, 0
  %16 = zext i1 %.not48 to i32
  br i1 %.not47, label %18, label %17

17:                                               ; preds = %15
  tail call void @libxsmm_x86_instruction_vec_move(ptr noundef nonnull %0, i32 noundef %13, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i8 noundef signext %6, i32 noundef %7, i32 noundef %9, i32 noundef %16, i32 noundef %10)
  br label %29

18:                                               ; preds = %15
  tail call void @libxsmm_x86_instruction_vec_move(ptr noundef nonnull %0, i32 noundef %13, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i8 noundef signext %6, i32 noundef %7, i32 noundef 0, i32 noundef %16, i32 noundef %10)
  br label %29

19:                                               ; preds = %11
  %20 = icmp ugt i32 %13, 1004
  br i1 %20, label %21, label %24

21:                                               ; preds = %19
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %23, label %22

22:                                               ; preds = %21
  tail call void @libxsmm_x86_instruction_vec_mask_move(ptr noundef nonnull %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i8 noundef signext %6, i32 noundef %7, i32 noundef %9, i32 noundef %10)
  br label %29

23:                                               ; preds = %21
  tail call void @libxsmm_x86_instruction_vec_move(ptr noundef nonnull %0, i32 noundef %13, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i8 noundef signext %6, i32 noundef %7, i32 noundef 0, i32 noundef 1, i32 noundef %10)
  br label %29

24:                                               ; preds = %19
  %25 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !11
  %26 = icmp ugt i32 %25, 1
  %27 = load i32, ptr @libxsmm_verbosity, align 4
  %28 = select i1 %26, i32 %27, i32 1
  tail call void @libxsmm_handle_error(ptr noundef nonnull %0, i32 noundef 90000, ptr noundef nonnull @__func__.libxsmm_x86_instruction_vex_evex_mask_mov, ptr noundef nonnull @.str, i32 noundef 2586, i32 noundef %28) #2
  br label %29

29:                                               ; preds = %23, %22, %17, %18, %24
  ret void
}

attributes #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 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, !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 = !{!10, !10, i64 0}


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