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

; 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 void @i32_store(ptr noundef, i64 noundef, i32 noundef) #1

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

; Function Attrs: nounwind uwtable
declare dso_local void @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AordinaryHasInstance0x28hermes0x3A0x3Avm0x3A0x3ARuntime0x260x2C0x20hermes0x3A0x3Avm0x3A0x3AHandle0x3Chermes0x3A0x3Avm0x3A0x3AHermesValue0x3E0x2C0x20hermes0x3A0x3Avm0x3A0x3AHandle0x3Chermes0x3A0x3Avm0x3A0x3AHermesValue0x3E0x29(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #2

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

54:                                               ; preds = %5
  %55 = load i32, ptr %14, align 4, !tbaa !9
  br label %58

56:                                               ; preds = %5
  %57 = load i32, ptr %15, align 4, !tbaa !9
  br label %58

58:                                               ; preds = %56, %54
  %59 = phi i32 [ %55, %54 ], [ %57, %56 ]
  store i32 %59, ptr %14, align 4, !tbaa !9
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = load i32, ptr %11, align 4, !tbaa !9
  %62 = load i32, ptr %12, align 4, !tbaa !9
  %63 = load i32, ptr %13, align 4, !tbaa !9
  %64 = load i32, ptr %14, align 4, !tbaa !9
  call void @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AordinaryHasInstance0x28hermes0x3A0x3Avm0x3A0x3ARuntime0x260x2C0x20hermes0x3A0x3Avm0x3A0x3AHandle0x3Chermes0x3A0x3Avm0x3A0x3AHermesValue0x3E0x2C0x20hermes0x3A0x3Avm0x3A0x3AHandle0x3Chermes0x3A0x3Avm0x3A0x3AHermesValue0x3E0x29(ptr noundef %60, i32 noundef %61, i32 noundef %62, i32 noundef %63, i32 noundef %64)
  %65 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %65, ptr %11, align 4, !tbaa !9
  %66 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %66, ptr %12, align 4, !tbaa !9
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.w2c_hermes, ptr %67, i32 0, i32 6
  %69 = load i32, ptr %12, align 4, !tbaa !9
  %70 = zext i32 %69 to i64
  %71 = add i64 %70, 12
  %72 = call i32 @i32_load16_u(ptr noundef %68, i64 noundef %71)
  store i32 %72, ptr %12, align 4, !tbaa !9
  %73 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %73, ptr %9, align 4, !tbaa !9
  store i32 255, ptr %13, align 4, !tbaa !9
  %74 = load i32, ptr %13, align 4, !tbaa !9
  %75 = load i32, ptr %12, align 4, !tbaa !9
  %76 = and i32 %75, %74
  store i32 %76, ptr %12, align 4, !tbaa !9
  %77 = load i32, ptr %12, align 4, !tbaa !9
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %79, label %100

79:                                               ; preds = %58
  %80 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %80, ptr %12, align 4, !tbaa !9
  %81 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %81, ptr %13, align 4, !tbaa !9
  store i32 8, ptr %14, align 4, !tbaa !9
  %82 = load i32, ptr %14, align 4, !tbaa !9
  %83 = and i32 %82, 31
  %84 = load i32, ptr %13, align 4, !tbaa !9
  %85 = lshr i32 %84, %83
  store i32 %85, ptr %13, align 4, !tbaa !9
  store i32 1, ptr %14, align 4, !tbaa !9
  %86 = load i32, ptr %14, align 4, !tbaa !9
  %87 = load i32, ptr %13, align 4, !tbaa !9
  %88 = and i32 %87, %86
  store i32 %88, ptr %13, align 4, !tbaa !9
  %89 = load i32, ptr %13, align 4, !tbaa !9
  %90 = zext i32 %89 to i64
  store i64 %90, ptr %17, align 8, !tbaa !17
  store i64 -1407374883553280, ptr %18, align 8, !tbaa !17
  %91 = load i64, ptr %18, align 8, !tbaa !17
  %92 = load i64, ptr %17, align 8, !tbaa !17
  %93 = or i64 %92, %91
  store i64 %93, ptr %17, align 8, !tbaa !17
  %94 = load ptr, ptr %6, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.w2c_hermes, ptr %94, i32 0, i32 6
  %96 = load i32, ptr %12, align 4, !tbaa !9
  %97 = zext i32 %96 to i64
  %98 = add i64 %97, 8
  %99 = load i64, ptr %17, align 8, !tbaa !17
  call void @i64_store(ptr noundef %95, i64 noundef %98, i64 noundef %99)
  store i32 1, ptr %12, align 4, !tbaa !9
  br label %101

100:                                              ; preds = %58
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %101

101:                                              ; preds = %100, %79
  %102 = load ptr, ptr %6, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.w2c_hermes, ptr %102, i32 0, i32 6
  %104 = load i32, ptr %11, align 4, !tbaa !9
  %105 = zext i32 %104 to i64
  %106 = load i32, ptr %12, align 4, !tbaa !9
  call void @i32_store(ptr noundef %103, i64 noundef %105, i32 noundef %106)
  %107 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %107, ptr %11, align 4, !tbaa !9
  store i32 16, ptr %12, align 4, !tbaa !9
  %108 = load i32, ptr %12, align 4, !tbaa !9
  %109 = load i32, ptr %11, align 4, !tbaa !9
  %110 = add i32 %109, %108
  store i32 %110, ptr %11, align 4, !tbaa !9
  %111 = load i32, ptr %11, align 4, !tbaa !9
  %112 = load ptr, ptr %6, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.w2c_hermes, ptr %112, i32 0, i32 3
  store i32 %111, ptr %113, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  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 = { 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 }

!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, !10, i64 24}
!12 = !{!"w2c_hermes", !6, i64 0, !6, i64 8, !6, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !13, i64 40, !16, i64 80}
!13 = !{!"", !6, i64 0, !14, i64 8, !14, i64 16, !14, i64 24, !15, i64 32}
!14 = !{!"long", !7, i64 0}
!15 = !{!"_Bool", !7, i64 0}
!16 = !{!"", !6, i64 0, !10, i64 8, !10, i64 12}
!17 = !{!14, !14, 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 void @i32_store(ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare dso_local void @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AordinaryHasInstance0x28hermes0x3A0x3Avm0x3A0x3ARuntime0x260x2C0x20hermes0x3A0x3Avm0x3A0x3AHandle0x3Chermes0x3A0x3Avm0x3A0x3AHermesValue0x3E0x2C0x20hermes0x3A0x3Avm0x3A0x3AHandle0x3Chermes0x3A0x3Avm0x3A0x3AHermesValue0x3E0x29(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AfunctionPrototypeSymbolHasInstance0x28void0x2A0x2C0x20hermes0x3A0x3Avm0x3A0x3ARuntime0x260x2C0x20hermes0x3A0x3Avm0x3A0x3ANativeArgs0x29(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #1 {
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %7 = load i32, ptr %6, align 8, !tbaa !5
  %8 = add i32 %7, -16
  store i32 %8, ptr %6, align 8, !tbaa !5
  %9 = add i32 %7, -4
  %10 = getelementptr inbounds i8, ptr %0, i64 40
  %11 = zext i32 %4 to i64
  %12 = tail call i32 @i32_load(ptr noundef nonnull %10, i64 noundef %11)
  %13 = add i32 %12, -8
  %14 = add nuw nsw i64 %11, 4
  %15 = tail call i32 @i32_load(ptr noundef nonnull %10, i64 noundef %14)
  %.not = icmp eq i32 %15, 0
  %16 = select i1 %.not, i32 67208, i32 %13
  tail call void @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AordinaryHasInstance0x28hermes0x3A0x3Avm0x3A0x3ARuntime0x260x2C0x20hermes0x3A0x3Avm0x3A0x3AHandle0x3Chermes0x3A0x3Avm0x3A0x3AHermesValue0x3E0x2C0x20hermes0x3A0x3Avm0x3A0x3AHandle0x3Chermes0x3A0x3Avm0x3A0x3AHermesValue0x3E0x29(ptr noundef %0, i32 noundef %9, i32 noundef %3, i32 noundef %12, i32 noundef %16)
  %17 = zext i32 %8 to i64
  %18 = add nuw nsw i64 %17, 12
  %19 = tail call i32 @i32_load16_u(ptr noundef nonnull %10, i64 noundef %18)
  %20 = and i32 %19, 255
  %.not55 = icmp eq i32 %20, 0
  br i1 %.not55, label %._crit_edge, label %21

._crit_edge:                                      ; preds = %5
  %.pre = zext i32 %1 to i64
  br label %28

21:                                               ; preds = %5
  %22 = lshr i32 %19, 8
  %23 = and i32 %22, 1
  %24 = zext nneg i32 %23 to i64
  %25 = or disjoint i64 %24, -1407374883553280
  %26 = zext i32 %1 to i64
  %27 = add nuw nsw i64 %26, 8
  tail call void @i64_store(ptr noundef nonnull %10, i64 noundef %27, i64 noundef %25)
  br label %28

28:                                               ; preds = %._crit_edge, %21
  %.pre-phi = phi i64 [ %.pre, %._crit_edge ], [ %26, %21 ]
  %.0 = phi i32 [ 0, %._crit_edge ], [ 1, %21 ]
  tail call void @i32_store(ptr noundef nonnull %10, i64 noundef %.pre-phi, i32 noundef %.0)
  store i32 %7, ptr %6, align 8, !tbaa !5
  ret void
}

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

!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, !10, i64 24}
!6 = !{!"w2c_hermes", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !11, i64 40, !14, i64 80}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"", !7, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !13, i64 32}
!12 = !{!"long", !8, i64 0}
!13 = !{!"_Bool", !8, i64 0}
!14 = !{!"", !7, i64 0, !10, i64 8, !10, i64 12}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass