; 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 void @i32_store(ptr noundef, i64 noundef, i32 noundef) #3

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

; Function Attrs: nounwind uwtable
define dso_local void @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AHadesGC0x3A0x3AsnapshotWriteBarrierInternal0x28hermes0x3A0x3Avm0x3A0x3ASymbolID0x29(ptr noundef %0, i32 noundef %1, i32 noundef %2) #4 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %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
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  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
  %13 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %13, ptr %8, align 4, !tbaa !9
  store i32 536870909, ptr %9, align 4, !tbaa !9
  %14 = load i32, ptr %8, align 4, !tbaa !9
  %15 = load i32, ptr %9, align 4, !tbaa !9
  %16 = icmp ugt i32 %14, %15
  %17 = zext i1 %16 to i32
  store i32 %17, ptr %8, align 4, !tbaa !9
  %18 = load i32, ptr %8, align 4, !tbaa !9
  %19 = icmp ne i32 %18, 0
  br i1 %19, label %20, label %21

20:                                               ; preds = %3
  br label %105

21:                                               ; preds = %3
  %22 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %22, ptr %8, align 4, !tbaa !9
  store i32 268435455, ptr %9, align 4, !tbaa !9
  %23 = load i32, ptr %9, align 4, !tbaa !9
  %24 = load i32, ptr %8, align 4, !tbaa !9
  %25 = and i32 %24, %23
  store i32 %25, ptr %8, align 4, !tbaa !9
  %26 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %26, ptr %7, align 4, !tbaa !9
  %27 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %27, ptr %9, align 4, !tbaa !9
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.w2c_hermes, ptr %28, i32 0, i32 6
  %30 = load i32, ptr %9, align 4, !tbaa !9
  %31 = zext i32 %30 to i64
  %32 = add i64 %31, 4056
  %33 = call i32 @i32_load(ptr noundef %29, i64 noundef %32)
  store i32 %33, ptr %9, align 4, !tbaa !9
  %34 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %34, ptr %5, align 4, !tbaa !9
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.w2c_hermes, ptr %35, i32 0, i32 6
  %37 = load i32, ptr %9, align 4, !tbaa !9
  %38 = zext i32 %37 to i64
  %39 = add i64 %38, 580
  %40 = call i32 @i32_load(ptr noundef %36, i64 noundef %39)
  store i32 %40, ptr %9, align 4, !tbaa !9
  %41 = load i32, ptr %8, align 4, !tbaa !9
  %42 = load i32, ptr %9, align 4, !tbaa !9
  %43 = icmp uge i32 %41, %42
  %44 = zext i1 %43 to i32
  store i32 %44, ptr %8, align 4, !tbaa !9
  %45 = load i32, ptr %8, align 4, !tbaa !9
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %47, label %48

47:                                               ; preds = %21
  br label %105

48:                                               ; preds = %21
  %49 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %49, ptr %8, align 4, !tbaa !9
  store i32 5, ptr %9, align 4, !tbaa !9
  %50 = load i32, ptr %9, align 4, !tbaa !9
  %51 = and i32 %50, 31
  %52 = load i32, ptr %8, align 4, !tbaa !9
  %53 = lshr i32 %52, %51
  store i32 %53, ptr %8, align 4, !tbaa !9
  %54 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %54, ptr %7, align 4, !tbaa !9
  %55 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %55, ptr %9, align 4, !tbaa !9
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.w2c_hermes, ptr %56, i32 0, i32 6
  %58 = load i32, ptr %9, align 4, !tbaa !9
  %59 = zext i32 %58 to i64
  %60 = add i64 %59, 576
  %61 = call i32 @i32_load(ptr noundef %57, i64 noundef %60)
  store i32 %61, ptr %9, align 4, !tbaa !9
  %62 = load i32, ptr %8, align 4, !tbaa !9
  %63 = load i32, ptr %9, align 4, !tbaa !9
  %64 = icmp uge i32 %62, %63
  %65 = zext i1 %64 to i32
  store i32 %65, ptr %8, align 4, !tbaa !9
  %66 = load i32, ptr %8, align 4, !tbaa !9
  %67 = icmp ne i32 %66, 0
  br i1 %67, label %68, label %69

68:                                               ; preds = %48
  br label %106

69:                                               ; preds = %48
  %70 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %70, ptr %8, align 4, !tbaa !9
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.w2c_hermes, ptr %71, i32 0, i32 6
  %73 = load i32, ptr %8, align 4, !tbaa !9
  %74 = zext i32 %73 to i64
  %75 = add i64 %74, 572
  %76 = call i32 @i32_load(ptr noundef %72, i64 noundef %75)
  store i32 %76, ptr %8, align 4, !tbaa !9
  %77 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %77, ptr %9, align 4, !tbaa !9
  store i32 2, ptr %10, align 4, !tbaa !9
  %78 = load i32, ptr %10, align 4, !tbaa !9
  %79 = and i32 %78, 31
  %80 = load i32, ptr %9, align 4, !tbaa !9
  %81 = shl i32 %80, %79
  store i32 %81, ptr %9, align 4, !tbaa !9
  %82 = load i32, ptr %9, align 4, !tbaa !9
  %83 = load i32, ptr %8, align 4, !tbaa !9
  %84 = add i32 %83, %82
  store i32 %84, ptr %8, align 4, !tbaa !9
  %85 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %85, ptr %5, align 4, !tbaa !9
  %86 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %86, ptr %9, align 4, !tbaa !9
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.w2c_hermes, ptr %87, i32 0, i32 6
  %89 = load i32, ptr %9, align 4, !tbaa !9
  %90 = zext i32 %89 to i64
  %91 = call i32 @i32_load(ptr noundef %88, i64 noundef %90)
  store i32 %91, ptr %9, align 4, !tbaa !9
  store i32 1, ptr %10, align 4, !tbaa !9
  %92 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %92, ptr %11, align 4, !tbaa !9
  %93 = load i32, ptr %11, align 4, !tbaa !9
  %94 = and i32 %93, 31
  %95 = load i32, ptr %10, align 4, !tbaa !9
  %96 = shl i32 %95, %94
  store i32 %96, ptr %10, align 4, !tbaa !9
  %97 = load i32, ptr %10, align 4, !tbaa !9
  %98 = load i32, ptr %9, align 4, !tbaa !9
  %99 = or i32 %98, %97
  store i32 %99, ptr %9, align 4, !tbaa !9
  %100 = load ptr, ptr %4, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.w2c_hermes, ptr %100, i32 0, i32 6
  %102 = load i32, ptr %8, align 4, !tbaa !9
  %103 = zext i32 %102 to i64
  %104 = load i32, ptr %9, align 4, !tbaa !9
  call void @i32_store(ptr noundef %101, i64 noundef %103, i32 noundef %104)
  br label %105

105:                                              ; preds = %69, %47, %20
  br label %124

106:                                              ; preds = %68
  store i32 0, ptr %8, align 4, !tbaa !9
  %107 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %107, ptr %6, align 4, !tbaa !9
  store i32 202974, ptr %9, align 4, !tbaa !9
  %108 = load i32, ptr %9, align 4, !tbaa !9
  %109 = load i32, ptr %8, align 4, !tbaa !9
  %110 = add i32 %109, %108
  store i32 %110, ptr %8, align 4, !tbaa !9
  %111 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %111, ptr %9, align 4, !tbaa !9
  store i32 82833, ptr %10, align 4, !tbaa !9
  %112 = load i32, ptr %10, align 4, !tbaa !9
  %113 = load i32, ptr %9, align 4, !tbaa !9
  %114 = add i32 %113, %112
  store i32 %114, ptr %9, align 4, !tbaa !9
  store i32 418, ptr %10, align 4, !tbaa !9
  %115 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %115, ptr %11, align 4, !tbaa !9
  store i32 108367, ptr %12, align 4, !tbaa !9
  %116 = load i32, ptr %12, align 4, !tbaa !9
  %117 = load i32, ptr %11, align 4, !tbaa !9
  %118 = add i32 %117, %116
  store i32 %118, ptr %11, align 4, !tbaa !9
  %119 = load ptr, ptr %4, align 8, !tbaa !5
  %120 = load i32, ptr %8, align 4, !tbaa !9
  %121 = load i32, ptr %9, align 4, !tbaa !9
  %122 = load i32, ptr %10, align 4, !tbaa !9
  %123 = load i32, ptr %11, align 4, !tbaa !9
  call void @w2c_hermes_0x5F_assert_fail(ptr noundef %119, i32 noundef %120, i32 noundef %121, i32 noundef %122, i32 noundef %123)
  call void @wasm_rt_trap(i32 noundef 5) #6
  unreachable

124:                                              ; preds = %105
  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
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  ret void
}

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 void @i32_store(ptr noundef, i64 noundef, i32 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
define dso_local void @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AHadesGC0x3A0x3AsnapshotWriteBarrierInternal0x28hermes0x3A0x3Avm0x3A0x3ASymbolID0x29(ptr noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #3 {
  %4 = icmp ugt i32 %2, 536870909
  br i1 %4, label %29, label %5

5:                                                ; preds = %3
  %6 = and i32 %2, 268435455
  %7 = getelementptr inbounds i8, ptr %0, i64 40
  %8 = zext i32 %1 to i64
  %9 = add nuw nsw i64 %8, 4056
  %10 = tail call i32 @i32_load(ptr noundef nonnull %7, i64 noundef %9)
  %11 = zext i32 %10 to i64
  %12 = add nuw nsw i64 %11, 580
  %13 = tail call i32 @i32_load(ptr noundef nonnull %7, i64 noundef %12)
  %.not = icmp ult i32 %6, %13
  br i1 %.not, label %14, label %29

14:                                               ; preds = %5
  %15 = lshr i32 %6, 5
  %16 = add nuw nsw i64 %11, 576
  %17 = tail call i32 @i32_load(ptr noundef nonnull %7, i64 noundef %16)
  %.not62 = icmp ult i32 %15, %17
  br i1 %.not62, label %18, label %28

18:                                               ; preds = %14
  %19 = add nuw nsw i64 %11, 572
  %20 = tail call i32 @i32_load(ptr noundef nonnull %7, i64 noundef %19)
  %21 = shl nuw nsw i32 %15, 2
  %22 = add i32 %20, %21
  %23 = zext i32 %22 to i64
  %24 = tail call i32 @i32_load(ptr noundef nonnull %7, i64 noundef %23)
  %25 = and i32 %2, 31
  %26 = shl nuw i32 1, %25
  %27 = or i32 %24, %26
  tail call void @i32_store(ptr noundef nonnull %7, i64 noundef %23, i32 noundef %27)
  br label %29

28:                                               ; preds = %14
  tail call void @w2c_hermes_0x5F_assert_fail(ptr noundef %0, i32 noundef 202974, i32 noundef 82833, i32 noundef 418, i32 noundef 108367) #4
  tail call void @wasm_rt_trap(i32 noundef 5) #5
  unreachable

29:                                               ; preds = %18, %3, %5
  ret void
}

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