; LLVM IR from facebook/redex :: service/copy-propagation (AliasedRegisters)

; 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" = type { %"class.boost::optional_detail::tc_optional_base" }
%"class.boost::optional_detail::tc_optional_base" = type { i8, i32 }

@.str.10 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [21 x i8], align 1
@__PRETTY_FUNCTION__._ZN17aliased_registers16AliasedRegisters14change_root_toEjj = external hidden unnamed_addr constant [77 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [23 x i8], align 1

; Function Attrs: noreturn
declare void @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN17aliased_registers16AliasedRegisters14change_root_toEjj(ptr noundef nonnull align 8 dereferenceable(144) %0, i32 noundef %1, i32 noundef %2) #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %"class.boost::optional", align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !9
  %8 = load ptr, ptr %4, align 8
  %9 = load i32, ptr %5, align 4, !tbaa !9
  %10 = load i32, ptr %6, align 4, !tbaa !9
  %11 = icmp ne i32 %9, %10
  br i1 %11, label %12, label %13

12:                                               ; preds = %3
  br label %15

13:                                               ; preds = %3
  call void (ptr, ptr, i32, ptr, i32, ptr, ...) @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef @.str.17, ptr noundef @.str.10, i32 noundef 225, ptr noundef @__PRETTY_FUNCTION__._ZN17aliased_registers16AliasedRegisters14change_root_toEjj, i32 noundef 2, ptr noundef @.str.13) #2
  unreachable

14:                                               ; No predecessors!
  br label %15

15:                                               ; preds = %14, %12
  %16 = load i32, ptr %5, align 4, !tbaa !9
  %17 = call noundef zeroext i1 @_ZNK17aliased_registers16AliasedRegisters12has_incomingEj(ptr noundef nonnull align 8 dereferenceable(144) %8, i32 noundef %16)
  br i1 %17, label %18, label %19

18:                                               ; preds = %15
  br label %21

19:                                               ; preds = %15
  call void (ptr, ptr, i32, ptr, i32, ptr, ...) @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef @.str.18, ptr noundef @.str.10, i32 noundef 226, ptr noundef @__PRETTY_FUNCTION__._ZN17aliased_registers16AliasedRegisters14change_root_toEjj, i32 noundef 2, ptr noundef @.str.13) #2
  unreachable

20:                                               ; No predecessors!
  br label %21

21:                                               ; preds = %20, %18
  %22 = load i32, ptr %5, align 4, !tbaa !9
  call void @_ZN5boost8optionalIjEC2ERKj(ptr noundef nonnull align 4 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %23 = getelementptr inbounds %"class.boost::optional", ptr %7, i32 0, i32 0
  %24 = load i64, ptr %23, align 4
  call void @_ZN17aliased_registers16AliasedRegisters18change_root_helperEjN5boost8optionalIjEE(ptr noundef nonnull align 8 dereferenceable(144) %8, i32 noundef %22, i64 %24)
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN17aliased_registers16AliasedRegisters18change_root_helperEjN5boost8optionalIjEE(ptr noundef nonnull align 8 dereferenceable(144), i32 noundef, i64) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK17aliased_registers16AliasedRegisters12has_incomingEj(ptr noundef nonnull align 8 dereferenceable(144), i32 noundef) #1 align 2

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

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

!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 = !{!"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"

%"class.boost::optional" = type { %"class.boost::optional_detail::tc_optional_base" }
%"class.boost::optional_detail::tc_optional_base" = type { i8, i32 }

@.str.10 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [21 x i8], align 1
@__PRETTY_FUNCTION__._ZN17aliased_registers16AliasedRegisters14change_root_toEjj = external hidden unnamed_addr constant [77 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [23 x i8], align 1

; Function Attrs: noreturn
declare void @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN17aliased_registers16AliasedRegisters14change_root_toEjj(ptr noundef nonnull align 8 dereferenceable(144) %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #1 align 2 {
  %4 = alloca i32, align 4
  %5 = alloca %"class.boost::optional", align 8
  store i32 %2, ptr %4, align 4, !tbaa !5
  %.not = icmp eq i32 %1, %2
  br i1 %.not, label %6, label %7

6:                                                ; preds = %3
  tail call void (ptr, ptr, i32, ptr, i32, ptr, ...) @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef nonnull @.str.17, ptr noundef nonnull @.str.10, i32 noundef 225, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN17aliased_registers16AliasedRegisters14change_root_toEjj, i32 noundef 2, ptr noundef nonnull @.str.13) #2
  unreachable

7:                                                ; preds = %3
  %8 = tail call noundef zeroext i1 @_ZNK17aliased_registers16AliasedRegisters12has_incomingEj(ptr noundef nonnull align 8 dereferenceable(144) %0, i32 noundef %1)
  br i1 %8, label %10, label %9

9:                                                ; preds = %7
  tail call void (ptr, ptr, i32, ptr, i32, ptr, ...) @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef nonnull @.str.18, ptr noundef nonnull @.str.10, i32 noundef 226, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN17aliased_registers16AliasedRegisters14change_root_toEjj, i32 noundef 2, ptr noundef nonnull @.str.13) #2
  unreachable

10:                                               ; preds = %7
  call void @_ZN5boost8optionalIjEC2ERKj(ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %11 = load i64, ptr %5, align 8
  call void @_ZN17aliased_registers16AliasedRegisters18change_root_helperEjN5boost8optionalIjEE(ptr noundef nonnull align 8 dereferenceable(144) %0, i32 noundef %1, i64 %11)
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN17aliased_registers16AliasedRegisters18change_root_helperEjN5boost8optionalIjEE(ptr noundef nonnull align 8 dereferenceable(144), i32 noundef, i64) local_unnamed_addr #1 align 2

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

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

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

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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