; LLVM IR from facebook/hermes :: API/hermes_sandbox/external (hermes_sandbox_impl_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: 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_0x5F_assert_fail(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @i32_store16(ptr noundef, i64 noundef, i32 noundef) #1

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

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

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

41:                                               ; preds = %3
  %42 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %42, ptr %9, align 4, !tbaa !9
  %43 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %43, ptr %10, align 4, !tbaa !9
  store i32 12, ptr %11, align 4, !tbaa !9
  %44 = load i32, ptr %11, align 4, !tbaa !9
  %45 = load i32, ptr %10, align 4, !tbaa !9
  %46 = add i32 %45, %44
  store i32 %46, ptr %10, align 4, !tbaa !9
  store i32 0, ptr %11, align 4, !tbaa !9
  store i32 2, ptr %12, align 4, !tbaa !9
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = load i32, ptr %9, align 4, !tbaa !9
  %49 = load i32, ptr %10, align 4, !tbaa !9
  %50 = load i32, ptr %11, align 4, !tbaa !9
  %51 = load i32, ptr %12, align 4, !tbaa !9
  call void @w2c_hermes_llvh0x3A0x3ASmallVectorBase0x3A0x3Agrow_pod0x28void0x2A0x2C0x20unsigned0x20long0x2C0x20unsigned0x20long0x29(ptr noundef %47, i32 noundef %48, i32 noundef %49, i32 noundef %50, i32 noundef %51)
  %52 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %52, ptr %9, align 4, !tbaa !9
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.w2c_hermes, ptr %53, i32 0, i32 6
  %55 = load i32, ptr %9, align 4, !tbaa !9
  %56 = zext i32 %55 to i64
  %57 = add i64 %56, 4
  %58 = call i32 @i32_load(ptr noundef %54, i64 noundef %57)
  store i32 %58, ptr %9, align 4, !tbaa !9
  %59 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %59, ptr %8, align 4, !tbaa !9
  br label %60

60:                                               ; preds = %41, %3
  %61 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %61, ptr %9, align 4, !tbaa !9
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.w2c_hermes, ptr %62, i32 0, i32 6
  %64 = load i32, ptr %9, align 4, !tbaa !9
  %65 = zext i32 %64 to i64
  %66 = call i32 @i32_load(ptr noundef %63, i64 noundef %65)
  store i32 %66, ptr %9, align 4, !tbaa !9
  %67 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %67, ptr %10, align 4, !tbaa !9
  store i32 1, ptr %11, align 4, !tbaa !9
  %68 = load i32, ptr %11, align 4, !tbaa !9
  %69 = and i32 %68, 31
  %70 = load i32, ptr %10, align 4, !tbaa !9
  %71 = shl i32 %70, %69
  store i32 %71, ptr %10, align 4, !tbaa !9
  %72 = load i32, ptr %10, align 4, !tbaa !9
  %73 = load i32, ptr %9, align 4, !tbaa !9
  %74 = add i32 %73, %72
  store i32 %74, ptr %9, align 4, !tbaa !9
  %75 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %75, ptr %10, align 4, !tbaa !9
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.w2c_hermes, ptr %76, i32 0, i32 6
  %78 = load i32, ptr %10, align 4, !tbaa !9
  %79 = zext i32 %78 to i64
  %80 = call i32 @i32_load16_u(ptr noundef %77, i64 noundef %79)
  store i32 %80, ptr %10, align 4, !tbaa !9
  %81 = load ptr, ptr %4, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.w2c_hermes, ptr %81, i32 0, i32 6
  %83 = load i32, ptr %9, align 4, !tbaa !9
  %84 = zext i32 %83 to i64
  %85 = load i32, ptr %10, align 4, !tbaa !9
  call void @i32_store16(ptr noundef %82, i64 noundef %84, i32 noundef %85)
  %86 = load i32, ptr %7, 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 = add i64 %90, 4
  %92 = call i32 @i32_load(ptr noundef %88, i64 noundef %91)
  store i32 %92, ptr %9, align 4, !tbaa !9
  store i32 1, ptr %10, align 4, !tbaa !9
  %93 = load i32, ptr %10, align 4, !tbaa !9
  %94 = load i32, ptr %9, align 4, !tbaa !9
  %95 = add i32 %94, %93
  store i32 %95, ptr %9, align 4, !tbaa !9
  %96 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %96, ptr %8, align 4, !tbaa !9
  %97 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %97, ptr %10, align 4, !tbaa !9
  %98 = load ptr, ptr %4, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.w2c_hermes, ptr %98, i32 0, i32 6
  %100 = load i32, ptr %10, align 4, !tbaa !9
  %101 = zext i32 %100 to i64
  %102 = add i64 %101, 8
  %103 = call i32 @i32_load(ptr noundef %99, i64 noundef %102)
  store i32 %103, ptr %10, align 4, !tbaa !9
  %104 = load i32, ptr %9, align 4, !tbaa !9
  %105 = load i32, ptr %10, align 4, !tbaa !9
  %106 = icmp ugt i32 %104, %105
  %107 = zext i1 %106 to i32
  store i32 %107, ptr %9, align 4, !tbaa !9
  %108 = load i32, ptr %9, align 4, !tbaa !9
  %109 = icmp ne i32 %108, 0
  br i1 %109, label %110, label %128

110:                                              ; preds = %60
  store i32 0, ptr %9, align 4, !tbaa !9
  %111 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %111, ptr %7, align 4, !tbaa !9
  store i32 117789, 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
  %115 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %115, ptr %10, align 4, !tbaa !9
  store i32 79572, 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
  store i32 74, ptr %11, align 4, !tbaa !9
  %119 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %119, ptr %12, align 4, !tbaa !9
  store i32 88407, ptr %13, align 4, !tbaa !9
  %120 = load i32, ptr %13, align 4, !tbaa !9
  %121 = load i32, ptr %12, align 4, !tbaa !9
  %122 = add i32 %121, %120
  store i32 %122, ptr %12, align 4, !tbaa !9
  %123 = load ptr, ptr %4, align 8, !tbaa !5
  %124 = load i32, ptr %9, align 4, !tbaa !9
  %125 = load i32, ptr %10, align 4, !tbaa !9
  %126 = load i32, ptr %11, align 4, !tbaa !9
  %127 = load i32, ptr %12, align 4, !tbaa !9
  call void @w2c_hermes_0x5F_assert_fail(ptr noundef %123, i32 noundef %124, i32 noundef %125, i32 noundef %126, i32 noundef %127)
  call void @wasm_rt_trap(i32 noundef 5) #6
  unreachable

128:                                              ; preds = %60
  %129 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %129, ptr %9, align 4, !tbaa !9
  %130 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %130, ptr %10, align 4, !tbaa !9
  %131 = load ptr, ptr %4, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.w2c_hermes, ptr %131, i32 0, i32 6
  %133 = load i32, ptr %9, align 4, !tbaa !9
  %134 = zext i32 %133 to i64
  %135 = add i64 %134, 4
  %136 = load i32, ptr %10, align 4, !tbaa !9
  call void @i32_store(ptr noundef %132, i64 noundef %135, i32 noundef %136)
  %137 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %137, ptr %9, align 4, !tbaa !9
  %138 = load i32, ptr %9, align 4, !tbaa !9
  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
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  ret i32 %138
}

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

; 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_0x5F_assert_fail(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @i32_store16(ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @i32_load16_u(ptr noundef, i64 noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @w2c_hermes_std0x3A0x3A_0x5F20x3A0x3Aback_insert_iterator0x3Cllvh0x3A0x3ASmallVector0x3Cchar16_t0x2C0x206u0x3E0x3E0x3A0x3Aoperator0x3D0x5Babi0x3Av150070x5D0x28char16_t0x260x260x29(ptr noundef %0, i32 noundef returned %1, i32 noundef %2) local_unnamed_addr #3 {
  %4 = getelementptr inbounds i8, ptr %0, i64 40
  %5 = zext i32 %1 to i64
  %6 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %5)
  %7 = zext i32 %6 to i64
  %8 = add nuw nsw i64 %7, 4
  %9 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %8)
  %10 = add nuw nsw i64 %7, 8
  %11 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %10)
  %.not = icmp ult i32 %9, %11
  br i1 %.not, label %15, label %12

12:                                               ; preds = %3
  %13 = add i32 %6, 12
  tail call void @w2c_hermes_llvh0x3A0x3ASmallVectorBase0x3A0x3Agrow_pod0x28void0x2A0x2C0x20unsigned0x20long0x2C0x20unsigned0x20long0x29(ptr noundef %0, i32 noundef %6, i32 noundef %13, i32 noundef 0, i32 noundef 2) #4
  %14 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %8)
  br label %15

15:                                               ; preds = %12, %3
  %.0 = phi i32 [ %14, %12 ], [ %9, %3 ]
  %16 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %7)
  %17 = shl i32 %.0, 1
  %18 = add i32 %16, %17
  %19 = zext i32 %2 to i64
  %20 = tail call i32 @i32_load16_u(ptr noundef nonnull %4, i64 noundef %19)
  %21 = zext i32 %18 to i64
  tail call void @i32_store16(ptr noundef nonnull %4, i64 noundef %21, i32 noundef %20)
  %22 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %8)
  %23 = add i32 %22, 1
  %24 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %10)
  %25 = icmp ugt i32 %23, %24
  br i1 %25, label %26, label %27

26:                                               ; preds = %15
  tail call void @w2c_hermes_0x5F_assert_fail(ptr noundef %0, i32 noundef 117789, i32 noundef 79572, i32 noundef 74, i32 noundef 88407) #4
  tail call void @wasm_rt_trap(i32 noundef 5) #5
  unreachable

27:                                               ; preds = %15
  tail call void @i32_store(ptr noundef nonnull %4, i64 noundef %8, i32 noundef %23)
  ret i32 %1
}

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


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,TailCallElimPass