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

@.str.7 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.44 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.45 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [26 x i8], align 1
@__PRETTY_FUNCTION__.libxsmm_cpuid_name = external hidden unnamed_addr constant [36 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local ptr @libxsmm_cpuid_name(i32 noundef %0) #2 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  store i32 %0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  store ptr null, ptr %3, align 8, !tbaa !9
  %4 = load i32, ptr %2, align 4, !tbaa !5
  switch i32 %4, label %34 [
    i32 1106, label %5
    i32 1105, label %6
    i32 1104, label %7
    i32 1103, label %8
    i32 1102, label %9
    i32 1101, label %10
    i32 1051, label %11
    i32 1052, label %12
    i32 1053, label %13
    i32 1008, label %14
    i32 1007, label %15
    i32 1006, label %16
    i32 1005, label %17
    i32 1004, label %18
    i32 1003, label %19
    i32 2001, label %20
    i32 2002, label %20
    i32 2101, label %21
    i32 2501, label %22
    i32 2201, label %23
    i32 2202, label %24
    i32 2301, label %25
    i32 2302, label %26
    i32 2401, label %27
    i32 2402, label %28
    i32 3001, label %29
    i32 3002, label %30
    i32 3004, label %31
    i32 3003, label %32
    i32 1, label %33
  ]

5:                                                ; preds = %1
  store ptr @.str.15, ptr %3, align 8, !tbaa !9
  br label %43

6:                                                ; preds = %1
  store ptr @.str.16, ptr %3, align 8, !tbaa !9
  br label %43

7:                                                ; preds = %1
  store ptr @.str.17, ptr %3, align 8, !tbaa !9
  br label %43

8:                                                ; preds = %1
  store ptr @.str.18, ptr %3, align 8, !tbaa !9
  br label %43

9:                                                ; preds = %1
  store ptr @.str.19, ptr %3, align 8, !tbaa !9
  br label %43

10:                                               ; preds = %1
  store ptr @.str.20, ptr %3, align 8, !tbaa !9
  br label %43

11:                                               ; preds = %1
  store ptr @.str.21, ptr %3, align 8, !tbaa !9
  br label %43

12:                                               ; preds = %1
  store ptr @.str.22, ptr %3, align 8, !tbaa !9
  br label %43

13:                                               ; preds = %1
  store ptr @.str.23, ptr %3, align 8, !tbaa !9
  br label %43

14:                                               ; preds = %1
  store ptr @.str.24, ptr %3, align 8, !tbaa !9
  br label %43

15:                                               ; preds = %1
  store ptr @.str.25, ptr %3, align 8, !tbaa !9
  br label %43

16:                                               ; preds = %1
  store ptr @.str.26, ptr %3, align 8, !tbaa !9
  br label %43

17:                                               ; preds = %1
  store ptr @.str.27, ptr %3, align 8, !tbaa !9
  br label %43

18:                                               ; preds = %1
  store ptr @.str.28, ptr %3, align 8, !tbaa !9
  br label %43

19:                                               ; preds = %1
  store ptr @.str.29, ptr %3, align 8, !tbaa !9
  br label %43

20:                                               ; preds = %1, %1
  store ptr @.str.30, ptr %3, align 8, !tbaa !9
  br label %43

21:                                               ; preds = %1
  store ptr @.str.31, ptr %3, align 8, !tbaa !9
  br label %43

22:                                               ; preds = %1
  store ptr @.str.32, ptr %3, align 8, !tbaa !9
  br label %43

23:                                               ; preds = %1
  store ptr @.str.33, ptr %3, align 8, !tbaa !9
  br label %43

24:                                               ; preds = %1
  store ptr @.str.34, ptr %3, align 8, !tbaa !9
  br label %43

25:                                               ; preds = %1
  store ptr @.str.35, ptr %3, align 8, !tbaa !9
  br label %43

26:                                               ; preds = %1
  store ptr @.str.36, ptr %3, align 8, !tbaa !9
  br label %43

27:                                               ; preds = %1
  store ptr @.str.37, ptr %3, align 8, !tbaa !9
  br label %43

28:                                               ; preds = %1
  store ptr @.str.38, ptr %3, align 8, !tbaa !9
  br label %43

29:                                               ; preds = %1
  store ptr @.str.39, ptr %3, align 8, !tbaa !9
  br label %43

30:                                               ; preds = %1
  store ptr @.str.40, ptr %3, align 8, !tbaa !9
  br label %43

31:                                               ; preds = %1
  store ptr @.str.41, ptr %3, align 8, !tbaa !9
  br label %43

32:                                               ; preds = %1
  store ptr @.str.42, ptr %3, align 8, !tbaa !9
  br label %43

33:                                               ; preds = %1
  store ptr @.str.43, ptr %3, align 8, !tbaa !9
  br label %43

34:                                               ; preds = %1
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = icmp sle i32 1002, %35
  br i1 %36, label %37, label %41

37:                                               ; preds = %34
  %38 = load i32, ptr %2, align 4, !tbaa !5
  %39 = icmp sge i32 1999, %38
  br i1 %39, label %40, label %41

40:                                               ; preds = %37
  store ptr @.str.44, ptr %3, align 8, !tbaa !9
  br label %42

41:                                               ; preds = %37, %34
  store ptr @.str.45, ptr %3, align 8, !tbaa !9
  br label %42

42:                                               ; preds = %41, %40
  br label %43

43:                                               ; preds = %42, %33, %32, %31, %30, %29, %28, %27, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
  %44 = load ptr, ptr %3, align 8, !tbaa !9
  %45 = icmp ne ptr null, %44
  br i1 %45, label %46, label %47

46:                                               ; preds = %43
  br label %48

47:                                               ; preds = %43
  call void @__assert_fail(ptr noundef @.str.46, ptr noundef @.str.7, i32 noundef 460, ptr noundef @__PRETTY_FUNCTION__.libxsmm_cpuid_name) #4
  unreachable

48:                                               ; preds = %46
  %49 = load ptr, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  ret ptr %49
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn 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 = { 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 = { noreturn 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, 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"

@.str.15 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.44 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.45 = external hidden unnamed_addr constant [8 x i8], align 1

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local noundef nonnull ptr @libxsmm_cpuid_name(i32 noundef %0) local_unnamed_addr #0 {
  switch i32 %0, label %30 [
    i32 1106, label %32
    i32 1105, label %2
    i32 1104, label %3
    i32 1103, label %4
    i32 1102, label %5
    i32 1101, label %6
    i32 1051, label %7
    i32 1052, label %8
    i32 1053, label %9
    i32 1008, label %10
    i32 1007, label %11
    i32 1006, label %12
    i32 1005, label %13
    i32 1004, label %14
    i32 1003, label %15
    i32 2001, label %16
    i32 2002, label %16
    i32 2101, label %17
    i32 2501, label %18
    i32 2201, label %19
    i32 2202, label %20
    i32 2301, label %21
    i32 2302, label %22
    i32 2401, label %23
    i32 2402, label %24
    i32 3001, label %25
    i32 3002, label %26
    i32 3004, label %27
    i32 3003, label %28
    i32 1, label %29
  ]

2:                                                ; preds = %1
  br label %32

3:                                                ; preds = %1
  br label %32

4:                                                ; preds = %1
  br label %32

5:                                                ; preds = %1
  br label %32

6:                                                ; preds = %1
  br label %32

7:                                                ; preds = %1
  br label %32

8:                                                ; preds = %1
  br label %32

9:                                                ; preds = %1
  br label %32

10:                                               ; preds = %1
  br label %32

11:                                               ; preds = %1
  br label %32

12:                                               ; preds = %1
  br label %32

13:                                               ; preds = %1
  br label %32

14:                                               ; preds = %1
  br label %32

15:                                               ; preds = %1
  br label %32

16:                                               ; preds = %1, %1
  br label %32

17:                                               ; preds = %1
  br label %32

18:                                               ; preds = %1
  br label %32

19:                                               ; preds = %1
  br label %32

20:                                               ; preds = %1
  br label %32

21:                                               ; preds = %1
  br label %32

22:                                               ; preds = %1
  br label %32

23:                                               ; preds = %1
  br label %32

24:                                               ; preds = %1
  br label %32

25:                                               ; preds = %1
  br label %32

26:                                               ; preds = %1
  br label %32

27:                                               ; preds = %1
  br label %32

28:                                               ; preds = %1
  br label %32

29:                                               ; preds = %1
  br label %32

30:                                               ; preds = %1
  %31 = add i32 %0, -1002
  %or.cond = icmp ult i32 %31, 998
  %.str.44..str.45 = select i1 %or.cond, ptr @.str.44, ptr @.str.45
  br label %32

32:                                               ; preds = %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20, %21, %22, %23, %24, %25, %26, %27, %28, %29, %1, %30
  %.0 = phi ptr [ @.str.43, %29 ], [ @.str.42, %28 ], [ @.str.41, %27 ], [ @.str.40, %26 ], [ @.str.39, %25 ], [ @.str.38, %24 ], [ @.str.37, %23 ], [ @.str.36, %22 ], [ @.str.35, %21 ], [ @.str.34, %20 ], [ @.str.33, %19 ], [ @.str.32, %18 ], [ @.str.31, %17 ], [ @.str.30, %16 ], [ @.str.29, %15 ], [ @.str.28, %14 ], [ @.str.27, %13 ], [ @.str.26, %12 ], [ @.str.25, %11 ], [ @.str.24, %10 ], [ @.str.23, %9 ], [ @.str.22, %8 ], [ @.str.21, %7 ], [ @.str.20, %6 ], [ @.str.19, %5 ], [ @.str.18, %4 ], [ @.str.17, %3 ], [ @.str.16, %2 ], [ @.str.15, %1 ], [ %.str.44..str.45, %30 ]
  ret ptr %.0
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) 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)"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass