; LLVM IR from facebook/redex :: libredex/ControlFlow.ll (ZNK3cfg5Block12cannot_throwEv)

; 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.ir_list::InstructionIteratorImpl.62" = type { %"class.boost::intrusive::list_iterator.38", %"class.boost::intrusive::list_iterator.38" }
%"class.boost::intrusive::list_iterator.38" = type { %"struct.boost::intrusive::iiterator_members" }
%"struct.boost::intrusive::iiterator_members" = type { ptr }
%"class.ir_list::ConstInstructionIterable" = type { %"class.ir_list::InstructionIterableImpl" }
%"class.ir_list::InstructionIterableImpl" = type { %"class.boost::intrusive::list_iterator.38", %"class.boost::intrusive::list_iterator.38" }
%struct.MethodItemEntry = type { %"class.boost::intrusive::list_member_hook", i32, %union.anon.16 }
%"class.boost::intrusive::list_member_hook" = type { %"class.boost::intrusive::generic_hook" }
%"class.boost::intrusive::generic_hook" = type { %"struct.boost::intrusive::list_node" }
%"struct.boost::intrusive::list_node" = type { ptr, ptr }
%union.anon.16 = type { 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 nounwind uwtable
declare dso_local noundef zeroext i16 @_ZNK13IRInstruction6opcodeEv(ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7ir_list23InstructionIterableImplILb1EE5beginEv(ptr dead_on_unwind noalias writable sret(%"class.ir_list::InstructionIteratorImpl.62") align 8, ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7ir_list23InstructionIterableImplILb1EE3endEv(ptr dead_on_unwind noalias writable sret(%"class.ir_list::InstructionIteratorImpl.62") align 8, ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK3cfg5Block12cannot_throwEv(ptr noundef nonnull align 8 dereferenceable(104) %0) #2 align 2 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"class.ir_list::ConstInstructionIterable", align 8
  %6 = alloca %"class.ir_list::InstructionIteratorImpl.62", align 8
  %7 = alloca %"class.ir_list::InstructionIteratorImpl.62", align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %10 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #4
  call void @_ZN7ir_list24ConstInstructionIterableC2IN3cfg5BlockEEEPKT_(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef %10)
  store ptr %5, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #4
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZNK7ir_list23InstructionIterableImplILb1EE5beginEv(ptr dead_on_unwind writable sret(%"class.ir_list::InstructionIteratorImpl.62") align 8 %6, ptr noundef nonnull align 8 dereferenceable(16) %11)
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #4
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZNK7ir_list23InstructionIterableImplILb1EE3endEv(ptr dead_on_unwind writable sret(%"class.ir_list::InstructionIteratorImpl.62") align 8 %7, ptr noundef nonnull align 8 dereferenceable(16) %12)
  br label %13

13:                                               ; preds = %28, %1
  %14 = call noundef zeroext i1 @_ZNK7ir_list23InstructionIteratorImplILb1EEneERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(16) %7)
  br i1 %14, label %16, label %15

15:                                               ; preds = %13
  store i32 2, ptr %8, align 4
  br label %30

16:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %17 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNK7ir_list23InstructionIteratorImplILb1EEdeEv(ptr noundef nonnull align 8 dereferenceable(16) %6)
  store ptr %17, ptr %9, align 8, !tbaa !5
  %18 = load ptr, ptr %9, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.MethodItemEntry, ptr %18, i32 0, i32 2
  %20 = load ptr, ptr %19, align 8, !tbaa !9
  %21 = call noundef zeroext i16 @_ZNK13IRInstruction6opcodeEv(ptr noundef nonnull align 8 dereferenceable(32) %20)
  %22 = call noundef zeroext i1 @_ZN6opcode9can_throwE8IROpcode(i16 noundef zeroext %21)
  br i1 %22, label %23, label %24

23:                                               ; preds = %16
  store i1 false, ptr %2, align 1
  store i32 1, ptr %8, align 4
  br label %25

24:                                               ; preds = %16
  store i32 0, ptr %8, align 4
  br label %25

25:                                               ; preds = %24, %23
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  %26 = load i32, ptr %8, align 4
  switch i32 %26, label %30 [
    i32 0, label %27
  ]

27:                                               ; preds = %25
  br label %28

28:                                               ; preds = %27
  %29 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN7ir_list23InstructionIteratorImplILb1EEppEv(ptr noundef nonnull align 8 dereferenceable(16) %6)
  br label %13

30:                                               ; preds = %25, %15
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  %31 = load i32, ptr %8, align 4
  switch i32 %31, label %35 [
    i32 2, label %32
    i32 1, label %33
  ]

32:                                               ; preds = %30
  store i1 true, ptr %2, align 1
  br label %33

33:                                               ; preds = %32, %30
  %34 = load i1, ptr %2, align 1
  ret i1 %34

35:                                               ; preds = %30
  unreachable
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN6opcode9can_throwE8IROpcode(i16 noundef zeroext) #3

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

%"class.ir_list::InstructionIteratorImpl.62" = type { %"class.boost::intrusive::list_iterator.38", %"class.boost::intrusive::list_iterator.38" }
%"class.boost::intrusive::list_iterator.38" = type { %"struct.boost::intrusive::iiterator_members" }
%"struct.boost::intrusive::iiterator_members" = type { ptr }
%"class.ir_list::ConstInstructionIterable" = type { %"class.ir_list::InstructionIterableImpl" }
%"class.ir_list::InstructionIterableImpl" = type { %"class.boost::intrusive::list_iterator.38", %"class.boost::intrusive::list_iterator.38" }

; 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 nounwind uwtable
declare dso_local noundef zeroext i16 @_ZNK13IRInstruction6opcodeEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7ir_list23InstructionIterableImplILb1EE5beginEv(ptr dead_on_unwind noalias writable sret(%"class.ir_list::InstructionIteratorImpl.62") align 8, ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7ir_list23InstructionIterableImplILb1EE3endEv(ptr dead_on_unwind noalias writable sret(%"class.ir_list::InstructionIteratorImpl.62") align 8, ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK3cfg5Block12cannot_throwEv(ptr noundef nonnull align 8 dereferenceable(104) %0) local_unnamed_addr #2 align 2 {
  %2 = alloca %"class.ir_list::ConstInstructionIterable", align 8
  %3 = alloca %"class.ir_list::InstructionIteratorImpl.62", align 8
  %4 = alloca %"class.ir_list::InstructionIteratorImpl.62", align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #4
  call void @_ZN7ir_list24ConstInstructionIterableC2IN3cfg5BlockEEEPKT_(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull %0)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #4
  call void @_ZNK7ir_list23InstructionIterableImplILb1EE5beginEv(ptr dead_on_unwind nonnull writable sret(%"class.ir_list::InstructionIteratorImpl.62") align 8 %3, ptr noundef nonnull align 8 dereferenceable(16) %2)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #4
  call void @_ZNK7ir_list23InstructionIterableImplILb1EE3endEv(ptr dead_on_unwind nonnull writable sret(%"class.ir_list::InstructionIteratorImpl.62") align 8 %4, ptr noundef nonnull align 8 dereferenceable(16) %2)
  %5 = call noundef zeroext i1 @_ZNK7ir_list23InstructionIteratorImplILb1EEneERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %4)
  br i1 %5, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %1, %11
  %6 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNK7ir_list23InstructionIteratorImplILb1EEdeEv(ptr noundef nonnull align 8 dereferenceable(16) %3)
  %7 = getelementptr inbounds i8, ptr %6, i64 24
  %8 = load ptr, ptr %7, align 8, !tbaa !5
  %9 = call noundef zeroext i16 @_ZNK13IRInstruction6opcodeEv(ptr noundef nonnull align 8 dereferenceable(32) %8)
  %10 = call noundef zeroext i1 @_ZN6opcode9can_throwE8IROpcode(i16 noundef zeroext %9)
  br i1 %10, label %._crit_edge.loopexit, label %11

11:                                               ; preds = %.lr.ph
  %12 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN7ir_list23InstructionIteratorImplILb1EEppEv(ptr noundef nonnull align 8 dereferenceable(16) %3)
  %13 = call noundef zeroext i1 @_ZNK7ir_list23InstructionIteratorImplILb1EEneERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %4)
  br i1 %13, label %.lr.ph, label %._crit_edge.loopexit

._crit_edge.loopexit:                             ; preds = %11, %.lr.ph
  %14 = xor i1 %10, true
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %1
  %.lcssa = phi i1 [ true, %1 ], [ %14, %._crit_edge.loopexit ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #4
  ret i1 %.lcssa
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN6opcode9can_throwE8IROpcode(i16 noundef zeroext) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
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: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass