; LLVM IR from facebook/hermes :: API/hermes_sandbox/external (hermes_sandbox_impl_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: noreturn
declare void @wasm_rt_trap(i32 noundef) #1

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @i64_store(ptr noundef, i64 noundef, i64 noundef) #2

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @i32_load8_u(ptr noundef, i64 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 i64 @i64_load(ptr noundef, i64 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AStringView0x3A0x3AStringView0x28hermes0x3A0x3Avm0x3A0x3AStringView0x20const0x260x29(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 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) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  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 8, ptr %12) #5
  %13 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %13, ptr %7, align 4, !tbaa !9
  %14 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %14, ptr %8, 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 %8, align 4, !tbaa !9
  %18 = zext i32 %17 to i64
  %19 = add i64 %18, 8
  %20 = call i64 @i64_load(ptr noundef %16, i64 noundef %19)
  store i64 %20, ptr %12, align 8, !tbaa !11
  %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 %7, align 4, !tbaa !9
  %24 = zext i32 %23 to i64
  %25 = add i64 %24, 8
  %26 = load i64, ptr %12, align 8, !tbaa !11
  call void @i64_store(ptr noundef %22, i64 noundef %25, i64 noundef %26)
  %27 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %27, ptr %7, align 4, !tbaa !9
  %28 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %28, ptr %8, 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 %8, align 4, !tbaa !9
  %32 = zext i32 %31 to i64
  %33 = call i64 @i64_load(ptr noundef %30, i64 noundef %32)
  store i64 %33, ptr %12, align 8, !tbaa !11
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.w2c_hermes, ptr %34, i32 0, i32 6
  %36 = load i32, ptr %7, align 4, !tbaa !9
  %37 = zext i32 %36 to i64
  %38 = load i64, ptr %12, align 8, !tbaa !11
  call void @i64_store(ptr noundef %35, i64 noundef %37, i64 noundef %38)
  %39 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %39, ptr %7, align 4, !tbaa !9
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.w2c_hermes, ptr %40, i32 0, i32 6
  %42 = load i32, ptr %7, align 4, !tbaa !9
  %43 = zext i32 %42 to i64
  %44 = add i64 %43, 11
  %45 = call i32 @i32_load8_u(ptr noundef %41, i64 noundef %44)
  store i32 %45, ptr %7, align 4, !tbaa !9
  store i32 64, ptr %8, align 4, !tbaa !9
  %46 = load i32, ptr %8, align 4, !tbaa !9
  %47 = load i32, ptr %7, align 4, !tbaa !9
  %48 = and i32 %47, %46
  store i32 %48, ptr %7, align 4, !tbaa !9
  %49 = load i32, ptr %7, align 4, !tbaa !9
  %50 = icmp ne i32 %49, 0
  %51 = xor i1 %50, true
  %52 = zext i1 %51 to i32
  store i32 %52, ptr %7, align 4, !tbaa !9
  %53 = load i32, ptr %7, align 4, !tbaa !9
  %54 = icmp ne i32 %53, 0
  br i1 %54, label %55, label %56

55:                                               ; preds = %3
  br label %126

56:                                               ; preds = %3
  %57 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %57, ptr %7, align 4, !tbaa !9
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.w2c_hermes, ptr %58, i32 0, i32 6
  %60 = load i32, ptr %7, align 4, !tbaa !9
  %61 = zext i32 %60 to i64
  %62 = add i64 %61, 11
  %63 = call i32 @i32_load8_u(ptr noundef %59, i64 noundef %62)
  store i32 %63, ptr %7, align 4, !tbaa !9
  store i32 64, ptr %8, align 4, !tbaa !9
  %64 = load i32, ptr %8, align 4, !tbaa !9
  %65 = load i32, ptr %7, align 4, !tbaa !9
  %66 = and i32 %65, %64
  store i32 %66, ptr %7, align 4, !tbaa !9
  %67 = load i32, ptr %7, align 4, !tbaa !9
  %68 = icmp ne i32 %67, 0
  %69 = xor i1 %68, true
  %70 = zext i1 %69 to i32
  store i32 %70, ptr %7, align 4, !tbaa !9
  %71 = load i32, ptr %7, align 4, !tbaa !9
  %72 = icmp ne i32 %71, 0
  br i1 %72, label %73, label %74

73:                                               ; preds = %56
  br label %128

74:                                               ; preds = %56
  %75 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %75, ptr %7, align 4, !tbaa !9
  %76 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %76, ptr %8, align 4, !tbaa !9
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.w2c_hermes, ptr %77, i32 0, i32 6
  %79 = load i32, ptr %8, align 4, !tbaa !9
  %80 = zext i32 %79 to i64
  %81 = add i64 %80, 4
  %82 = call i32 @i32_load(ptr noundef %78, i64 noundef %81)
  store i32 %82, ptr %8, align 4, !tbaa !9
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.w2c_hermes, ptr %83, i32 0, i32 6
  %85 = load i32, ptr %7, align 4, !tbaa !9
  %86 = zext i32 %85 to i64
  %87 = add i64 %86, 4
  %88 = load i32, ptr %8, align 4, !tbaa !9
  call void @i32_store(ptr noundef %84, i64 noundef %87, i32 noundef %88)
  %89 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %89, ptr %7, align 4, !tbaa !9
  %90 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %90, ptr %8, align 4, !tbaa !9
  %91 = load ptr, ptr %4, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.w2c_hermes, ptr %91, i32 0, i32 6
  %93 = load i32, ptr %8, align 4, !tbaa !9
  %94 = zext i32 %93 to i64
  %95 = call i32 @i32_load(ptr noundef %92, i64 noundef %94)
  store i32 %95, ptr %8, align 4, !tbaa !9
  %96 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %96, ptr %6, align 4, !tbaa !9
  %97 = load ptr, ptr %4, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.w2c_hermes, ptr %97, i32 0, i32 6
  %99 = load i32, ptr %7, align 4, !tbaa !9
  %100 = zext i32 %99 to i64
  %101 = load i32, ptr %8, align 4, !tbaa !9
  call void @i32_store(ptr noundef %98, i64 noundef %100, i32 noundef %101)
  %102 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %102, ptr %7, align 4, !tbaa !9
  %103 = load i32, ptr %7, align 4, !tbaa !9
  %104 = icmp ne i32 %103, 0
  %105 = xor i1 %104, true
  %106 = zext i1 %105 to i32
  store i32 %106, ptr %7, align 4, !tbaa !9
  %107 = load i32, ptr %7, align 4, !tbaa !9
  %108 = icmp ne i32 %107, 0
  br i1 %108, label %109, label %110

109:                                              ; preds = %74
  br label %126

110:                                              ; preds = %74
  %111 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %111, ptr %7, align 4, !tbaa !9
  %112 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %112, ptr %8, align 4, !tbaa !9
  %113 = load ptr, ptr %4, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.w2c_hermes, ptr %113, i32 0, i32 6
  %115 = load i32, ptr %8, align 4, !tbaa !9
  %116 = zext i32 %115 to i64
  %117 = call i32 @i32_load(ptr noundef %114, i64 noundef %116)
  store i32 %117, ptr %8, align 4, !tbaa !9
  store i32 1, ptr %9, align 4, !tbaa !9
  %118 = load i32, ptr %9, align 4, !tbaa !9
  %119 = load i32, ptr %8, align 4, !tbaa !9
  %120 = add i32 %119, %118
  store i32 %120, ptr %8, align 4, !tbaa !9
  %121 = load ptr, ptr %4, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.w2c_hermes, ptr %121, i32 0, i32 6
  %123 = load i32, ptr %7, align 4, !tbaa !9
  %124 = zext i32 %123 to i64
  %125 = load i32, ptr %8, align 4, !tbaa !9
  call void @i32_store(ptr noundef %122, i64 noundef %124, i32 noundef %125)
  br label %126

126:                                              ; preds = %110, %109, %55
  %127 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %127, ptr %7, align 4, !tbaa !9
  br label %146

128:                                              ; preds = %73
  store i32 0, ptr %7, align 4, !tbaa !9
  %129 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %129, ptr %5, align 4, !tbaa !9
  store i32 168568, ptr %8, align 4, !tbaa !9
  %130 = load i32, ptr %8, align 4, !tbaa !9
  %131 = load i32, ptr %7, align 4, !tbaa !9
  %132 = add i32 %131, %130
  store i32 %132, ptr %7, align 4, !tbaa !9
  %133 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %133, ptr %8, align 4, !tbaa !9
  store i32 76914, ptr %9, align 4, !tbaa !9
  %134 = load i32, ptr %9, align 4, !tbaa !9
  %135 = load i32, ptr %8, align 4, !tbaa !9
  %136 = add i32 %135, %134
  store i32 %136, ptr %8, align 4, !tbaa !9
  store i32 428, ptr %9, align 4, !tbaa !9
  %137 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %137, ptr %10, align 4, !tbaa !9
  store i32 71540, ptr %11, align 4, !tbaa !9
  %138 = load i32, ptr %11, align 4, !tbaa !9
  %139 = load i32, ptr %10, align 4, !tbaa !9
  %140 = add i32 %139, %138
  store i32 %140, ptr %10, align 4, !tbaa !9
  %141 = load ptr, ptr %4, align 8, !tbaa !5
  %142 = load i32, ptr %7, align 4, !tbaa !9
  %143 = load i32, ptr %8, align 4, !tbaa !9
  %144 = load i32, ptr %9, align 4, !tbaa !9
  %145 = load i32, ptr %10, align 4, !tbaa !9
  call void @w2c_hermes_0x5F_assert_fail(ptr noundef %141, i32 noundef %142, i32 noundef %143, i32 noundef %144, i32 noundef %145)
  call void @wasm_rt_trap(i32 noundef 5) #6
  unreachable

146:                                              ; preds = %126
  %147 = load i32, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, 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 %147
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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}
!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: noreturn
declare void @wasm_rt_trap(i32 noundef) local_unnamed_addr #0

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AStringView0x3A0x3AStringView0x28hermes0x3A0x3Avm0x3A0x3AStringView0x20const0x260x29(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 %2 to i64
  %6 = add nuw nsw i64 %5, 8
  %7 = tail call i64 @i64_load(ptr noundef nonnull %4, i64 noundef %6)
  %8 = zext i32 %1 to i64
  %9 = add nuw nsw i64 %8, 8
  tail call void @i64_store(ptr noundef nonnull %4, i64 noundef %9, i64 noundef %7)
  %10 = tail call i64 @i64_load(ptr noundef nonnull %4, i64 noundef %5)
  tail call void @i64_store(ptr noundef nonnull %4, i64 noundef %8, i64 noundef %10)
  %11 = add nuw nsw i64 %8, 11
  %12 = tail call i32 @i32_load8_u(ptr noundef nonnull %4, i64 noundef %11)
  %13 = and i32 %12, 64
  %.not = icmp eq i32 %13, 0
  br i1 %.not, label %27, label %14

14:                                               ; preds = %3
  %15 = add nuw nsw i64 %5, 11
  %16 = tail call i32 @i32_load8_u(ptr noundef nonnull %4, i64 noundef %15)
  %17 = and i32 %16, 64
  %.not70 = icmp eq i32 %17, 0
  br i1 %.not70, label %28, label %18

18:                                               ; preds = %14
  %19 = add nuw nsw i64 %5, 4
  %20 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %19)
  %21 = add nuw nsw i64 %8, 4
  tail call void @i32_store(ptr noundef nonnull %4, i64 noundef %21, i32 noundef %20)
  %22 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %5)
  tail call void @i32_store(ptr noundef nonnull %4, i64 noundef %8, i32 noundef %22)
  %.not71 = icmp eq i32 %22, 0
  br i1 %.not71, label %27, label %23

23:                                               ; preds = %18
  %24 = zext i32 %22 to i64
  %25 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %24)
  %26 = add i32 %25, 1
  tail call void @i32_store(ptr noundef nonnull %4, i64 noundef %24, i32 noundef %26)
  br label %27

27:                                               ; preds = %18, %3, %23
  ret i32 %1

28:                                               ; preds = %14
  tail call void @w2c_hermes_0x5F_assert_fail(ptr noundef %0, i32 noundef 168568, i32 noundef 76914, i32 noundef 428, i32 noundef 71540) #4
  tail call void @wasm_rt_trap(i32 noundef 5) #5
  unreachable
}

attributes #0 = { 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 #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 = { "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,SROAPass,SimplifyCFGPass,TailCallElimPass