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

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

; Function Attrs: nounwind uwtable
define dso_local void @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AHadesGC0x3A0x3ArelocationWriteBarrier0x28void0x20const0x2A0x2C0x20void0x20const0x2A0x29(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 i32, align 4
  %15 = alloca i32, align 4
  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
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !9
  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 4, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %16 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %16, ptr %11, 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 %11, align 4, !tbaa !9
  %20 = zext i32 %19 to i64
  %21 = add i64 %20, 588
  %22 = call i32 @i32_load(ptr noundef %18, i64 noundef %21)
  store i32 %22, ptr %11, align 4, !tbaa !9
  %23 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %23, ptr %10, align 4, !tbaa !9
  %24 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %24, ptr %12, align 4, !tbaa !9
  store i32 -4194304, ptr %13, align 4, !tbaa !9
  %25 = load i32, ptr %13, align 4, !tbaa !9
  %26 = load i32, ptr %12, align 4, !tbaa !9
  %27 = and i32 %26, %25
  store i32 %27, ptr %12, align 4, !tbaa !9
  %28 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %28, ptr %9, align 4, !tbaa !9
  %29 = load i32, ptr %11, align 4, !tbaa !9
  %30 = load i32, ptr %12, align 4, !tbaa !9
  %31 = icmp ne i32 %29, %30
  %32 = zext i1 %31 to i32
  store i32 %32, ptr %11, align 4, !tbaa !9
  %33 = load i32, ptr %11, align 4, !tbaa !9
  %34 = icmp ne i32 %33, 0
  br i1 %34, label %35, label %120

35:                                               ; preds = %4
  %36 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %36, ptr %11, align 4, !tbaa !9
  %37 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %37, ptr %12, align 4, !tbaa !9
  %38 = load i32, ptr %12, align 4, !tbaa !9
  %39 = load i32, ptr %11, align 4, !tbaa !9
  %40 = xor i32 %39, %38
  store i32 %40, ptr %11, align 4, !tbaa !9
  store i32 4194304, ptr %12, align 4, !tbaa !9
  %41 = load i32, ptr %11, align 4, !tbaa !9
  %42 = load i32, ptr %12, align 4, !tbaa !9
  %43 = icmp ult i32 %41, %42
  %44 = zext i1 %43 to i32
  store i32 %44, ptr %11, align 4, !tbaa !9
  %45 = load i32, ptr %11, align 4, !tbaa !9
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %47, label %48

47:                                               ; preds = %35
  br label %119

48:                                               ; preds = %35
  %49 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %49, ptr %11, align 4, !tbaa !9
  store i32 -4194304, ptr %12, align 4, !tbaa !9
  %50 = load i32, ptr %12, align 4, !tbaa !9
  %51 = load i32, ptr %11, align 4, !tbaa !9
  %52 = and i32 %51, %50
  store i32 %52, ptr %11, align 4, !tbaa !9
  %53 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %53, ptr %8, align 4, !tbaa !9
  %54 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %54, ptr %12, align 4, !tbaa !9
  %55 = load i32, ptr %11, align 4, !tbaa !9
  %56 = load i32, ptr %12, align 4, !tbaa !9
  %57 = icmp ne i32 %55, %56
  %58 = zext i1 %57 to i32
  store i32 %58, ptr %11, align 4, !tbaa !9
  %59 = load i32, ptr %11, align 4, !tbaa !9
  %60 = icmp ne i32 %59, 0
  br i1 %60, label %61, label %78

61:                                               ; preds = %48
  %62 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %62, ptr %11, align 4, !tbaa !9
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.w2c_hermes, ptr %63, i32 0, i32 6
  %65 = load i32, ptr %11, align 4, !tbaa !9
  %66 = zext i32 %65 to i64
  %67 = add i64 %66, 4448
  %68 = call i32 @i32_load(ptr noundef %64, i64 noundef %67)
  store i32 %68, ptr %11, align 4, !tbaa !9
  %69 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %69, ptr %12, align 4, !tbaa !9
  %70 = load i32, ptr %11, align 4, !tbaa !9
  %71 = load i32, ptr %12, align 4, !tbaa !9
  %72 = icmp ne i32 %70, %71
  %73 = zext i1 %72 to i32
  store i32 %73, ptr %11, align 4, !tbaa !9
  %74 = load i32, ptr %11, align 4, !tbaa !9
  %75 = icmp ne i32 %74, 0
  br i1 %75, label %76, label %77

76:                                               ; preds = %61
  br label %119

77:                                               ; preds = %61
  br label %78

78:                                               ; preds = %77, %48
  %79 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %79, ptr %11, align 4, !tbaa !9
  %80 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %80, ptr %12, align 4, !tbaa !9
  %81 = load i32, ptr %11, align 4, !tbaa !9
  %82 = load i32, ptr %12, align 4, !tbaa !9
  %83 = icmp ult i32 %81, %82
  %84 = zext i1 %83 to i32
  store i32 %84, ptr %11, align 4, !tbaa !9
  %85 = load i32, ptr %11, align 4, !tbaa !9
  %86 = icmp ne i32 %85, 0
  br i1 %86, label %87, label %88

87:                                               ; preds = %78
  br label %138

88:                                               ; preds = %78
  %89 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %89, ptr %11, align 4, !tbaa !9
  store i32 4194816, ptr %12, align 4, !tbaa !9
  %90 = load i32, ptr %12, align 4, !tbaa !9
  %91 = load i32, ptr %11, align 4, !tbaa !9
  %92 = add i32 %91, %90
  store i32 %92, ptr %11, align 4, !tbaa !9
  %93 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %93, ptr %12, align 4, !tbaa !9
  %94 = load i32, ptr %11, align 4, !tbaa !9
  %95 = load i32, ptr %12, align 4, !tbaa !9
  %96 = icmp ule i32 %94, %95
  %97 = zext i1 %96 to i32
  store i32 %97, ptr %11, align 4, !tbaa !9
  %98 = load i32, ptr %11, align 4, !tbaa !9
  %99 = icmp ne i32 %98, 0
  br i1 %99, label %100, label %101

100:                                              ; preds = %88
  br label %138

101:                                              ; preds = %88
  %102 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %102, ptr %11, align 4, !tbaa !9
  %103 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %103, ptr %12, align 4, !tbaa !9
  store i32 9, ptr %13, align 4, !tbaa !9
  %104 = load i32, ptr %13, align 4, !tbaa !9
  %105 = and i32 %104, 31
  %106 = load i32, ptr %12, align 4, !tbaa !9
  %107 = lshr i32 %106, %105
  store i32 %107, ptr %12, align 4, !tbaa !9
  store i32 8191, ptr %13, align 4, !tbaa !9
  %108 = load i32, ptr %13, align 4, !tbaa !9
  %109 = load i32, ptr %12, align 4, !tbaa !9
  %110 = and i32 %109, %108
  store i32 %110, ptr %12, align 4, !tbaa !9
  %111 = load i32, ptr %12, align 4, !tbaa !9
  %112 = load i32, ptr %11, align 4, !tbaa !9
  %113 = add i32 %112, %111
  store i32 %113, ptr %11, align 4, !tbaa !9
  store i32 1, ptr %12, align 4, !tbaa !9
  %114 = load ptr, ptr %5, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.w2c_hermes, ptr %114, i32 0, i32 6
  %116 = load i32, ptr %11, align 4, !tbaa !9
  %117 = zext i32 %116 to i64
  %118 = load i32, ptr %12, align 4, !tbaa !9
  call void @i32_store8(ptr noundef %115, i64 noundef %117, i32 noundef %118)
  br label %119

119:                                              ; preds = %101, %76, %47
  br label %156

120:                                              ; preds = %4
  store i32 0, ptr %11, align 4, !tbaa !9
  %121 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %121, ptr %7, align 4, !tbaa !9
  store i32 139235, ptr %12, align 4, !tbaa !9
  %122 = load i32, ptr %12, align 4, !tbaa !9
  %123 = load i32, ptr %11, align 4, !tbaa !9
  %124 = add i32 %123, %122
  store i32 %124, ptr %11, align 4, !tbaa !9
  %125 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %125, ptr %12, align 4, !tbaa !9
  store i32 62693, ptr %13, align 4, !tbaa !9
  %126 = load i32, ptr %13, align 4, !tbaa !9
  %127 = load i32, ptr %12, align 4, !tbaa !9
  %128 = add i32 %127, %126
  store i32 %128, ptr %12, align 4, !tbaa !9
  store i32 2103, ptr %13, align 4, !tbaa !9
  %129 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %129, ptr %14, align 4, !tbaa !9
  store i32 50426, ptr %15, align 4, !tbaa !9
  %130 = load i32, ptr %15, align 4, !tbaa !9
  %131 = load i32, ptr %14, align 4, !tbaa !9
  %132 = add i32 %131, %130
  store i32 %132, ptr %14, align 4, !tbaa !9
  %133 = load ptr, ptr %5, align 8, !tbaa !5
  %134 = load i32, ptr %11, align 4, !tbaa !9
  %135 = load i32, ptr %12, align 4, !tbaa !9
  %136 = load i32, ptr %13, align 4, !tbaa !9
  %137 = load i32, ptr %14, align 4, !tbaa !9
  call void @w2c_hermes_0x5F_assert_fail(ptr noundef %133, i32 noundef %134, i32 noundef %135, i32 noundef %136, i32 noundef %137)
  call void @wasm_rt_trap(i32 noundef 5) #6
  unreachable

138:                                              ; preds = %100, %87
  store i32 0, ptr %11, align 4, !tbaa !9
  %139 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %139, ptr %7, align 4, !tbaa !9
  store i32 196978, ptr %12, align 4, !tbaa !9
  %140 = load i32, ptr %12, align 4, !tbaa !9
  %141 = load i32, ptr %11, align 4, !tbaa !9
  %142 = add i32 %141, %140
  store i32 %142, ptr %11, align 4, !tbaa !9
  %143 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %143, ptr %12, align 4, !tbaa !9
  store i32 86311, ptr %13, align 4, !tbaa !9
  %144 = load i32, ptr %13, align 4, !tbaa !9
  %145 = load i32, ptr %12, align 4, !tbaa !9
  %146 = add i32 %145, %144
  store i32 %146, ptr %12, align 4, !tbaa !9
  store i32 300, ptr %13, align 4, !tbaa !9
  %147 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %147, ptr %14, align 4, !tbaa !9
  store i32 19893, ptr %15, align 4, !tbaa !9
  %148 = load i32, ptr %15, align 4, !tbaa !9
  %149 = load i32, ptr %14, align 4, !tbaa !9
  %150 = add i32 %149, %148
  store i32 %150, ptr %14, align 4, !tbaa !9
  %151 = load ptr, ptr %5, align 8, !tbaa !5
  %152 = load i32, ptr %11, align 4, !tbaa !9
  %153 = load i32, ptr %12, align 4, !tbaa !9
  %154 = load i32, ptr %13, align 4, !tbaa !9
  %155 = load i32, ptr %14, align 4, !tbaa !9
  call void @w2c_hermes_0x5F_assert_fail(ptr noundef %151, i32 noundef %152, i32 noundef %153, i32 noundef %154, i32 noundef %155)
  call void @wasm_rt_trap(i32 noundef 5) #6
  unreachable

156:                                              ; preds = %119
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, 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 = { "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 = { 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 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: inlinehint nounwind uwtable
declare hidden void @i32_store8(ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
define dso_local void @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AHadesGC0x3A0x3ArelocationWriteBarrier0x28void0x20const0x2A0x2C0x20void0x20const0x2A0x29(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 %1 to i64
  %7 = add nuw nsw i64 %6, 588
  %8 = tail call i32 @i32_load(ptr noundef nonnull %5, i64 noundef %7)
  %9 = and i32 %2, -4194304
  %.not = icmp eq i32 %8, %9
  br i1 %.not, label %25, label %10

10:                                               ; preds = %4
  %11 = xor i32 %3, %2
  %12 = icmp ult i32 %11, 4194304
  br i1 %12, label %27, label %13

13:                                               ; preds = %10
  %14 = and i32 %3, -4194304
  %.not86 = icmp eq i32 %14, %8
  br i1 %.not86, label %18, label %15

15:                                               ; preds = %13
  %16 = add nuw nsw i64 %6, 4448
  %17 = tail call i32 @i32_load(ptr noundef nonnull %5, i64 noundef %16)
  %.not87 = icmp eq i32 %17, %14
  br i1 %.not87, label %18, label %27

18:                                               ; preds = %13, %15
  %19 = add i32 %9, 4194816
  %.not88 = icmp ugt i32 %19, %2
  br i1 %.not88, label %20, label %26

20:                                               ; preds = %18
  %21 = lshr i32 %2, 9
  %22 = and i32 %21, 8191
  %23 = or disjoint i32 %22, %9
  %24 = zext i32 %23 to i64
  tail call void @i32_store8(ptr noundef nonnull %5, i64 noundef %24, i32 noundef 1)
  br label %27

25:                                               ; preds = %4
  tail call void @w2c_hermes_0x5F_assert_fail(ptr noundef %0, i32 noundef 139235, i32 noundef 62693, i32 noundef 2103, i32 noundef 50426) #4
  tail call void @wasm_rt_trap(i32 noundef 5) #5
  unreachable

26:                                               ; preds = %18
  tail call void @w2c_hermes_0x5F_assert_fail(ptr noundef %0, i32 noundef 196978, i32 noundef 86311, i32 noundef 300, i32 noundef 19893) #4
  tail call void @wasm_rt_trap(i32 noundef 5) #5
  unreachable

27:                                               ; preds = %20, %10, %15
  ret void
}

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