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

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

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

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

31:                                               ; preds = %5
  %32 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %32, ptr %12, align 4, !tbaa !9
  %33 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %33, ptr %13, align 4, !tbaa !9
  store i32 2, ptr %14, align 4, !tbaa !9
  %34 = load i32, ptr %14, align 4, !tbaa !9
  %35 = and i32 %34, 31
  %36 = load i32, ptr %13, align 4, !tbaa !9
  %37 = shl i32 %36, %35
  store i32 %37, ptr %13, align 4, !tbaa !9
  %38 = load i32, ptr %13, align 4, !tbaa !9
  %39 = load i32, ptr %12, align 4, !tbaa !9
  %40 = add i32 %39, %38
  store i32 %40, ptr %12, align 4, !tbaa !9
  store i32 8, ptr %13, align 4, !tbaa !9
  %41 = load i32, ptr %13, align 4, !tbaa !9
  %42 = load i32, ptr %12, align 4, !tbaa !9
  %43 = add i32 %42, %41
  store i32 %43, ptr %12, align 4, !tbaa !9
  br label %82

44:                                               ; preds = %5
  %45 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %45, ptr %12, align 4, !tbaa !9
  %46 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %46, ptr %13, align 4, !tbaa !9
  store i32 4096, ptr %14, align 4, !tbaa !9
  %47 = load i32, ptr %14, align 4, !tbaa !9
  %48 = load i32, ptr %13, align 4, !tbaa !9
  %49 = sub i32 %48, %47
  store i32 %49, ptr %13, align 4, !tbaa !9
  store i32 8, ptr %14, align 4, !tbaa !9
  %50 = load i32, ptr %14, align 4, !tbaa !9
  %51 = and i32 %50, 31
  %52 = load i32, ptr %13, align 4, !tbaa !9
  %53 = lshr i32 %52, %51
  store i32 %53, ptr %13, align 4, !tbaa !9
  store i32 16777212, ptr %14, align 4, !tbaa !9
  %54 = load i32, ptr %14, align 4, !tbaa !9
  %55 = load i32, ptr %13, align 4, !tbaa !9
  %56 = and i32 %55, %54
  store i32 %56, ptr %13, align 4, !tbaa !9
  %57 = load i32, ptr %13, align 4, !tbaa !9
  %58 = load i32, ptr %12, align 4, !tbaa !9
  %59 = add i32 %58, %57
  store i32 %59, ptr %12, align 4, !tbaa !9
  store i32 16392, ptr %13, align 4, !tbaa !9
  %60 = load i32, ptr %13, align 4, !tbaa !9
  %61 = load i32, ptr %12, align 4, !tbaa !9
  %62 = add i32 %61, %60
  store i32 %62, ptr %12, align 4, !tbaa !9
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.w2c_hermes, ptr %63, i32 0, i32 6
  %65 = load i32, ptr %12, align 4, !tbaa !9
  %66 = zext i32 %65 to i64
  %67 = call i32 @i32_load(ptr noundef %64, i64 noundef %66)
  store i32 %67, ptr %12, align 4, !tbaa !9
  %68 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %68, ptr %13, align 4, !tbaa !9
  store i32 1023, ptr %14, align 4, !tbaa !9
  %69 = load i32, ptr %14, align 4, !tbaa !9
  %70 = load i32, ptr %13, align 4, !tbaa !9
  %71 = and i32 %70, %69
  store i32 %71, ptr %13, align 4, !tbaa !9
  store i32 2, ptr %14, align 4, !tbaa !9
  %72 = load i32, ptr %14, align 4, !tbaa !9
  %73 = and i32 %72, 31
  %74 = load i32, ptr %13, align 4, !tbaa !9
  %75 = shl i32 %74, %73
  store i32 %75, ptr %13, align 4, !tbaa !9
  %76 = load i32, ptr %13, align 4, !tbaa !9
  %77 = load i32, ptr %12, align 4, !tbaa !9
  %78 = add i32 %77, %76
  store i32 %78, ptr %12, align 4, !tbaa !9
  store i32 8, ptr %13, align 4, !tbaa !9
  %79 = load i32, ptr %13, align 4, !tbaa !9
  %80 = load i32, ptr %12, align 4, !tbaa !9
  %81 = add i32 %80, %79
  store i32 %81, ptr %12, align 4, !tbaa !9
  br label %82

82:                                               ; preds = %44, %31
  %83 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %83, ptr %9, align 4, !tbaa !9
  store i32 -4194304, ptr %13, align 4, !tbaa !9
  %84 = load i32, ptr %13, align 4, !tbaa !9
  %85 = load i32, ptr %12, align 4, !tbaa !9
  %86 = and i32 %85, %84
  store i32 %86, ptr %12, align 4, !tbaa !9
  %87 = load i32, ptr %11, align 4, !tbaa !9
  %88 = load i32, ptr %12, align 4, !tbaa !9
  %89 = icmp ne i32 %87, %88
  %90 = zext i1 %89 to i32
  store i32 %90, ptr %11, align 4, !tbaa !9
  %91 = load i32, ptr %11, align 4, !tbaa !9
  %92 = icmp ne i32 %91, 0
  br i1 %92, label %93, label %104

93:                                               ; preds = %82
  %94 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %94, ptr %11, align 4, !tbaa !9
  store i32 808, ptr %12, align 4, !tbaa !9
  %95 = load i32, ptr %12, align 4, !tbaa !9
  %96 = load i32, ptr %11, align 4, !tbaa !9
  %97 = add i32 %96, %95
  store i32 %97, ptr %11, align 4, !tbaa !9
  %98 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %98, ptr %12, align 4, !tbaa !9
  %99 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %99, ptr %13, align 4, !tbaa !9
  %100 = load ptr, ptr %6, align 8, !tbaa !5
  %101 = load i32, ptr %11, align 4, !tbaa !9
  %102 = load i32, ptr %12, align 4, !tbaa !9
  %103 = load i32, ptr %13, align 4, !tbaa !9
  call void @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AHadesGC0x3A0x3AwriteBarrierSlow0x28hermes0x3A0x3Avm0x3A0x3AGCHermesValueBase0x3Chermes0x3A0x3Avm0x3A0x3AHermesValue320x3E0x20const0x2A0x2C0x20hermes0x3A0x3Avm0x3A0x3AHermesValue320x29(ptr noundef %100, i32 noundef %101, i32 noundef %102, i32 noundef %103)
  br label %104

104:                                              ; preds = %93, %82
  %105 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %105, ptr %11, align 4, !tbaa !9
  %106 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %106, ptr %12, align 4, !tbaa !9
  %107 = load ptr, ptr %6, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.w2c_hermes, ptr %107, i32 0, i32 6
  %109 = load i32, ptr %11, align 4, !tbaa !9
  %110 = zext i32 %109 to i64
  %111 = load i32, ptr %12, align 4, !tbaa !9
  call void @i32_store(ptr noundef %108, i64 noundef %110, i32 noundef %111)
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  ret void
}

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

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 = { 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 = { "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 }

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

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

; Function Attrs: nounwind uwtable
define dso_local void @w2c_hermes_void0x20hermes0x3A0x3Avm0x3A0x3ASegmentedArrayBase0x3Chermes0x3A0x3Avm0x3A0x3AHermesValue320x3E0x3A0x3Aset0x3C0x28hermes0x3A0x3Avm0x3A0x3ASegmentedArrayBase0x3Chermes0x3A0x3Avm0x3A0x3AHermesValue320x3E0x3A0x3AInline0x2900x3E0x28hermes0x3A0x3Avm0x3A0x3ARuntime0x260x2C0x20unsigned0x20int0x2C0x20hermes0x3A0x3Avm0x3A0x3AHermesValue320x29(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #1 {
  %6 = add i32 %2, 1356
  %7 = getelementptr inbounds i8, ptr %0, i64 40
  %8 = zext i32 %6 to i64
  %9 = tail call i32 @i32_load(ptr noundef nonnull %7, i64 noundef %8)
  %10 = icmp ult i32 %3, 4096
  br i1 %10, label %11, label %14

11:                                               ; preds = %5
  %12 = shl nuw nsw i32 %3, 2
  %13 = add i32 %12, %1
  br label %25

14:                                               ; preds = %5
  %15 = add i32 %3, -4096
  %16 = lshr i32 %15, 8
  %17 = and i32 %16, 16777212
  %18 = add i32 %1, 16392
  %19 = add i32 %18, %17
  %20 = zext i32 %19 to i64
  %21 = tail call i32 @i32_load(ptr noundef nonnull %7, i64 noundef %20)
  %22 = shl i32 %3, 2
  %23 = and i32 %22, 4092
  %24 = add i32 %21, %23
  br label %25

25:                                               ; preds = %14, %11
  %.0.in = phi i32 [ %13, %11 ], [ %24, %14 ]
  %.0 = add i32 %.0.in, 8
  %26 = and i32 %.0, -4194304
  %.not = icmp eq i32 %9, %26
  br i1 %.not, label %29, label %27

27:                                               ; preds = %25
  %28 = add i32 %2, 808
  tail call void @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AHadesGC0x3A0x3AwriteBarrierSlow0x28hermes0x3A0x3Avm0x3A0x3AGCHermesValueBase0x3Chermes0x3A0x3Avm0x3A0x3AHermesValue320x3E0x20const0x2A0x2C0x20hermes0x3A0x3Avm0x3A0x3AHermesValue320x29(ptr noundef %0, i32 noundef %28, i32 noundef %.0, i32 noundef %4) #3
  br label %29

29:                                               ; preds = %27, %25
  %30 = zext i32 %.0 to i64
  tail call void @i32_store(ptr noundef nonnull %7, i64 noundef %30, i32 noundef %4)
  ret void
}

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

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 = { 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 = { "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 }

!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,TailCallElimPass