; LLVM IR from facebook/redex :: service/regalloc/RegisterType.ll (ZN8regalloc8gen_moveENS_12RegisterTypeEtt)

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

declare i32 @__gxx_personality_v0(...)

; 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 noundef ptr @_ZN8regalloc8gen_moveENS_12RegisterTypeEtt(i32 noundef %0, i16 noundef zeroext %1, i16 noundef zeroext %2) #1 personality ptr @__gxx_personality_v0 {
  %4 = alloca i32, align 4
  %5 = alloca i16, align 2
  %6 = alloca i16, align 2
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store i16 %1, ptr %5, align 2, !tbaa !9
  store i16 %2, ptr %6, align 2, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %10 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 32) #6
  %11 = load i32, ptr %4, align 4, !tbaa !5
  %12 = invoke noundef zeroext i16 @_ZN8regallocL16move_op_for_typeENS_12RegisterTypeE(i32 noundef %11)
          to label %13 unwind label %24

13:                                               ; preds = %3
  invoke void @_ZN13IRInstructionC1E8IROpcode(ptr noundef nonnull align 8 dereferenceable(32) %10, i16 noundef zeroext %12)
          to label %14 unwind label %24

14:                                               ; preds = %13
  store ptr %10, ptr %7, align 8, !tbaa !11
  %15 = load ptr, ptr %7, align 8, !tbaa !11
  %16 = load i16, ptr %5, align 2, !tbaa !9
  %17 = zext i16 %16 to i32
  %18 = call noundef ptr @_ZN13IRInstruction8set_destEj(ptr noundef nonnull align 8 dereferenceable(32) %15, i32 noundef %17)
  %19 = load ptr, ptr %7, align 8, !tbaa !11
  %20 = load i16, ptr %6, align 2, !tbaa !9
  %21 = zext i16 %20 to i32
  %22 = call noundef ptr @_ZN13IRInstruction7set_srcEtj(ptr noundef nonnull align 8 dereferenceable(32) %19, i16 noundef zeroext 0, i32 noundef %21)
  %23 = load ptr, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  ret ptr %23

24:                                               ; preds = %13, %3
  %25 = landingpad { ptr, i32 }
          cleanup
  %26 = extractvalue { ptr, i32 } %25, 0
  store ptr %26, ptr %8, align 8
  %27 = extractvalue { ptr, i32 } %25, 1
  store i32 %27, ptr %9, align 4
  call void @_ZdlPvm(ptr noundef %10, i64 noundef 32) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %28

28:                                               ; preds = %24
  %29 = load ptr, ptr %8, align 8
  %30 = load i32, ptr %9, align 4
  %31 = insertvalue { ptr, i32 } poison, ptr %29, 0
  %32 = insertvalue { ptr, i32 } %31, i32 %30, 1
  resume { ptr, i32 } %32
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden noundef zeroext i16 @_ZN8regallocL16move_op_for_typeENS_12RegisterTypeE(i32 noundef) #1

declare void @_ZN13IRInstructionC1E8IROpcode(ptr noundef nonnull align 8 dereferenceable(32), i16 noundef zeroext) unnamed_addr #3

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN13IRInstruction8set_destEj(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) #1 align 2

declare noundef ptr @_ZN13IRInstruction7set_srcEtj(ptr noundef nonnull align 8 dereferenceable(32), i16 noundef zeroext, i32 noundef) #3

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 = { nobuiltin allocsize(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 = { "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 = { nobuiltin nounwind "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 #5 = { nounwind }
attributes #6 = { builtin allocsize(0) }
attributes #7 = { builtin 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 = !{!"_ZTSN8regalloc12RegisterTypeE", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !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"

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local noundef nonnull ptr @_ZN8regalloc8gen_moveENS_12RegisterTypeEtt(i32 noundef %0, i16 noundef zeroext %1, i16 noundef zeroext %2) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %4 = tail call noalias noundef nonnull dereferenceable(32) ptr @_Znwm(i64 noundef 32) #4
  %5 = invoke noundef zeroext i16 @_ZN8regallocL16move_op_for_typeENS_12RegisterTypeE(i32 noundef %0)
          to label %6 unwind label %12

6:                                                ; preds = %3
  invoke void @_ZN13IRInstructionC1E8IROpcode(ptr noundef nonnull align 8 dereferenceable(32) %4, i16 noundef zeroext %5)
          to label %7 unwind label %12

7:                                                ; preds = %6
  %8 = zext i16 %1 to i32
  %9 = tail call noundef ptr @_ZN13IRInstruction8set_destEj(ptr noundef nonnull align 8 dereferenceable(32) %4, i32 noundef %8)
  %10 = zext i16 %2 to i32
  %11 = tail call noundef ptr @_ZN13IRInstruction7set_srcEtj(ptr noundef nonnull align 8 dereferenceable(32) %4, i16 noundef zeroext 0, i32 noundef %10)
  ret ptr %4

12:                                               ; preds = %6, %3
  %13 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %4, i64 noundef 32) #5
  resume { ptr, i32 } %13
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare hidden noundef zeroext i16 @_ZN8regallocL16move_op_for_typeENS_12RegisterTypeE(i32 noundef) local_unnamed_addr #0

declare void @_ZN13IRInstructionC1E8IROpcode(ptr noundef nonnull align 8 dereferenceable(32), i16 noundef zeroext) unnamed_addr #2

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN13IRInstruction8set_destEj(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) local_unnamed_addr #0 align 2

declare noundef ptr @_ZN13IRInstruction7set_srcEtj(ptr noundef nonnull align 8 dereferenceable(32), i16 noundef zeroext, i32 noundef) local_unnamed_addr #2

attributes #0 = { 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 #1 = { nobuiltin allocsize(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 = { "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 = { nobuiltin nounwind "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 = { builtin allocsize(0) }
attributes #5 = { builtin 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: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass