; LLVM IR from facebook/redex :: service/reference-update (MethodReference)

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

@.str.8 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [93 x i8], align 1
@__PRETTY_FUNCTION__._ZN16method_reference11make_invokeEP9DexMethod8IROpcodeRKSt6vectorIjSaIjEE = external hidden unnamed_addr constant [96 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [2 x i8], align 1

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: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #1

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) #3

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN16method_reference11make_invokeEP9DexMethod8IROpcodeRKSt6vectorIjSaIjEE(ptr noundef %0, i16 noundef zeroext %1, ptr noundef nonnull align 8 dereferenceable(24) %2) #4 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca i16, align 2
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i16 %1, ptr %5, align 2, !tbaa !9
  store ptr %2, ptr %6, align 8, !tbaa !5
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = call noundef zeroext i1 @_ZNK12DexMethodRef6is_defEv(ptr noundef nonnull align 8 dereferenceable(26) %10)
  br i1 %11, label %12, label %16

12:                                               ; preds = %3
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = call noundef zeroext i1 @_Z9is_publicI9DexMethodEbPT_(ptr noundef %13)
  br i1 %14, label %15, label %16

15:                                               ; preds = %12
  br label %18

16:                                               ; preds = %12, %3
  call void (ptr, ptr, i32, ptr, i32, ptr, ...) @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef @.str.8, ptr noundef @.str.9, i32 noundef 48, ptr noundef @__PRETTY_FUNCTION__._ZN16method_reference11make_invokeEP9DexMethod8IROpcodeRKSt6vectorIjSaIjEE, i32 noundef 2, ptr noundef @.str.10) #6
  unreachable

17:                                               ; No predecessors!
  br label %18

18:                                               ; preds = %17, %15
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %19 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 32) #8
  %20 = load i16, ptr %5, align 2, !tbaa !9
  invoke void @_ZN13IRInstructionC1E8IROpcode(ptr noundef nonnull align 8 dereferenceable(32) %19, i16 noundef zeroext %20)
          to label %21 unwind label %27

21:                                               ; preds = %18
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = call noundef ptr @_ZN13IRInstruction10set_methodEP12DexMethodRef(ptr noundef nonnull align 8 dereferenceable(32) %19, ptr noundef %22)
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = call noundef ptr @_ZN13IRInstruction8set_srcsERKSt6vectorIjSaIjEE(ptr noundef nonnull align 8 dereferenceable(32) %23, ptr noundef nonnull align 8 dereferenceable(24) %24)
  store ptr %25, ptr %7, align 8, !tbaa !5
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  ret ptr %26

27:                                               ; preds = %18
  %28 = landingpad { ptr, i32 }
          cleanup
  %29 = extractvalue { ptr, i32 } %28, 0
  store ptr %29, ptr %8, align 8
  %30 = extractvalue { ptr, i32 } %28, 1
  store i32 %30, ptr %9, align 4
  call void @_ZdlPvm(ptr noundef %19, i64 noundef 32) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  br label %31

31:                                               ; preds = %27
  %32 = load ptr, ptr %8, align 8
  %33 = load i32, ptr %9, align 4
  %34 = insertvalue { ptr, i32 } poison, ptr %32, 0
  %35 = insertvalue { ptr, i32 } %34, i32 %33, 1
  resume { ptr, i32 } %35
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK12DexMethodRef6is_defEv(ptr noundef nonnull align 8 dereferenceable(26)) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z9is_publicI9DexMethodEbPT_(ptr noundef) #4

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN13IRInstruction8set_srcsERKSt6vectorIjSaIjEE(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #5 = { 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 #6 = { noreturn }
attributes #7 = { nounwind }
attributes #8 = { builtin allocsize(0) }
attributes #9 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"_ZTS8IROpcode", !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"

@.str.8 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [93 x i8], align 1
@__PRETTY_FUNCTION__._ZN16method_reference11make_invokeEP9DexMethod8IROpcodeRKSt6vectorIjSaIjEE = external hidden unnamed_addr constant [96 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [2 x i8], align 1

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN16method_reference11make_invokeEP9DexMethod8IROpcodeRKSt6vectorIjSaIjEE(ptr noundef nonnull %0, i16 noundef zeroext %1, ptr noundef nonnull align 8 dereferenceable(24) %2) local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %4 = tail call noundef zeroext i1 @_ZNK12DexMethodRef6is_defEv(ptr noundef nonnull align 8 dereferenceable(26) %0)
  br i1 %4, label %5, label %7

5:                                                ; preds = %3
  %6 = tail call noundef zeroext i1 @_Z9is_publicI9DexMethodEbPT_(ptr noundef nonnull %0)
  br i1 %6, label %8, label %7

7:                                                ; preds = %5, %3
  tail call void (ptr, ptr, i32, ptr, i32, ptr, ...) @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.9, i32 noundef 48, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN16method_reference11make_invokeEP9DexMethod8IROpcodeRKSt6vectorIjSaIjEE, i32 noundef 2, ptr noundef nonnull @.str.10) #5
  unreachable

8:                                                ; preds = %5
  %9 = tail call noalias noundef nonnull dereferenceable(32) ptr @_Znwm(i64 noundef 32) #6
  invoke void @_ZN13IRInstructionC1E8IROpcode(ptr noundef nonnull align 8 dereferenceable(32) %9, i16 noundef zeroext %1)
          to label %10 unwind label %13

10:                                               ; preds = %8
  %11 = tail call noundef ptr @_ZN13IRInstruction10set_methodEP12DexMethodRef(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef nonnull %0)
  %12 = tail call noundef ptr @_ZN13IRInstruction8set_srcsERKSt6vectorIjSaIjEE(ptr noundef nonnull align 8 dereferenceable(32) %11, ptr noundef nonnull align 8 dereferenceable(24) %2)
  ret ptr %12

13:                                               ; preds = %8
  %14 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %9, i64 noundef 32) #7
  resume { ptr, i32 } %14
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK12DexMethodRef6is_defEv(ptr noundef nonnull align 8 dereferenceable(26)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z9is_publicI9DexMethodEbPT_(ptr noundef) local_unnamed_addr #3

; 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 #4

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN13IRInstruction8set_srcsERKSt6vectorIjSaIjEE(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

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


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