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

; 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

declare void @w2c_hermes_0x5F_assert_fail(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #1

; Function Attrs: noreturn
declare void @wasm_rt_trap(i32 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3ACardTable0x3A0x3AfirstObjForCard0x28unsigned0x20int0x290x20const(ptr noundef %0, i32 noundef %1, i32 noundef %2) #3 {
  %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
  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
  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
  %13 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %13, ptr %8, align 4, !tbaa !9
  %14 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %14, ptr %9, align 4, !tbaa !9
  %15 = load i32, ptr %9, align 4, !tbaa !9
  %16 = load i32, ptr %8, align 4, !tbaa !9
  %17 = add i32 %16, %15
  store i32 %17, ptr %8, align 4, !tbaa !9
  store i32 -8192, ptr %9, align 4, !tbaa !9
  %18 = load i32, ptr %9, align 4, !tbaa !9
  %19 = load i32, ptr %8, align 4, !tbaa !9
  %20 = sub i32 %19, %18
  store i32 %20, ptr %8, 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 %8, align 4, !tbaa !9
  %24 = zext i32 %23 to i64
  %25 = call i32 @i32_load8_s(ptr noundef %22, i64 noundef %24)
  store i32 %25, ptr %8, align 4, !tbaa !9
  %26 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %26, ptr %7, align 4, !tbaa !9
  store i32 0, ptr %9, align 4, !tbaa !9
  %27 = load i32, ptr %8, align 4, !tbaa !9
  %28 = load i32, ptr %9, align 4, !tbaa !9
  %29 = icmp slt i32 %27, %28
  %30 = zext i1 %29 to i32
  store i32 %30, ptr %8, align 4, !tbaa !9
  %31 = load i32, ptr %8, align 4, !tbaa !9
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %33, label %69

33:                                               ; preds = %3
  br label %34

34:                                               ; preds = %67, %33
  %35 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %35, ptr %8, align 4, !tbaa !9
  store i32 -1, ptr %9, align 4, !tbaa !9
  %36 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %36, ptr %10, align 4, !tbaa !9
  store i32 -1, ptr %11, align 4, !tbaa !9
  %37 = load i32, ptr %11, align 4, !tbaa !9
  %38 = load i32, ptr %10, align 4, !tbaa !9
  %39 = xor i32 %38, %37
  store i32 %39, ptr %10, align 4, !tbaa !9
  %40 = load i32, ptr %10, align 4, !tbaa !9
  %41 = and i32 %40, 31
  %42 = load i32, ptr %9, align 4, !tbaa !9
  %43 = shl i32 %42, %41
  store i32 %43, ptr %9, align 4, !tbaa !9
  %44 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %44, ptr %10, align 4, !tbaa !9
  %45 = load i32, ptr %10, align 4, !tbaa !9
  %46 = load i32, ptr %9, align 4, !tbaa !9
  %47 = add i32 %46, %45
  store i32 %47, ptr %9, align 4, !tbaa !9
  %48 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %48, ptr %6, align 4, !tbaa !9
  %49 = load i32, ptr %9, align 4, !tbaa !9
  %50 = load i32, ptr %8, align 4, !tbaa !9
  %51 = add i32 %50, %49
  store i32 %51, ptr %8, align 4, !tbaa !9
  store i32 -8192, ptr %9, align 4, !tbaa !9
  %52 = load i32, ptr %9, align 4, !tbaa !9
  %53 = load i32, ptr %8, align 4, !tbaa !9
  %54 = sub i32 %53, %52
  store i32 %54, ptr %8, align 4, !tbaa !9
  %55 = load ptr, ptr %4, 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 i32 @i32_load8_s(ptr noundef %56, i64 noundef %58)
  store i32 %59, ptr %8, align 4, !tbaa !9
  %60 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %60, ptr %7, align 4, !tbaa !9
  store i32 0, ptr %9, align 4, !tbaa !9
  %61 = load i32, ptr %8, align 4, !tbaa !9
  %62 = load i32, ptr %9, align 4, !tbaa !9
  %63 = icmp slt i32 %61, %62
  %64 = zext i1 %63 to i32
  store i32 %64, ptr %8, align 4, !tbaa !9
  %65 = load i32, ptr %8, align 4, !tbaa !9
  %66 = icmp ne i32 %65, 0
  br i1 %66, label %67, label %68

67:                                               ; preds = %34
  br label %34

68:                                               ; preds = %34
  br label %69

69:                                               ; preds = %68, %3
  %70 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %70, ptr %8, align 4, !tbaa !9
  store i32 8193, ptr %9, align 4, !tbaa !9
  %71 = load i32, ptr %8, align 4, !tbaa !9
  %72 = load i32, ptr %9, align 4, !tbaa !9
  %73 = icmp ult i32 %71, %72
  %74 = zext i1 %73 to i32
  store i32 %74, ptr %8, align 4, !tbaa !9
  %75 = load i32, ptr %8, align 4, !tbaa !9
  %76 = icmp ne i32 %75, 0
  br i1 %76, label %77, label %115

77:                                               ; preds = %69
  %78 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %78, ptr %8, align 4, !tbaa !9
  %79 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %79, ptr %9, align 4, !tbaa !9
  store i32 9, ptr %10, align 4, !tbaa !9
  %80 = load i32, ptr %10, align 4, !tbaa !9
  %81 = and i32 %80, 31
  %82 = load i32, ptr %9, align 4, !tbaa !9
  %83 = shl i32 %82, %81
  store i32 %83, ptr %9, align 4, !tbaa !9
  %84 = load i32, ptr %9, align 4, !tbaa !9
  %85 = load i32, ptr %8, align 4, !tbaa !9
  %86 = add i32 %85, %84
  store i32 %86, ptr %8, align 4, !tbaa !9
  %87 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %87, ptr %6, align 4, !tbaa !9
  %88 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %88, ptr %9, align 4, !tbaa !9
  store i32 -4194304, ptr %10, align 4, !tbaa !9
  %89 = load i32, ptr %10, align 4, !tbaa !9
  %90 = load i32, ptr %9, align 4, !tbaa !9
  %91 = and i32 %90, %89
  store i32 %91, ptr %9, align 4, !tbaa !9
  store i32 4194304, ptr %10, align 4, !tbaa !9
  %92 = load i32, ptr %10, align 4, !tbaa !9
  %93 = load i32, ptr %9, align 4, !tbaa !9
  %94 = add i32 %93, %92
  store i32 %94, ptr %9, align 4, !tbaa !9
  %95 = load i32, ptr %8, align 4, !tbaa !9
  %96 = load i32, ptr %9, align 4, !tbaa !9
  %97 = icmp ugt i32 %95, %96
  %98 = zext i1 %97 to i32
  store i32 %98, ptr %8, align 4, !tbaa !9
  %99 = load i32, ptr %8, align 4, !tbaa !9
  %100 = icmp ne i32 %99, 0
  br i1 %100, label %101, label %102

101:                                              ; preds = %77
  br label %133

102:                                              ; preds = %77
  %103 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %103, ptr %8, align 4, !tbaa !9
  %104 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %104, ptr %9, align 4, !tbaa !9
  store i32 255, ptr %10, align 4, !tbaa !9
  %105 = load i32, ptr %10, align 4, !tbaa !9
  %106 = load i32, ptr %9, align 4, !tbaa !9
  %107 = and i32 %106, %105
  store i32 %107, ptr %9, align 4, !tbaa !9
  store i32 3, ptr %10, align 4, !tbaa !9
  %108 = load i32, ptr %10, align 4, !tbaa !9
  %109 = and i32 %108, 31
  %110 = load i32, ptr %9, align 4, !tbaa !9
  %111 = shl i32 %110, %109
  store i32 %111, ptr %9, align 4, !tbaa !9
  %112 = load i32, ptr %9, align 4, !tbaa !9
  %113 = load i32, ptr %8, align 4, !tbaa !9
  %114 = sub i32 %113, %112
  store i32 %114, ptr %8, align 4, !tbaa !9
  br label %151

115:                                              ; preds = %69
  store i32 0, ptr %8, align 4, !tbaa !9
  %116 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %116, ptr %6, align 4, !tbaa !9
  store i32 169648, ptr %9, align 4, !tbaa !9
  %117 = load i32, ptr %9, align 4, !tbaa !9
  %118 = load i32, ptr %8, align 4, !tbaa !9
  %119 = add i32 %118, %117
  store i32 %119, ptr %8, align 4, !tbaa !9
  %120 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %120, ptr %9, align 4, !tbaa !9
  store i32 86311, ptr %10, align 4, !tbaa !9
  %121 = load i32, ptr %10, align 4, !tbaa !9
  %122 = load i32, ptr %9, align 4, !tbaa !9
  %123 = add i32 %122, %121
  store i32 %123, ptr %9, align 4, !tbaa !9
  store i32 305, ptr %10, align 4, !tbaa !9
  %124 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %124, ptr %11, align 4, !tbaa !9
  store i32 40994, ptr %12, align 4, !tbaa !9
  %125 = load i32, ptr %12, align 4, !tbaa !9
  %126 = load i32, ptr %11, align 4, !tbaa !9
  %127 = add i32 %126, %125
  store i32 %127, ptr %11, align 4, !tbaa !9
  %128 = load ptr, ptr %4, align 8, !tbaa !5
  %129 = load i32, ptr %8, align 4, !tbaa !9
  %130 = load i32, ptr %9, align 4, !tbaa !9
  %131 = load i32, ptr %10, align 4, !tbaa !9
  %132 = load i32, ptr %11, align 4, !tbaa !9
  call void @w2c_hermes_0x5F_assert_fail(ptr noundef %128, i32 noundef %129, i32 noundef %130, i32 noundef %131, i32 noundef %132)
  call void @wasm_rt_trap(i32 noundef 5) #6
  unreachable

133:                                              ; preds = %101
  store i32 0, ptr %8, align 4, !tbaa !9
  %134 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %134, ptr %6, align 4, !tbaa !9
  store i32 170960, ptr %9, align 4, !tbaa !9
  %135 = load i32, ptr %9, align 4, !tbaa !9
  %136 = load i32, ptr %8, align 4, !tbaa !9
  %137 = add i32 %136, %135
  store i32 %137, ptr %8, align 4, !tbaa !9
  %138 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %138, ptr %9, align 4, !tbaa !9
  store i32 86311, ptr %10, align 4, !tbaa !9
  %139 = load i32, ptr %10, align 4, !tbaa !9
  %140 = load i32, ptr %9, align 4, !tbaa !9
  %141 = add i32 %140, %139
  store i32 %141, ptr %9, align 4, !tbaa !9
  store i32 309, ptr %10, align 4, !tbaa !9
  %142 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %142, ptr %11, align 4, !tbaa !9
  store i32 40994, ptr %12, align 4, !tbaa !9
  %143 = load i32, ptr %12, align 4, !tbaa !9
  %144 = load i32, ptr %11, align 4, !tbaa !9
  %145 = add i32 %144, %143
  store i32 %145, ptr %11, align 4, !tbaa !9
  %146 = load ptr, ptr %4, align 8, !tbaa !5
  %147 = load i32, ptr %8, align 4, !tbaa !9
  %148 = load i32, ptr %9, align 4, !tbaa !9
  %149 = load i32, ptr %10, align 4, !tbaa !9
  %150 = load i32, ptr %11, align 4, !tbaa !9
  call void @w2c_hermes_0x5F_assert_fail(ptr noundef %146, i32 noundef %147, i32 noundef %148, i32 noundef %149, i32 noundef %150)
  call void @wasm_rt_trap(i32 noundef 5) #6
  unreachable

151:                                              ; preds = %102
  %152 = load i32, ptr %8, align 4, !tbaa !9
  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 %152
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 = { 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 #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"

declare void @w2c_hermes_0x5F_assert_fail(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: noreturn
declare void @wasm_rt_trap(i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3ACardTable0x3A0x3AfirstObjForCard0x28unsigned0x20int0x290x20const(ptr noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #2 {
  %4 = add i32 %1, 8192
  %5 = add i32 %4, %2
  %6 = getelementptr inbounds i8, ptr %0, i64 40
  %7 = zext i32 %5 to i64
  %8 = tail call i32 @i32_load8_s(ptr noundef nonnull %6, i64 noundef %7)
  %9 = icmp slt i32 %8, 0
  br i1 %9, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %3, %.preheader
  %.087 = phi i32 [ %13, %.preheader ], [ %2, %3 ]
  %.0 = phi i32 [ %16, %.preheader ], [ %8, %3 ]
  %10 = and i32 %.0, 31
  %11 = xor i32 %10, 31
  %12 = shl nsw i32 -1, %11
  %13 = add i32 %12, %.087
  %14 = add i32 %4, %13
  %15 = zext i32 %14 to i64
  %16 = tail call i32 @i32_load8_s(ptr noundef nonnull %6, i64 noundef %15)
  %17 = icmp slt i32 %16, 0
  br i1 %17, label %.preheader, label %.loopexit

.loopexit:                                        ; preds = %.preheader, %3
  %.188 = phi i32 [ %2, %3 ], [ %13, %.preheader ]
  %.1 = phi i32 [ %8, %3 ], [ %16, %.preheader ]
  %18 = icmp ult i32 %.188, 8193
  br i1 %18, label %19, label %29

19:                                               ; preds = %.loopexit
  %20 = shl nuw nsw i32 %.188, 9
  %21 = add i32 %20, %1
  %22 = and i32 %1, -4194304
  %23 = add i32 %22, 4194304
  %24 = icmp ugt i32 %21, %23
  br i1 %24, label %30, label %25

25:                                               ; preds = %19
  %26 = shl i32 %.1, 3
  %27 = and i32 %26, 2040
  %28 = sub i32 %21, %27
  ret i32 %28

29:                                               ; preds = %.loopexit
  tail call void @w2c_hermes_0x5F_assert_fail(ptr noundef %0, i32 noundef 169648, i32 noundef 86311, i32 noundef 305, i32 noundef 40994) #4
  tail call void @wasm_rt_trap(i32 noundef 5) #5
  unreachable

30:                                               ; preds = %19
  tail call void @w2c_hermes_0x5F_assert_fail(ptr noundef %0, i32 noundef 170960, i32 noundef 86311, i32 noundef 309, i32 noundef 40994) #4
  tail call void @wasm_rt_trap(i32 noundef 5) #5
  unreachable
}

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

attributes #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 = { 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 = { 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 #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,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass