; LLVM IR from facebook/redex :: libredex/Match.ll (ZN1m6detail16is_assignable_toEPK7DexTypeS3_)

; 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"

; 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
declare dso_local noundef zeroext i1 @_ZN1m6detail26is_assignable_to_interfaceEPK7DexTypeS3_(ptr noundef, ptr noundef) #1

declare noundef ptr @_Z10type_classPK7DexType(ptr noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN1m6detail16is_assignable_toEPK7DexTypeS3_(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %10, ptr %6, align 8, !tbaa !5
  br label %11

11:                                               ; preds = %30, %2
  %12 = load ptr, ptr %6, align 8, !tbaa !5
  %13 = icmp ne ptr %12, null
  br i1 %13, label %14, label %31

14:                                               ; preds = %11
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = icmp eq ptr %15, %16
  br i1 %17, label %18, label %19

18:                                               ; preds = %14
  store i1 true, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %45

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

24:                                               ; preds = %19
  store i32 3, ptr %7, align 4
  br label %28

25:                                               ; preds = %19
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  %27 = call noundef ptr @_ZNK8DexClass15get_super_classEv(ptr noundef nonnull align 8 dereferenceable(176) %26)
  store ptr %27, ptr %6, align 8, !tbaa !5
  store i32 0, ptr %7, align 4
  br label %28

28:                                               ; preds = %25, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  %29 = load i32, ptr %7, align 4
  switch i32 %29, label %47 [
    i32 0, label %30
    i32 3, label %31
  ]

30:                                               ; preds = %28
  br label %11, !llvm.loop !9

31:                                               ; preds = %28, %11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = call noundef ptr @_Z10type_classPK7DexType(ptr noundef %32)
  store ptr %33, ptr %9, align 8, !tbaa !5
  %34 = load ptr, ptr %9, align 8, !tbaa !5
  %35 = icmp ne ptr %34, null
  br i1 %35, label %36, label %43

36:                                               ; preds = %31
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = call noundef zeroext i1 @_Z12is_interfaceI8DexClassEbPT_(ptr noundef %37)
  br i1 %38, label %39, label %43

39:                                               ; preds = %36
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = call noundef zeroext i1 @_ZN1m6detail26is_assignable_to_interfaceEPK7DexTypeS3_(ptr noundef %40, ptr noundef %41)
  br label %43

43:                                               ; preds = %39, %36, %31
  %44 = phi i1 [ false, %36 ], [ false, %31 ], [ %42, %39 ]
  store i1 %44, ptr %3, align 1
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %45

45:                                               ; preds = %43, %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  %46 = load i1, ptr %3, align 1
  ret i1 %46

47:                                               ; preds = %28
  unreachable
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z12is_interfaceI8DexClassEbPT_(ptr noundef) #1

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 = { "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 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 = { 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 = distinct !{!9, !10}
!10 = !{!"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"

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN1m6detail26is_assignable_to_interfaceEPK7DexTypeS3_(ptr noundef, ptr noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN1m6detail16is_assignable_toEPK7DexTypeS3_(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %.not21 = icmp eq ptr %0, null
  br i1 %.not21, label %.thread, label %.lr.ph

.lr.ph:                                           ; preds = %2, %7
  %.01322 = phi ptr [ %8, %7 ], [ %0, %2 ]
  %3 = icmp eq ptr %.01322, %1
  br i1 %3, label %.loopexit, label %4

4:                                                ; preds = %.lr.ph
  %5 = tail call noundef ptr @_Z10type_classPK7DexType(ptr noundef nonnull %.01322)
  %6 = icmp eq ptr %5, null
  br i1 %6, label %.thread, label %7

7:                                                ; preds = %4
  %8 = tail call noundef ptr @_ZNK8DexClass15get_super_classEv(ptr noundef nonnull align 8 dereferenceable(176) %5)
  %.not = icmp eq ptr %8, null
  br i1 %.not, label %.thread, label %.lr.ph

.thread:                                          ; preds = %7, %4, %2
  %9 = tail call noundef ptr @_Z10type_classPK7DexType(ptr noundef %1)
  %.not17 = icmp eq ptr %9, null
  br i1 %.not17, label %.loopexit, label %10

10:                                               ; preds = %.thread
  %11 = tail call noundef zeroext i1 @_Z12is_interfaceI8DexClassEbPT_(ptr noundef nonnull %9)
  br i1 %11, label %12, label %.loopexit

12:                                               ; preds = %10
  %13 = tail call noundef zeroext i1 @_ZN1m6detail26is_assignable_to_interfaceEPK7DexTypeS3_(ptr noundef %0, ptr noundef %1)
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph, %.thread, %10, %12
  %.0 = phi i1 [ false, %10 ], [ false, %.thread ], [ %13, %12 ], [ true, %.lr.ph ]
  ret i1 %.0
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z12is_interfaceI8DexClassEbPT_(ptr noundef) local_unnamed_addr #0

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

!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: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass