; LLVM IR from facebook/redex :: libresource (Visitor)

; 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.android::ResTable_entry" = type { i16, i16, %"struct.android::ResStringPool_ref" }
%"struct.android::ResStringPool_ref" = type { i32 }
%"struct.android::Res_value" = type { i16, i8, i8, i32 }

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

15:                                               ; preds = %6
  br label %16

16:                                               ; preds = %15
  %17 = load ptr, ptr %9, align 8, !tbaa !5
  %18 = load ptr, ptr %11, align 8, !tbaa !5
  %19 = load ptr, ptr %12, align 8, !tbaa !5
  %20 = getelementptr inbounds %"struct.android::ResTable_entry", ptr %19, i32 0, i32 2
  %21 = load ptr, ptr %14, align 8, !tbaa !9
  %22 = getelementptr inbounds ptr, ptr %21, i64 17
  %23 = load ptr, ptr %22, align 8
  %24 = call noundef zeroext i1 %23(ptr noundef nonnull align 8 dereferenceable(24) %14, ptr noundef %17, ptr noundef %18, ptr noundef %20)
  br i1 %24, label %26, label %25

25:                                               ; preds = %16
  store i1 false, ptr %7, align 1
  br label %41

26:                                               ; preds = %16
  %27 = load ptr, ptr %13, align 8, !tbaa !5
  %28 = getelementptr inbounds %"struct.android::Res_value", ptr %27, i32 0, i32 2
  %29 = load i8, ptr %28, align 1, !tbaa !11
  %30 = zext i8 %29 to i32
  %31 = icmp eq i32 %30, 3
  br i1 %31, label %32, label %40

32:                                               ; preds = %26
  %33 = load ptr, ptr %13, align 8, !tbaa !5
  %34 = load ptr, ptr %14, align 8, !tbaa !9
  %35 = getelementptr inbounds ptr, ptr %34, i64 18
  %36 = load ptr, ptr %35, align 8
  %37 = call noundef zeroext i1 %36(ptr noundef nonnull align 8 dereferenceable(24) %14, ptr noundef %33)
  br i1 %37, label %39, label %38

38:                                               ; preds = %32
  store i1 false, ptr %7, align 1
  br label %41

39:                                               ; preds = %32
  br label %40

40:                                               ; preds = %39, %26
  store i1 true, ptr %7, align 1
  br label %41

41:                                               ; preds = %40, %38, %25
  %42 = load i1, ptr %7, align 1
  ret i1 %42
}

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

!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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !7, i64 3}
!12 = !{!"_ZTSN7android9Res_valueE", !13, i64 0, !7, i64 2, !7, i64 3, !14, i64 4}
!13 = !{!"short", !7, i64 0}
!14 = !{!"int", !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"

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4arsc20StringPoolRefVisitor11visit_entryEPN7android16ResTable_packageEPNS1_17ResTable_typeSpecEPNS1_13ResTable_typeEPNS1_14ResTable_entryEPNS1_9Res_valueE(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1, ptr nocapture noundef readnone %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) unnamed_addr #0 align 2 {
  %7 = getelementptr inbounds i8, ptr %4, i64 4
  %8 = load ptr, ptr %0, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %8, i64 136
  %10 = load ptr, ptr %9, align 8
  %11 = tail call noundef zeroext i1 %10(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1, ptr noundef %3, ptr noundef nonnull %7)
  br i1 %11, label %12, label %22

12:                                               ; preds = %6
  %13 = getelementptr inbounds i8, ptr %5, i64 3
  %14 = load i8, ptr %13, align 1, !tbaa !8
  %15 = icmp eq i8 %14, 3
  br i1 %15, label %16, label %21

16:                                               ; preds = %12
  %17 = load ptr, ptr %0, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %17, i64 144
  %19 = load ptr, ptr %18, align 8
  %20 = tail call noundef zeroext i1 %19(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull %5)
  br i1 %20, label %21, label %22

21:                                               ; preds = %16, %12
  br label %22

22:                                               ; preds = %16, %6, %21
  %.0 = phi i1 [ true, %21 ], [ false, %6 ], [ false, %16 ]
  ret i1 %.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" }

!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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !11, i64 3}
!9 = !{!"_ZTSN7android9Res_valueE", !10, i64 0, !11, i64 2, !11, i64 3, !12, i64 4}
!10 = !{!"short", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"int", !11, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass