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

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #4

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

42:                                               ; preds = %7
  %43 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %43, ptr %16, align 4, !tbaa !9
  store i32 808, ptr %17, align 4, !tbaa !9
  %44 = load i32, ptr %17, align 4, !tbaa !9
  %45 = load i32, ptr %16, align 4, !tbaa !9
  %46 = add i32 %45, %44
  store i32 %46, ptr %16, align 4, !tbaa !9
  %47 = load i32, ptr %15, align 4, !tbaa !9
  store i32 %47, ptr %17, align 4, !tbaa !9
  %48 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %48, ptr %18, align 4, !tbaa !9
  %49 = load ptr, ptr %8, align 8, !tbaa !5
  %50 = load i32, ptr %16, align 4, !tbaa !9
  %51 = load i32, ptr %17, align 4, !tbaa !9
  %52 = load i32, ptr %18, align 4, !tbaa !9
  call void @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AHadesGC0x3A0x3AwriteBarrierSlow0x28hermes0x3A0x3Avm0x3A0x3AGCPointerBase0x20const0x2A0x2C0x20hermes0x3A0x3Avm0x3A0x3AGCCell0x20const0x2A0x29(ptr noundef %49, i32 noundef %50, i32 noundef %51, i32 noundef %52)
  br label %53

53:                                               ; preds = %42, %7
  %54 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %54, ptr %16, align 4, !tbaa !9
  %55 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %55, ptr %17, align 4, !tbaa !9
  %56 = load ptr, ptr %8, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.w2c_hermes, ptr %56, i32 0, i32 6
  %58 = load i32, ptr %16, align 4, !tbaa !9
  %59 = zext i32 %58 to i64
  %60 = add i64 %59, 28
  %61 = load i32, ptr %17, align 4, !tbaa !9
  call void @i32_store(ptr noundef %57, i64 noundef %60, i32 noundef %61)
  %62 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %62, ptr %16, align 4, !tbaa !9
  %63 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %63, ptr %17, align 4, !tbaa !9
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.w2c_hermes, ptr %64, i32 0, i32 6
  %66 = load i32, ptr %16, align 4, !tbaa !9
  %67 = zext i32 %66 to i64
  %68 = add i64 %67, 20
  %69 = load i32, ptr %17, align 4, !tbaa !9
  call void @i32_store(ptr noundef %65, i64 noundef %68, i32 noundef %69)
  %70 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %70, ptr %16, align 4, !tbaa !9
  %71 = load i32, ptr %13, align 4, !tbaa !9
  store i32 %71, ptr %17, align 4, !tbaa !9
  %72 = load i32, ptr %14, align 4, !tbaa !9
  store i32 %72, ptr %18, align 4, !tbaa !9
  %73 = load i32, ptr %18, align 4, !tbaa !9
  %74 = icmp eq i32 %73, 0
  %75 = xor i1 %74, true
  %76 = xor i1 %75, true
  %77 = zext i1 %76 to i32
  %78 = sext i32 %77 to i64
  %79 = call i64 @llvm.expect.i64(i64 %78, i64 0)
  %80 = icmp ne i64 %79, 0
  br i1 %80, label %81, label %83

81:                                               ; preds = %53
  call void @wasm_rt_trap(i32 noundef 3) #7
  unreachable

82:                                               ; No predecessors!
  br label %87

83:                                               ; preds = %53
  %84 = load i32, ptr %17, align 4, !tbaa !9
  %85 = load i32, ptr %18, align 4, !tbaa !9
  %86 = udiv i32 %84, %85
  br label %87

87:                                               ; preds = %83, %82
  %88 = phi i32 [ 0, %82 ], [ %86, %83 ]
  store i32 %88, ptr %17, align 4, !tbaa !9
  %89 = load ptr, ptr %8, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.w2c_hermes, ptr %89, i32 0, i32 6
  %91 = load i32, ptr %16, align 4, !tbaa !9
  %92 = zext i32 %91 to i64
  %93 = add i64 %92, 24
  %94 = load i32, ptr %17, align 4, !tbaa !9
  call void @i32_store(ptr noundef %90, i64 noundef %93, i32 noundef %94)
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  ret void
}

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 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #5 = { 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 #6 = { nounwind }
attributes #7 = { 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"

; 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: noreturn
declare void @wasm_rt_trap(i32 noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local void @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AJSTypedArrayBase0x3A0x3AsetBuffer0x28hermes0x3A0x3Avm0x3A0x3ARuntime0x260x2C0x20hermes0x3A0x3Avm0x3A0x3AJSTypedArrayBase0x2A0x2C0x20hermes0x3A0x3Avm0x3A0x3AJSArrayBuffer0x2A0x2C0x20unsigned0x20int0x2C0x20unsigned0x20int0x2C0x20unsigned0x20char0x29(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6) local_unnamed_addr #3 {
  %8 = add i32 %1, 1356
  %9 = getelementptr inbounds i8, ptr %0, i64 40
  %10 = zext i32 %8 to i64
  %11 = tail call i32 @i32_load(ptr noundef nonnull %9, i64 noundef %10)
  %12 = add i32 %2, 20
  %13 = and i32 %12, -4194304
  %.not = icmp eq i32 %11, %13
  br i1 %.not, label %16, label %14

14:                                               ; preds = %7
  %15 = add i32 %1, 808
  tail call void @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AHadesGC0x3A0x3AwriteBarrierSlow0x28hermes0x3A0x3Avm0x3A0x3AGCPointerBase0x20const0x2A0x2C0x20hermes0x3A0x3Avm0x3A0x3AGCCell0x20const0x2A0x29(ptr noundef %0, i32 noundef %15, i32 noundef %12, i32 noundef %3) #4
  br label %16

16:                                               ; preds = %14, %7
  %17 = zext i32 %2 to i64
  %18 = add nuw nsw i64 %17, 28
  tail call void @i32_store(ptr noundef nonnull %9, i64 noundef %18, i32 noundef %4)
  %19 = add nuw nsw i64 %17, 20
  tail call void @i32_store(ptr noundef nonnull %9, i64 noundef %19, i32 noundef %3)
  %20 = icmp eq i32 %6, 0
  br i1 %20, label %21, label %22, !prof !5

21:                                               ; preds = %16
  tail call void @wasm_rt_trap(i32 noundef 3) #5
  unreachable

22:                                               ; preds = %16
  %23 = udiv i32 %5, %6
  %24 = add nuw nsw i64 %17, 24
  tail call void @i32_store(ptr noundef nonnull %9, i64 noundef %24, i32 noundef %23)
  ret void
}

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)"}
!5 = !{!"branch_weights", !"expected", i32 1, i32 2000}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LowerExpectIntrinsicPass,SROAPass,SimplifyCFGPass,TailCallElimPass