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

; 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

declare void @w2c_hermes_0x5F_assert_fail(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #1

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AGCPointer0x3Chermes0x3A0x3Avm0x3A0x3AArrayStorageBase0x3Chermes0x3A0x3Avm0x3A0x3AHermesValue320x3E0x3E0x3A0x3AgetNonNull0x28hermes0x3A0x3Avm0x3A0x3APointerBase0x260x290x20const(ptr noundef, i32 noundef, i32 noundef) #4

; Function Attrs: nounwind uwtable
define dso_local i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AHermesValue320x20hermes0x3A0x3Avm0x3A0x3AJSObject0x3A0x3AgetNamedSlotValueUnsafe0x3C0x28hermes0x3A0x3Avm0x3A0x3AArrayStorageBase0x3Chermes0x3A0x3Avm0x3A0x3AHermesValue320x3E0x3A0x3AInline0x2900x3E0x28hermes0x3A0x3Avm0x3A0x3AJSObject0x2A0x2C0x20hermes0x3A0x3Avm0x3A0x3APointerBase0x260x2C0x20unsigned0x20int0x29(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 i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  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
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  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
  %14 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %14, ptr %9, align 4, !tbaa !9
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.w2c_hermes, ptr %15, i32 0, i32 6
  %17 = load i32, ptr %9, align 4, !tbaa !9
  %18 = zext i32 %17 to i64
  %19 = add i64 %18, 12
  %20 = call i32 @i32_load8_u(ptr noundef %16, i64 noundef %19)
  store i32 %20, ptr %9, align 4, !tbaa !9
  store i32 128, ptr %10, align 4, !tbaa !9
  %21 = load i32, ptr %10, align 4, !tbaa !9
  %22 = load i32, ptr %9, align 4, !tbaa !9
  %23 = and i32 %22, %21
  store i32 %23, ptr %9, align 4, !tbaa !9
  %24 = load i32, ptr %9, 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 %9, align 4, !tbaa !9
  %28 = load i32, ptr %9, align 4, !tbaa !9
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %30, label %99

30:                                               ; preds = %4
  %31 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %31, ptr %9, align 4, !tbaa !9
  store i32 4, ptr %10, align 4, !tbaa !9
  %32 = load i32, ptr %9, align 4, !tbaa !9
  %33 = load i32, ptr %10, align 4, !tbaa !9
  %34 = icmp ule i32 %32, %33
  %35 = zext i1 %34 to i32
  store i32 %35, ptr %9, align 4, !tbaa !9
  %36 = load i32, ptr %9, align 4, !tbaa !9
  %37 = icmp ne i32 %36, 0
  br i1 %37, label %38, label %54

38:                                               ; preds = %30
  %39 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %39, ptr %9, align 4, !tbaa !9
  %40 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %40, ptr %10, align 4, !tbaa !9
  store i32 2, ptr %11, align 4, !tbaa !9
  %41 = load i32, ptr %11, align 4, !tbaa !9
  %42 = and i32 %41, 31
  %43 = load i32, ptr %10, align 4, !tbaa !9
  %44 = shl i32 %43, %42
  store i32 %44, ptr %10, align 4, !tbaa !9
  %45 = load i32, ptr %10, align 4, !tbaa !9
  %46 = load i32, ptr %9, align 4, !tbaa !9
  %47 = add i32 %46, %45
  store i32 %47, ptr %9, align 4, !tbaa !9
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.w2c_hermes, ptr %48, i32 0, i32 6
  %50 = load i32, ptr %9, align 4, !tbaa !9
  %51 = zext i32 %50 to i64
  %52 = add i64 %51, 28
  %53 = call i32 @i32_load(ptr noundef %49, i64 noundef %52)
  store i32 %53, ptr %9, align 4, !tbaa !9
  br label %135

54:                                               ; preds = %30
  %55 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %55, ptr %9, align 4, !tbaa !9
  store i32 5, ptr %10, align 4, !tbaa !9
  %56 = load i32, ptr %10, align 4, !tbaa !9
  %57 = load i32, ptr %9, align 4, !tbaa !9
  %58 = sub i32 %57, %56
  store i32 %58, ptr %9, align 4, !tbaa !9
  %59 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %59, ptr %8, align 4, !tbaa !9
  %60 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %60, ptr %10, align 4, !tbaa !9
  store i32 24, ptr %11, align 4, !tbaa !9
  %61 = load i32, ptr %11, align 4, !tbaa !9
  %62 = load i32, ptr %10, align 4, !tbaa !9
  %63 = add i32 %62, %61
  store i32 %63, ptr %10, align 4, !tbaa !9
  %64 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %64, ptr %11, align 4, !tbaa !9
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = load i32, ptr %10, align 4, !tbaa !9
  %67 = load i32, ptr %11, align 4, !tbaa !9
  %68 = call i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AGCPointer0x3Chermes0x3A0x3Avm0x3A0x3AArrayStorageBase0x3Chermes0x3A0x3Avm0x3A0x3AHermesValue320x3E0x3E0x3A0x3AgetNonNull0x28hermes0x3A0x3Avm0x3A0x3APointerBase0x260x290x20const(ptr noundef %65, i32 noundef %66, i32 noundef %67)
  store i32 %68, ptr %10, align 4, !tbaa !9
  %69 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %69, ptr %6, align 4, !tbaa !9
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.w2c_hermes, ptr %70, i32 0, i32 6
  %72 = load i32, ptr %10, align 4, !tbaa !9
  %73 = zext i32 %72 to i64
  %74 = add i64 %73, 12
  %75 = call i32 @i32_load(ptr noundef %71, i64 noundef %74)
  store i32 %75, ptr %10, align 4, !tbaa !9
  %76 = load i32, ptr %9, align 4, !tbaa !9
  %77 = load i32, ptr %10, align 4, !tbaa !9
  %78 = icmp uge i32 %76, %77
  %79 = zext i1 %78 to i32
  store i32 %79, ptr %9, align 4, !tbaa !9
  %80 = load i32, ptr %9, align 4, !tbaa !9
  %81 = icmp ne i32 %80, 0
  br i1 %81, label %82, label %83

82:                                               ; preds = %54
  br label %117

83:                                               ; preds = %54
  %84 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %84, ptr %9, align 4, !tbaa !9
  %85 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %85, ptr %10, align 4, !tbaa !9
  store i32 2, ptr %11, align 4, !tbaa !9
  %86 = load i32, ptr %11, align 4, !tbaa !9
  %87 = and i32 %86, 31
  %88 = load i32, ptr %10, align 4, !tbaa !9
  %89 = shl i32 %88, %87
  store i32 %89, ptr %10, align 4, !tbaa !9
  %90 = load i32, ptr %10, align 4, !tbaa !9
  %91 = load i32, ptr %9, align 4, !tbaa !9
  %92 = add i32 %91, %90
  store i32 %92, ptr %9, align 4, !tbaa !9
  %93 = load ptr, ptr %5, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.w2c_hermes, ptr %93, i32 0, i32 6
  %95 = load i32, ptr %9, align 4, !tbaa !9
  %96 = zext i32 %95 to i64
  %97 = add i64 %96, 16
  %98 = call i32 @i32_load(ptr noundef %94, i64 noundef %97)
  store i32 %98, ptr %9, align 4, !tbaa !9
  br label %135

99:                                               ; preds = %4
  store i32 0, ptr %9, align 4, !tbaa !9
  %100 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %100, ptr %6, align 4, !tbaa !9
  store i32 122716, ptr %10, align 4, !tbaa !9
  %101 = load i32, ptr %10, align 4, !tbaa !9
  %102 = load i32, ptr %9, align 4, !tbaa !9
  %103 = add i32 %102, %101
  store i32 %103, ptr %9, align 4, !tbaa !9
  %104 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %104, ptr %10, align 4, !tbaa !9
  store i32 77863, ptr %11, align 4, !tbaa !9
  %105 = load i32, ptr %11, align 4, !tbaa !9
  %106 = load i32, ptr %10, align 4, !tbaa !9
  %107 = add i32 %106, %105
  store i32 %107, ptr %10, align 4, !tbaa !9
  store i32 1693, ptr %11, align 4, !tbaa !9
  %108 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %108, ptr %12, align 4, !tbaa !9
  store i32 100111, ptr %13, align 4, !tbaa !9
  %109 = load i32, ptr %13, align 4, !tbaa !9
  %110 = load i32, ptr %12, align 4, !tbaa !9
  %111 = add i32 %110, %109
  store i32 %111, ptr %12, align 4, !tbaa !9
  %112 = load ptr, ptr %5, align 8, !tbaa !5
  %113 = load i32, ptr %9, align 4, !tbaa !9
  %114 = load i32, ptr %10, align 4, !tbaa !9
  %115 = load i32, ptr %11, align 4, !tbaa !9
  %116 = load i32, ptr %12, align 4, !tbaa !9
  call void @w2c_hermes_0x5F_assert_fail(ptr noundef %112, i32 noundef %113, i32 noundef %114, i32 noundef %115, i32 noundef %116)
  call void @wasm_rt_trap(i32 noundef 5) #6
  unreachable

117:                                              ; preds = %82
  store i32 0, ptr %9, align 4, !tbaa !9
  %118 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %118, ptr %6, align 4, !tbaa !9
  store i32 169961, ptr %10, align 4, !tbaa !9
  %119 = load i32, ptr %10, align 4, !tbaa !9
  %120 = load i32, ptr %9, align 4, !tbaa !9
  %121 = add i32 %120, %119
  store i32 %121, ptr %9, align 4, !tbaa !9
  %122 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %122, ptr %10, align 4, !tbaa !9
  store i32 85168, ptr %11, align 4, !tbaa !9
  %123 = load i32, ptr %11, align 4, !tbaa !9
  %124 = load i32, ptr %10, align 4, !tbaa !9
  %125 = add i32 %124, %123
  store i32 %125, ptr %10, align 4, !tbaa !9
  store i32 150, ptr %11, align 4, !tbaa !9
  %126 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %126, ptr %12, align 4, !tbaa !9
  store i32 39587, ptr %13, align 4, !tbaa !9
  %127 = load i32, ptr %13, align 4, !tbaa !9
  %128 = load i32, ptr %12, align 4, !tbaa !9
  %129 = add i32 %128, %127
  store i32 %129, ptr %12, align 4, !tbaa !9
  %130 = load ptr, ptr %5, align 8, !tbaa !5
  %131 = load i32, ptr %9, align 4, !tbaa !9
  %132 = load i32, ptr %10, align 4, !tbaa !9
  %133 = load i32, ptr %11, align 4, !tbaa !9
  %134 = load i32, ptr %12, align 4, !tbaa !9
  call void @w2c_hermes_0x5F_assert_fail(ptr noundef %130, i32 noundef %131, i32 noundef %132, i32 noundef %133, i32 noundef %134)
  call void @wasm_rt_trap(i32 noundef 5) #6
  unreachable

135:                                              ; preds = %83, %38
  %136 = load i32, ptr %9, align 4, !tbaa !9
  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 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  ret i32 %136
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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 #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}


; 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 void @w2c_hermes_0x5F_assert_fail(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AGCPointer0x3Chermes0x3A0x3Avm0x3A0x3AArrayStorageBase0x3Chermes0x3A0x3Avm0x3A0x3AHermesValue320x3E0x3E0x3A0x3AgetNonNull0x28hermes0x3A0x3Avm0x3A0x3APointerBase0x260x290x20const(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AHermesValue320x20hermes0x3A0x3Avm0x3A0x3AJSObject0x3A0x3AgetNamedSlotValueUnsafe0x3C0x28hermes0x3A0x3Avm0x3A0x3AArrayStorageBase0x3Chermes0x3A0x3Avm0x3A0x3AHermesValue320x3E0x3A0x3AInline0x2900x3E0x28hermes0x3A0x3Avm0x3A0x3AJSObject0x2A0x2C0x20hermes0x3A0x3Avm0x3A0x3APointerBase0x260x2C0x20unsigned0x20int0x29(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, 12
  %8 = tail call i32 @i32_load8_u(ptr noundef nonnull %5, i64 noundef %7)
  %9 = and i32 %8, 128
  %.not = icmp eq i32 %9, 0
  br i1 %.not, label %10, label %25

10:                                               ; preds = %4
  %11 = icmp ult i32 %3, 5
  br i1 %11, label %12, label %15

12:                                               ; preds = %10
  %13 = shl nuw nsw i32 %3, 2
  %14 = add i32 %13, %1
  br label %27

15:                                               ; preds = %10
  %16 = add i32 %3, -5
  %17 = add i32 %1, 24
  %18 = tail call i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AGCPointer0x3Chermes0x3A0x3Avm0x3A0x3AArrayStorageBase0x3Chermes0x3A0x3Avm0x3A0x3AHermesValue320x3E0x3E0x3A0x3AgetNonNull0x28hermes0x3A0x3Avm0x3A0x3APointerBase0x260x290x20const(ptr noundef %0, i32 noundef %17, i32 noundef %2)
  %19 = zext i32 %18 to i64
  %20 = add nuw nsw i64 %19, 12
  %21 = tail call i32 @i32_load(ptr noundef nonnull %5, i64 noundef %20)
  %.not74 = icmp ult i32 %16, %21
  br i1 %.not74, label %22, label %26

22:                                               ; preds = %15
  %23 = shl i32 %16, 2
  %24 = add i32 %18, %23
  br label %27

25:                                               ; preds = %4
  tail call void @w2c_hermes_0x5F_assert_fail(ptr noundef %0, i32 noundef 122716, i32 noundef 77863, i32 noundef 1693, i32 noundef 100111) #4
  tail call void @wasm_rt_trap(i32 noundef 5) #5
  unreachable

26:                                               ; preds = %15
  tail call void @w2c_hermes_0x5F_assert_fail(ptr noundef %0, i32 noundef 169961, i32 noundef 85168, i32 noundef 150, i32 noundef 39587) #4
  tail call void @wasm_rt_trap(i32 noundef 5) #5
  unreachable

27:                                               ; preds = %22, %12
  %.sink = phi i32 [ %24, %22 ], [ %14, %12 ]
  %.sink76 = phi i64 [ 16, %22 ], [ 28, %12 ]
  %28 = zext i32 %.sink to i64
  %29 = add nuw nsw i64 %.sink76, %28
  %30 = tail call i32 @i32_load(ptr noundef nonnull %5, i64 noundef %29)
  ret i32 %30
}

attributes #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 = { 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 #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