; 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_hermes0x3A0x3Avm0x3A0x3ADroppingAcceptor0x3Chermes0x3A0x3Avm0x3A0x3AHadesGC0x3A0x3AMarkAcceptor0x3E0x3A0x3Aaccept0x28hermes0x3A0x3Avm0x3A0x3ARootSymbolID0x20const0x260x2C0x20char0x20const0x2A0x29(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
  %14 = 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
  store i32 0, ptr %9, align 4, !tbaa !9
  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
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %15 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %15, ptr %10, align 4, !tbaa !9
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.w2c_hermes, ptr %16, i32 0, i32 6
  %18 = load i32, ptr %10, align 4, !tbaa !9
  %19 = zext i32 %18 to i64
  %20 = call i32 @i32_load(ptr noundef %17, i64 noundef %19)
  store i32 %20, ptr %10, align 4, !tbaa !9
  %21 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %21, ptr %7, align 4, !tbaa !9
  store i32 536870909, ptr %11, align 4, !tbaa !9
  %22 = load i32, ptr %10, align 4, !tbaa !9
  %23 = load i32, ptr %11, align 4, !tbaa !9
  %24 = icmp ugt i32 %22, %23
  %25 = zext i1 %24 to i32
  store i32 %25, ptr %10, align 4, !tbaa !9
  %26 = load i32, ptr %10, align 4, !tbaa !9
  %27 = icmp ne i32 %26, 0
  br i1 %27, label %28, label %29

28:                                               ; preds = %4
  br label %113

29:                                               ; preds = %4
  %30 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %30, ptr %10, align 4, !tbaa !9
  store i32 268435455, ptr %11, align 4, !tbaa !9
  %31 = load i32, ptr %11, align 4, !tbaa !9
  %32 = load i32, ptr %10, align 4, !tbaa !9
  %33 = and i32 %32, %31
  store i32 %33, ptr %10, align 4, !tbaa !9
  %34 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %34, ptr %9, align 4, !tbaa !9
  %35 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %35, ptr %11, align 4, !tbaa !9
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.w2c_hermes, ptr %36, i32 0, i32 6
  %38 = load i32, ptr %11, align 4, !tbaa !9
  %39 = zext i32 %38 to i64
  %40 = add i64 %39, 8
  %41 = call i32 @i32_load(ptr noundef %37, i64 noundef %40)
  store i32 %41, ptr %11, align 4, !tbaa !9
  %42 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %42, ptr %6, align 4, !tbaa !9
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.w2c_hermes, ptr %43, i32 0, i32 6
  %45 = load i32, ptr %11, align 4, !tbaa !9
  %46 = zext i32 %45 to i64
  %47 = add i64 %46, 568
  %48 = call i32 @i32_load(ptr noundef %44, i64 noundef %47)
  store i32 %48, ptr %11, align 4, !tbaa !9
  %49 = load i32, ptr %10, align 4, !tbaa !9
  %50 = load i32, ptr %11, align 4, !tbaa !9
  %51 = icmp uge i32 %49, %50
  %52 = zext i1 %51 to i32
  store i32 %52, ptr %10, align 4, !tbaa !9
  %53 = load i32, ptr %10, align 4, !tbaa !9
  %54 = icmp ne i32 %53, 0
  br i1 %54, label %55, label %56

55:                                               ; preds = %29
  br label %113

56:                                               ; preds = %29
  %57 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %57, ptr %10, align 4, !tbaa !9
  store i32 5, ptr %11, align 4, !tbaa !9
  %58 = load i32, ptr %11, align 4, !tbaa !9
  %59 = and i32 %58, 31
  %60 = load i32, ptr %10, align 4, !tbaa !9
  %61 = lshr i32 %60, %59
  store i32 %61, ptr %10, align 4, !tbaa !9
  %62 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %62, ptr %9, align 4, !tbaa !9
  %63 = load i32, ptr %6, 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, 564
  %69 = call i32 @i32_load(ptr noundef %65, i64 noundef %68)
  store i32 %69, ptr %11, align 4, !tbaa !9
  %70 = load i32, ptr %10, align 4, !tbaa !9
  %71 = load i32, ptr %11, align 4, !tbaa !9
  %72 = icmp uge i32 %70, %71
  %73 = zext i1 %72 to i32
  store i32 %73, ptr %10, align 4, !tbaa !9
  %74 = load i32, ptr %10, align 4, !tbaa !9
  %75 = icmp ne i32 %74, 0
  br i1 %75, label %76, label %77

76:                                               ; preds = %56
  br label %114

77:                                               ; preds = %56
  %78 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %78, ptr %10, 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 %10, align 4, !tbaa !9
  %82 = zext i32 %81 to i64
  %83 = add i64 %82, 560
  %84 = call i32 @i32_load(ptr noundef %80, i64 noundef %83)
  store i32 %84, ptr %10, align 4, !tbaa !9
  %85 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %85, ptr %11, align 4, !tbaa !9
  store i32 2, ptr %12, align 4, !tbaa !9
  %86 = load i32, ptr %12, align 4, !tbaa !9
  %87 = and i32 %86, 31
  %88 = load i32, ptr %11, align 4, !tbaa !9
  %89 = shl i32 %88, %87
  store i32 %89, ptr %11, align 4, !tbaa !9
  %90 = load i32, ptr %11, align 4, !tbaa !9
  %91 = load i32, ptr %10, align 4, !tbaa !9
  %92 = add i32 %91, %90
  store i32 %92, ptr %10, align 4, !tbaa !9
  %93 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %93, ptr %6, align 4, !tbaa !9
  %94 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %94, ptr %11, 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 %11, align 4, !tbaa !9
  %98 = zext i32 %97 to i64
  %99 = call i32 @i32_load(ptr noundef %96, i64 noundef %98)
  store i32 %99, ptr %11, align 4, !tbaa !9
  store i32 1, ptr %12, align 4, !tbaa !9
  %100 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %100, ptr %13, align 4, !tbaa !9
  %101 = load i32, ptr %13, align 4, !tbaa !9
  %102 = and i32 %101, 31
  %103 = load i32, ptr %12, align 4, !tbaa !9
  %104 = shl i32 %103, %102
  store i32 %104, ptr %12, align 4, !tbaa !9
  %105 = load i32, ptr %12, align 4, !tbaa !9
  %106 = load i32, ptr %11, align 4, !tbaa !9
  %107 = or i32 %106, %105
  store i32 %107, ptr %11, align 4, !tbaa !9
  %108 = load ptr, ptr %5, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.w2c_hermes, ptr %108, i32 0, i32 6
  %110 = load i32, ptr %10, align 4, !tbaa !9
  %111 = zext i32 %110 to i64
  %112 = load i32, ptr %11, align 4, !tbaa !9
  call void @i32_store(ptr noundef %109, i64 noundef %111, i32 noundef %112)
  br label %113

113:                                              ; preds = %77, %55, %28
  br label %132

114:                                              ; preds = %76
  store i32 0, ptr %10, align 4, !tbaa !9
  %115 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %115, ptr %7, align 4, !tbaa !9
  store i32 202974, ptr %11, align 4, !tbaa !9
  %116 = load i32, ptr %11, align 4, !tbaa !9
  %117 = load i32, ptr %10, align 4, !tbaa !9
  %118 = add i32 %117, %116
  store i32 %118, ptr %10, align 4, !tbaa !9
  %119 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %119, ptr %11, align 4, !tbaa !9
  store i32 82833, ptr %12, align 4, !tbaa !9
  %120 = load i32, ptr %12, align 4, !tbaa !9
  %121 = load i32, ptr %11, align 4, !tbaa !9
  %122 = add i32 %121, %120
  store i32 %122, ptr %11, align 4, !tbaa !9
  store i32 418, ptr %12, align 4, !tbaa !9
  %123 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %123, ptr %13, align 4, !tbaa !9
  store i32 108367, ptr %14, align 4, !tbaa !9
  %124 = load i32, ptr %14, align 4, !tbaa !9
  %125 = load i32, ptr %13, align 4, !tbaa !9
  %126 = add i32 %125, %124
  store i32 %126, ptr %13, align 4, !tbaa !9
  %127 = load ptr, ptr %5, align 8, !tbaa !5
  %128 = load i32, ptr %10, align 4, !tbaa !9
  %129 = load i32, ptr %11, align 4, !tbaa !9
  %130 = load i32, ptr %12, align 4, !tbaa !9
  %131 = load i32, ptr %13, align 4, !tbaa !9
  call void @w2c_hermes_0x5F_assert_fail(ptr noundef %127, i32 noundef %128, i32 noundef %129, i32 noundef %130, i32 noundef %131)
  call void @wasm_rt_trap(i32 noundef 5) #6
  unreachable

132:                                              ; preds = %113
  call void @llvm.lifetime.end.p0(i64 4, 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 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #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_hermes0x3A0x3Avm0x3A0x3ADroppingAcceptor0x3Chermes0x3A0x3Avm0x3A0x3AHadesGC0x3A0x3AMarkAcceptor0x3E0x3A0x3Aaccept0x28hermes0x3A0x3Avm0x3A0x3ARootSymbolID0x20const0x260x2C0x20char0x20const0x2A0x29(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 %2 to i64
  %7 = tail call i32 @i32_load(ptr noundef nonnull %5, i64 noundef %6)
  %8 = icmp ugt i32 %7, 536870909
  br i1 %8, label %32, label %9

9:                                                ; preds = %4
  %10 = and i32 %7, 268435455
  %11 = zext i32 %1 to i64
  %12 = add nuw nsw i64 %11, 8
  %13 = tail call i32 @i32_load(ptr noundef nonnull %5, i64 noundef %12)
  %14 = zext i32 %13 to i64
  %15 = add nuw nsw i64 %14, 568
  %16 = tail call i32 @i32_load(ptr noundef nonnull %5, i64 noundef %15)
  %.not = icmp ult i32 %10, %16
  br i1 %.not, label %17, label %32

17:                                               ; preds = %9
  %18 = lshr i32 %10, 5
  %19 = add nuw nsw i64 %14, 564
  %20 = tail call i32 @i32_load(ptr noundef nonnull %5, i64 noundef %19)
  %.not65 = icmp ult i32 %18, %20
  br i1 %.not65, label %21, label %31

21:                                               ; preds = %17
  %22 = add nuw nsw i64 %14, 560
  %23 = tail call i32 @i32_load(ptr noundef nonnull %5, i64 noundef %22)
  %24 = shl nuw nsw i32 %18, 2
  %25 = add i32 %23, %24
  %26 = zext i32 %25 to i64
  %27 = tail call i32 @i32_load(ptr noundef nonnull %5, i64 noundef %26)
  %28 = and i32 %7, 31
  %29 = shl nuw i32 1, %28
  %30 = or i32 %27, %29
  tail call void @i32_store(ptr noundef nonnull %5, i64 noundef %26, i32 noundef %30)
  br label %32

31:                                               ; preds = %17
  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

32:                                               ; preds = %21, %4, %9
  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