; LLVM IR from alibaba/MNN :: source/backend/cpu/x86_x64 (cpu_id)

; 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 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [4 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

declare noalias ptr @fopen(ptr noundef, ptr noundef) #1

declare ptr @fgets(ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nounwind willreturn memory(read)
declare i32 @memcmp(ptr noundef, ptr noundef, i64 noundef) #2

; Function Attrs: nounwind willreturn memory(read)
declare noundef ptr @strstr(ptr noundef, ptr noundef) #2

declare i32 @fclose(ptr noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local i32 @MipsCpuCaps(ptr noundef %0) #3 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca [512 x i8], align 16
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 512, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = call noalias ptr @fopen(ptr noundef %8, ptr noundef @.str)
  store ptr %9, ptr %6, align 8, !tbaa !5
  %10 = load ptr, ptr %6, align 8, !tbaa !5
  %11 = icmp ne ptr %10, null
  br i1 %11, label %13, label %12

12:                                               ; preds = %1
  store i32 0, ptr %2, align 4
  store i32 1, ptr %7, align 4
  br label %67

13:                                               ; preds = %1
  br label %14

14:                                               ; preds = %62, %13
  %15 = getelementptr inbounds [512 x i8], ptr %4, i64 0, i64 0
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = call ptr @fgets(ptr noundef %15, i32 noundef 511, ptr noundef %16)
  %18 = icmp ne ptr %17, null
  br i1 %18, label %19, label %63

19:                                               ; preds = %14
  %20 = getelementptr inbounds [512 x i8], ptr %4, i64 0, i64 0
  %21 = call i32 @memcmp(ptr noundef %20, ptr noundef @.str.4, i64 noundef 9) #5
  %22 = icmp eq i32 %21, 0
  br i1 %22, label %23, label %39

23:                                               ; preds = %19
  %24 = getelementptr inbounds [512 x i8], ptr %4, i64 0, i64 0
  %25 = call noundef ptr @strstr(ptr noundef %24, ptr noundef @.str.5) #5
  %26 = icmp ne ptr %25, null
  br i1 %26, label %27, label %30

27:                                               ; preds = %23
  %28 = load i32, ptr %5, align 4, !tbaa !9
  %29 = or i32 %28, 8388608
  store i32 %29, ptr %5, align 4, !tbaa !9
  br label %38

30:                                               ; preds = %23
  %31 = getelementptr inbounds [512 x i8], ptr %4, i64 0, i64 0
  %32 = call noundef ptr @strstr(ptr noundef %31, ptr noundef @.str.6) #5
  %33 = icmp ne ptr %32, null
  br i1 %33, label %34, label %37

34:                                               ; preds = %30
  %35 = load i32, ptr %5, align 4, !tbaa !9
  %36 = or i32 %35, 12582912
  store i32 %36, ptr %5, align 4, !tbaa !9
  br label %37

37:                                               ; preds = %34, %30
  br label %38

38:                                               ; preds = %37, %27
  br label %39

39:                                               ; preds = %38, %19
  %40 = getelementptr inbounds [512 x i8], ptr %4, i64 0, i64 0
  %41 = call i32 @memcmp(ptr noundef %40, ptr noundef @.str.7, i64 noundef 16) #5
  %42 = icmp eq i32 %41, 0
  br i1 %42, label %43, label %62

43:                                               ; preds = %39
  %44 = getelementptr inbounds [512 x i8], ptr %4, i64 0, i64 0
  %45 = call noundef ptr @strstr(ptr noundef %44, ptr noundef @.str.8) #5
  %46 = icmp ne ptr %45, null
  br i1 %46, label %47, label %54

47:                                               ; preds = %43
  %48 = getelementptr inbounds [512 x i8], ptr %4, i64 0, i64 0
  %49 = call noundef ptr @strstr(ptr noundef %48, ptr noundef @.str.9) #5
  %50 = icmp ne ptr %49, null
  br i1 %50, label %51, label %54

51:                                               ; preds = %47
  %52 = load i32, ptr %5, align 4, !tbaa !9
  %53 = or i32 %52, 8388608
  store i32 %53, ptr %5, align 4, !tbaa !9
  br label %54

54:                                               ; preds = %51, %47, %43
  %55 = getelementptr inbounds [512 x i8], ptr %4, i64 0, i64 0
  %56 = call noundef ptr @strstr(ptr noundef %55, ptr noundef @.str.10) #5
  %57 = icmp ne ptr %56, null
  br i1 %57, label %58, label %61

58:                                               ; preds = %54
  %59 = load i32, ptr %5, align 4, !tbaa !9
  %60 = or i32 %59, 4194304
  store i32 %60, ptr %5, align 4, !tbaa !9
  br label %61

61:                                               ; preds = %58, %54
  br label %63

62:                                               ; preds = %39
  br label %14, !llvm.loop !11

63:                                               ; preds = %61, %14
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = call i32 @fclose(ptr noundef %64)
  %66 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %66, ptr %2, align 4
  store i32 1, ptr %7, align 4
  br label %67

67:                                               ; preds = %63, %12
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 512, ptr %4) #4
  %68 = load i32, ptr %2, align 4
  ret i32 %68
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 willreturn memory(read) "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 = { mustprogress 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 }
attributes #5 = { nounwind willreturn memory(read) }

!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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; 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 [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #1

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare noundef ptr @strstr(ptr noundef, ptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind uwtable
define dso_local i32 @MipsCpuCaps(ptr nocapture noundef readonly %0) local_unnamed_addr #3 {
  %2 = alloca [512 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %2) #5
  %3 = tail call noalias ptr @fopen(ptr noundef %0, ptr noundef nonnull @.str)
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %25, label %.preheader

.preheader:                                       ; preds = %1, %14
  %.09 = phi i32 [ %.1, %14 ], [ 0, %1 ]
  %4 = call ptr @fgets(ptr noundef nonnull %2, i32 noundef 511, ptr noundef nonnull %3)
  %.not10 = icmp eq ptr %4, null
  br i1 %.not10, label %.loopexit, label %5

5:                                                ; preds = %.preheader
  %bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(9) %2, ptr noundef nonnull dereferenceable(9) @.str.4, i64 9)
  %6 = icmp eq i32 %bcmp, 0
  br i1 %6, label %7, label %14

7:                                                ; preds = %5
  %8 = call noundef ptr @strstr(ptr noundef nonnull dereferenceable(1) %2, ptr noundef nonnull dereferenceable(1) @.str.5) #6
  %.not11 = icmp eq ptr %8, null
  br i1 %.not11, label %11, label %9

9:                                                ; preds = %7
  %10 = or i32 %.09, 8388608
  br label %14

11:                                               ; preds = %7
  %12 = call noundef ptr @strstr(ptr noundef nonnull dereferenceable(1) %2, ptr noundef nonnull dereferenceable(1) @.str.6) #6
  %.not12 = icmp eq ptr %12, null
  %13 = or i32 %.09, 12582912
  %spec.select = select i1 %.not12, i32 %.09, i32 %13
  br label %14

14:                                               ; preds = %11, %9, %5
  %.1 = phi i32 [ %10, %9 ], [ %.09, %5 ], [ %spec.select, %11 ]
  %bcmp13 = call i32 @bcmp(ptr noundef nonnull dereferenceable(16) %2, ptr noundef nonnull dereferenceable(16) @.str.7, i64 16)
  %15 = icmp eq i32 %bcmp13, 0
  br i1 %15, label %16, label %.preheader, !llvm.loop !5

16:                                               ; preds = %14
  %17 = call noundef ptr @strstr(ptr noundef nonnull dereferenceable(1) %2, ptr noundef nonnull dereferenceable(1) @.str.8) #6
  %.not14 = icmp eq ptr %17, null
  br i1 %.not14, label %21, label %18

18:                                               ; preds = %16
  %19 = call noundef ptr @strstr(ptr noundef nonnull dereferenceable(1) %2, ptr noundef nonnull dereferenceable(1) @.str.9) #6
  %.not15 = icmp eq ptr %19, null
  %20 = or i32 %.1, 8388608
  %spec.select17 = select i1 %.not15, i32 %.1, i32 %20
  br label %21

21:                                               ; preds = %18, %16
  %.2 = phi i32 [ %.1, %16 ], [ %spec.select17, %18 ]
  %22 = call noundef ptr @strstr(ptr noundef nonnull dereferenceable(1) %2, ptr noundef nonnull dereferenceable(1) @.str.10) #6
  %.not16 = icmp eq ptr %22, null
  %23 = or i32 %.2, 4194304
  %spec.select18 = select i1 %.not16, i32 %.2, i32 %23
  br label %.loopexit

.loopexit:                                        ; preds = %.preheader, %21
  %.3 = phi i32 [ %spec.select18, %21 ], [ %.09, %.preheader ]
  %24 = call i32 @fclose(ptr noundef nonnull %3)
  br label %25

25:                                               ; preds = %1, %.loopexit
  %.0 = phi i32 [ %.3, %.loopexit ], [ 0, %1 ]
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %2) #5
  ret i32 %.0
}

; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 = { mustprogress nofree 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 = { nofree nounwind willreturn memory(argmem: read) }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }

!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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass