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

; 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.aliased_registers::Value" = type { i8, i8, %union.anon.3 }
%union.anon.3 = type { i64 }

@.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.38 = external hidden unnamed_addr constant [18 x i8], align 1
@__PRETTY_FUNCTION__._ZNK17aliased_registers5Value4hashEv = external hidden unnamed_addr constant [46 x i8], align 1

; 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: noreturn
declare void @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) #1

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZNK17aliased_registers5Value4hashEv(ptr noundef nonnull align 8 dereferenceable(16) %0) #2 align 2 {
  %2 = alloca i64, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %6 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %7 = getelementptr inbounds %"class.aliased_registers::Value", ptr %6, i32 0, i32 0
  %8 = load i8, ptr %7, align 8, !tbaa !9
  %9 = zext i8 %8 to i64
  store i64 %9, ptr %4, align 8, !tbaa !13
  %10 = getelementptr inbounds %"class.aliased_registers::Value", ptr %6, i32 0, i32 0
  %11 = load i8, ptr %10, align 8, !tbaa !9
  switch i8 %11, label %30 [
    i8 0, label %12
    i8 1, label %15
    i8 2, label %15
    i8 3, label %19
    i8 4, label %22
    i8 5, label %25
    i8 6, label %25
    i8 7, label %28
  ]

12:                                               ; preds = %1
  %13 = getelementptr inbounds %"class.aliased_registers::Value", ptr %6, i32 0, i32 2
  call void @_ZN5boost12hash_combineIjEEvRmRKT_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %14 = load i64, ptr %4, align 8, !tbaa !13
  store i64 %14, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %35

15:                                               ; preds = %1, %1
  %16 = getelementptr inbounds %"class.aliased_registers::Value", ptr %6, i32 0, i32 1
  call void @_ZN5boost12hash_combineIN13constant_uses10TypeDemandEEEvRmRKT_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 1 dereferenceable(1) %16)
  %17 = getelementptr inbounds %"class.aliased_registers::Value", ptr %6, i32 0, i32 2
  call void @_ZN5boost12hash_combineIlEEvRmRKT_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %17)
  %18 = load i64, ptr %4, align 8, !tbaa !13
  store i64 %18, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %35

19:                                               ; preds = %1
  %20 = getelementptr inbounds %"class.aliased_registers::Value", ptr %6, i32 0, i32 2
  call void @_ZN5boost12hash_combineIPK9DexStringEEvRmRKT_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %20)
  %21 = load i64, ptr %4, align 8, !tbaa !13
  store i64 %21, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %35

22:                                               ; preds = %1
  %23 = getelementptr inbounds %"class.aliased_registers::Value", ptr %6, i32 0, i32 2
  call void @_ZN5boost12hash_combineIP7DexTypeEEvRmRKT_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %23)
  %24 = load i64, ptr %4, align 8, !tbaa !13
  store i64 %24, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %35

25:                                               ; preds = %1, %1
  %26 = getelementptr inbounds %"class.aliased_registers::Value", ptr %6, i32 0, i32 2
  call void @_ZN5boost12hash_combineIP8DexFieldEEvRmRKT_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %26)
  %27 = load i64, ptr %4, align 8, !tbaa !13
  store i64 %27, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %35

28:                                               ; preds = %1
  %29 = load i64, ptr %4, align 8, !tbaa !13
  store i64 %29, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %35

30:                                               ; preds = %1
  br label %31

31:                                               ; preds = %32, %30
  call void (ptr, ptr, i32, ptr, i32, ptr, ...) @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef @.str.38, ptr noundef @.str.10, i32 noundef 671, ptr noundef @__PRETTY_FUNCTION__._ZNK17aliased_registers5Value4hashEv, i32 noundef 2, ptr noundef @.str.13) #5
  unreachable

32:                                               ; No predecessors!
  br i1 true, label %31, label %33, !llvm.loop !15

33:                                               ; preds = %32
  br label %34

34:                                               ; preds = %33
  unreachable

35:                                               ; preds = %28, %25, %22, %19, %15, %12
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  %36 = load i64, ptr %2, align 8
  ret i64 %36
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5boost12hash_combineIjEEvRmRKT_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5boost12hash_combineIN13constant_uses10TypeDemandEEEvRmRKT_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 1 dereferenceable(1)) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5boost12hash_combineIlEEvRmRKT_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5boost12hash_combineIPK9DexStringEEvRmRKT_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5boost12hash_combineIP7DexTypeEEvRmRKT_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5boost12hash_combineIP8DexFieldEEvRmRKT_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 }
attributes #5 = { 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, !11, i64 0}
!10 = !{!"_ZTSN17aliased_registers5ValueE", !11, i64 0, !12, i64 1, !7, i64 8}
!11 = !{!"_ZTSN17aliased_registers5Value4KindE", !7, i64 0}
!12 = !{!"_ZTSN13constant_uses10TypeDemandE", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"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"

@.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.38 = external hidden unnamed_addr constant [18 x i8], align 1
@__PRETTY_FUNCTION__._ZNK17aliased_registers5Value4hashEv = external hidden unnamed_addr constant [46 x i8], align 1

; 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: noreturn
declare void @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZNK17aliased_registers5Value4hashEv(ptr noundef nonnull align 8 dereferenceable(16) %0) local_unnamed_addr #2 align 2 {
  %2 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  %3 = load i8, ptr %0, align 8, !tbaa !5
  %4 = zext i8 %3 to i64
  store i64 %4, ptr %2, align 8, !tbaa !11
  switch i8 %3, label %21 [
    i8 0, label %5
    i8 1, label %8
    i8 2, label %8
    i8 3, label %12
    i8 4, label %15
    i8 5, label %18
    i8 6, label %18
    i8 7, label %22
  ]

5:                                                ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  call void @_ZN5boost12hash_combineIjEEvRmRKT_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %7 = load i64, ptr %2, align 8, !tbaa !11
  br label %22

8:                                                ; preds = %1, %1
  %9 = getelementptr inbounds i8, ptr %0, i64 1
  call void @_ZN5boost12hash_combineIN13constant_uses10TypeDemandEEEvRmRKT_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 1 dereferenceable(1) %9)
  %10 = getelementptr inbounds i8, ptr %0, i64 8
  call void @_ZN5boost12hash_combineIlEEvRmRKT_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %10)
  %11 = load i64, ptr %2, align 8, !tbaa !11
  br label %22

12:                                               ; preds = %1
  %13 = getelementptr inbounds i8, ptr %0, i64 8
  call void @_ZN5boost12hash_combineIPK9DexStringEEvRmRKT_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %13)
  %14 = load i64, ptr %2, align 8, !tbaa !11
  br label %22

15:                                               ; preds = %1
  %16 = getelementptr inbounds i8, ptr %0, i64 8
  call void @_ZN5boost12hash_combineIP7DexTypeEEvRmRKT_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %16)
  %17 = load i64, ptr %2, align 8, !tbaa !11
  br label %22

18:                                               ; preds = %1, %1
  %19 = getelementptr inbounds i8, ptr %0, i64 8
  call void @_ZN5boost12hash_combineIP8DexFieldEEvRmRKT_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %19)
  %20 = load i64, ptr %2, align 8, !tbaa !11
  br label %22

21:                                               ; preds = %1
  tail call void (ptr, ptr, i32, ptr, i32, ptr, ...) @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef nonnull @.str.38, ptr noundef nonnull @.str.10, i32 noundef 671, ptr noundef nonnull @__PRETTY_FUNCTION__._ZNK17aliased_registers5Value4hashEv, i32 noundef 2, ptr noundef nonnull @.str.13) #5
  unreachable

22:                                               ; preds = %1, %18, %15, %12, %8, %5
  %.0 = phi i64 [ %20, %18 ], [ %17, %15 ], [ %14, %12 ], [ %11, %8 ], [ %7, %5 ], [ 7, %1 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  ret i64 %.0
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5boost12hash_combineIjEEvRmRKT_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5boost12hash_combineIN13constant_uses10TypeDemandEEEvRmRKT_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5boost12hash_combineIlEEvRmRKT_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5boost12hash_combineIPK9DexStringEEvRmRKT_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5boost12hash_combineIP7DexTypeEEvRmRKT_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5boost12hash_combineIP8DexFieldEEvRmRKT_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 }
attributes #5 = { 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, !7, i64 0}
!6 = !{!"_ZTSN17aliased_registers5ValueE", !7, i64 0, !10, i64 1, !8, i64 8}
!7 = !{!"_ZTSN17aliased_registers5Value4KindE", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN13constant_uses10TypeDemandE", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !8, i64 0}


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