; 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 i32 @i32_load(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
declare dso_local i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AStringPrimitive0x3A0x3AcastToUTF16Pointer0x280x290x20const(ptr noundef, i32 noundef) #4

; Function Attrs: nounwind uwtable
define dso_local i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AStringView0x3A0x3AcastToChar16Ptr0x280x290x20const(ptr noundef %0, i32 noundef %1) #4 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %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
  %13 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store i64 0, ptr %7, align 8, !tbaa !11
  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
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %14 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %14, ptr %8, align 4, !tbaa !9
  %15 = load ptr, ptr %3, 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 i32 @i32_load(ptr noundef %16, i64 noundef %19)
  store i32 %20, ptr %8, align 4, !tbaa !9
  %21 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %21, ptr %5, align 4, !tbaa !9
  store i32 0, ptr %9, align 4, !tbaa !9
  %22 = load i32, ptr %8, align 4, !tbaa !9
  %23 = load i32, ptr %9, align 4, !tbaa !9
  %24 = icmp sge i32 %22, %23
  %25 = zext i1 %24 to i32
  store i32 %25, ptr %8, align 4, !tbaa !9
  %26 = load i32, ptr %8, align 4, !tbaa !9
  %27 = icmp ne i32 %26, 0
  br i1 %27, label %28, label %112

28:                                               ; preds = %2
  %29 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %29, ptr %8, align 4, !tbaa !9
  store i32 1073741824, ptr %9, align 4, !tbaa !9
  %30 = load i32, ptr %9, align 4, !tbaa !9
  %31 = load i32, ptr %8, align 4, !tbaa !9
  %32 = and i32 %31, %30
  store i32 %32, ptr %8, align 4, !tbaa !9
  %33 = load i32, ptr %8, align 4, !tbaa !9
  %34 = icmp ne i32 %33, 0
  %35 = xor i1 %34, true
  %36 = zext i1 %35 to i32
  store i32 %36, ptr %8, align 4, !tbaa !9
  %37 = load i32, ptr %8, align 4, !tbaa !9
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %39, label %47

39:                                               ; preds = %28
  %40 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %40, ptr %8, align 4, !tbaa !9
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.w2c_hermes, ptr %41, i32 0, i32 6
  %43 = load i32, ptr %8, align 4, !tbaa !9
  %44 = zext i32 %43 to i64
  %45 = call i32 @i32_load(ptr noundef %42, i64 noundef %44)
  store i32 %45, ptr %8, align 4, !tbaa !9
  %46 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %46, ptr %6, align 4, !tbaa !9
  br label %99

47:                                               ; preds = %28
  %48 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %48, ptr %8, align 4, !tbaa !9
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.w2c_hermes, ptr %49, i32 0, i32 6
  %51 = load i32, ptr %8, align 4, !tbaa !9
  %52 = zext i32 %51 to i64
  %53 = add i64 %52, 4
  %54 = call i32 @i32_load(ptr noundef %50, i64 noundef %53)
  store i32 %54, ptr %8, align 4, !tbaa !9
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.w2c_hermes, ptr %55, i32 0, i32 6
  %57 = load i32, ptr %8, align 4, !tbaa !9
  %58 = zext i32 %57 to i64
  %59 = call i64 @i64_load(ptr noundef %56, i64 noundef %58)
  store i64 %59, ptr %12, align 8, !tbaa !11
  %60 = load i64, ptr %12, align 8, !tbaa !11
  store i64 %60, ptr %7, align 8, !tbaa !11
  store i64 48, ptr %13, align 8, !tbaa !11
  %61 = load i64, ptr %12, align 8, !tbaa !11
  %62 = load i64, ptr %13, align 8, !tbaa !11
  %63 = and i64 %62, 63
  %64 = ashr i64 %61, %63
  store i64 %64, ptr %12, align 8, !tbaa !11
  %65 = load i64, ptr %12, align 8, !tbaa !11
  %66 = trunc i64 %65 to i32
  store i32 %66, ptr %8, align 4, !tbaa !9
  store i32 -3, ptr %9, align 4, !tbaa !9
  %67 = load i32, ptr %8, align 4, !tbaa !9
  %68 = load i32, ptr %9, align 4, !tbaa !9
  %69 = icmp ne i32 %67, %68
  %70 = zext i1 %69 to i32
  store i32 %70, ptr %8, align 4, !tbaa !9
  %71 = load i32, ptr %8, align 4, !tbaa !9
  %72 = icmp ne i32 %71, 0
  br i1 %72, label %73, label %74

73:                                               ; preds = %47
  br label %118

74:                                               ; preds = %47
  %75 = load i64, ptr %7, align 8, !tbaa !11
  store i64 %75, ptr %12, align 8, !tbaa !11
  store i64 -844424930131969, ptr %13, align 8, !tbaa !11
  %76 = load i64, ptr %12, align 8, !tbaa !11
  %77 = load i64, ptr %13, align 8, !tbaa !11
  %78 = icmp ule i64 %76, %77
  %79 = zext i1 %78 to i32
  store i32 %79, ptr %8, align 4, !tbaa !9
  %80 = load i32, ptr %8, align 4, !tbaa !9
  %81 = icmp ne i32 %80, 0
  br i1 %81, label %82, label %83

82:                                               ; preds = %74
  br label %124

83:                                               ; preds = %74
  %84 = load i64, ptr %7, align 8, !tbaa !11
  store i64 %84, ptr %12, align 8, !tbaa !11
  %85 = load i64, ptr %12, align 8, !tbaa !11
  %86 = trunc i64 %85 to i32
  store i32 %86, ptr %8, align 4, !tbaa !9
  %87 = load ptr, ptr %3, align 8, !tbaa !5
  %88 = load i32, ptr %8, align 4, !tbaa !9
  %89 = call i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AStringPrimitive0x3A0x3AcastToUTF16Pointer0x280x290x20const(ptr noundef %87, i32 noundef %88)
  store i32 %89, ptr %8, align 4, !tbaa !9
  %90 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %90, ptr %6, align 4, !tbaa !9
  %91 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %91, ptr %8, align 4, !tbaa !9
  %92 = load ptr, ptr %3, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.w2c_hermes, ptr %92, i32 0, i32 6
  %94 = load i32, ptr %8, align 4, !tbaa !9
  %95 = zext i32 %94 to i64
  %96 = add i64 %95, 8
  %97 = call i32 @i32_load(ptr noundef %93, i64 noundef %96)
  store i32 %97, ptr %8, align 4, !tbaa !9
  %98 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %98, ptr %5, align 4, !tbaa !9
  br label %99

99:                                               ; preds = %83, %39
  %100 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %100, ptr %8, align 4, !tbaa !9
  %101 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %101, ptr %9, align 4, !tbaa !9
  store i32 1073741823, ptr %10, align 4, !tbaa !9
  %102 = load i32, ptr %10, align 4, !tbaa !9
  %103 = load i32, ptr %9, align 4, !tbaa !9
  %104 = and i32 %103, %102
  store i32 %104, ptr %9, align 4, !tbaa !9
  store i32 1, ptr %10, align 4, !tbaa !9
  %105 = load i32, ptr %10, align 4, !tbaa !9
  %106 = and i32 %105, 31
  %107 = load i32, ptr %9, align 4, !tbaa !9
  %108 = shl i32 %107, %106
  store i32 %108, ptr %9, align 4, !tbaa !9
  %109 = load i32, ptr %9, align 4, !tbaa !9
  %110 = load i32, ptr %8, align 4, !tbaa !9
  %111 = add i32 %110, %109
  store i32 %111, ptr %8, align 4, !tbaa !9
  br label %130

112:                                              ; preds = %2
  store i32 147758, ptr %8, align 4, !tbaa !9
  store i32 76914, ptr %9, align 4, !tbaa !9
  store i32 353, ptr %10, align 4, !tbaa !9
  store i32 46033, ptr %11, align 4, !tbaa !9
  %113 = load ptr, ptr %3, align 8, !tbaa !5
  %114 = load i32, ptr %8, align 4, !tbaa !9
  %115 = load i32, ptr %9, align 4, !tbaa !9
  %116 = load i32, ptr %10, align 4, !tbaa !9
  %117 = load i32, ptr %11, align 4, !tbaa !9
  call void @w2c_hermes_0x5F_assert_fail(ptr noundef %113, i32 noundef %114, i32 noundef %115, i32 noundef %116, i32 noundef %117)
  call void @wasm_rt_trap(i32 noundef 5) #6
  unreachable

118:                                              ; preds = %73
  store i32 118502, ptr %8, align 4, !tbaa !9
  store i32 83341, ptr %9, align 4, !tbaa !9
  store i32 470, ptr %10, align 4, !tbaa !9
  store i32 87089, ptr %11, align 4, !tbaa !9
  %119 = load ptr, ptr %3, align 8, !tbaa !5
  %120 = load i32, ptr %8, align 4, !tbaa !9
  %121 = load i32, ptr %9, align 4, !tbaa !9
  %122 = load i32, ptr %10, align 4, !tbaa !9
  %123 = load i32, ptr %11, align 4, !tbaa !9
  call void @w2c_hermes_0x5F_assert_fail(ptr noundef %119, i32 noundef %120, i32 noundef %121, i32 noundef %122, i32 noundef %123)
  call void @wasm_rt_trap(i32 noundef 5) #6
  unreachable

124:                                              ; preds = %82
  store i32 118273, ptr %8, align 4, !tbaa !9
  store i32 83341, ptr %9, align 4, !tbaa !9
  store i32 438, ptr %10, align 4, !tbaa !9
  store i32 49706, ptr %11, align 4, !tbaa !9
  %125 = load ptr, ptr %3, align 8, !tbaa !5
  %126 = load i32, ptr %8, align 4, !tbaa !9
  %127 = load i32, ptr %9, align 4, !tbaa !9
  %128 = load i32, ptr %10, align 4, !tbaa !9
  %129 = load i32, ptr %11, align 4, !tbaa !9
  call void @w2c_hermes_0x5F_assert_fail(ptr noundef %125, i32 noundef %126, i32 noundef %127, i32 noundef %128, i32 noundef %129)
  call void @wasm_rt_trap(i32 noundef 5) #6
  unreachable

130:                                              ; preds = %99
  %131 = load i32, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  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 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  ret i32 %131
}

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 i32 @i32_load(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
declare dso_local i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AStringPrimitive0x3A0x3AcastToUTF16Pointer0x280x290x20const(ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AStringView0x3A0x3AcastToChar16Ptr0x280x290x20const(ptr noundef %0, i32 noundef %1) local_unnamed_addr #3 {
  %3 = getelementptr inbounds i8, ptr %0, i64 40
  %4 = zext i32 %1 to i64
  %5 = add nuw nsw i64 %4, 8
  %6 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %5)
  %7 = icmp sgt i32 %6, -1
  br i1 %7, label %8, label %24

8:                                                ; preds = %2
  %.not = icmp ult i32 %6, 1073741824
  br i1 %.not, label %9, label %11

9:                                                ; preds = %8
  %10 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %4)
  br label %20

11:                                               ; preds = %8
  %12 = add nuw nsw i64 %4, 4
  %13 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %12)
  %14 = zext i32 %13 to i64
  %15 = tail call i64 @i64_load(ptr noundef nonnull %3, i64 noundef %14)
  %.mask = and i64 %15, -281474976710656
  %.not67 = icmp eq i64 %.mask, -844424930131968
  br i1 %.not67, label %16, label %25

16:                                               ; preds = %11
  %17 = trunc i64 %15 to i32
  %18 = tail call i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AStringPrimitive0x3A0x3AcastToUTF16Pointer0x280x290x20const(ptr noundef %0, i32 noundef %17)
  %19 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %5)
  br label %20

20:                                               ; preds = %16, %9
  %.064 = phi i32 [ %6, %9 ], [ %19, %16 ]
  %.0 = phi i32 [ %10, %9 ], [ %18, %16 ]
  %21 = shl i32 %.064, 1
  %22 = and i32 %21, 2147483646
  %23 = add i32 %22, %.0
  ret i32 %23

24:                                               ; preds = %2
  tail call void @w2c_hermes_0x5F_assert_fail(ptr noundef %0, i32 noundef 147758, i32 noundef 76914, i32 noundef 353, i32 noundef 46033) #4
  tail call void @wasm_rt_trap(i32 noundef 5) #5
  unreachable

25:                                               ; preds = %11
  tail call void @w2c_hermes_0x5F_assert_fail(ptr noundef %0, i32 noundef 118502, i32 noundef 83341, i32 noundef 470, i32 noundef 87089) #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,JumpThreadingPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass