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

; 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.boost::optional.12" = type { %"class.boost::optional_detail::tc_optional_base.13" }
%"class.boost::optional_detail::tc_optional_base.13" = type { i8, i32 }
%"struct.boost::none_t" = type { i8 }
%"class.reflection::ReflectionAnalysis" = type { ptr, %"class.std::unique_ptr", ptr }
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.28" }
%"struct.std::_Head_base.28" = type { ptr }

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZNK10reflection4impl8Analyzer16get_class_sourceEmP13IRInstruction(ptr noundef nonnull align 8 dereferenceable(680), i64 noundef, ptr noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5boost8optionalIN10reflection17ClassObjectSourceEEC2ENS_6none_tE(ptr noundef nonnull align 4 dereferenceable(8)) unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local i64 @_ZNK10reflection18ReflectionAnalysis16get_class_sourceEmP13IRInstruction(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %1, ptr noundef %2) #1 align 2 {
  %4 = alloca %"class.boost::optional.12", align 4
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %"struct.boost::none_t", align 1
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  %9 = load ptr, ptr %5, align 8
  %10 = getelementptr inbounds %"class.reflection::ReflectionAnalysis", ptr %9, i32 0, i32 1
  %11 = call noundef zeroext i1 @_ZSteqIN10reflection4impl8AnalyzerESt14default_deleteIS2_EEbRKSt10unique_ptrIT_T0_EDn(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr null) #3
  br i1 %11, label %12, label %13

12:                                               ; preds = %3
  call void @_ZN5boost8optionalIN10reflection17ClassObjectSourceEEC2ENS_6none_tE(ptr noundef nonnull align 4 dereferenceable(8) %4) #3
  br label %20

13:                                               ; preds = %3
  %14 = getelementptr inbounds %"class.reflection::ReflectionAnalysis", ptr %9, i32 0, i32 1
  %15 = call noundef ptr @_ZNKSt10unique_ptrIN10reflection4impl8AnalyzerESt14default_deleteIS2_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %14) #3
  %16 = load i64, ptr %6, align 8, !tbaa !9
  %17 = load ptr, ptr %7, align 8, !tbaa !5
  %18 = call i64 @_ZNK10reflection4impl8Analyzer16get_class_sourceEmP13IRInstruction(ptr noundef nonnull align 8 dereferenceable(680) %15, i64 noundef %16, ptr noundef %17)
  %19 = getelementptr inbounds %"class.boost::optional.12", ptr %4, i32 0, i32 0
  store i64 %18, ptr %19, align 4
  br label %20

20:                                               ; preds = %13, %12
  %21 = getelementptr inbounds %"class.boost::optional.12", ptr %4, i32 0, i32 0
  %22 = load i64, ptr %21, align 4
  ret i64 %22
}

attributes #0 = { 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 #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 = { inlinehint 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, !10, i64 0}
!10 = !{!"long", !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.boost::optional.12" = type { %"class.boost::optional_detail::tc_optional_base.13" }
%"class.boost::optional_detail::tc_optional_base.13" = type { i8, i32 }

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZNK10reflection4impl8Analyzer16get_class_sourceEmP13IRInstruction(ptr noundef nonnull align 8 dereferenceable(680), i64 noundef, ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5boost8optionalIN10reflection17ClassObjectSourceEEC2ENS_6none_tE(ptr noundef nonnull align 4 dereferenceable(8)) unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local i64 @_ZNK10reflection18ReflectionAnalysis16get_class_sourceEmP13IRInstruction(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %1, ptr noundef %2) local_unnamed_addr #1 align 2 {
  %4 = alloca %"class.boost::optional.12", align 8
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = tail call noundef zeroext i1 @_ZSteqIN10reflection4impl8AnalyzerESt14default_deleteIS2_EEbRKSt10unique_ptrIT_T0_EDn(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr null) #3
  br i1 %6, label %7, label %8

7:                                                ; preds = %3
  call void @_ZN5boost8optionalIN10reflection17ClassObjectSourceEEC2ENS_6none_tE(ptr noundef nonnull align 4 dereferenceable(8) %4) #3
  %.pre = load i64, ptr %4, align 8
  br label %11

8:                                                ; preds = %3
  %9 = tail call noundef ptr @_ZNKSt10unique_ptrIN10reflection4impl8AnalyzerESt14default_deleteIS2_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  %10 = tail call i64 @_ZNK10reflection4impl8Analyzer16get_class_sourceEmP13IRInstruction(ptr noundef nonnull align 8 dereferenceable(680) %9, i64 noundef %1, ptr noundef %2)
  br label %11

11:                                               ; preds = %8, %7
  %12 = phi i64 [ %10, %8 ], [ %.pre, %7 ]
  ret i64 %12
}

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


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferAlignmentPass,InstCombinePass,SROAPass,TailCallElimPass