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

; 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: nounwind uwtable
declare dso_local i32 @w2c_hermes_hermes0x3A0x3ABacktrackingBumpPtrAllocator0x3A0x3AallocateNewSlab0x28unsigned0x20long0x2C0x20unsigned0x20long0x29(ptr noundef, i32 noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @w2c_hermes_hermes0x3A0x3AESTree0x3A0x3ANode0x3A0x3Aoperator0x20new0x28unsigned0x20long0x2C0x20hermes0x3A0x3AContext0x260x2C0x20unsigned0x20long0x29(ptr noundef %0, i32 noundef %1, i32 noundef %2) #2 {
  %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 i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  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) #3
  store i32 0, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 0, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  store i64 0, ptr %10, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  %18 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %18, ptr %11, align 4, !tbaa !9
  %19 = load ptr, ptr %4, 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 = add i64 %22, 12
  %24 = call i32 @i32_load(ptr noundef %20, i64 noundef %23)
  store i32 %24, ptr %11, align 4, !tbaa !9
  %25 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %25, ptr %8, align 4, !tbaa !9
  %26 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %26, ptr %12, align 4, !tbaa !9
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.w2c_hermes, ptr %27, i32 0, i32 6
  %29 = load i32, ptr %12, align 4, !tbaa !9
  %30 = zext i32 %29 to i64
  %31 = call i32 @i32_load(ptr noundef %28, i64 noundef %30)
  store i32 %31, ptr %12, align 4, !tbaa !9
  %32 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %32, ptr %13, align 4, !tbaa !9
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.w2c_hermes, ptr %33, i32 0, i32 6
  %35 = load i32, ptr %13, align 4, !tbaa !9
  %36 = zext i32 %35 to i64
  %37 = call i32 @i32_load(ptr noundef %34, i64 noundef %36)
  store i32 %37, ptr %13, align 4, !tbaa !9
  store i32 2, ptr %14, align 4, !tbaa !9
  %38 = load i32, ptr %14, align 4, !tbaa !9
  %39 = and i32 %38, 31
  %40 = load i32, ptr %13, align 4, !tbaa !9
  %41 = shl i32 %40, %39
  store i32 %41, ptr %13, align 4, !tbaa !9
  %42 = load i32, ptr %13, align 4, !tbaa !9
  %43 = load i32, ptr %12, align 4, !tbaa !9
  %44 = add i32 %43, %42
  store i32 %44, ptr %12, align 4, !tbaa !9
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.w2c_hermes, ptr %45, i32 0, i32 6
  %47 = load i32, ptr %12, align 4, !tbaa !9
  %48 = zext i32 %47 to i64
  %49 = call i32 @i32_load(ptr noundef %46, i64 noundef %48)
  store i32 %49, ptr %12, align 4, !tbaa !9
  %50 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %50, ptr %7, align 4, !tbaa !9
  %51 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %51, ptr %13, align 4, !tbaa !9
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.w2c_hermes, ptr %52, i32 0, i32 6
  %54 = load i32, ptr %13, align 4, !tbaa !9
  %55 = zext i32 %54 to i64
  %56 = add i64 %55, 4
  %57 = call i32 @i32_load(ptr noundef %53, i64 noundef %56)
  store i32 %57, ptr %13, align 4, !tbaa !9
  %58 = load i32, ptr %13, align 4, !tbaa !9
  %59 = load i32, ptr %12, align 4, !tbaa !9
  %60 = add i32 %59, %58
  store i32 %60, ptr %12, align 4, !tbaa !9
  %61 = load i32, ptr %12, align 4, !tbaa !9
  %62 = zext i32 %61 to i64
  store i64 %62, ptr %15, align 8, !tbaa !11
  store i64 7, ptr %16, align 8, !tbaa !11
  %63 = load i64, ptr %16, align 8, !tbaa !11
  %64 = load i64, ptr %15, align 8, !tbaa !11
  %65 = add i64 %64, %63
  store i64 %65, ptr %15, align 8, !tbaa !11
  %66 = load i64, ptr %15, align 8, !tbaa !11
  store i64 %66, ptr %10, align 8, !tbaa !11
  %67 = load i64, ptr %10, align 8, !tbaa !11
  store i64 %67, ptr %16, align 8, !tbaa !11
  store i64 7, ptr %17, align 8, !tbaa !11
  %68 = load i64, ptr %17, align 8, !tbaa !11
  %69 = load i64, ptr %16, align 8, !tbaa !11
  %70 = and i64 %69, %68
  store i64 %70, ptr %16, align 8, !tbaa !11
  %71 = load i64, ptr %16, align 8, !tbaa !11
  %72 = load i64, ptr %15, align 8, !tbaa !11
  %73 = sub i64 %72, %71
  store i64 %73, ptr %15, align 8, !tbaa !11
  %74 = load i64, ptr %15, align 8, !tbaa !11
  %75 = trunc i64 %74 to i32
  store i32 %75, ptr %12, align 4, !tbaa !9
  %76 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %76, ptr %9, align 4, !tbaa !9
  %77 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %77, ptr %13, align 4, !tbaa !9
  %78 = load i32, ptr %13, align 4, !tbaa !9
  %79 = load i32, ptr %12, align 4, !tbaa !9
  %80 = sub i32 %79, %78
  store i32 %80, ptr %12, align 4, !tbaa !9
  %81 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %81, ptr %7, align 4, !tbaa !9
  %82 = load ptr, ptr %4, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.w2c_hermes, ptr %82, i32 0, i32 6
  %84 = load i32, ptr %11, align 4, !tbaa !9
  %85 = zext i32 %84 to i64
  %86 = add i64 %85, 4
  %87 = load i32, ptr %12, align 4, !tbaa !9
  call void @i32_store(ptr noundef %83, i64 noundef %86, i32 noundef %87)
  %88 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %88, ptr %11, align 4, !tbaa !9
  store i32 262144, ptr %12, align 4, !tbaa !9
  %89 = load i32, ptr %11, align 4, !tbaa !9
  %90 = load i32, ptr %12, align 4, !tbaa !9
  %91 = icmp ule i32 %89, %90
  %92 = zext i1 %91 to i32
  store i32 %92, ptr %11, align 4, !tbaa !9
  %93 = load i32, ptr %11, align 4, !tbaa !9
  %94 = icmp ne i32 %93, 0
  br i1 %94, label %95, label %110

95:                                               ; preds = %3
  %96 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %96, ptr %11, align 4, !tbaa !9
  %97 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %97, ptr %12, align 4, !tbaa !9
  %98 = load i32, ptr %12, align 4, !tbaa !9
  %99 = load i32, ptr %11, align 4, !tbaa !9
  %100 = add i32 %99, %98
  store i32 %100, ptr %11, align 4, !tbaa !9
  %101 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %101, ptr %7, align 4, !tbaa !9
  store i32 262145, ptr %12, align 4, !tbaa !9
  %102 = load i32, ptr %11, align 4, !tbaa !9
  %103 = load i32, ptr %12, align 4, !tbaa !9
  %104 = icmp ult i32 %102, %103
  %105 = zext i1 %104 to i32
  store i32 %105, ptr %11, align 4, !tbaa !9
  %106 = load i32, ptr %11, align 4, !tbaa !9
  %107 = icmp ne i32 %106, 0
  br i1 %107, label %108, label %109

108:                                              ; preds = %95
  br label %117

109:                                              ; preds = %95
  br label %110

110:                                              ; preds = %109, %3
  %111 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %111, ptr %11, align 4, !tbaa !9
  %112 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %112, ptr %12, align 4, !tbaa !9
  %113 = load ptr, ptr %4, align 8, !tbaa !5
  %114 = load i32, ptr %11, align 4, !tbaa !9
  %115 = load i32, ptr %12, align 4, !tbaa !9
  %116 = call i32 @w2c_hermes_hermes0x3A0x3ABacktrackingBumpPtrAllocator0x3A0x3AallocateNewSlab0x28unsigned0x20long0x2C0x20unsigned0x20long0x29(ptr noundef %113, i32 noundef %114, i32 noundef %115)
  store i32 %116, ptr %11, align 4, !tbaa !9
  br label %127

117:                                              ; preds = %108
  %118 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %118, ptr %11, align 4, !tbaa !9
  %119 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %119, ptr %12, align 4, !tbaa !9
  %120 = load ptr, ptr %4, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.w2c_hermes, ptr %120, i32 0, i32 6
  %122 = load i32, ptr %11, align 4, !tbaa !9
  %123 = zext i32 %122 to i64
  %124 = add i64 %123, 4
  %125 = load i32, ptr %12, align 4, !tbaa !9
  call void @i32_store(ptr noundef %121, i64 noundef %124, i32 noundef %125)
  %126 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %126, ptr %11, align 4, !tbaa !9
  br label %127

127:                                              ; preds = %117, %110
  %128 = load i32, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  ret i32 %128
}

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 = { 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}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !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
declare dso_local i32 @w2c_hermes_hermes0x3A0x3ABacktrackingBumpPtrAllocator0x3A0x3AallocateNewSlab0x28unsigned0x20long0x2C0x20unsigned0x20long0x29(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i32 @w2c_hermes_hermes0x3A0x3AESTree0x3A0x3ANode0x3A0x3Aoperator0x20new0x28unsigned0x20long0x2C0x20hermes0x3A0x3AContext0x260x2C0x20unsigned0x20long0x29(ptr noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = getelementptr inbounds i8, ptr %0, i64 40
  %5 = zext i32 %2 to i64
  %6 = add nuw nsw i64 %5, 12
  %7 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %6)
  %8 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %5)
  %9 = zext i32 %7 to i64
  %10 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %9)
  %11 = shl i32 %10, 2
  %12 = add i32 %11, %8
  %13 = zext i32 %12 to i64
  %14 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %13)
  %15 = add nuw nsw i64 %9, 4
  %16 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %15)
  %17 = add i32 %14, 7
  %18 = add i32 %17, %16
  %19 = and i32 %18, -8
  %20 = sub i32 %19, %14
  tail call void @i32_store(ptr noundef nonnull %4, i64 noundef %15, i32 noundef %20)
  %21 = icmp ult i32 %1, 262145
  br i1 %21, label %22, label %25

22:                                               ; preds = %3
  %23 = add i32 %20, %1
  %24 = icmp ult i32 %23, 262145
  br i1 %24, label %27, label %25

25:                                               ; preds = %22, %3
  %26 = tail call i32 @w2c_hermes_hermes0x3A0x3ABacktrackingBumpPtrAllocator0x3A0x3AallocateNewSlab0x28unsigned0x20long0x2C0x20unsigned0x20long0x29(ptr noundef %0, i32 noundef %2, i32 noundef %1)
  br label %28

27:                                               ; preds = %22
  tail call void @i32_store(ptr noundef nonnull %4, i64 noundef %15, i32 noundef %23)
  br label %28

28:                                               ; preds = %27, %25
  %.0 = phi i32 [ %19, %27 ], [ %26, %25 ]
  ret i32 %.0
}

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

!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