; LLVM IR from facebook/redex :: libredex/ClassUtil.ll (ZN5klass21maybe_anonymous_classEPK8DexClass)

; 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.std::array" = type { [2 x %"class.std::basic_string_view"] }
%"class.std::basic_string_view" = type { i64, ptr }
%class.anon = type { ptr }

@_ZZN5klass21maybe_anonymous_classEPK8DexClassE8patterns = external hidden constant %"struct.std::array", align 8

; 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: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN5klass21maybe_anonymous_classEPK8DexClass(ptr noundef %0) #1 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca %"class.std::basic_string_view", align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca %class.anon, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %4) #4
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = call { i64, ptr } @_ZNK8DexClass30get_deobfuscated_name_or_emptyEv(ptr noundef nonnull align 8 dereferenceable(176) %8)
  %10 = getelementptr inbounds { i64, ptr }, ptr %4, i32 0, i32 0
  %11 = extractvalue { i64, ptr } %9, 0
  store i64 %11, ptr %10, align 8
  %12 = getelementptr inbounds { i64, ptr }, ptr %4, i32 0, i32 1
  %13 = extractvalue { i64, ptr } %9, 1
  store ptr %13, ptr %12, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %14 = call noundef i64 @_ZNKSt17basic_string_viewIcSt11char_traitsIcEE5rfindEcm(ptr noundef nonnull align 8 dereferenceable(16) %4, i8 noundef signext 36, i64 noundef -1) #4
  store i64 %14, ptr %5, align 8, !tbaa !9
  %15 = load i64, ptr %5, align 8, !tbaa !9
  %16 = icmp eq i64 %15, -1
  br i1 %16, label %17, label %18

17:                                               ; preds = %1
  store i1 false, ptr %2, align 1
  store i32 1, ptr %6, align 4
  br label %45

18:                                               ; preds = %1
  %19 = load i64, ptr %5, align 8, !tbaa !9
  %20 = add i64 %19, 1
  store i64 %20, ptr %5, align 8, !tbaa !9
  %21 = load i64, ptr %5, align 8, !tbaa !9
  %22 = call noundef i64 @_ZNKSt17basic_string_viewIcSt11char_traitsIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %4) #4
  %23 = icmp ult i64 %21, %22
  br i1 %23, label %24, label %36

24:                                               ; preds = %18
  %25 = load i64, ptr %5, align 8, !tbaa !9
  %26 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt17basic_string_viewIcSt11char_traitsIcEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %4, i64 noundef %25) #4
  %27 = load i8, ptr %26, align 1, !tbaa !11
  %28 = sext i8 %27 to i32
  %29 = icmp sge i32 %28, 48
  br i1 %29, label %30, label %36

30:                                               ; preds = %24
  %31 = load i64, ptr %5, align 8, !tbaa !9
  %32 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt17basic_string_viewIcSt11char_traitsIcEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %4, i64 noundef %31) #4
  %33 = load i8, ptr %32, align 1, !tbaa !11
  %34 = sext i8 %33 to i32
  %35 = icmp sle i32 %34, 57
  br i1 %35, label %43, label %36

36:                                               ; preds = %30, %24, %18
  %37 = call noundef ptr @_ZNKSt5arrayISt17basic_string_viewIcSt11char_traitsIcEELm2EE5beginEv(ptr noundef nonnull align 8 dereferenceable(32) @_ZZN5klass21maybe_anonymous_classEPK8DexClassE8patterns) #4
  %38 = call noundef ptr @_ZNKSt5arrayISt17basic_string_viewIcSt11char_traitsIcEELm2EE3endEv(ptr noundef nonnull align 8 dereferenceable(32) @_ZZN5klass21maybe_anonymous_classEPK8DexClassE8patterns) #4
  %39 = getelementptr inbounds %class.anon, ptr %7, i32 0, i32 0
  store ptr %4, ptr %39, align 8, !tbaa !5
  %40 = getelementptr inbounds %class.anon, ptr %7, i32 0, i32 0
  %41 = load ptr, ptr %40, align 8
  %42 = call noundef zeroext i1 @"_ZSt6any_ofIPKSt17basic_string_viewIcSt11char_traitsIcEEZN5klass21maybe_anonymous_classEPK8DexClassE3$_0EbT_SB_T0_"(ptr noundef %37, ptr noundef %38, ptr %41)
  br label %43

43:                                               ; preds = %36, %30
  %44 = phi i1 [ true, %30 ], [ %42, %36 ]
  store i1 %44, ptr %2, align 1
  store i32 1, ptr %6, align 4
  br label %45

45:                                               ; preds = %43, %17
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %4) #4
  %46 = load i1, ptr %2, align 1
  ret i1 %46
}

; Function Attrs: mustprogress uwtable
declare dso_local { i64, ptr } @_ZNK8DexClass30get_deobfuscated_name_or_emptyEv(ptr noundef nonnull align 8 dereferenceable(176)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt17basic_string_viewIcSt11char_traitsIcEE5rfindEcm(ptr noundef nonnull align 8 dereferenceable(16), i8 noundef signext, i64 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt17basic_string_viewIcSt11char_traitsIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt17basic_string_viewIcSt11char_traitsIcEEixEm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare hidden noundef zeroext i1 @"_ZSt6any_ofIPKSt17basic_string_viewIcSt11char_traitsIcEEZN5klass21maybe_anonymous_classEPK8DexClassE3$_0EbT_SB_T0_"(ptr noundef, ptr noundef, ptr) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt5arrayISt17basic_string_viewIcSt11char_traitsIcEELm2EE5beginEv(ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt5arrayISt17basic_string_viewIcSt11char_traitsIcEELm2EE3endEv(ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

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

!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 = !{!"long", !7, i64 0}
!11 = !{!7, !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"

%"struct.std::array" = type { [2 x %"class.std::basic_string_view"] }
%"class.std::basic_string_view" = type { i64, ptr }

@_ZZN5klass21maybe_anonymous_classEPK8DexClassE8patterns = external hidden constant %"struct.std::array", align 8

; 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: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN5klass21maybe_anonymous_classEPK8DexClass(ptr noundef nonnull %0) local_unnamed_addr #1 {
  %2 = alloca %"class.std::basic_string_view", align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #4
  %3 = tail call { i64, ptr } @_ZNK8DexClass30get_deobfuscated_name_or_emptyEv(ptr noundef nonnull align 8 dereferenceable(176) %0)
  %4 = extractvalue { i64, ptr } %3, 0
  store i64 %4, ptr %2, align 8
  %5 = getelementptr inbounds i8, ptr %2, i64 8
  %6 = extractvalue { i64, ptr } %3, 1
  store ptr %6, ptr %5, align 8
  %7 = call noundef i64 @_ZNKSt17basic_string_viewIcSt11char_traitsIcEE5rfindEcm(ptr noundef nonnull align 8 dereferenceable(16) %2, i8 noundef signext 36, i64 noundef -1) #4
  %8 = icmp eq i64 %7, -1
  br i1 %8, label %25, label %9

9:                                                ; preds = %1
  %10 = add nuw i64 %7, 1
  %11 = call noundef i64 @_ZNKSt17basic_string_viewIcSt11char_traitsIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %2) #4
  %12 = icmp ult i64 %10, %11
  br i1 %12, label %13, label %21

13:                                               ; preds = %9
  %14 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt17basic_string_viewIcSt11char_traitsIcEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %2, i64 noundef %10) #4
  %15 = load i8, ptr %14, align 1, !tbaa !5
  %16 = icmp sgt i8 %15, 47
  br i1 %16, label %17, label %21

17:                                               ; preds = %13
  %18 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt17basic_string_viewIcSt11char_traitsIcEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %2, i64 noundef %10) #4
  %19 = load i8, ptr %18, align 1, !tbaa !5
  %20 = icmp slt i8 %19, 58
  br i1 %20, label %25, label %21

21:                                               ; preds = %17, %13, %9
  %22 = call noundef ptr @_ZNKSt5arrayISt17basic_string_viewIcSt11char_traitsIcEELm2EE5beginEv(ptr noundef nonnull align 8 dereferenceable(32) @_ZZN5klass21maybe_anonymous_classEPK8DexClassE8patterns) #4
  %23 = call noundef ptr @_ZNKSt5arrayISt17basic_string_viewIcSt11char_traitsIcEELm2EE3endEv(ptr noundef nonnull align 8 dereferenceable(32) @_ZZN5klass21maybe_anonymous_classEPK8DexClassE8patterns) #4
  %24 = call noundef zeroext i1 @"_ZSt6any_ofIPKSt17basic_string_viewIcSt11char_traitsIcEEZN5klass21maybe_anonymous_classEPK8DexClassE3$_0EbT_SB_T0_"(ptr noundef %22, ptr noundef %23, ptr nonnull %2)
  br label %25

25:                                               ; preds = %17, %21, %1
  %.0 = phi i1 [ false, %1 ], [ true, %17 ], [ %24, %21 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #4
  ret i1 %.0
}

; Function Attrs: mustprogress uwtable
declare dso_local { i64, ptr } @_ZNK8DexClass30get_deobfuscated_name_or_emptyEv(ptr noundef nonnull align 8 dereferenceable(176)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt17basic_string_viewIcSt11char_traitsIcEE5rfindEcm(ptr noundef nonnull align 8 dereferenceable(16), i8 noundef signext, i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt17basic_string_viewIcSt11char_traitsIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt17basic_string_viewIcSt11char_traitsIcEEixEm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare hidden noundef zeroext i1 @"_ZSt6any_ofIPKSt17basic_string_viewIcSt11char_traitsIcEEZN5klass21maybe_anonymous_classEPK8DexClassE3$_0EbT_SB_T0_"(ptr noundef, ptr noundef, ptr) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt5arrayISt17basic_string_viewIcSt11char_traitsIcEELm2EE5beginEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt5arrayISt17basic_string_viewIcSt11char_traitsIcEELm2EE3endEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

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

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}


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