; LLVM IR from facebook/redex :: service/dedup-blocks/DedupBlocks.ll (ZN17dedup_blocks_impl11DedupBlocks3runEv)

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

%"class.dedup_blocks_impl::DedupBlocksImpl" = type { ptr, ptr }
%"class.dedup_blocks_impl::DedupBlocks" = type { ptr, ptr, i8, ptr, ptr, %"struct.dedup_blocks_impl::Stats" }
%"struct.dedup_blocks_impl::Stats" = type { i32, i32, i32, i32, i32, %class.UnorderedMap }
%class.UnorderedMap = type { %"class.std::unordered_map" }
%"class.std::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }
%"struct.dedup_blocks_impl::Config" = type <{ %class.UnorderedSet.79, i32, i8, i8, i8, i8, i32, [4 x i8] }>
%class.UnorderedSet.79 = type { %"class.std::unordered_set.81" }
%"class.std::unordered_set.81" = type { %"class.std::_Hashtable.82" }
%"class.std::_Hashtable.82" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", 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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN17dedup_blocks_impl11DedupBlocks3runEv(ptr noundef nonnull align 8 dereferenceable(120) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca %"class.dedup_blocks_impl::DedupBlocksImpl", align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %6 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %3) #3
  %7 = getelementptr inbounds %"class.dedup_blocks_impl::DedupBlocks", ptr %6, i32 0, i32 0
  %8 = load ptr, ptr %7, align 8, !tbaa !9
  %9 = getelementptr inbounds %"class.dedup_blocks_impl::DedupBlocks", ptr %6, i32 0, i32 5
  call void @_ZN17dedup_blocks_impl15DedupBlocksImplC2EPKNS_6ConfigERNS_5StatsE(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef %8, ptr noundef nonnull align 8 dereferenceable(80) %9)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %10 = getelementptr inbounds %"class.dedup_blocks_impl::DedupBlocks", ptr %6, i32 0, i32 1
  %11 = load ptr, ptr %10, align 8, !tbaa !21
  %12 = call noundef nonnull align 8 dereferenceable(160) ptr @_ZN6IRCode3cfgEv(ptr noundef nonnull align 8 dereferenceable(32) %11)
  store ptr %12, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !22
  br label %13

13:                                               ; preds = %41, %1
  %14 = load i32, ptr %5, align 4, !tbaa !22
  %15 = add i32 %14, 1
  store i32 %15, ptr %5, align 4, !tbaa !22
  %16 = getelementptr inbounds %"class.dedup_blocks_impl::DedupBlocks", ptr %6, i32 0, i32 0
  %17 = load ptr, ptr %16, align 8, !tbaa !9
  %18 = getelementptr inbounds %"struct.dedup_blocks_impl::Config", ptr %17, i32 0, i32 2
  %19 = load i8, ptr %18, align 4, !tbaa !23, !range !28, !noundef !29
  %20 = trunc i8 %19 to i1
  br i1 %20, label %21, label %23

21:                                               ; preds = %13
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN17dedup_blocks_impl15DedupBlocksImpl13split_postfixERN3cfg16ControlFlowGraphE(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(160) %22)
  br label %23

23:                                               ; preds = %21, %13
  br label %24

24:                                               ; preds = %23
  %25 = getelementptr inbounds %"class.dedup_blocks_impl::DedupBlocks", ptr %6, i32 0, i32 2
  %26 = load i8, ptr %25, align 8, !tbaa !30, !range !28, !noundef !29
  %27 = trunc i8 %26 to i1
  %28 = getelementptr inbounds %"class.dedup_blocks_impl::DedupBlocks", ptr %6, i32 0, i32 3
  %29 = load ptr, ptr %28, align 8, !tbaa !31
  %30 = getelementptr inbounds %"class.dedup_blocks_impl::DedupBlocks", ptr %6, i32 0, i32 4
  %31 = load ptr, ptr %30, align 8, !tbaa !32
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = call noundef zeroext i1 @_ZN17dedup_blocks_impl15DedupBlocksImpl5dedupEbP7DexTypeP11DexTypeListRN3cfg16ControlFlowGraphE(ptr noundef nonnull align 8 dereferenceable(16) %3, i1 noundef zeroext %27, ptr noundef %29, ptr noundef %31, ptr noundef nonnull align 8 dereferenceable(160) %32)
  br i1 %33, label %34, label %41

34:                                               ; preds = %24
  %35 = load i32, ptr %5, align 4, !tbaa !22
  %36 = getelementptr inbounds %"class.dedup_blocks_impl::DedupBlocks", ptr %6, i32 0, i32 0
  %37 = load ptr, ptr %36, align 8, !tbaa !9
  %38 = getelementptr inbounds %"struct.dedup_blocks_impl::Config", ptr %37, i32 0, i32 6
  %39 = load i32, ptr %38, align 8, !tbaa !33
  %40 = icmp ult i32 %35, %39
  br label %41

41:                                               ; preds = %34, %24
  %42 = phi i1 [ false, %24 ], [ %40, %34 ]
  br i1 %42, label %13, label %43, !llvm.loop !34

43:                                               ; preds = %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %3) #3
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN17dedup_blocks_impl15DedupBlocksImplC2EPKNS_6ConfigERNS_5StatsE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN17dedup_blocks_impl15DedupBlocksImpl13split_postfixERN3cfg16ControlFlowGraphE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(160)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN17dedup_blocks_impl15DedupBlocksImpl5dedupEbP7DexTypeP11DexTypeListRN3cfg16ControlFlowGraphE(ptr noundef nonnull align 8 dereferenceable(16), i1 noundef zeroext, ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(160)) #1 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 = { 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, !6, i64 0}
!10 = !{!"_ZTSN17dedup_blocks_impl11DedupBlocksE", !6, i64 0, !6, i64 8, !11, i64 16, !6, i64 24, !6, i64 32, !12, i64 40}
!11 = !{!"bool", !7, i64 0}
!12 = !{!"_ZTSN17dedup_blocks_impl5StatsE", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !14, i64 24}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTS12UnorderedMapImmSt4hashImESt8equal_toImEE", !15, i64 0}
!15 = !{!"_ZTSSt13unordered_mapImmSt4hashImESt8equal_toImESaISt4pairIKmmEEE", !16, i64 0}
!16 = !{!"_ZTSSt10_HashtableImSt4pairIKmmESaIS2_ENSt8__detail10_Select1stESt8equal_toImESt4hashImENS4_18_Mod_range_hashingENS4_20_Default_ranged_hashENS4_20_Prime_rehash_policyENS4_17_Hashtable_traitsILb0ELb0ELb1EEEE", !6, i64 0, !17, i64 8, !18, i64 16, !17, i64 24, !19, i64 32, !6, i64 48}
!17 = !{!"long", !7, i64 0}
!18 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !6, i64 0}
!19 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !20, i64 0, !17, i64 8}
!20 = !{!"float", !7, i64 0}
!21 = !{!10, !6, i64 8}
!22 = !{!13, !13, i64 0}
!23 = !{!24, !11, i64 60}
!24 = !{!"_ZTSN17dedup_blocks_impl6ConfigE", !25, i64 0, !13, i64 56, !11, i64 60, !11, i64 61, !11, i64 62, !13, i64 64}
!25 = !{!"_ZTS12UnorderedSetIP9DexMethodSt4hashIS1_ESt8equal_toIS1_EE", !26, i64 0}
!26 = !{!"_ZTSSt13unordered_setIP9DexMethodSt4hashIS1_ESt8equal_toIS1_ESaIS1_EE", !27, i64 0}
!27 = !{!"_ZTSSt10_HashtableIP9DexMethodS1_SaIS1_ENSt8__detail9_IdentityESt8equal_toIS1_ESt4hashIS1_ENS3_18_Mod_range_hashingENS3_20_Default_ranged_hashENS3_20_Prime_rehash_policyENS3_17_Hashtable_traitsILb0ELb1ELb1EEEE", !6, i64 0, !17, i64 8, !18, i64 16, !17, i64 24, !19, i64 32, !6, i64 48}
!28 = !{i8 0, i8 2}
!29 = !{}
!30 = !{!10, !11, i64 16}
!31 = !{!10, !6, i64 24}
!32 = !{!10, !6, i64 32}
!33 = !{!24, !13, i64 64}
!34 = distinct !{!34, !35}
!35 = !{!"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"

%"class.dedup_blocks_impl::DedupBlocksImpl" = type { ptr, ptr }

; 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 void @_ZN17dedup_blocks_impl11DedupBlocks3runEv(ptr noundef nonnull align 8 dereferenceable(120) %0) local_unnamed_addr #1 align 2 {
  %2 = alloca %"class.dedup_blocks_impl::DedupBlocksImpl", align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #3
  %3 = load ptr, ptr %0, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 40
  call void @_ZN17dedup_blocks_impl15DedupBlocksImplC2EPKNS_6ConfigERNS_5StatsE(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef %3, ptr noundef nonnull align 8 dereferenceable(80) %4)
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = load ptr, ptr %5, align 8, !tbaa !20
  %7 = call noundef nonnull align 8 dereferenceable(160) ptr @_ZN6IRCode3cfgEv(ptr noundef nonnull align 8 dereferenceable(32) %6)
  %8 = getelementptr inbounds i8, ptr %0, i64 16
  %9 = getelementptr inbounds i8, ptr %0, i64 24
  %10 = getelementptr inbounds i8, ptr %0, i64 32
  %.pre = load ptr, ptr %0, align 8, !tbaa !5
  br label %11

11:                                               ; preds = %24, %1
  %12 = phi ptr [ %.pre, %1 ], [ %25, %24 ]
  %.0 = phi i32 [ 0, %1 ], [ %13, %24 ]
  %13 = add nuw i32 %.0, 1
  %14 = getelementptr inbounds i8, ptr %12, i64 60
  %15 = load i8, ptr %14, align 4, !tbaa !21, !range !26, !noundef !27
  %16 = trunc nuw i8 %15 to i1
  br i1 %16, label %17, label %18

17:                                               ; preds = %11
  call void @_ZN17dedup_blocks_impl15DedupBlocksImpl13split_postfixERN3cfg16ControlFlowGraphE(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(160) %7)
  br label %18

18:                                               ; preds = %11, %17
  %19 = load i8, ptr %8, align 8, !tbaa !28, !range !26, !noundef !27
  %20 = trunc nuw i8 %19 to i1
  %21 = load ptr, ptr %9, align 8, !tbaa !29
  %22 = load ptr, ptr %10, align 8, !tbaa !30
  %23 = call noundef zeroext i1 @_ZN17dedup_blocks_impl15DedupBlocksImpl5dedupEbP7DexTypeP11DexTypeListRN3cfg16ControlFlowGraphE(ptr noundef nonnull align 8 dereferenceable(16) %2, i1 noundef zeroext %20, ptr noundef %21, ptr noundef %22, ptr noundef nonnull align 8 dereferenceable(160) %7)
  br i1 %23, label %24, label %.critedge

24:                                               ; preds = %18
  %25 = load ptr, ptr %0, align 8, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %25, i64 64
  %27 = load i32, ptr %26, align 8, !tbaa !31
  %28 = icmp ult i32 %13, %27
  br i1 %28, label %11, label %.critedge, !llvm.loop !32

.critedge:                                        ; preds = %18, %24
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #3
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN17dedup_blocks_impl15DedupBlocksImplC2EPKNS_6ConfigERNS_5StatsE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN17dedup_blocks_impl15DedupBlocksImpl13split_postfixERN3cfg16ControlFlowGraphE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(160)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN17dedup_blocks_impl15DedupBlocksImpl5dedupEbP7DexTypeP11DexTypeListRN3cfg16ControlFlowGraphE(ptr noundef nonnull align 8 dereferenceable(16), i1 noundef zeroext, ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(160)) local_unnamed_addr #1 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 = { 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, !7, i64 0}
!6 = !{!"_ZTSN17dedup_blocks_impl11DedupBlocksE", !7, i64 0, !7, i64 8, !10, i64 16, !7, i64 24, !7, i64 32, !11, i64 40}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"bool", !8, i64 0}
!11 = !{!"_ZTSN17dedup_blocks_impl5StatsE", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !13, i64 24}
!12 = !{!"int", !8, i64 0}
!13 = !{!"_ZTS12UnorderedMapImmSt4hashImESt8equal_toImEE", !14, i64 0}
!14 = !{!"_ZTSSt13unordered_mapImmSt4hashImESt8equal_toImESaISt4pairIKmmEEE", !15, i64 0}
!15 = !{!"_ZTSSt10_HashtableImSt4pairIKmmESaIS2_ENSt8__detail10_Select1stESt8equal_toImESt4hashImENS4_18_Mod_range_hashingENS4_20_Default_ranged_hashENS4_20_Prime_rehash_policyENS4_17_Hashtable_traitsILb0ELb0ELb1EEEE", !7, i64 0, !16, i64 8, !17, i64 16, !16, i64 24, !18, i64 32, !7, i64 48}
!16 = !{!"long", !8, i64 0}
!17 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !7, i64 0}
!18 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !19, i64 0, !16, i64 8}
!19 = !{!"float", !8, i64 0}
!20 = !{!6, !7, i64 8}
!21 = !{!22, !10, i64 60}
!22 = !{!"_ZTSN17dedup_blocks_impl6ConfigE", !23, i64 0, !12, i64 56, !10, i64 60, !10, i64 61, !10, i64 62, !12, i64 64}
!23 = !{!"_ZTS12UnorderedSetIP9DexMethodSt4hashIS1_ESt8equal_toIS1_EE", !24, i64 0}
!24 = !{!"_ZTSSt13unordered_setIP9DexMethodSt4hashIS1_ESt8equal_toIS1_ESaIS1_EE", !25, i64 0}
!25 = !{!"_ZTSSt10_HashtableIP9DexMethodS1_SaIS1_ENSt8__detail9_IdentityESt8equal_toIS1_ESt4hashIS1_ENS3_18_Mod_range_hashingENS3_20_Default_ranged_hashENS3_20_Prime_rehash_policyENS3_17_Hashtable_traitsILb0ELb1ELb1EEEE", !7, i64 0, !16, i64 8, !17, i64 16, !16, i64 24, !18, i64 32, !7, i64 48}
!26 = !{i8 0, i8 2}
!27 = !{}
!28 = !{!6, !10, i64 16}
!29 = !{!6, !7, i64 24}
!30 = !{!6, !7, i64 32}
!31 = !{!22, !12, i64 64}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,SROAPass,SimplifyCFGPass