; LLVM IR from facebook/hermes :: API/hermes_sandbox/external (hermes_sandbox_impl_opt_compiled_4)

; 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.w2c_hermes = type { ptr, ptr, ptr, i32, i32, i32, %struct.wasm_rt_memory_t, %struct.wasm_rt_funcref_table_t }
%struct.wasm_rt_memory_t = type { ptr, i64, i64, i64, i8 }
%struct.wasm_rt_funcref_table_t = type { ptr, i32, i32 }

; 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: inlinehint nounwind uwtable
declare hidden i32 @i32_load(ptr noundef, i64 noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @i32_load8_u(ptr noundef, i64 noundef) #1

; Function Attrs: noreturn
declare void @wasm_rt_trap(i32 noundef) #2

declare void @w2c_hermes_hermes0x3A0x3Ahermes_fatal0x28char0x20const0x2A0x29(ptr noundef, i32 noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @i64_reinterpret_f64(double noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i64 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AJSTypedArray0x3Cunsigned0x20int0x2C0x200x28hermes0x3A0x3Avm0x3A0x3ACellKind0x29410x3E0x3A0x3A_getOwnIndexedImpl0x28hermes0x3A0x3Avm0x3A0x3APseudoHandle0x3Chermes0x3A0x3Avm0x3A0x3AJSObject0x3E0x2C0x20hermes0x3A0x3Avm0x3A0x3ARuntime0x260x2C0x20unsigned0x20int0x29(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #4 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  %15 = alloca double, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  store i64 0, ptr %10, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %16 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %16, ptr %11, align 4, !tbaa !9
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.w2c_hermes, ptr %17, i32 0, i32 6
  %19 = load i32, ptr %11, align 4, !tbaa !9
  %20 = zext i32 %19 to i64
  %21 = add i64 %20, 20
  %22 = call i32 @i32_load(ptr noundef %18, i64 noundef %21)
  store i32 %22, ptr %11, align 4, !tbaa !9
  %23 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %23, ptr %9, align 4, !tbaa !9
  %24 = load i32, ptr %11, align 4, !tbaa !9
  %25 = icmp ne i32 %24, 0
  %26 = xor i1 %25, true
  %27 = zext i1 %26 to i32
  store i32 %27, ptr %11, align 4, !tbaa !9
  %28 = load i32, ptr %11, align 4, !tbaa !9
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %30, label %31

30:                                               ; preds = %4
  br label %125

31:                                               ; preds = %4
  %32 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %32, ptr %11, align 4, !tbaa !9
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.w2c_hermes, ptr %33, i32 0, i32 6
  %35 = load i32, ptr %11, align 4, !tbaa !9
  %36 = zext i32 %35 to i64
  %37 = add i64 %36, 29
  %38 = call i32 @i32_load8_u(ptr noundef %34, i64 noundef %37)
  store i32 %38, ptr %11, align 4, !tbaa !9
  %39 = load i32, ptr %11, align 4, !tbaa !9
  %40 = icmp ne i32 %39, 0
  %41 = xor i1 %40, true
  %42 = zext i1 %41 to i32
  store i32 %42, ptr %11, align 4, !tbaa !9
  %43 = load i32, ptr %11, align 4, !tbaa !9
  %44 = icmp ne i32 %43, 0
  br i1 %44, label %45, label %46

45:                                               ; preds = %31
  br label %125

46:                                               ; preds = %31
  %47 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %47, ptr %11, align 4, !tbaa !9
  %48 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %48, ptr %12, align 4, !tbaa !9
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.w2c_hermes, ptr %49, i32 0, i32 6
  %51 = load i32, ptr %12, align 4, !tbaa !9
  %52 = zext i32 %51 to i64
  %53 = add i64 %52, 24
  %54 = call i32 @i32_load(ptr noundef %50, i64 noundef %53)
  store i32 %54, ptr %12, align 4, !tbaa !9
  %55 = load i32, ptr %11, align 4, !tbaa !9
  %56 = load i32, ptr %12, align 4, !tbaa !9
  %57 = icmp uge i32 %55, %56
  %58 = zext i1 %57 to i32
  store i32 %58, ptr %11, align 4, !tbaa !9
  %59 = load i32, ptr %11, align 4, !tbaa !9
  %60 = icmp ne i32 %59, 0
  br i1 %60, label %61, label %62

61:                                               ; preds = %46
  store i64 -1688849860263936, ptr %14, align 8, !tbaa !11
  br label %130

62:                                               ; preds = %46
  %63 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %63, ptr %11, align 4, !tbaa !9
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.w2c_hermes, ptr %64, i32 0, i32 6
  %66 = load i32, ptr %11, align 4, !tbaa !9
  %67 = zext i32 %66 to i64
  %68 = add i64 %67, 5300
  %69 = call i32 @i32_load8_u(ptr noundef %65, i64 noundef %68)
  store i32 %69, ptr %11, align 4, !tbaa !9
  %70 = load i32, ptr %11, align 4, !tbaa !9
  %71 = icmp ne i32 %70, 0
  %72 = xor i1 %71, true
  %73 = zext i1 %72 to i32
  store i32 %73, ptr %11, align 4, !tbaa !9
  %74 = load i32, ptr %11, align 4, !tbaa !9
  %75 = icmp ne i32 %74, 0
  br i1 %75, label %76, label %77

76:                                               ; preds = %62
  br label %127

77:                                               ; preds = %62
  %78 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %78, ptr %11, align 4, !tbaa !9
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.w2c_hermes, ptr %79, i32 0, i32 6
  %81 = load i32, ptr %11, align 4, !tbaa !9
  %82 = zext i32 %81 to i64
  %83 = add i64 %82, 28
  %84 = call i32 @i32_load(ptr noundef %80, i64 noundef %83)
  store i32 %84, ptr %11, align 4, !tbaa !9
  %85 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %85, ptr %12, align 4, !tbaa !9
  store i32 1272, ptr %13, align 4, !tbaa !9
  %86 = load i32, ptr %13, align 4, !tbaa !9
  %87 = load i32, ptr %12, align 4, !tbaa !9
  %88 = add i32 %87, %86
  store i32 %88, ptr %12, align 4, !tbaa !9
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.w2c_hermes, ptr %89, i32 0, i32 6
  %91 = load i32, ptr %12, align 4, !tbaa !9
  %92 = zext i32 %91 to i64
  %93 = call i32 @i32_load(ptr noundef %90, i64 noundef %92)
  store i32 %93, ptr %12, align 4, !tbaa !9
  %94 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %94, ptr %13, align 4, !tbaa !9
  %95 = load ptr, ptr %5, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.w2c_hermes, ptr %95, i32 0, i32 6
  %97 = load i32, ptr %13, align 4, !tbaa !9
  %98 = zext i32 %97 to i64
  %99 = add i64 %98, 20
  %100 = call i32 @i32_load(ptr noundef %96, i64 noundef %99)
  store i32 %100, ptr %13, align 4, !tbaa !9
  %101 = load i32, ptr %13, align 4, !tbaa !9
  %102 = load i32, ptr %12, align 4, !tbaa !9
  %103 = xor i32 %102, %101
  store i32 %103, ptr %12, align 4, !tbaa !9
  %104 = load i32, ptr %12, align 4, !tbaa !9
  %105 = load i32, ptr %11, align 4, !tbaa !9
  %106 = add i32 %105, %104
  store i32 %106, ptr %11, align 4, !tbaa !9
  %107 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %107, ptr %12, align 4, !tbaa !9
  store i32 2, ptr %13, align 4, !tbaa !9
  %108 = load i32, ptr %13, align 4, !tbaa !9
  %109 = and i32 %108, 31
  %110 = load i32, ptr %12, align 4, !tbaa !9
  %111 = shl i32 %110, %109
  store i32 %111, ptr %12, align 4, !tbaa !9
  %112 = load i32, ptr %12, align 4, !tbaa !9
  %113 = load i32, ptr %11, align 4, !tbaa !9
  %114 = add i32 %113, %112
  store i32 %114, ptr %11, align 4, !tbaa !9
  %115 = load ptr, ptr %5, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.w2c_hermes, ptr %115, i32 0, i32 6
  %117 = load i32, ptr %11, align 4, !tbaa !9
  %118 = zext i32 %117 to i64
  %119 = call i32 @i32_load(ptr noundef %116, i64 noundef %118)
  store i32 %119, ptr %11, align 4, !tbaa !9
  %120 = load i32, ptr %11, align 4, !tbaa !9
  %121 = uitofp i32 %120 to double
  store double %121, ptr %15, align 8, !tbaa !13
  %122 = load double, ptr %15, align 8, !tbaa !13
  %123 = call i64 @i64_reinterpret_f64(double noundef %122)
  store i64 %123, ptr %14, align 8, !tbaa !11
  %124 = load i64, ptr %14, align 8, !tbaa !11
  store i64 %124, ptr %10, align 8, !tbaa !11
  br label %125

125:                                              ; preds = %77, %45, %30
  %126 = load i64, ptr %10, align 8, !tbaa !11
  store i64 %126, ptr %14, align 8, !tbaa !11
  br label %130

127:                                              ; preds = %76
  store i32 38571, ptr %11, align 4, !tbaa !9
  %128 = load ptr, ptr %5, align 8, !tbaa !5
  %129 = load i32, ptr %11, align 4, !tbaa !9
  call void @w2c_hermes_hermes0x3A0x3Ahermes_fatal0x28char0x20const0x2A0x29(ptr noundef %128, i32 noundef %129)
  call void @wasm_rt_trap(i32 noundef 5) #6
  unreachable

130:                                              ; preds = %125, %61
  %131 = load i64, ptr %14, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  ret i64 %131
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 #2 = { 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 #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 = { 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 = { nounwind }
attributes #6 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !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"

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @i32_load(ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @i32_load8_u(ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: noreturn
declare void @wasm_rt_trap(i32 noundef) local_unnamed_addr #1

declare void @w2c_hermes_hermes0x3A0x3Ahermes_fatal0x28char0x20const0x2A0x29(ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @i64_reinterpret_f64(double noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i64 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AJSTypedArray0x3Cunsigned0x20int0x2C0x200x28hermes0x3A0x3Avm0x3A0x3ACellKind0x29410x3E0x3A0x3A_getOwnIndexedImpl0x28hermes0x3A0x3Avm0x3A0x3APseudoHandle0x3Chermes0x3A0x3Avm0x3A0x3AJSObject0x3E0x2C0x20hermes0x3A0x3Avm0x3A0x3ARuntime0x260x2C0x20unsigned0x20int0x29(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #3 {
  %5 = getelementptr inbounds i8, ptr %0, i64 40
  %6 = zext i32 %1 to i64
  %7 = add nuw nsw i64 %6, 20
  %8 = tail call i32 @i32_load(ptr noundef nonnull %5, i64 noundef %7)
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %37, label %9

9:                                                ; preds = %4
  %10 = zext i32 %8 to i64
  %11 = add nuw nsw i64 %10, 29
  %12 = tail call i32 @i32_load8_u(ptr noundef nonnull %5, i64 noundef %11)
  %.not53 = icmp eq i32 %12, 0
  br i1 %.not53, label %37, label %13

13:                                               ; preds = %9
  %14 = add nuw nsw i64 %6, 24
  %15 = tail call i32 @i32_load(ptr noundef nonnull %5, i64 noundef %14)
  %.not54 = icmp ugt i32 %15, %3
  br i1 %.not54, label %16, label %37

16:                                               ; preds = %13
  %17 = zext i32 %2 to i64
  %18 = add nuw nsw i64 %17, 5300
  %19 = tail call i32 @i32_load8_u(ptr noundef nonnull %5, i64 noundef %18)
  %.not55 = icmp eq i32 %19, 0
  br i1 %.not55, label %36, label %20

20:                                               ; preds = %16
  %21 = add nuw nsw i64 %6, 28
  %22 = tail call i32 @i32_load(ptr noundef nonnull %5, i64 noundef %21)
  %23 = add i32 %2, 1272
  %24 = zext i32 %23 to i64
  %25 = tail call i32 @i32_load(ptr noundef nonnull %5, i64 noundef %24)
  %26 = add nuw nsw i64 %10, 20
  %27 = tail call i32 @i32_load(ptr noundef nonnull %5, i64 noundef %26)
  %28 = xor i32 %27, %25
  %29 = shl i32 %3, 2
  %30 = add i32 %22, %29
  %31 = add i32 %30, %28
  %32 = zext i32 %31 to i64
  %33 = tail call i32 @i32_load(ptr noundef nonnull %5, i64 noundef %32)
  %34 = uitofp i32 %33 to double
  %35 = tail call i64 @i64_reinterpret_f64(double noundef %34)
  br label %37

36:                                               ; preds = %16
  tail call void @w2c_hermes_hermes0x3A0x3Ahermes_fatal0x28char0x20const0x2A0x29(ptr noundef %0, i32 noundef 38571) #4
  tail call void @wasm_rt_trap(i32 noundef 5) #5
  unreachable

37:                                               ; preds = %20, %4, %9, %13
  %.0 = phi i64 [ -1688849860263936, %13 ], [ 0, %4 ], [ 0, %9 ], [ %35, %20 ]
  ret i64 %.0
}

attributes #0 = { inlinehint 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 #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 = { "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 = { 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 #4 = { nounwind }
attributes #5 = { noreturn 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: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass