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

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
define dso_local void @w2c_hermes_hermes0x3A0x3Ahbc0x3A0x3ABCProviderFromSrc0x3A0x3AgetStringTableEntry0x28unsigned0x20int0x290x20const(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #4 {
  %5 = alloca ptr, align 8
  %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
  %14 = alloca i64, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !9
  store i32 %3, 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
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %15 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %15, ptr %9, align 4, !tbaa !9
  %16 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %16, ptr %10, align 4, !tbaa !9
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.w2c_hermes, ptr %17, i32 0, i32 6
  %19 = load i32, ptr %10, align 4, !tbaa !9
  %20 = zext i32 %19 to i64
  %21 = add i64 %20, 16
  %22 = call i32 @i32_load(ptr noundef %18, i64 noundef %21)
  store i32 %22, ptr %10, align 4, !tbaa !9
  %23 = load i32, ptr %9, align 4, !tbaa !9
  %24 = load i32, ptr %10, align 4, !tbaa !9
  %25 = icmp ult i32 %23, %24
  %26 = zext i1 %25 to i32
  store i32 %26, ptr %9, align 4, !tbaa !9
  %27 = load i32, ptr %9, align 4, !tbaa !9
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %29, label %88

29:                                               ; preds = %4
  %30 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %30, ptr %9, align 4, !tbaa !9
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.w2c_hermes, ptr %31, i32 0, i32 6
  %33 = load i32, ptr %9, align 4, !tbaa !9
  %34 = zext i32 %33 to i64
  %35 = add i64 %34, 144
  %36 = call i32 @i32_load(ptr noundef %32, i64 noundef %35)
  store i32 %36, ptr %9, align 4, !tbaa !9
  %37 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %37, ptr %7, align 4, !tbaa !9
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.w2c_hermes, ptr %38, i32 0, i32 6
  %40 = load i32, ptr %9, align 4, !tbaa !9
  %41 = zext i32 %40 to i64
  %42 = add i64 %41, 44
  %43 = call i32 @i32_load(ptr noundef %39, i64 noundef %42)
  store i32 %43, ptr %9, align 4, !tbaa !9
  %44 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %44, ptr %10, align 4, !tbaa !9
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.w2c_hermes, ptr %45, i32 0, i32 6
  %47 = load i32, ptr %10, align 4, !tbaa !9
  %48 = zext i32 %47 to i64
  %49 = add i64 %48, 40
  %50 = call i32 @i32_load(ptr noundef %46, i64 noundef %49)
  store i32 %50, ptr %10, align 4, !tbaa !9
  %51 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %51, ptr %7, align 4, !tbaa !9
  %52 = load i32, ptr %10, align 4, !tbaa !9
  %53 = load i32, ptr %9, align 4, !tbaa !9
  %54 = sub i32 %53, %52
  store i32 %54, ptr %9, align 4, !tbaa !9
  store i32 3, ptr %10, align 4, !tbaa !9
  %55 = load i32, ptr %9, align 4, !tbaa !9
  %56 = load i32, ptr %10, align 4, !tbaa !9
  %57 = and i32 %56, 31
  %58 = ashr i32 %55, %57
  store i32 %58, ptr %9, align 4, !tbaa !9
  %59 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %59, ptr %10, align 4, !tbaa !9
  %60 = load i32, ptr %9, align 4, !tbaa !9
  %61 = load i32, ptr %10, align 4, !tbaa !9
  %62 = icmp ule i32 %60, %61
  %63 = zext i1 %62 to i32
  store i32 %63, ptr %9, align 4, !tbaa !9
  %64 = load i32, ptr %9, align 4, !tbaa !9
  %65 = icmp ne i32 %64, 0
  br i1 %65, label %66, label %67

66:                                               ; preds = %29
  br label %106

67:                                               ; preds = %29
  %68 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %68, ptr %9, align 4, !tbaa !9
  %69 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %69, ptr %10, align 4, !tbaa !9
  %70 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %70, ptr %11, align 4, !tbaa !9
  store i32 3, ptr %12, align 4, !tbaa !9
  %71 = load i32, ptr %12, align 4, !tbaa !9
  %72 = and i32 %71, 31
  %73 = load i32, ptr %11, align 4, !tbaa !9
  %74 = shl i32 %73, %72
  store i32 %74, ptr %11, align 4, !tbaa !9
  %75 = load i32, ptr %11, align 4, !tbaa !9
  %76 = load i32, ptr %10, align 4, !tbaa !9
  %77 = add i32 %76, %75
  store i32 %77, ptr %10, align 4, !tbaa !9
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.w2c_hermes, ptr %78, i32 0, i32 6
  %80 = load i32, ptr %10, align 4, !tbaa !9
  %81 = zext i32 %80 to i64
  %82 = call i64 @i64_load(ptr noundef %79, i64 noundef %81)
  store i64 %82, ptr %14, align 8, !tbaa !11
  %83 = load ptr, ptr %5, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.w2c_hermes, ptr %83, i32 0, i32 6
  %85 = load i32, ptr %9, align 4, !tbaa !9
  %86 = zext i32 %85 to i64
  %87 = load i64, ptr %14, align 8, !tbaa !11
  call void @i64_store(ptr noundef %84, i64 noundef %86, i64 noundef %87)
  br label %124

88:                                               ; preds = %4
  store i32 0, ptr %9, align 4, !tbaa !9
  %89 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %89, ptr %8, align 4, !tbaa !9
  store i32 126823, ptr %10, align 4, !tbaa !9
  %90 = load i32, ptr %10, align 4, !tbaa !9
  %91 = load i32, ptr %9, align 4, !tbaa !9
  %92 = add i32 %91, %90
  store i32 %92, ptr %9, align 4, !tbaa !9
  %93 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %93, ptr %10, align 4, !tbaa !9
  store i32 85619, ptr %11, align 4, !tbaa !9
  %94 = load i32, ptr %11, align 4, !tbaa !9
  %95 = load i32, ptr %10, align 4, !tbaa !9
  %96 = add i32 %95, %94
  store i32 %96, ptr %10, align 4, !tbaa !9
  store i32 189, ptr %11, align 4, !tbaa !9
  %97 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %97, ptr %12, align 4, !tbaa !9
  store i32 17596, ptr %13, align 4, !tbaa !9
  %98 = load i32, ptr %13, align 4, !tbaa !9
  %99 = load i32, ptr %12, align 4, !tbaa !9
  %100 = add i32 %99, %98
  store i32 %100, ptr %12, align 4, !tbaa !9
  %101 = load ptr, ptr %5, align 8, !tbaa !5
  %102 = load i32, ptr %9, align 4, !tbaa !9
  %103 = load i32, ptr %10, align 4, !tbaa !9
  %104 = load i32, ptr %11, align 4, !tbaa !9
  %105 = load i32, ptr %12, align 4, !tbaa !9
  call void @w2c_hermes_0x5F_assert_fail(ptr noundef %101, i32 noundef %102, i32 noundef %103, i32 noundef %104, i32 noundef %105)
  call void @wasm_rt_trap(i32 noundef 5) #6
  unreachable

106:                                              ; preds = %66
  store i32 0, ptr %9, align 4, !tbaa !9
  %107 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %107, ptr %8, align 4, !tbaa !9
  store i32 202939, ptr %10, align 4, !tbaa !9
  %108 = load i32, ptr %10, align 4, !tbaa !9
  %109 = load i32, ptr %9, align 4, !tbaa !9
  %110 = add i32 %109, %108
  store i32 %110, ptr %9, align 4, !tbaa !9
  %111 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %111, ptr %10, align 4, !tbaa !9
  store i32 82833, ptr %11, align 4, !tbaa !9
  %112 = load i32, ptr %11, align 4, !tbaa !9
  %113 = load i32, ptr %10, align 4, !tbaa !9
  %114 = add i32 %113, %112
  store i32 %114, ptr %10, align 4, !tbaa !9
  store i32 241, ptr %11, align 4, !tbaa !9
  %115 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %115, ptr %12, align 4, !tbaa !9
  store i32 108367, ptr %13, align 4, !tbaa !9
  %116 = load i32, ptr %13, align 4, !tbaa !9
  %117 = load i32, ptr %12, align 4, !tbaa !9
  %118 = add i32 %117, %116
  store i32 %118, ptr %12, align 4, !tbaa !9
  %119 = load ptr, ptr %5, align 8, !tbaa !5
  %120 = load i32, ptr %9, align 4, !tbaa !9
  %121 = load i32, ptr %10, align 4, !tbaa !9
  %122 = load i32, ptr %11, align 4, !tbaa !9
  %123 = load i32, ptr %12, 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 = %67
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  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
  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 = { 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: inlinehint nounwind uwtable
declare hidden i32 @i32_load(ptr noundef, i64 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 i64 @i64_load(ptr noundef, i64 noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local void @w2c_hermes_hermes0x3A0x3Ahbc0x3A0x3ABCProviderFromSrc0x3A0x3AgetStringTableEntry0x28unsigned0x20int0x290x20const(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #3 {
  %5 = getelementptr inbounds i8, ptr %0, i64 40
  %6 = zext i32 %2 to i64
  %7 = add nuw nsw i64 %6, 16
  %8 = tail call i32 @i32_load(ptr noundef nonnull %5, i64 noundef %7)
  %9 = icmp ugt i32 %8, %3
  br i1 %9, label %10, label %26

10:                                               ; preds = %4
  %11 = add nuw nsw i64 %6, 144
  %12 = tail call i32 @i32_load(ptr noundef nonnull %5, i64 noundef %11)
  %13 = zext i32 %12 to i64
  %14 = add nuw nsw i64 %13, 44
  %15 = tail call i32 @i32_load(ptr noundef nonnull %5, i64 noundef %14)
  %16 = add nuw nsw i64 %13, 40
  %17 = tail call i32 @i32_load(ptr noundef nonnull %5, i64 noundef %16)
  %18 = sub i32 %15, %17
  %19 = ashr i32 %18, 3
  %.not = icmp ugt i32 %19, %3
  br i1 %.not, label %20, label %27

20:                                               ; preds = %10
  %21 = shl i32 %3, 3
  %22 = add i32 %17, %21
  %23 = zext i32 %22 to i64
  %24 = tail call i64 @i64_load(ptr noundef nonnull %5, i64 noundef %23)
  %25 = zext i32 %1 to i64
  tail call void @i64_store(ptr noundef nonnull %5, i64 noundef %25, i64 noundef %24)
  ret void

26:                                               ; preds = %4
  tail call void @w2c_hermes_0x5F_assert_fail(ptr noundef %0, i32 noundef 126823, i32 noundef 85619, i32 noundef 189, i32 noundef 17596) #4
  tail call void @wasm_rt_trap(i32 noundef 5) #5
  unreachable

27:                                               ; preds = %10
  tail call void @w2c_hermes_0x5F_assert_fail(ptr noundef %0, i32 noundef 202939, i32 noundef 82833, i32 noundef 241, i32 noundef 108367) #4
  tail call void @wasm_rt_trap(i32 noundef 5) #5
  unreachable
}

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,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass