; LLVM IR from facebook/redex :: libredex (TypeUtil)

; 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.api::FrameworkAPI" = type <{ ptr, ptr, %"class.std::vector.195", %"class.std::vector.200", i32, [4 x i8] }>
%"class.std::vector.195" = type { %"struct.std::_Vector_base.196" }
%"struct.std::_Vector_base.196" = type { %"struct.std::_Vector_base<api::MRefInfo, std::allocator<api::MRefInfo>>::_Vector_impl" }
%"struct.std::_Vector_base<api::MRefInfo, std::allocator<api::MRefInfo>>::_Vector_impl" = type { %"struct.std::_Vector_base<api::MRefInfo, std::allocator<api::MRefInfo>>::_Vector_impl_data" }
%"struct.std::_Vector_base<api::MRefInfo, std::allocator<api::MRefInfo>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.200" = type { %"struct.std::_Vector_base.201" }
%"struct.std::_Vector_base.201" = type { %"struct.std::_Vector_base<api::FRefInfo, std::allocator<api::FRefInfo>>::_Vector_impl" }
%"struct.std::_Vector_base<api::FRefInfo, std::allocator<api::FRefInfo>>::_Vector_impl" = type { %"struct.std::_Vector_base<api::FRefInfo, std::allocator<api::FRefInfo>>::_Vector_impl_data" }
%"struct.std::_Vector_base<api::FRefInfo, std::allocator<api::FRefInfo>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; 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 noundef ptr @_Z10type_classPK7DexType(ptr noundef) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK8DexClass11is_externalEv(ptr noundef nonnull align 8 dereferenceable(176)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK3api10AndroidSDK8has_typeEPK7DexType(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef) #3 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(68) ptr @_ZNK12UnorderedMapIPK7DexTypeN3api12FrameworkAPIESt4hashIS2_ESt8equal_toIS2_EE2atERKS2_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4type31is_min_sdk_acceptable_sdk_chainEPK7DexTypeS2_RKN3api10AndroidSDKE(ptr noundef %0, ptr noundef %1, ptr noundef nonnull align 8 dereferenceable(88) %2) #3 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i8, align 1
  %11 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = icmp eq ptr %12, %13
  br i1 %14, label %15, label %16

15:                                               ; preds = %3
  store i1 true, ptr %4, align 1
  br label %56

16:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = call noundef ptr @_Z10type_classPK7DexType(ptr noundef %17)
  store ptr %18, ptr %8, align 8, !tbaa !5
  %19 = load ptr, ptr %8, align 8, !tbaa !5
  %20 = icmp eq ptr %19, null
  br i1 %20, label %21, label %22

21:                                               ; preds = %16
  store i1 false, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %55

22:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #4
  %23 = load ptr, ptr %8, align 8, !tbaa !5
  %24 = call noundef zeroext i1 @_ZNK8DexClass11is_externalEv(ptr noundef nonnull align 8 dereferenceable(176) %23)
  %25 = zext i1 %24 to i8
  store i8 %25, ptr %10, align 1, !tbaa !9
  %26 = load i8, ptr %10, align 1, !tbaa !9, !range !11, !noundef !12
  %27 = trunc i8 %26 to i1
  br i1 %27, label %28, label %33

28:                                               ; preds = %22
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = call noundef zeroext i1 @_ZNK3api10AndroidSDK8has_typeEPK7DexType(ptr noundef nonnull align 8 dereferenceable(88) %29, ptr noundef %30)
  br i1 %31, label %33, label %32

32:                                               ; preds = %28
  store i1 false, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %54

33:                                               ; preds = %28, %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = call noundef ptr @_ZNK8DexClass15get_super_classEv(ptr noundef nonnull align 8 dereferenceable(176) %34)
  store ptr %35, ptr %11, align 8, !tbaa !5
  %36 = load i8, ptr %10, align 1, !tbaa !9, !range !11, !noundef !12
  %37 = trunc i8 %36 to i1
  br i1 %37, label %38, label %44

38:                                               ; preds = %33
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = call noundef nonnull align 8 dereferenceable(56) ptr @_ZNK3api10AndroidSDK21get_framework_classesEv(ptr noundef nonnull align 8 dereferenceable(88) %39)
  %41 = call noundef nonnull align 8 dereferenceable(68) ptr @_ZNK12UnorderedMapIPK7DexTypeN3api12FrameworkAPIESt4hashIS2_ESt8equal_toIS2_EE2atERKS2_(ptr noundef nonnull align 8 dereferenceable(56) %40, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %42 = getelementptr inbounds %"struct.api::FrameworkAPI", ptr %41, i32 0, i32 1
  %43 = load ptr, ptr %42, align 8, !tbaa !13
  store ptr %43, ptr %11, align 8, !tbaa !5
  br label %44

44:                                               ; preds = %38, %33
  %45 = load ptr, ptr %11, align 8, !tbaa !5
  %46 = icmp eq ptr %45, null
  br i1 %46, label %47, label %48

47:                                               ; preds = %44
  store i1 false, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %53

48:                                               ; preds = %44
  %49 = load ptr, ptr %11, align 8, !tbaa !5
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  %52 = call noundef zeroext i1 @_ZN4type31is_min_sdk_acceptable_sdk_chainEPK7DexTypeS2_RKN3api10AndroidSDKE(ptr noundef %49, ptr noundef %50, ptr noundef nonnull align 8 dereferenceable(88) %51)
  store i1 %52, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %53

53:                                               ; preds = %48, %47
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br label %54

54:                                               ; preds = %53, %32
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #4
  br label %55

55:                                               ; preds = %54, %21
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %56

56:                                               ; preds = %55, %15
  %57 = load i1, ptr %4, align 1
  ret i1 %57
}

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 = { 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 = { 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 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!14, !6, i64 8}
!14 = !{!"_ZTSN3api12FrameworkAPIE", !6, i64 0, !6, i64 8, !15, i64 16, !19, i64 40, !23, i64 64}
!15 = !{!"_ZTSSt6vectorIN3api8MRefInfoESaIS1_EE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIN3api8MRefInfoESaIS1_EE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIN3api8MRefInfoESaIS1_EE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIN3api8MRefInfoESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!19 = !{!"_ZTSSt6vectorIN3api8FRefInfoESaIS1_EE", !20, i64 0}
!20 = !{!"_ZTSSt12_Vector_baseIN3api8FRefInfoESaIS1_EE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIN3api8FRefInfoESaIS1_EE12_Vector_implE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIN3api8FRefInfoESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!23 = !{!"_ZTS14DexAccessFlags", !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"

declare noundef ptr @_Z10type_classPK7DexType(ptr noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK8DexClass11is_externalEv(ptr noundef nonnull align 8 dereferenceable(176)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK3api10AndroidSDK8has_typeEPK7DexType(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(56) ptr @_ZNK3api10AndroidSDK21get_framework_classesEv(ptr noundef nonnull align 8 dereferenceable(88)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(68) ptr @_ZNK12UnorderedMapIPK7DexTypeN3api12FrameworkAPIESt4hashIS2_ESt8equal_toIS2_EE2atERKS2_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4type31is_min_sdk_acceptable_sdk_chainEPK7DexTypeS2_RKN3api10AndroidSDKE(ptr noundef %0, ptr noundef %1, ptr noundef nonnull align 8 dereferenceable(88) %2) local_unnamed_addr #2 {
  %4 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  %5 = icmp eq ptr %0, %1
  br i1 %5, label %25, label %6

6:                                                ; preds = %3
  %7 = tail call noundef ptr @_Z10type_classPK7DexType(ptr noundef %0)
  %8 = icmp eq ptr %7, null
  br i1 %8, label %25, label %9

9:                                                ; preds = %6
  %10 = tail call noundef zeroext i1 @_ZNK8DexClass11is_externalEv(ptr noundef nonnull align 8 dereferenceable(176) %7)
  br i1 %10, label %11, label %13

11:                                               ; preds = %9
  %12 = tail call noundef zeroext i1 @_ZNK3api10AndroidSDK8has_typeEPK7DexType(ptr noundef nonnull align 8 dereferenceable(88) %2, ptr noundef %0)
  br i1 %12, label %15, label %25

13:                                               ; preds = %9
  %14 = tail call noundef ptr @_ZNK8DexClass15get_super_classEv(ptr noundef nonnull align 8 dereferenceable(176) %7)
  br label %21

15:                                               ; preds = %11
  %16 = tail call noundef ptr @_ZNK8DexClass15get_super_classEv(ptr noundef nonnull align 8 dereferenceable(176) %7)
  %17 = tail call noundef nonnull align 8 dereferenceable(56) ptr @_ZNK3api10AndroidSDK21get_framework_classesEv(ptr noundef nonnull align 8 dereferenceable(88) %2)
  %18 = call noundef nonnull align 8 dereferenceable(68) ptr @_ZNK12UnorderedMapIPK7DexTypeN3api12FrameworkAPIESt4hashIS2_ESt8equal_toIS2_EE2atERKS2_(ptr noundef nonnull align 8 dereferenceable(56) %17, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %19 = getelementptr inbounds i8, ptr %18, i64 8
  %20 = load ptr, ptr %19, align 8, !tbaa !9
  br label %21

21:                                               ; preds = %13, %15
  %.0 = phi ptr [ %20, %15 ], [ %14, %13 ]
  %22 = icmp eq ptr %.0, null
  br i1 %22, label %25, label %23

23:                                               ; preds = %21
  %24 = call noundef zeroext i1 @_ZN4type31is_min_sdk_acceptable_sdk_chainEPK7DexTypeS2_RKN3api10AndroidSDKE(ptr noundef nonnull %.0, ptr noundef %1, ptr noundef nonnull align 8 dereferenceable(88) %2)
  br label %25

25:                                               ; preds = %6, %23, %21, %11, %3
  %.3 = phi i1 [ true, %3 ], [ false, %6 ], [ false, %11 ], [ %24, %23 ], [ false, %21 ]
  ret i1 %.3
}

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 = { 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 #2 = { 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" }

!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, !6, i64 8}
!10 = !{!"_ZTSN3api12FrameworkAPIE", !6, i64 0, !6, i64 8, !11, i64 16, !15, i64 40, !19, i64 64}
!11 = !{!"_ZTSSt6vectorIN3api8MRefInfoESaIS1_EE", !12, i64 0}
!12 = !{!"_ZTSSt12_Vector_baseIN3api8MRefInfoESaIS1_EE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIN3api8MRefInfoESaIS1_EE12_Vector_implE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIN3api8MRefInfoESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!15 = !{!"_ZTSSt6vectorIN3api8FRefInfoESaIS1_EE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIN3api8FRefInfoESaIS1_EE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIN3api8FRefInfoESaIS1_EE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIN3api8FRefInfoESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!19 = !{!"_ZTS14DexAccessFlags", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass,TailCallElimPass