; LLVM IR from facebook/redex :: libredex/Creators.ll (ZN11MethodBlock13if_else_testzE8IROpcode8LocationPPS_)

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

%struct.Location = type <{ ptr, i32, [4 x i8] }>

@.str.8 = external hidden unnamed_addr constant [70 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [49 x i8], align 1
@__PRETTY_FUNCTION__._ZN11MethodBlock13if_else_testzE8IROpcode8LocationPPS_ = external hidden unnamed_addr constant [76 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: noreturn
declare void @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) #1

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK8Location7get_regEv(ptr noundef nonnull align 8 dereferenceable(12)) #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN11MethodBlock18make_if_else_blockEP13IRInstructionPPS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, ptr noundef) #6 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN11MethodBlock13if_else_testzE8IROpcode8LocationPPS_(ptr noundef nonnull align 8 dereferenceable(16) %0, i16 noundef zeroext %1, ptr %2, i32 %3, ptr noundef %4) #6 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca %struct.Location, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i16, align 2
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = getelementptr inbounds { ptr, i32 }, ptr %6, i32 0, i32 0
  store ptr %2, ptr %13, align 8
  %14 = getelementptr inbounds { ptr, i32 }, ptr %6, i32 0, i32 1
  store i32 %3, ptr %14, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i16 %1, ptr %8, align 2, !tbaa !9
  store ptr %4, ptr %9, align 8, !tbaa !5
  %15 = load ptr, ptr %7, align 8
  %16 = load i16, ptr %8, align 2, !tbaa !9
  %17 = zext i16 %16 to i32
  %18 = icmp sle i32 39, %17
  br i1 %18, label %19, label %24

19:                                               ; preds = %5
  %20 = load i16, ptr %8, align 2, !tbaa !9
  %21 = zext i16 %20 to i32
  %22 = icmp sle i32 %21, 44
  br i1 %22, label %23, label %24

23:                                               ; preds = %19
  br label %26

24:                                               ; preds = %19, %5
  call void (ptr, ptr, i32, ptr, i32, ptr, ...) @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef @.str.35, ptr noundef @.str.8, i32 noundef 505, ptr noundef @__PRETTY_FUNCTION__._ZN11MethodBlock13if_else_testzE8IROpcode8LocationPPS_, i32 noundef 2, ptr noundef @.str.13) #7
  unreachable

25:                                               ; No predecessors!
  br label %26

26:                                               ; preds = %25, %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  %27 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 32) #9
  %28 = load i16, ptr %8, align 2, !tbaa !9
  invoke void @_ZN13IRInstructionC1E8IROpcode(ptr noundef nonnull align 8 dereferenceable(32) %27, i16 noundef zeroext %28)
          to label %29 unwind label %36

29:                                               ; preds = %26
  store ptr %27, ptr %10, align 8, !tbaa !5
  %30 = load ptr, ptr %10, align 8, !tbaa !5
  %31 = call noundef i32 @_ZNK8Location7get_regEv(ptr noundef nonnull align 8 dereferenceable(12) %6)
  %32 = call noundef ptr @_ZN13IRInstruction7set_srcEtj(ptr noundef nonnull align 8 dereferenceable(32) %30, i16 noundef zeroext 0, i32 noundef %31)
  %33 = load ptr, ptr %10, align 8, !tbaa !5
  %34 = load ptr, ptr %9, align 8, !tbaa !5
  %35 = call noundef ptr @_ZN11MethodBlock18make_if_else_blockEP13IRInstructionPPS_(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef %33, ptr noundef %34)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  ret ptr %35

36:                                               ; preds = %26
  %37 = landingpad { ptr, i32 }
          cleanup
  %38 = extractvalue { ptr, i32 } %37, 0
  store ptr %38, ptr %11, align 8
  %39 = extractvalue { ptr, i32 } %37, 1
  store i32 %39, ptr %12, align 4
  call void @_ZdlPvm(ptr noundef %27, i64 noundef 32) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  br label %40

40:                                               ; preds = %36
  %41 = load ptr, ptr %11, align 8
  %42 = load i32, ptr %12, align 4
  %43 = insertvalue { ptr, i32 } poison, ptr %41, 0
  %44 = insertvalue { ptr, i32 } %43, i32 %42, 1
  resume { ptr, i32 } %44
}

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 = { 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 = { 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 #6 = { 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 #7 = { noreturn }
attributes #8 = { nounwind }
attributes #9 = { builtin allocsize(0) }
attributes #10 = { 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"

%struct.Location = type <{ ptr, i32, [4 x i8] }>

@.str.8 = external hidden unnamed_addr constant [70 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [49 x i8], align 1
@__PRETTY_FUNCTION__._ZN11MethodBlock13if_else_testzE8IROpcode8LocationPPS_ = external hidden unnamed_addr constant [76 x i8], align 1

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK8Location7get_regEv(ptr noundef nonnull align 8 dereferenceable(12)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN11MethodBlock18make_if_else_blockEP13IRInstructionPPS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, ptr noundef) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN11MethodBlock13if_else_testzE8IROpcode8LocationPPS_(ptr noundef nonnull align 8 dereferenceable(16) %0, i16 noundef zeroext %1, ptr %2, i32 %3, ptr noundef %4) local_unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca %struct.Location, align 8
  store ptr %2, ptr %6, align 8
  %7 = getelementptr inbounds i8, ptr %6, i64 8
  store i32 %3, ptr %7, align 8
  %8 = add i16 %1, -39
  %or.cond = icmp ult i16 %8, 6
  br i1 %or.cond, label %10, label %9

9:                                                ; preds = %5
  tail call void (ptr, ptr, i32, ptr, i32, ptr, ...) @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef nonnull @.str.35, ptr noundef nonnull @.str.8, i32 noundef 505, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN11MethodBlock13if_else_testzE8IROpcode8LocationPPS_, i32 noundef 2, ptr noundef nonnull @.str.13) #6
  unreachable

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

12:                                               ; preds = %10
  %13 = call noundef i32 @_ZNK8Location7get_regEv(ptr noundef nonnull align 8 dereferenceable(12) %6)
  %14 = call noundef ptr @_ZN13IRInstruction7set_srcEtj(ptr noundef nonnull align 8 dereferenceable(32) %11, i16 noundef zeroext 0, i32 noundef %13)
  %15 = call noundef ptr @_ZN11MethodBlock18make_if_else_blockEP13IRInstructionPPS_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull %11, ptr noundef %4)
  ret ptr %15

16:                                               ; preds = %10
  %17 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %11, i64 noundef 32) #8
  resume { ptr, i32 } %17
}

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 = { 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 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 #5 = { 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 #6 = { noreturn }
attributes #7 = { builtin allocsize(0) }
attributes #8 = { 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,SROAPass,SimplifyCFGPass,TailCallElimPass