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

; 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.6 = external hidden unnamed_addr constant [76 x i8], align 1
@libxsmm_ninit = external global i32, align 4
@libxsmm_verbosity = external global i32, align 4
@__func__.libxsmm_generator_cvt_from_ps_avx512 = external hidden unnamed_addr constant [37 x i8], align 1

declare void @libxsmm_x86_instruction_vec_compute_2reg(ptr noundef, i32 noundef, i8 noundef signext, i32 noundef, i32 noundef) #0

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

; Function Attrs: nounwind uwtable
define dso_local void @libxsmm_generator_cvt_from_ps_avx512(ptr noundef %0, i8 noundef signext %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) #1 {
  %6 = alloca ptr, align 8
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i8 %1, ptr %7, align 1, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !10
  store i32 %3, ptr %9, align 4, !tbaa !10
  store i32 %4, ptr %10, align 4, !tbaa !10
  %11 = load ptr, ptr %6, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.libxsmm_generated_code, ptr %11, i32 0, i32 6
  %13 = load i32, ptr %12, align 4, !tbaa !12
  %14 = icmp ult i32 %13, 1104
  br i1 %14, label %15, label %24

15:                                               ; preds = %5
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !10
  %18 = icmp ult i32 1, %17
  br i1 %18, label %19, label %21

19:                                               ; preds = %15
  %20 = load i32, ptr @libxsmm_verbosity, align 4, !tbaa !10
  br label %22

21:                                               ; preds = %15
  br label %22

22:                                               ; preds = %21, %19
  %23 = phi i32 [ %20, %19 ], [ 1, %21 ]
  call void @libxsmm_handle_error(ptr noundef %16, i32 noundef 90006, ptr noundef @__func__.libxsmm_generator_cvt_from_ps_avx512, ptr noundef @.str.6, i32 noundef 2966, i32 noundef %23)
  br label %100

24:                                               ; preds = %5
  %25 = load i32, ptr %8, align 4, !tbaa !10
  %26 = icmp eq i32 %25, 1
  br i1 %26, label %27, label %37

27:                                               ; preds = %24
  %28 = load i32, ptr %9, align 4, !tbaa !10
  %29 = load i32, ptr %10, align 4, !tbaa !10
  %30 = icmp ne i32 %28, %29
  br i1 %30, label %31, label %36

31:                                               ; preds = %27
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = load i8, ptr %7, align 1, !tbaa !9
  %34 = load i32, ptr %9, align 4, !tbaa !10
  %35 = load i32, ptr %10, align 4, !tbaa !10
  call void @libxsmm_x86_instruction_vec_compute_2reg(ptr noundef %32, i32 noundef 537138704, i8 noundef signext %33, i32 noundef %34, i32 noundef %35)
  br label %36

36:                                               ; preds = %31, %27
  br label %100

37:                                               ; preds = %24
  %38 = load i32, ptr %8, align 4, !tbaa !10
  %39 = icmp eq i32 %38, 2
  br i1 %39, label %40, label %45

40:                                               ; preds = %37
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = load i8, ptr %7, align 1, !tbaa !9
  %43 = load i32, ptr %9, align 4, !tbaa !10
  %44 = load i32, ptr %10, align 4, !tbaa !10
  call void @libxsmm_x86_instruction_vec_compute_2reg(ptr noundef %41, i32 noundef 537273970, i8 noundef signext %42, i32 noundef %43, i32 noundef %44)
  br label %99

45:                                               ; preds = %37
  %46 = load i32, ptr %8, align 4, !tbaa !10
  %47 = icmp eq i32 %46, 3
  br i1 %47, label %48, label %53

48:                                               ; preds = %45
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = load i8, ptr %7, align 1, !tbaa !9
  %51 = load i32, ptr %9, align 4, !tbaa !10
  %52 = load i32, ptr %10, align 4, !tbaa !10
  call void @libxsmm_x86_instruction_vec_compute_2reg_mask_sae_imm8(ptr noundef %49, i32 noundef 671954205, i8 noundef signext %50, i32 noundef %51, i32 noundef %52, i32 noundef 0, i32 noundef 1, i8 noundef zeroext 1, i32 noundef 0)
  br label %98

53:                                               ; preds = %45
  %54 = load i32, ptr %8, align 4, !tbaa !10
  %55 = icmp eq i32 %54, 4
  br i1 %55, label %56, label %70

56:                                               ; preds = %53
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = load i8, ptr %7, align 1, !tbaa !9
  %59 = load i32, ptr %9, align 4, !tbaa !10
  %60 = load i32, ptr %10, align 4, !tbaa !10
  call void @libxsmm_x86_instruction_vec_compute_2reg_mask_sae_imm8(ptr noundef %57, i32 noundef 671954205, i8 noundef signext %58, i32 noundef %59, i32 noundef %60, i32 noundef 0, i32 noundef 1, i8 noundef zeroext 1, i32 noundef 0)
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  %62 = load i8, ptr %7, align 1, !tbaa !9
  %63 = sext i8 %62 to i32
  %64 = icmp eq i32 %63, 122
  %65 = zext i1 %64 to i64
  %66 = select i1 %64, i32 121, i32 120
  %67 = trunc i32 %66 to i8
  %68 = load i32, ptr %10, align 4, !tbaa !10
  %69 = load i32, ptr %10, align 4, !tbaa !10
  call void @libxsmm_x86_instruction_vec_compute_2reg(ptr noundef %61, i32 noundef -536467852, i8 noundef signext %67, i32 noundef %68, i32 noundef %69)
  br label %97

70:                                               ; preds = %53
  %71 = load i32, ptr %8, align 4, !tbaa !10
  %72 = icmp eq i32 %71, 5
  br i1 %72, label %73, label %87

73:                                               ; preds = %70
  %74 = load ptr, ptr %6, align 8, !tbaa !5
  %75 = load i8, ptr %7, align 1, !tbaa !9
  %76 = load i32, ptr %9, align 4, !tbaa !10
  %77 = load i32, ptr %10, align 4, !tbaa !10
  call void @libxsmm_x86_instruction_vec_compute_2reg_mask_sae_imm8(ptr noundef %74, i32 noundef 671954205, i8 noundef signext %75, i32 noundef %76, i32 noundef %77, i32 noundef 0, i32 noundef 1, i8 noundef zeroext 1, i32 noundef 0)
  %78 = load ptr, ptr %6, align 8, !tbaa !5
  %79 = load i8, ptr %7, align 1, !tbaa !9
  %80 = sext i8 %79 to i32
  %81 = icmp eq i32 %80, 122
  %82 = zext i1 %81 to i64
  %83 = select i1 %81, i32 121, i32 120
  %84 = trunc i32 %83 to i8
  %85 = load i32, ptr %10, align 4, !tbaa !10
  %86 = load i32, ptr %10, align 4, !tbaa !10
  call void @libxsmm_x86_instruction_vec_compute_2reg(ptr noundef %78, i32 noundef -536455656, i8 noundef signext %84, i32 noundef %85, i32 noundef %86)
  br label %96

87:                                               ; preds = %70
  %88 = load ptr, ptr %6, align 8, !tbaa !5
  %89 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !10
  %90 = icmp ult i32 1, %89
  br i1 %90, label %91, label %93

91:                                               ; preds = %87
  %92 = load i32, ptr @libxsmm_verbosity, align 4, !tbaa !10
  br label %94

93:                                               ; preds = %87
  br label %94

94:                                               ; preds = %93, %91
  %95 = phi i32 [ %92, %91 ], [ 1, %93 ]
  call void @libxsmm_handle_error(ptr noundef %88, i32 noundef 90033, ptr noundef @__func__.libxsmm_generator_cvt_from_ps_avx512, ptr noundef @.str.6, i32 noundef 2984, i32 noundef %95)
  br label %100

96:                                               ; preds = %73
  br label %97

97:                                               ; preds = %96, %56
  br label %98

98:                                               ; preds = %97, %48
  br label %99

99:                                               ; preds = %98, %40
  br label %100

100:                                              ; preds = %99, %94, %36, %22
  ret void
}

declare void @libxsmm_x86_instruction_vec_compute_2reg_mask_sae_imm8(ptr noundef, i32 noundef, i8 noundef signext, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i8 noundef zeroext, i32 noundef) #0

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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !11, i64 28}
!13 = !{!"libxsmm_generated_code", !6, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, 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.6 = external hidden unnamed_addr constant [76 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_generator_cvt_from_ps_avx512 = external hidden unnamed_addr constant [37 x i8], align 1

declare void @libxsmm_x86_instruction_vec_compute_2reg(ptr noundef, i32 noundef, i8 noundef signext, i32 noundef, i32 noundef) local_unnamed_addr #0

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
define dso_local void @libxsmm_generator_cvt_from_ps_avx512(ptr noundef %0, i8 noundef signext %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #1 {
  %6 = getelementptr inbounds i8, ptr %0, i64 28
  %7 = load i32, ptr %6, align 4, !tbaa !5
  %8 = icmp ult i32 %7, 1104
  br i1 %8, label %9, label %14

9:                                                ; preds = %5
  %10 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !11
  %11 = icmp ugt i32 %10, 1
  %12 = load i32, ptr @libxsmm_verbosity, align 4
  %13 = select i1 %11, i32 %12, i32 1
  tail call void @libxsmm_handle_error(ptr noundef nonnull %0, i32 noundef 90006, ptr noundef nonnull @__func__.libxsmm_generator_cvt_from_ps_avx512, ptr noundef nonnull @.str.6, i32 noundef 2966, i32 noundef %13) #2
  br label %30

14:                                               ; preds = %5
  switch i32 %2, label %25 [
    i32 1, label %15
    i32 2, label %17
    i32 3, label %18
    i32 4, label %19
    i32 5, label %22
  ]

15:                                               ; preds = %14
  %.not = icmp eq i32 %3, %4
  br i1 %.not, label %30, label %16

16:                                               ; preds = %15
  tail call void @libxsmm_x86_instruction_vec_compute_2reg(ptr noundef nonnull %0, i32 noundef 537138704, i8 noundef signext %1, i32 noundef %3, i32 noundef %4) #2
  br label %30

17:                                               ; preds = %14
  tail call void @libxsmm_x86_instruction_vec_compute_2reg(ptr noundef nonnull %0, i32 noundef 537273970, i8 noundef signext %1, i32 noundef %3, i32 noundef %4) #2
  br label %30

18:                                               ; preds = %14
  tail call void @libxsmm_x86_instruction_vec_compute_2reg_mask_sae_imm8(ptr noundef nonnull %0, i32 noundef 671954205, i8 noundef signext %1, i32 noundef %3, i32 noundef %4, i32 noundef 0, i32 noundef 1, i8 noundef zeroext 1, i32 noundef 0) #2
  br label %30

19:                                               ; preds = %14
  tail call void @libxsmm_x86_instruction_vec_compute_2reg_mask_sae_imm8(ptr noundef nonnull %0, i32 noundef 671954205, i8 noundef signext %1, i32 noundef %3, i32 noundef %4, i32 noundef 0, i32 noundef 1, i8 noundef zeroext 1, i32 noundef 0) #2
  %20 = icmp eq i8 %1, 122
  %21 = select i1 %20, i8 121, i8 120
  tail call void @libxsmm_x86_instruction_vec_compute_2reg(ptr noundef nonnull %0, i32 noundef -536467852, i8 noundef signext %21, i32 noundef %4, i32 noundef %4) #2
  br label %30

22:                                               ; preds = %14
  tail call void @libxsmm_x86_instruction_vec_compute_2reg_mask_sae_imm8(ptr noundef nonnull %0, i32 noundef 671954205, i8 noundef signext %1, i32 noundef %3, i32 noundef %4, i32 noundef 0, i32 noundef 1, i8 noundef zeroext 1, i32 noundef 0) #2
  %23 = icmp eq i8 %1, 122
  %24 = select i1 %23, i8 121, i8 120
  tail call void @libxsmm_x86_instruction_vec_compute_2reg(ptr noundef nonnull %0, i32 noundef -536455656, i8 noundef signext %24, i32 noundef %4, i32 noundef %4) #2
  br label %30

25:                                               ; preds = %14
  %26 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !11
  %27 = icmp ugt i32 %26, 1
  %28 = load i32, ptr @libxsmm_verbosity, align 4
  %29 = select i1 %27, i32 %28, i32 1
  tail call void @libxsmm_handle_error(ptr noundef nonnull %0, i32 noundef 90033, ptr noundef nonnull @__func__.libxsmm_generator_cvt_from_ps_avx512, ptr noundef nonnull @.str.6, i32 noundef 2984, i32 noundef %29) #2
  br label %30

30:                                               ; preds = %17, %19, %22, %18, %15, %16, %25, %9
  ret void
}

declare void @libxsmm_x86_instruction_vec_compute_2reg_mask_sae_imm8(ptr noundef, i32 noundef, i8 noundef signext, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i8 noundef zeroext, i32 noundef) local_unnamed_addr #0

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,IPSCCPPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass