Merge pull request #14365 from srini100/master

Include pkg-config in the required tools to build
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index fb6f98c..9c0e9dd 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -5,5 +5,6 @@
 /bazel/** @nicolasnoble @dgquintas @a11r @vjpai
 /cmake/** @jtattermusch @nicolasnoble @matt-kwong
 /src/core/ext/filters/client_channel/** @markdroth @dgquintas @a11r
+/test/cpp/end2end/** @vjpai @yang-g @y-zeng
 /tools/dockerfile/** @jtattermusch @matt-kwong @nicolasnoble
 /tools/run_tests/performance/** @ncteisen @matt-kwong @jtattermusch
diff --git a/.gitmodules b/.gitmodules
index c4b0d24..52db29b 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,6 +1,10 @@
 [submodule "third_party/zlib"]
 	path = third_party/zlib
 	url = https://github.com/madler/zlib
+	# When using CMake to build, the zlib submodule ends up with a
+	# generated file that makes Git consider the submodule dirty. This
+	# state can be ignored for day-to-day development on gRPC.
+	ignore = dirty
 [submodule "third_party/protobuf"]
 	path = third_party/protobuf
 	url = https://github.com/google/protobuf.git
diff --git a/BUILD b/BUILD
index 3edcc55..561993a 100644
--- a/BUILD
+++ b/BUILD
@@ -66,15 +66,11 @@
     "include/grpc/support/atm_gcc_atomic.h",
     "include/grpc/support/atm_gcc_sync.h",
     "include/grpc/support/atm_windows.h",
-    "include/grpc/support/avl.h",
-    "include/grpc/support/cmdline.h",
     "include/grpc/support/cpu.h",
-    "include/grpc/support/host_port.h",
     "include/grpc/support/log.h",
     "include/grpc/support/log_windows.h",
     "include/grpc/support/port_platform.h",
     "include/grpc/support/string_util.h",
-    "include/grpc/support/subprocess.h",
     "include/grpc/support/sync.h",
     "include/grpc/support/sync_custom.h",
     "include/grpc/support/sync_generic.h",
@@ -82,11 +78,6 @@
     "include/grpc/support/sync_windows.h",
     "include/grpc/support/thd.h",
     "include/grpc/support/time.h",
-    "include/grpc/support/tls.h",
-    "include/grpc/support/tls_gcc.h",
-    "include/grpc/support/tls_msvc.h",
-    "include/grpc/support/tls_pthread.h",
-    "include/grpc/support/useful.h",
 ]
 
 GRPC_PUBLIC_HDRS = [
@@ -452,13 +443,9 @@
 grpc_cc_library(
     name = "gpr_base",
     srcs = [
-        "src/core/lib/profiling/basic_timers.cc",
-        "src/core/lib/profiling/stap_timers.cc",
         "src/core/lib/gpr/alloc.cc",
         "src/core/lib/gpr/arena.cc",
         "src/core/lib/gpr/atm.cc",
-        "src/core/lib/gpr/avl.cc",
-        "src/core/lib/gpr/cmdline.cc",
         "src/core/lib/gpr/cpu_iphone.cc",
         "src/core/lib/gpr/cpu_linux.cc",
         "src/core/lib/gpr/cpu_posix.cc",
@@ -479,8 +466,6 @@
         "src/core/lib/gpr/string_posix.cc",
         "src/core/lib/gpr/string_util_windows.cc",
         "src/core/lib/gpr/string_windows.cc",
-        "src/core/lib/gpr/subprocess_posix.cc",
-        "src/core/lib/gpr/subprocess_windows.cc",
         "src/core/lib/gpr/sync.cc",
         "src/core/lib/gpr/sync_posix.cc",
         "src/core/lib/gpr/sync_windows.cc",
@@ -496,12 +481,14 @@
         "src/core/lib/gpr/tmpfile_posix.cc",
         "src/core/lib/gpr/tmpfile_windows.cc",
         "src/core/lib/gpr/wrap_memcpy.cc",
+        "src/core/lib/profiling/basic_timers.cc",
+        "src/core/lib/profiling/stap_timers.cc",
     ],
     hdrs = [
-        "src/core/lib/profiling/timers.h",
         "src/core/lib/gpr/arena.h",
         "src/core/lib/gpr/env.h",
         "src/core/lib/gpr/fork.h",
+        "src/core/lib/gpr/host_port.h",
         "src/core/lib/gpr/mpscq.h",
         "src/core/lib/gpr/murmur_hash.h",
         "src/core/lib/gpr/spinlock.h",
@@ -509,7 +496,13 @@
         "src/core/lib/gpr/string_windows.h",
         "src/core/lib/gpr/thd_internal.h",
         "src/core/lib/gpr/time_precise.h",
+        "src/core/lib/gpr/tls.h",
+        "src/core/lib/gpr/tls_gcc.h",
+        "src/core/lib/gpr/tls_msvc.h",
+        "src/core/lib/gpr/tls_pthread.h",
         "src/core/lib/gpr/tmpfile.h",
+        "src/core/lib/gpr/useful.h",
+        "src/core/lib/profiling/timers.h",
     ],
     language = "c++",
     public_hdrs = GPR_PUBLIC_HDRS,
@@ -562,14 +555,14 @@
 
 grpc_cc_library(
     name = "atomic",
-    language = "c++",
-    public_hdrs = [
-        "src/core/lib/gprpp/atomic.h",
-    ],
     hdrs = [
         "src/core/lib/gprpp/atomic_with_atm.h",
         "src/core/lib/gprpp/atomic_with_std.h",
     ],
+    language = "c++",
+    public_hdrs = [
+        "src/core/lib/gprpp/atomic.h",
+    ],
     deps = [
         "gpr",
     ],
@@ -598,9 +591,9 @@
     public_hdrs = ["src/core/lib/gprpp/orphanable.h"],
     deps = [
         "debug_location",
-        "ref_counted_ptr",
         "gpr++_base",
         "grpc_trace",
+        "ref_counted_ptr",
     ],
 )
 
@@ -610,9 +603,9 @@
     public_hdrs = ["src/core/lib/gprpp/ref_counted.h"],
     deps = [
         "debug_location",
-        "ref_counted_ptr",
         "gpr++_base",
         "grpc_trace",
+        "ref_counted_ptr",
     ],
 )
 
@@ -628,6 +621,7 @@
 grpc_cc_library(
     name = "grpc_base_c",
     srcs = [
+        "src/core/lib/avl/avl.cc",
         "src/core/lib/backoff/backoff.cc",
         "src/core/lib/channel/channel_args.cc",
         "src/core/lib/channel/channel_stack.cc",
@@ -762,6 +756,7 @@
         "src/core/lib/transport/transport_op_string.cc",
     ],
     hdrs = [
+        "src/core/lib/avl/avl.h",
         "src/core/lib/backoff/backoff.h",
         "src/core/lib/channel/channel_args.h",
         "src/core/lib/channel/channel_stack.h",
@@ -888,8 +883,8 @@
     language = "c++",
     public_hdrs = GRPC_PUBLIC_HDRS,
     deps = [
-        "gpr_base",
         "gpr++_base",
+        "gpr_base",
         "grpc_codegen",
         "grpc_trace",
     ],
@@ -950,7 +945,6 @@
         "src/core/ext/filters/client_channel/proxy_mapper.cc",
         "src/core/ext/filters/client_channel/proxy_mapper_registry.cc",
         "src/core/ext/filters/client_channel/resolver.cc",
-        "src/core/ext/filters/client_channel/resolver_factory.cc",
         "src/core/ext/filters/client_channel/resolver_registry.cc",
         "src/core/ext/filters/client_channel/retry_throttle.cc",
         "src/core/ext/filters/client_channel/subchannel.cc",
@@ -980,8 +974,11 @@
     ],
     language = "c++",
     deps = [
+        "gpr_base",
         "grpc_base",
         "grpc_deadline_filter",
+        "inlined_vector",
+        "orphanable",
         "ref_counted",
         "ref_counted_ptr",
     ],
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1492eb9..382d7ce 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -213,6 +213,7 @@
 add_dependencies(buildtests_c alloc_test)
 add_dependencies(buildtests_c alpn_test)
 add_dependencies(buildtests_c arena_test)
+add_dependencies(buildtests_c avl_test)
 add_dependencies(buildtests_c bad_server_response_test)
 add_dependencies(buildtests_c bin_decoder_test)
 add_dependencies(buildtests_c bin_encoder_test)
@@ -221,6 +222,7 @@
 add_dependencies(buildtests_c chttp2_hpack_encoder_test)
 add_dependencies(buildtests_c chttp2_stream_map_test)
 add_dependencies(buildtests_c chttp2_varint_test)
+add_dependencies(buildtests_c cmdline_test)
 add_dependencies(buildtests_c combiner_test)
 add_dependencies(buildtests_c compression_test)
 add_dependencies(buildtests_c concurrent_connectivity_test)
@@ -257,8 +259,6 @@
 if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
 add_dependencies(buildtests_c goaway_server_test)
 endif()
-add_dependencies(buildtests_c gpr_avl_test)
-add_dependencies(buildtests_c gpr_cmdline_test)
 add_dependencies(buildtests_c gpr_cpu_test)
 add_dependencies(buildtests_c gpr_env_test)
 add_dependencies(buildtests_c gpr_host_port_test)
@@ -628,8 +628,6 @@
   src/core/lib/gpr/alloc.cc
   src/core/lib/gpr/arena.cc
   src/core/lib/gpr/atm.cc
-  src/core/lib/gpr/avl.cc
-  src/core/lib/gpr/cmdline.cc
   src/core/lib/gpr/cpu_iphone.cc
   src/core/lib/gpr/cpu_linux.cc
   src/core/lib/gpr/cpu_posix.cc
@@ -650,8 +648,6 @@
   src/core/lib/gpr/string_posix.cc
   src/core/lib/gpr/string_util_windows.cc
   src/core/lib/gpr/string_windows.cc
-  src/core/lib/gpr/subprocess_posix.cc
-  src/core/lib/gpr/subprocess_windows.cc
   src/core/lib/gpr/sync.cc
   src/core/lib/gpr/sync_posix.cc
   src/core/lib/gpr/sync_windows.cc
@@ -704,15 +700,11 @@
   include/grpc/support/atm_gcc_atomic.h
   include/grpc/support/atm_gcc_sync.h
   include/grpc/support/atm_windows.h
-  include/grpc/support/avl.h
-  include/grpc/support/cmdline.h
   include/grpc/support/cpu.h
-  include/grpc/support/host_port.h
   include/grpc/support/log.h
   include/grpc/support/log_windows.h
   include/grpc/support/port_platform.h
   include/grpc/support/string_util.h
-  include/grpc/support/subprocess.h
   include/grpc/support/sync.h
   include/grpc/support/sync_custom.h
   include/grpc/support/sync_generic.h
@@ -720,11 +712,6 @@
   include/grpc/support/sync_windows.h
   include/grpc/support/thd.h
   include/grpc/support/time.h
-  include/grpc/support/tls.h
-  include/grpc/support/tls_gcc.h
-  include/grpc/support/tls_msvc.h
-  include/grpc/support/tls_pthread.h
-  include/grpc/support/useful.h
   include/grpc/impl/codegen/atm.h
   include/grpc/impl/codegen/atm_gcc_atomic.h
   include/grpc/impl/codegen/atm_gcc_sync.h
@@ -794,6 +781,7 @@
 
 add_library(grpc
   src/core/lib/surface/init.cc
+  src/core/lib/avl/avl.cc
   src/core/lib/backoff/backoff.cc
   src/core/lib/channel/channel_args.cc
   src/core/lib/channel/channel_stack.cc
@@ -1003,7 +991,6 @@
   src/core/ext/filters/client_channel/proxy_mapper.cc
   src/core/ext/filters/client_channel/proxy_mapper_registry.cc
   src/core/ext/filters/client_channel/resolver.cc
-  src/core/ext/filters/client_channel/resolver_factory.cc
   src/core/ext/filters/client_channel/resolver_registry.cc
   src/core/ext/filters/client_channel/retry_throttle.cc
   src/core/ext/filters/client_channel/subchannel.cc
@@ -1134,6 +1121,7 @@
 
 add_library(grpc_cronet
   src/core/lib/surface/init.cc
+  src/core/lib/avl/avl.cc
   src/core/lib/backoff/backoff.cc
   src/core/lib/channel/channel_args.cc
   src/core/lib/channel/channel_stack.cc
@@ -1314,7 +1302,6 @@
   src/core/ext/filters/client_channel/proxy_mapper.cc
   src/core/ext/filters/client_channel/proxy_mapper_registry.cc
   src/core/ext/filters/client_channel/resolver.cc
-  src/core/ext/filters/client_channel/resolver_factory.cc
   src/core/ext/filters/client_channel/resolver_registry.cc
   src/core/ext/filters/client_channel/retry_throttle.cc
   src/core/ext/filters/client_channel/subchannel.cc
@@ -1455,8 +1442,12 @@
   test/core/util/port_isolated_runtime_environment.cc
   test/core/util/port_server_client.cc
   test/core/util/slice_splitter.cc
+  test/core/util/subprocess_posix.cc
+  test/core/util/subprocess_windows.cc
   test/core/util/tracer_util.cc
   test/core/util/trickle_endpoint.cc
+  test/core/util/cmdline.cc
+  src/core/lib/avl/avl.cc
   src/core/lib/backoff/backoff.cc
   src/core/lib/channel/channel_args.cc
   src/core/lib/channel/channel_stack.cc
@@ -1606,7 +1597,6 @@
   src/core/ext/filters/client_channel/proxy_mapper.cc
   src/core/ext/filters/client_channel/proxy_mapper_registry.cc
   src/core/ext/filters/client_channel/resolver.cc
-  src/core/ext/filters/client_channel/resolver_factory.cc
   src/core/ext/filters/client_channel/resolver_registry.cc
   src/core/ext/filters/client_channel/retry_throttle.cc
   src/core/ext/filters/client_channel/subchannel.cc
@@ -1673,14 +1663,23 @@
 )
 
 foreach(_hdr
-  include/grpc/impl/codegen/byte_buffer.h
-  include/grpc/impl/codegen/byte_buffer_reader.h
-  include/grpc/impl/codegen/compression_types.h
-  include/grpc/impl/codegen/connectivity_state.h
-  include/grpc/impl/codegen/grpc_types.h
-  include/grpc/impl/codegen/propagation_bits.h
-  include/grpc/impl/codegen/slice.h
-  include/grpc/impl/codegen/status.h
+  include/grpc/support/alloc.h
+  include/grpc/support/atm.h
+  include/grpc/support/atm_gcc_atomic.h
+  include/grpc/support/atm_gcc_sync.h
+  include/grpc/support/atm_windows.h
+  include/grpc/support/cpu.h
+  include/grpc/support/log.h
+  include/grpc/support/log_windows.h
+  include/grpc/support/port_platform.h
+  include/grpc/support/string_util.h
+  include/grpc/support/sync.h
+  include/grpc/support/sync_custom.h
+  include/grpc/support/sync_generic.h
+  include/grpc/support/sync_posix.h
+  include/grpc/support/sync_windows.h
+  include/grpc/support/thd.h
+  include/grpc/support/time.h
   include/grpc/impl/codegen/atm.h
   include/grpc/impl/codegen/atm_gcc_atomic.h
   include/grpc/impl/codegen/atm_gcc_sync.h
@@ -1694,6 +1693,14 @@
   include/grpc/impl/codegen/sync_generic.h
   include/grpc/impl/codegen/sync_posix.h
   include/grpc/impl/codegen/sync_windows.h
+  include/grpc/impl/codegen/byte_buffer.h
+  include/grpc/impl/codegen/byte_buffer_reader.h
+  include/grpc/impl/codegen/compression_types.h
+  include/grpc/impl/codegen/connectivity_state.h
+  include/grpc/impl/codegen/grpc_types.h
+  include/grpc/impl/codegen/propagation_bits.h
+  include/grpc/impl/codegen/slice.h
+  include/grpc/impl/codegen/status.h
 )
   string(REPLACE "include/" "" _path ${_hdr})
   get_filename_component(_path ${_path} PATH)
@@ -1722,8 +1729,12 @@
   test/core/util/port_isolated_runtime_environment.cc
   test/core/util/port_server_client.cc
   test/core/util/slice_splitter.cc
+  test/core/util/subprocess_posix.cc
+  test/core/util/subprocess_windows.cc
   test/core/util/tracer_util.cc
   test/core/util/trickle_endpoint.cc
+  test/core/util/cmdline.cc
+  src/core/lib/avl/avl.cc
   src/core/lib/backoff/backoff.cc
   src/core/lib/channel/channel_args.cc
   src/core/lib/channel/channel_stack.cc
@@ -1873,7 +1884,6 @@
   src/core/ext/filters/client_channel/proxy_mapper.cc
   src/core/ext/filters/client_channel/proxy_mapper_registry.cc
   src/core/ext/filters/client_channel/resolver.cc
-  src/core/ext/filters/client_channel/resolver_factory.cc
   src/core/ext/filters/client_channel/resolver_registry.cc
   src/core/ext/filters/client_channel/retry_throttle.cc
   src/core/ext/filters/client_channel/subchannel.cc
@@ -1940,14 +1950,23 @@
 )
 
 foreach(_hdr
-  include/grpc/impl/codegen/byte_buffer.h
-  include/grpc/impl/codegen/byte_buffer_reader.h
-  include/grpc/impl/codegen/compression_types.h
-  include/grpc/impl/codegen/connectivity_state.h
-  include/grpc/impl/codegen/grpc_types.h
-  include/grpc/impl/codegen/propagation_bits.h
-  include/grpc/impl/codegen/slice.h
-  include/grpc/impl/codegen/status.h
+  include/grpc/support/alloc.h
+  include/grpc/support/atm.h
+  include/grpc/support/atm_gcc_atomic.h
+  include/grpc/support/atm_gcc_sync.h
+  include/grpc/support/atm_windows.h
+  include/grpc/support/cpu.h
+  include/grpc/support/log.h
+  include/grpc/support/log_windows.h
+  include/grpc/support/port_platform.h
+  include/grpc/support/string_util.h
+  include/grpc/support/sync.h
+  include/grpc/support/sync_custom.h
+  include/grpc/support/sync_generic.h
+  include/grpc/support/sync_posix.h
+  include/grpc/support/sync_windows.h
+  include/grpc/support/thd.h
+  include/grpc/support/time.h
   include/grpc/impl/codegen/atm.h
   include/grpc/impl/codegen/atm_gcc_atomic.h
   include/grpc/impl/codegen/atm_gcc_sync.h
@@ -1961,6 +1980,14 @@
   include/grpc/impl/codegen/sync_generic.h
   include/grpc/impl/codegen/sync_posix.h
   include/grpc/impl/codegen/sync_windows.h
+  include/grpc/impl/codegen/byte_buffer.h
+  include/grpc/impl/codegen/byte_buffer_reader.h
+  include/grpc/impl/codegen/compression_types.h
+  include/grpc/impl/codegen/connectivity_state.h
+  include/grpc/impl/codegen/grpc_types.h
+  include/grpc/impl/codegen/propagation_bits.h
+  include/grpc/impl/codegen/slice.h
+  include/grpc/impl/codegen/status.h
 )
   string(REPLACE "include/" "" _path ${_hdr})
   get_filename_component(_path ${_path} PATH)
@@ -1974,6 +2001,7 @@
 add_library(grpc_unsecure
   src/core/lib/surface/init.cc
   src/core/lib/surface/init_unsecure.cc
+  src/core/lib/avl/avl.cc
   src/core/lib/backoff/backoff.cc
   src/core/lib/channel/channel_args.cc
   src/core/lib/channel/channel_stack.cc
@@ -2156,7 +2184,6 @@
   src/core/ext/filters/client_channel/proxy_mapper.cc
   src/core/ext/filters/client_channel/proxy_mapper_registry.cc
   src/core/ext/filters/client_channel/resolver.cc
-  src/core/ext/filters/client_channel/resolver_factory.cc
   src/core/ext/filters/client_channel/resolver_registry.cc
   src/core/ext/filters/client_channel/retry_throttle.cc
   src/core/ext/filters/client_channel/subchannel.cc
@@ -2487,15 +2514,11 @@
   include/grpc/support/atm_gcc_atomic.h
   include/grpc/support/atm_gcc_sync.h
   include/grpc/support/atm_windows.h
-  include/grpc/support/avl.h
-  include/grpc/support/cmdline.h
   include/grpc/support/cpu.h
-  include/grpc/support/host_port.h
   include/grpc/support/log.h
   include/grpc/support/log_windows.h
   include/grpc/support/port_platform.h
   include/grpc/support/string_util.h
-  include/grpc/support/subprocess.h
   include/grpc/support/sync.h
   include/grpc/support/sync_custom.h
   include/grpc/support/sync_generic.h
@@ -2503,11 +2526,6 @@
   include/grpc/support/sync_windows.h
   include/grpc/support/thd.h
   include/grpc/support/time.h
-  include/grpc/support/tls.h
-  include/grpc/support/tls_gcc.h
-  include/grpc/support/tls_msvc.h
-  include/grpc/support/tls_pthread.h
-  include/grpc/support/useful.h
   include/grpc/impl/codegen/atm.h
   include/grpc/impl/codegen/atm_gcc_atomic.h
   include/grpc/impl/codegen/atm_gcc_sync.h
@@ -2705,6 +2723,7 @@
   src/core/ext/transport/chttp2/transport/stream_map.cc
   src/core/ext/transport/chttp2/transport/varint.cc
   src/core/ext/transport/chttp2/transport/writing.cc
+  src/core/lib/avl/avl.cc
   src/core/lib/backoff/backoff.cc
   src/core/lib/channel/channel_args.cc
   src/core/lib/channel/channel_stack.cc
@@ -2859,7 +2878,6 @@
   src/core/ext/filters/client_channel/proxy_mapper.cc
   src/core/ext/filters/client_channel/proxy_mapper_registry.cc
   src/core/ext/filters/client_channel/resolver.cc
-  src/core/ext/filters/client_channel/resolver_factory.cc
   src/core/ext/filters/client_channel/resolver_registry.cc
   src/core/ext/filters/client_channel/retry_throttle.cc
   src/core/ext/filters/client_channel/subchannel.cc
@@ -2960,15 +2978,11 @@
   include/grpc/support/atm_gcc_atomic.h
   include/grpc/support/atm_gcc_sync.h
   include/grpc/support/atm_windows.h
-  include/grpc/support/avl.h
-  include/grpc/support/cmdline.h
   include/grpc/support/cpu.h
-  include/grpc/support/host_port.h
   include/grpc/support/log.h
   include/grpc/support/log_windows.h
   include/grpc/support/port_platform.h
   include/grpc/support/string_util.h
-  include/grpc/support/subprocess.h
   include/grpc/support/sync.h
   include/grpc/support/sync_custom.h
   include/grpc/support/sync_generic.h
@@ -2976,11 +2990,6 @@
   include/grpc/support/sync_windows.h
   include/grpc/support/thd.h
   include/grpc/support/time.h
-  include/grpc/support/tls.h
-  include/grpc/support/tls_gcc.h
-  include/grpc/support/tls_msvc.h
-  include/grpc/support/tls_pthread.h
-  include/grpc/support/useful.h
   include/grpc/impl/codegen/atm.h
   include/grpc/impl/codegen/atm_gcc_atomic.h
   include/grpc/impl/codegen/atm_gcc_sync.h
@@ -3690,15 +3699,11 @@
   include/grpc/support/atm_gcc_atomic.h
   include/grpc/support/atm_gcc_sync.h
   include/grpc/support/atm_windows.h
-  include/grpc/support/avl.h
-  include/grpc/support/cmdline.h
   include/grpc/support/cpu.h
-  include/grpc/support/host_port.h
   include/grpc/support/log.h
   include/grpc/support/log_windows.h
   include/grpc/support/port_platform.h
   include/grpc/support/string_util.h
-  include/grpc/support/subprocess.h
   include/grpc/support/sync.h
   include/grpc/support/sync_custom.h
   include/grpc/support/sync_generic.h
@@ -3706,11 +3711,6 @@
   include/grpc/support/sync_windows.h
   include/grpc/support/thd.h
   include/grpc/support/time.h
-  include/grpc/support/tls.h
-  include/grpc/support/tls_gcc.h
-  include/grpc/support/tls_msvc.h
-  include/grpc/support/tls_pthread.h
-  include/grpc/support/useful.h
   include/grpc/impl/codegen/atm.h
   include/grpc/impl/codegen/atm_gcc_atomic.h
   include/grpc/impl/codegen/atm_gcc_sync.h
@@ -4829,6 +4829,32 @@
 endif (gRPC_BUILD_TESTS)
 if (gRPC_BUILD_TESTS)
 
+add_executable(avl_test
+  test/core/avl/avl_test.cc
+)
+
+
+target_include_directories(avl_test
+  PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
+  PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
+  PRIVATE ${_gRPC_SSL_INCLUDE_DIR}
+  PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR}
+  PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR}
+  PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR}
+  PRIVATE ${_gRPC_CARES_INCLUDE_DIR}
+  PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR}
+)
+
+target_link_libraries(avl_test
+  ${_gRPC_ALLTARGETS_LIBRARIES}
+  gpr_test_util
+  gpr
+  grpc
+)
+
+endif (gRPC_BUILD_TESTS)
+if (gRPC_BUILD_TESTS)
+
 add_executable(bad_server_response_test
   test/core/end2end/bad_server_response_test.cc
 )
@@ -5074,6 +5100,32 @@
 endif (gRPC_BUILD_TESTS)
 if (gRPC_BUILD_TESTS)
 
+add_executable(cmdline_test
+  test/core/util/cmdline_test.cc
+)
+
+
+target_include_directories(cmdline_test
+  PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
+  PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
+  PRIVATE ${_gRPC_SSL_INCLUDE_DIR}
+  PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR}
+  PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR}
+  PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR}
+  PRIVATE ${_gRPC_CARES_INCLUDE_DIR}
+  PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR}
+)
+
+target_link_libraries(cmdline_test
+  ${_gRPC_ALLTARGETS_LIBRARIES}
+  gpr
+  gpr_test_util
+  grpc_test_util
+)
+
+endif (gRPC_BUILD_TESTS)
+if (gRPC_BUILD_TESTS)
+
 add_executable(combiner_test
   test/core/iomgr/combiner_test.cc
 )
@@ -5630,56 +5682,6 @@
 endif (gRPC_BUILD_TESTS)
 if (gRPC_BUILD_TESTS)
 
-add_executable(gpr_avl_test
-  test/core/gpr/avl_test.cc
-)
-
-
-target_include_directories(gpr_avl_test
-  PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
-  PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
-  PRIVATE ${_gRPC_SSL_INCLUDE_DIR}
-  PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR}
-  PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR}
-  PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR}
-  PRIVATE ${_gRPC_CARES_INCLUDE_DIR}
-  PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR}
-)
-
-target_link_libraries(gpr_avl_test
-  ${_gRPC_ALLTARGETS_LIBRARIES}
-  gpr_test_util
-  gpr
-)
-
-endif (gRPC_BUILD_TESTS)
-if (gRPC_BUILD_TESTS)
-
-add_executable(gpr_cmdline_test
-  test/core/gpr/cmdline_test.cc
-)
-
-
-target_include_directories(gpr_cmdline_test
-  PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
-  PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
-  PRIVATE ${_gRPC_SSL_INCLUDE_DIR}
-  PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR}
-  PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR}
-  PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR}
-  PRIVATE ${_gRPC_CARES_INCLUDE_DIR}
-  PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR}
-)
-
-target_link_libraries(gpr_cmdline_test
-  ${_gRPC_ALLTARGETS_LIBRARIES}
-  gpr_test_util
-  gpr
-)
-
-endif (gRPC_BUILD_TESTS)
-if (gRPC_BUILD_TESTS)
-
 add_executable(gpr_cpu_test
   test/core/gpr/cpu_test.cc
 )
@@ -6222,6 +6224,7 @@
 
 add_executable(grpc_create_jwt
   test/core/security/create_jwt.cc
+  test/core/util/cmdline.cc
 )
 
 
@@ -6392,6 +6395,7 @@
 
 add_executable(grpc_print_google_default_creds_token
   test/core/security/print_google_default_creds_token.cc
+  test/core/util/cmdline.cc
 )
 
 
@@ -6478,6 +6482,7 @@
 
 add_executable(grpc_verify_jwt
   test/core/security/verify_jwt.cc
+  test/core/util/cmdline.cc
 )
 
 
@@ -6864,7 +6869,9 @@
 
 target_link_libraries(json_rewrite
   ${_gRPC_ALLTARGETS_LIBRARIES}
+  grpc_test_util
   grpc
+  gpr_test_util
   gpr
 )
 
diff --git a/Makefile b/Makefile
index d379ca5..da6057e 100644
--- a/Makefile
+++ b/Makefile
@@ -955,6 +955,7 @@
 alpn_test: $(BINDIR)/$(CONFIG)/alpn_test
 api_fuzzer: $(BINDIR)/$(CONFIG)/api_fuzzer
 arena_test: $(BINDIR)/$(CONFIG)/arena_test
+avl_test: $(BINDIR)/$(CONFIG)/avl_test
 bad_server_response_test: $(BINDIR)/$(CONFIG)/bad_server_response_test
 bin_decoder_test: $(BINDIR)/$(CONFIG)/bin_decoder_test
 bin_encoder_test: $(BINDIR)/$(CONFIG)/bin_encoder_test
@@ -965,6 +966,7 @@
 chttp2_stream_map_test: $(BINDIR)/$(CONFIG)/chttp2_stream_map_test
 chttp2_varint_test: $(BINDIR)/$(CONFIG)/chttp2_varint_test
 client_fuzzer: $(BINDIR)/$(CONFIG)/client_fuzzer
+cmdline_test: $(BINDIR)/$(CONFIG)/cmdline_test
 combiner_test: $(BINDIR)/$(CONFIG)/combiner_test
 compression_test: $(BINDIR)/$(CONFIG)/compression_test
 concurrent_connectivity_test: $(BINDIR)/$(CONFIG)/concurrent_connectivity_test
@@ -985,8 +987,6 @@
 fling_stream_test: $(BINDIR)/$(CONFIG)/fling_stream_test
 fling_test: $(BINDIR)/$(CONFIG)/fling_test
 goaway_server_test: $(BINDIR)/$(CONFIG)/goaway_server_test
-gpr_avl_test: $(BINDIR)/$(CONFIG)/gpr_avl_test
-gpr_cmdline_test: $(BINDIR)/$(CONFIG)/gpr_cmdline_test
 gpr_cpu_test: $(BINDIR)/$(CONFIG)/gpr_cpu_test
 gpr_env_test: $(BINDIR)/$(CONFIG)/gpr_env_test
 gpr_host_port_test: $(BINDIR)/$(CONFIG)/gpr_host_port_test
@@ -1372,6 +1372,7 @@
   $(BINDIR)/$(CONFIG)/alloc_test \
   $(BINDIR)/$(CONFIG)/alpn_test \
   $(BINDIR)/$(CONFIG)/arena_test \
+  $(BINDIR)/$(CONFIG)/avl_test \
   $(BINDIR)/$(CONFIG)/bad_server_response_test \
   $(BINDIR)/$(CONFIG)/bin_decoder_test \
   $(BINDIR)/$(CONFIG)/bin_encoder_test \
@@ -1380,6 +1381,7 @@
   $(BINDIR)/$(CONFIG)/chttp2_hpack_encoder_test \
   $(BINDIR)/$(CONFIG)/chttp2_stream_map_test \
   $(BINDIR)/$(CONFIG)/chttp2_varint_test \
+  $(BINDIR)/$(CONFIG)/cmdline_test \
   $(BINDIR)/$(CONFIG)/combiner_test \
   $(BINDIR)/$(CONFIG)/compression_test \
   $(BINDIR)/$(CONFIG)/concurrent_connectivity_test \
@@ -1400,8 +1402,6 @@
   $(BINDIR)/$(CONFIG)/fling_stream_test \
   $(BINDIR)/$(CONFIG)/fling_test \
   $(BINDIR)/$(CONFIG)/goaway_server_test \
-  $(BINDIR)/$(CONFIG)/gpr_avl_test \
-  $(BINDIR)/$(CONFIG)/gpr_cmdline_test \
   $(BINDIR)/$(CONFIG)/gpr_cpu_test \
   $(BINDIR)/$(CONFIG)/gpr_env_test \
   $(BINDIR)/$(CONFIG)/gpr_host_port_test \
@@ -1812,6 +1812,8 @@
 	$(Q) $(BINDIR)/$(CONFIG)/alpn_test || ( echo test alpn_test failed ; exit 1 )
 	$(E) "[RUN]     Testing arena_test"
 	$(Q) $(BINDIR)/$(CONFIG)/arena_test || ( echo test arena_test failed ; exit 1 )
+	$(E) "[RUN]     Testing avl_test"
+	$(Q) $(BINDIR)/$(CONFIG)/avl_test || ( echo test avl_test failed ; exit 1 )
 	$(E) "[RUN]     Testing bad_server_response_test"
 	$(Q) $(BINDIR)/$(CONFIG)/bad_server_response_test || ( echo test bad_server_response_test failed ; exit 1 )
 	$(E) "[RUN]     Testing bin_decoder_test"
@@ -1828,6 +1830,8 @@
 	$(Q) $(BINDIR)/$(CONFIG)/chttp2_stream_map_test || ( echo test chttp2_stream_map_test failed ; exit 1 )
 	$(E) "[RUN]     Testing chttp2_varint_test"
 	$(Q) $(BINDIR)/$(CONFIG)/chttp2_varint_test || ( echo test chttp2_varint_test failed ; exit 1 )
+	$(E) "[RUN]     Testing cmdline_test"
+	$(Q) $(BINDIR)/$(CONFIG)/cmdline_test || ( echo test cmdline_test failed ; exit 1 )
 	$(E) "[RUN]     Testing combiner_test"
 	$(Q) $(BINDIR)/$(CONFIG)/combiner_test || ( echo test combiner_test failed ; exit 1 )
 	$(E) "[RUN]     Testing compression_test"
@@ -1864,10 +1868,6 @@
 	$(Q) $(BINDIR)/$(CONFIG)/fling_test || ( echo test fling_test failed ; exit 1 )
 	$(E) "[RUN]     Testing goaway_server_test"
 	$(Q) $(BINDIR)/$(CONFIG)/goaway_server_test || ( echo test goaway_server_test failed ; exit 1 )
-	$(E) "[RUN]     Testing gpr_avl_test"
-	$(Q) $(BINDIR)/$(CONFIG)/gpr_avl_test || ( echo test gpr_avl_test failed ; exit 1 )
-	$(E) "[RUN]     Testing gpr_cmdline_test"
-	$(Q) $(BINDIR)/$(CONFIG)/gpr_cmdline_test || ( echo test gpr_cmdline_test failed ; exit 1 )
 	$(E) "[RUN]     Testing gpr_cpu_test"
 	$(Q) $(BINDIR)/$(CONFIG)/gpr_cpu_test || ( echo test gpr_cpu_test failed ; exit 1 )
 	$(E) "[RUN]     Testing gpr_env_test"
@@ -2876,8 +2876,6 @@
     src/core/lib/gpr/alloc.cc \
     src/core/lib/gpr/arena.cc \
     src/core/lib/gpr/atm.cc \
-    src/core/lib/gpr/avl.cc \
-    src/core/lib/gpr/cmdline.cc \
     src/core/lib/gpr/cpu_iphone.cc \
     src/core/lib/gpr/cpu_linux.cc \
     src/core/lib/gpr/cpu_posix.cc \
@@ -2898,8 +2896,6 @@
     src/core/lib/gpr/string_posix.cc \
     src/core/lib/gpr/string_util_windows.cc \
     src/core/lib/gpr/string_windows.cc \
-    src/core/lib/gpr/subprocess_posix.cc \
-    src/core/lib/gpr/subprocess_windows.cc \
     src/core/lib/gpr/sync.cc \
     src/core/lib/gpr/sync_posix.cc \
     src/core/lib/gpr/sync_windows.cc \
@@ -2924,15 +2920,11 @@
     include/grpc/support/atm_gcc_atomic.h \
     include/grpc/support/atm_gcc_sync.h \
     include/grpc/support/atm_windows.h \
-    include/grpc/support/avl.h \
-    include/grpc/support/cmdline.h \
     include/grpc/support/cpu.h \
-    include/grpc/support/host_port.h \
     include/grpc/support/log.h \
     include/grpc/support/log_windows.h \
     include/grpc/support/port_platform.h \
     include/grpc/support/string_util.h \
-    include/grpc/support/subprocess.h \
     include/grpc/support/sync.h \
     include/grpc/support/sync_custom.h \
     include/grpc/support/sync_generic.h \
@@ -2940,11 +2932,6 @@
     include/grpc/support/sync_windows.h \
     include/grpc/support/thd.h \
     include/grpc/support/time.h \
-    include/grpc/support/tls.h \
-    include/grpc/support/tls_gcc.h \
-    include/grpc/support/tls_msvc.h \
-    include/grpc/support/tls_pthread.h \
-    include/grpc/support/useful.h \
     include/grpc/impl/codegen/atm.h \
     include/grpc/impl/codegen/atm_gcc_atomic.h \
     include/grpc/impl/codegen/atm_gcc_sync.h \
@@ -3023,6 +3010,7 @@
 
 LIBGRPC_SRC = \
     src/core/lib/surface/init.cc \
+    src/core/lib/avl/avl.cc \
     src/core/lib/backoff/backoff.cc \
     src/core/lib/channel/channel_args.cc \
     src/core/lib/channel/channel_stack.cc \
@@ -3232,7 +3220,6 @@
     src/core/ext/filters/client_channel/proxy_mapper.cc \
     src/core/ext/filters/client_channel/proxy_mapper_registry.cc \
     src/core/ext/filters/client_channel/resolver.cc \
-    src/core/ext/filters/client_channel/resolver_factory.cc \
     src/core/ext/filters/client_channel/resolver_registry.cc \
     src/core/ext/filters/client_channel/retry_throttle.cc \
     src/core/ext/filters/client_channel/subchannel.cc \
@@ -3365,6 +3352,7 @@
 
 LIBGRPC_CRONET_SRC = \
     src/core/lib/surface/init.cc \
+    src/core/lib/avl/avl.cc \
     src/core/lib/backoff/backoff.cc \
     src/core/lib/channel/channel_args.cc \
     src/core/lib/channel/channel_stack.cc \
@@ -3545,7 +3533,6 @@
     src/core/ext/filters/client_channel/proxy_mapper.cc \
     src/core/ext/filters/client_channel/proxy_mapper_registry.cc \
     src/core/ext/filters/client_channel/resolver.cc \
-    src/core/ext/filters/client_channel/resolver_factory.cc \
     src/core/ext/filters/client_channel/resolver_registry.cc \
     src/core/ext/filters/client_channel/retry_throttle.cc \
     src/core/ext/filters/client_channel/subchannel.cc \
@@ -3687,8 +3674,12 @@
     test/core/util/port_isolated_runtime_environment.cc \
     test/core/util/port_server_client.cc \
     test/core/util/slice_splitter.cc \
+    test/core/util/subprocess_posix.cc \
+    test/core/util/subprocess_windows.cc \
     test/core/util/tracer_util.cc \
     test/core/util/trickle_endpoint.cc \
+    test/core/util/cmdline.cc \
+    src/core/lib/avl/avl.cc \
     src/core/lib/backoff/backoff.cc \
     src/core/lib/channel/channel_args.cc \
     src/core/lib/channel/channel_stack.cc \
@@ -3838,7 +3829,6 @@
     src/core/ext/filters/client_channel/proxy_mapper.cc \
     src/core/ext/filters/client_channel/proxy_mapper_registry.cc \
     src/core/ext/filters/client_channel/resolver.cc \
-    src/core/ext/filters/client_channel/resolver_factory.cc \
     src/core/ext/filters/client_channel/resolver_registry.cc \
     src/core/ext/filters/client_channel/retry_throttle.cc \
     src/core/ext/filters/client_channel/subchannel.cc \
@@ -3874,14 +3864,23 @@
     src/core/ext/filters/http/server/http_server_filter.cc \
 
 PUBLIC_HEADERS_C += \
-    include/grpc/impl/codegen/byte_buffer.h \
-    include/grpc/impl/codegen/byte_buffer_reader.h \
-    include/grpc/impl/codegen/compression_types.h \
-    include/grpc/impl/codegen/connectivity_state.h \
-    include/grpc/impl/codegen/grpc_types.h \
-    include/grpc/impl/codegen/propagation_bits.h \
-    include/grpc/impl/codegen/slice.h \
-    include/grpc/impl/codegen/status.h \
+    include/grpc/support/alloc.h \
+    include/grpc/support/atm.h \
+    include/grpc/support/atm_gcc_atomic.h \
+    include/grpc/support/atm_gcc_sync.h \
+    include/grpc/support/atm_windows.h \
+    include/grpc/support/cpu.h \
+    include/grpc/support/log.h \
+    include/grpc/support/log_windows.h \
+    include/grpc/support/port_platform.h \
+    include/grpc/support/string_util.h \
+    include/grpc/support/sync.h \
+    include/grpc/support/sync_custom.h \
+    include/grpc/support/sync_generic.h \
+    include/grpc/support/sync_posix.h \
+    include/grpc/support/sync_windows.h \
+    include/grpc/support/thd.h \
+    include/grpc/support/time.h \
     include/grpc/impl/codegen/atm.h \
     include/grpc/impl/codegen/atm_gcc_atomic.h \
     include/grpc/impl/codegen/atm_gcc_sync.h \
@@ -3895,6 +3894,14 @@
     include/grpc/impl/codegen/sync_generic.h \
     include/grpc/impl/codegen/sync_posix.h \
     include/grpc/impl/codegen/sync_windows.h \
+    include/grpc/impl/codegen/byte_buffer.h \
+    include/grpc/impl/codegen/byte_buffer_reader.h \
+    include/grpc/impl/codegen/compression_types.h \
+    include/grpc/impl/codegen/connectivity_state.h \
+    include/grpc/impl/codegen/grpc_types.h \
+    include/grpc/impl/codegen/propagation_bits.h \
+    include/grpc/impl/codegen/slice.h \
+    include/grpc/impl/codegen/status.h \
 
 LIBGRPC_TEST_UTIL_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC_TEST_UTIL_SRC))))
 
@@ -3947,8 +3954,12 @@
     test/core/util/port_isolated_runtime_environment.cc \
     test/core/util/port_server_client.cc \
     test/core/util/slice_splitter.cc \
+    test/core/util/subprocess_posix.cc \
+    test/core/util/subprocess_windows.cc \
     test/core/util/tracer_util.cc \
     test/core/util/trickle_endpoint.cc \
+    test/core/util/cmdline.cc \
+    src/core/lib/avl/avl.cc \
     src/core/lib/backoff/backoff.cc \
     src/core/lib/channel/channel_args.cc \
     src/core/lib/channel/channel_stack.cc \
@@ -4098,7 +4109,6 @@
     src/core/ext/filters/client_channel/proxy_mapper.cc \
     src/core/ext/filters/client_channel/proxy_mapper_registry.cc \
     src/core/ext/filters/client_channel/resolver.cc \
-    src/core/ext/filters/client_channel/resolver_factory.cc \
     src/core/ext/filters/client_channel/resolver_registry.cc \
     src/core/ext/filters/client_channel/retry_throttle.cc \
     src/core/ext/filters/client_channel/subchannel.cc \
@@ -4134,14 +4144,23 @@
     src/core/ext/filters/http/server/http_server_filter.cc \
 
 PUBLIC_HEADERS_C += \
-    include/grpc/impl/codegen/byte_buffer.h \
-    include/grpc/impl/codegen/byte_buffer_reader.h \
-    include/grpc/impl/codegen/compression_types.h \
-    include/grpc/impl/codegen/connectivity_state.h \
-    include/grpc/impl/codegen/grpc_types.h \
-    include/grpc/impl/codegen/propagation_bits.h \
-    include/grpc/impl/codegen/slice.h \
-    include/grpc/impl/codegen/status.h \
+    include/grpc/support/alloc.h \
+    include/grpc/support/atm.h \
+    include/grpc/support/atm_gcc_atomic.h \
+    include/grpc/support/atm_gcc_sync.h \
+    include/grpc/support/atm_windows.h \
+    include/grpc/support/cpu.h \
+    include/grpc/support/log.h \
+    include/grpc/support/log_windows.h \
+    include/grpc/support/port_platform.h \
+    include/grpc/support/string_util.h \
+    include/grpc/support/sync.h \
+    include/grpc/support/sync_custom.h \
+    include/grpc/support/sync_generic.h \
+    include/grpc/support/sync_posix.h \
+    include/grpc/support/sync_windows.h \
+    include/grpc/support/thd.h \
+    include/grpc/support/time.h \
     include/grpc/impl/codegen/atm.h \
     include/grpc/impl/codegen/atm_gcc_atomic.h \
     include/grpc/impl/codegen/atm_gcc_sync.h \
@@ -4155,6 +4174,14 @@
     include/grpc/impl/codegen/sync_generic.h \
     include/grpc/impl/codegen/sync_posix.h \
     include/grpc/impl/codegen/sync_windows.h \
+    include/grpc/impl/codegen/byte_buffer.h \
+    include/grpc/impl/codegen/byte_buffer_reader.h \
+    include/grpc/impl/codegen/compression_types.h \
+    include/grpc/impl/codegen/connectivity_state.h \
+    include/grpc/impl/codegen/grpc_types.h \
+    include/grpc/impl/codegen/propagation_bits.h \
+    include/grpc/impl/codegen/slice.h \
+    include/grpc/impl/codegen/status.h \
 
 LIBGRPC_TEST_UTIL_UNSECURE_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC_TEST_UTIL_UNSECURE_SRC))))
 
@@ -4179,6 +4206,7 @@
 LIBGRPC_UNSECURE_SRC = \
     src/core/lib/surface/init.cc \
     src/core/lib/surface/init_unsecure.cc \
+    src/core/lib/avl/avl.cc \
     src/core/lib/backoff/backoff.cc \
     src/core/lib/channel/channel_args.cc \
     src/core/lib/channel/channel_stack.cc \
@@ -4361,7 +4389,6 @@
     src/core/ext/filters/client_channel/proxy_mapper.cc \
     src/core/ext/filters/client_channel/proxy_mapper_registry.cc \
     src/core/ext/filters/client_channel/resolver.cc \
-    src/core/ext/filters/client_channel/resolver_factory.cc \
     src/core/ext/filters/client_channel/resolver_registry.cc \
     src/core/ext/filters/client_channel/retry_throttle.cc \
     src/core/ext/filters/client_channel/subchannel.cc \
@@ -4645,15 +4672,11 @@
     include/grpc/support/atm_gcc_atomic.h \
     include/grpc/support/atm_gcc_sync.h \
     include/grpc/support/atm_windows.h \
-    include/grpc/support/avl.h \
-    include/grpc/support/cmdline.h \
     include/grpc/support/cpu.h \
-    include/grpc/support/host_port.h \
     include/grpc/support/log.h \
     include/grpc/support/log_windows.h \
     include/grpc/support/port_platform.h \
     include/grpc/support/string_util.h \
-    include/grpc/support/subprocess.h \
     include/grpc/support/sync.h \
     include/grpc/support/sync_custom.h \
     include/grpc/support/sync_generic.h \
@@ -4661,11 +4684,6 @@
     include/grpc/support/sync_windows.h \
     include/grpc/support/thd.h \
     include/grpc/support/time.h \
-    include/grpc/support/tls.h \
-    include/grpc/support/tls_gcc.h \
-    include/grpc/support/tls_msvc.h \
-    include/grpc/support/tls_pthread.h \
-    include/grpc/support/useful.h \
     include/grpc/impl/codegen/atm.h \
     include/grpc/impl/codegen/atm_gcc_atomic.h \
     include/grpc/impl/codegen/atm_gcc_sync.h \
@@ -4911,6 +4929,7 @@
     src/core/ext/transport/chttp2/transport/stream_map.cc \
     src/core/ext/transport/chttp2/transport/varint.cc \
     src/core/ext/transport/chttp2/transport/writing.cc \
+    src/core/lib/avl/avl.cc \
     src/core/lib/backoff/backoff.cc \
     src/core/lib/channel/channel_args.cc \
     src/core/lib/channel/channel_stack.cc \
@@ -5065,7 +5084,6 @@
     src/core/ext/filters/client_channel/proxy_mapper.cc \
     src/core/ext/filters/client_channel/proxy_mapper_registry.cc \
     src/core/ext/filters/client_channel/resolver.cc \
-    src/core/ext/filters/client_channel/resolver_factory.cc \
     src/core/ext/filters/client_channel/resolver_registry.cc \
     src/core/ext/filters/client_channel/retry_throttle.cc \
     src/core/ext/filters/client_channel/subchannel.cc \
@@ -5131,15 +5149,11 @@
     include/grpc/support/atm_gcc_atomic.h \
     include/grpc/support/atm_gcc_sync.h \
     include/grpc/support/atm_windows.h \
-    include/grpc/support/avl.h \
-    include/grpc/support/cmdline.h \
     include/grpc/support/cpu.h \
-    include/grpc/support/host_port.h \
     include/grpc/support/log.h \
     include/grpc/support/log_windows.h \
     include/grpc/support/port_platform.h \
     include/grpc/support/string_util.h \
-    include/grpc/support/subprocess.h \
     include/grpc/support/sync.h \
     include/grpc/support/sync_custom.h \
     include/grpc/support/sync_generic.h \
@@ -5147,11 +5161,6 @@
     include/grpc/support/sync_windows.h \
     include/grpc/support/thd.h \
     include/grpc/support/time.h \
-    include/grpc/support/tls.h \
-    include/grpc/support/tls_gcc.h \
-    include/grpc/support/tls_msvc.h \
-    include/grpc/support/tls_pthread.h \
-    include/grpc/support/useful.h \
     include/grpc/impl/codegen/atm.h \
     include/grpc/impl/codegen/atm_gcc_atomic.h \
     include/grpc/impl/codegen/atm_gcc_sync.h \
@@ -5850,15 +5859,11 @@
     include/grpc/support/atm_gcc_atomic.h \
     include/grpc/support/atm_gcc_sync.h \
     include/grpc/support/atm_windows.h \
-    include/grpc/support/avl.h \
-    include/grpc/support/cmdline.h \
     include/grpc/support/cpu.h \
-    include/grpc/support/host_port.h \
     include/grpc/support/log.h \
     include/grpc/support/log_windows.h \
     include/grpc/support/port_platform.h \
     include/grpc/support/string_util.h \
-    include/grpc/support/subprocess.h \
     include/grpc/support/sync.h \
     include/grpc/support/sync_custom.h \
     include/grpc/support/sync_generic.h \
@@ -5866,11 +5871,6 @@
     include/grpc/support/sync_windows.h \
     include/grpc/support/thd.h \
     include/grpc/support/time.h \
-    include/grpc/support/tls.h \
-    include/grpc/support/tls_gcc.h \
-    include/grpc/support/tls_msvc.h \
-    include/grpc/support/tls_pthread.h \
-    include/grpc/support/useful.h \
     include/grpc/impl/codegen/atm.h \
     include/grpc/impl/codegen/atm_gcc_atomic.h \
     include/grpc/impl/codegen/atm_gcc_sync.h \
@@ -9403,6 +9403,38 @@
 endif
 
 
+AVL_TEST_SRC = \
+    test/core/avl/avl_test.cc \
+
+AVL_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(AVL_TEST_SRC))))
+ifeq ($(NO_SECURE),true)
+
+# You can't build secure targets if you don't have OpenSSL.
+
+$(BINDIR)/$(CONFIG)/avl_test: openssl_dep_error
+
+else
+
+
+
+$(BINDIR)/$(CONFIG)/avl_test: $(AVL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a
+	$(E) "[LD]      Linking $@"
+	$(Q) mkdir -p `dirname $@`
+	$(Q) $(LD) $(LDFLAGS) $(AVL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/avl_test
+
+endif
+
+$(OBJDIR)/$(CONFIG)/test/core/avl/avl_test.o:  $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a
+
+deps_avl_test: $(AVL_TEST_OBJS:.o=.dep)
+
+ifneq ($(NO_SECURE),true)
+ifneq ($(NO_DEPS),true)
+-include $(AVL_TEST_OBJS:.o=.dep)
+endif
+endif
+
+
 BAD_SERVER_RESPONSE_TEST_SRC = \
     test/core/end2end/bad_server_response_test.cc \
 
@@ -9723,6 +9755,38 @@
 endif
 
 
+CMDLINE_TEST_SRC = \
+    test/core/util/cmdline_test.cc \
+
+CMDLINE_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(CMDLINE_TEST_SRC))))
+ifeq ($(NO_SECURE),true)
+
+# You can't build secure targets if you don't have OpenSSL.
+
+$(BINDIR)/$(CONFIG)/cmdline_test: openssl_dep_error
+
+else
+
+
+
+$(BINDIR)/$(CONFIG)/cmdline_test: $(CMDLINE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a
+	$(E) "[LD]      Linking $@"
+	$(Q) mkdir -p `dirname $@`
+	$(Q) $(LD) $(LDFLAGS) $(CMDLINE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/cmdline_test
+
+endif
+
+$(OBJDIR)/$(CONFIG)/test/core/util/cmdline_test.o:  $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a
+
+deps_cmdline_test: $(CMDLINE_TEST_OBJS:.o=.dep)
+
+ifneq ($(NO_SECURE),true)
+ifneq ($(NO_DEPS),true)
+-include $(CMDLINE_TEST_OBJS:.o=.dep)
+endif
+endif
+
+
 COMBINER_TEST_SRC = \
     test/core/iomgr/combiner_test.cc \
 
@@ -10366,70 +10430,6 @@
 endif
 
 
-GPR_AVL_TEST_SRC = \
-    test/core/gpr/avl_test.cc \
-
-GPR_AVL_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GPR_AVL_TEST_SRC))))
-ifeq ($(NO_SECURE),true)
-
-# You can't build secure targets if you don't have OpenSSL.
-
-$(BINDIR)/$(CONFIG)/gpr_avl_test: openssl_dep_error
-
-else
-
-
-
-$(BINDIR)/$(CONFIG)/gpr_avl_test: $(GPR_AVL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
-	$(E) "[LD]      Linking $@"
-	$(Q) mkdir -p `dirname $@`
-	$(Q) $(LD) $(LDFLAGS) $(GPR_AVL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_avl_test
-
-endif
-
-$(OBJDIR)/$(CONFIG)/test/core/gpr/avl_test.o:  $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
-
-deps_gpr_avl_test: $(GPR_AVL_TEST_OBJS:.o=.dep)
-
-ifneq ($(NO_SECURE),true)
-ifneq ($(NO_DEPS),true)
--include $(GPR_AVL_TEST_OBJS:.o=.dep)
-endif
-endif
-
-
-GPR_CMDLINE_TEST_SRC = \
-    test/core/gpr/cmdline_test.cc \
-
-GPR_CMDLINE_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GPR_CMDLINE_TEST_SRC))))
-ifeq ($(NO_SECURE),true)
-
-# You can't build secure targets if you don't have OpenSSL.
-
-$(BINDIR)/$(CONFIG)/gpr_cmdline_test: openssl_dep_error
-
-else
-
-
-
-$(BINDIR)/$(CONFIG)/gpr_cmdline_test: $(GPR_CMDLINE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
-	$(E) "[LD]      Linking $@"
-	$(Q) mkdir -p `dirname $@`
-	$(Q) $(LD) $(LDFLAGS) $(GPR_CMDLINE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_cmdline_test
-
-endif
-
-$(OBJDIR)/$(CONFIG)/test/core/gpr/cmdline_test.o:  $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
-
-deps_gpr_cmdline_test: $(GPR_CMDLINE_TEST_OBJS:.o=.dep)
-
-ifneq ($(NO_SECURE),true)
-ifneq ($(NO_DEPS),true)
--include $(GPR_CMDLINE_TEST_OBJS:.o=.dep)
-endif
-endif
-
-
 GPR_CPU_TEST_SRC = \
     test/core/gpr/cpu_test.cc \
 
@@ -11104,6 +11104,7 @@
 
 GRPC_CREATE_JWT_SRC = \
     test/core/security/create_jwt.cc \
+    test/core/util/cmdline.cc \
 
 GRPC_CREATE_JWT_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GRPC_CREATE_JWT_SRC))))
 ifeq ($(NO_SECURE),true)
@@ -11125,6 +11126,8 @@
 
 $(OBJDIR)/$(CONFIG)/test/core/security/create_jwt.o:  $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
 
+$(OBJDIR)/$(CONFIG)/test/core/util/cmdline.o:  $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
+
 deps_grpc_create_jwt: $(GRPC_CREATE_JWT_OBJS:.o=.dep)
 
 ifneq ($(NO_SECURE),true)
@@ -11296,6 +11299,7 @@
 
 GRPC_PRINT_GOOGLE_DEFAULT_CREDS_TOKEN_SRC = \
     test/core/security/print_google_default_creds_token.cc \
+    test/core/util/cmdline.cc \
 
 GRPC_PRINT_GOOGLE_DEFAULT_CREDS_TOKEN_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GRPC_PRINT_GOOGLE_DEFAULT_CREDS_TOKEN_SRC))))
 ifeq ($(NO_SECURE),true)
@@ -11317,6 +11321,8 @@
 
 $(OBJDIR)/$(CONFIG)/test/core/security/print_google_default_creds_token.o:  $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
 
+$(OBJDIR)/$(CONFIG)/test/core/util/cmdline.o:  $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
+
 deps_grpc_print_google_default_creds_token: $(GRPC_PRINT_GOOGLE_DEFAULT_CREDS_TOKEN_OBJS:.o=.dep)
 
 ifneq ($(NO_SECURE),true)
@@ -11392,6 +11398,7 @@
 
 GRPC_VERIFY_JWT_SRC = \
     test/core/security/verify_jwt.cc \
+    test/core/util/cmdline.cc \
 
 GRPC_VERIFY_JWT_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GRPC_VERIFY_JWT_SRC))))
 ifeq ($(NO_SECURE),true)
@@ -11413,6 +11420,8 @@
 
 $(OBJDIR)/$(CONFIG)/test/core/security/verify_jwt.o:  $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
 
+$(OBJDIR)/$(CONFIG)/test/core/util/cmdline.o:  $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
+
 deps_grpc_verify_jwt: $(GRPC_VERIFY_JWT_OBJS:.o=.dep)
 
 ifneq ($(NO_SECURE),true)
@@ -11954,14 +11963,14 @@
 
 
 
-$(BINDIR)/$(CONFIG)/json_rewrite: $(JSON_REWRITE_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
+$(BINDIR)/$(CONFIG)/json_rewrite: $(JSON_REWRITE_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
 	$(E) "[LD]      Linking $@"
 	$(Q) mkdir -p `dirname $@`
-	$(Q) $(LD) $(LDFLAGS) $(JSON_REWRITE_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/json_rewrite
+	$(Q) $(LD) $(LDFLAGS) $(JSON_REWRITE_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/json_rewrite
 
 endif
 
-$(OBJDIR)/$(CONFIG)/test/core/json/json_rewrite.o:  $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
+$(OBJDIR)/$(CONFIG)/test/core/json/json_rewrite.o:  $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
 
 deps_json_rewrite: $(JSON_REWRITE_OBJS:.o=.dep)
 
diff --git a/Rakefile b/Rakefile
index 74c8b1f..1eac37d 100755
--- a/Rakefile
+++ b/Rakefile
@@ -99,7 +99,7 @@
     env_comp = "CC=#{opt[:cross]}-gcc "
     env_comp += "CXX=#{opt[:cross]}-g++ "
     env_comp += "LD=#{opt[:cross]}-gcc "
-    docker_for_windows "gem update --system && #{env} #{env_comp} make -j #{out} && #{opt[:cross]}-strip -x -S #{out} && cp #{out} #{opt[:out]}"
+    docker_for_windows "gem update --system --no-ri --no-doc && #{env} #{env_comp} make -j #{out} && #{opt[:cross]}-strip -x -S #{out} && cp #{out} #{opt[:out]}"
   end
 
 end
@@ -113,10 +113,15 @@
   if RUBY_PLATFORM =~ /darwin/
     FileUtils.touch 'grpc_c.32.ruby'
     FileUtils.touch 'grpc_c.64.ruby'
+    unless '2.5' == /(\d+\.\d+)/.match(RUBY_VERSION).to_s
+      fail "rake gem:native (the rake task to build the binary packages) is being " \
+        "invoked on macos with ruby #{RUBY_VERSION}. The ruby macos artifact " \
+        "build should be running on ruby 2.5."
+    end
     system "rake cross native gem RUBY_CC_VERSION=2.5.0:2.4.0:2.3.0:2.2.2:2.1.6:2.0.0 V=#{verbose} GRPC_CONFIG=#{grpc_config}"
   else
     Rake::Task['dlls'].execute
-    docker_for_windows "gem update --system && bundle && rake cross native gem RUBY_CC_VERSION=2.5.0:2.4.0:2.3.0:2.2.2:2.1.6:2.0.0 V=#{verbose} GRPC_CONFIG=#{grpc_config}"
+    docker_for_windows "gem update --system --no-ri --no-doc && bundle && rake cross native gem RUBY_CC_VERSION=2.5.0:2.4.0:2.3.0:2.2.2:2.1.6:2.0.0 V=#{verbose} GRPC_CONFIG=#{grpc_config}"
   end
 end
 
diff --git a/build.yaml b/build.yaml
index f688f9e..0cfe04b 100644
--- a/build.yaml
+++ b/build.yaml
@@ -24,13 +24,18 @@
   uses:
   - grpc_base
   - nanopb
+- name: cmdline
+  headers:
+  - test/core/util/cmdline.h
+  src:
+  - test/core/util/cmdline.cc
+  uses:
+  - gpr_base_headers
 - name: gpr_base
   src:
   - src/core/lib/gpr/alloc.cc
   - src/core/lib/gpr/arena.cc
   - src/core/lib/gpr/atm.cc
-  - src/core/lib/gpr/avl.cc
-  - src/core/lib/gpr/cmdline.cc
   - src/core/lib/gpr/cpu_iphone.cc
   - src/core/lib/gpr/cpu_linux.cc
   - src/core/lib/gpr/cpu_posix.cc
@@ -51,8 +56,6 @@
   - src/core/lib/gpr/string_posix.cc
   - src/core/lib/gpr/string_util_windows.cc
   - src/core/lib/gpr/string_windows.cc
-  - src/core/lib/gpr/subprocess_posix.cc
-  - src/core/lib/gpr/subprocess_windows.cc
   - src/core/lib/gpr/sync.cc
   - src/core/lib/gpr/sync_posix.cc
   - src/core/lib/gpr/sync_windows.cc
@@ -79,15 +82,11 @@
   - include/grpc/support/atm_gcc_atomic.h
   - include/grpc/support/atm_gcc_sync.h
   - include/grpc/support/atm_windows.h
-  - include/grpc/support/avl.h
-  - include/grpc/support/cmdline.h
   - include/grpc/support/cpu.h
-  - include/grpc/support/host_port.h
   - include/grpc/support/log.h
   - include/grpc/support/log_windows.h
   - include/grpc/support/port_platform.h
   - include/grpc/support/string_util.h
-  - include/grpc/support/subprocess.h
   - include/grpc/support/sync.h
   - include/grpc/support/sync_custom.h
   - include/grpc/support/sync_generic.h
@@ -95,15 +94,11 @@
   - include/grpc/support/sync_windows.h
   - include/grpc/support/thd.h
   - include/grpc/support/time.h
-  - include/grpc/support/tls.h
-  - include/grpc/support/tls_gcc.h
-  - include/grpc/support/tls_msvc.h
-  - include/grpc/support/tls_pthread.h
-  - include/grpc/support/useful.h
   headers:
   - src/core/lib/gpr/arena.h
   - src/core/lib/gpr/env.h
   - src/core/lib/gpr/fork.h
+  - src/core/lib/gpr/host_port.h
   - src/core/lib/gpr/mpscq.h
   - src/core/lib/gpr/murmur_hash.h
   - src/core/lib/gpr/spinlock.h
@@ -111,7 +106,12 @@
   - src/core/lib/gpr/string_windows.h
   - src/core/lib/gpr/thd_internal.h
   - src/core/lib/gpr/time_precise.h
+  - src/core/lib/gpr/tls.h
+  - src/core/lib/gpr/tls_gcc.h
+  - src/core/lib/gpr/tls_msvc.h
+  - src/core/lib/gpr/tls_pthread.h
   - src/core/lib/gpr/tmpfile.h
+  - src/core/lib/gpr/useful.h
   - src/core/lib/gprpp/abstract.h
   - src/core/lib/gprpp/atomic.h
   - src/core/lib/gprpp/atomic_with_atm.h
@@ -150,6 +150,7 @@
   - grpc++_codegen_base
 - name: grpc_base
   src:
+  - src/core/lib/avl/avl.cc
   - src/core/lib/backoff/backoff.cc
   - src/core/lib/channel/channel_args.cc
   - src/core/lib/channel/channel_stack.cc
@@ -305,6 +306,7 @@
   - include/grpc/status.h
   - include/grpc/support/workaround_list.h
   headers:
+  - src/core/lib/avl/avl.h
   - src/core/lib/backoff/backoff.h
   - src/core/lib/channel/channel_args.h
   - src/core/lib/channel/channel_stack.h
@@ -471,7 +473,6 @@
   - src/core/ext/filters/client_channel/proxy_mapper.cc
   - src/core/ext/filters/client_channel/proxy_mapper_registry.cc
   - src/core/ext/filters/client_channel/resolver.cc
-  - src/core/ext/filters/client_channel/resolver_factory.cc
   - src/core/ext/filters/client_channel/resolver_registry.cc
   - src/core/ext/filters/client_channel/retry_throttle.cc
   - src/core/ext/filters/client_channel/subchannel.cc
@@ -721,6 +722,7 @@
   - test/core/util/port.h
   - test/core/util/port_server_client.h
   - test/core/util/slice_splitter.h
+  - test/core/util/subprocess.h
   - test/core/util/tracer_util.h
   - test/core/util/trickle_endpoint.h
   src:
@@ -740,12 +742,15 @@
   - test/core/util/port_isolated_runtime_environment.cc
   - test/core/util/port_server_client.cc
   - test/core/util/slice_splitter.cc
+  - test/core/util/subprocess_posix.cc
+  - test/core/util/subprocess_windows.cc
   - test/core/util/tracer_util.cc
   - test/core/util/trickle_endpoint.cc
   deps:
   - gpr_test_util
   - gpr
   uses:
+  - cmdline
   - grpc_base
   - grpc_client_channel
   - grpc_transport_chttp2
@@ -1760,6 +1765,16 @@
   - gpr_test_util
   - gpr
   uses_polling: false
+- name: avl_test
+  build: test
+  language: c
+  src:
+  - test/core/avl/avl_test.cc
+  deps:
+  - gpr_test_util
+  - gpr
+  - grpc
+  uses_polling: false
 - name: bad_server_response_test
   build: test
   language: c
@@ -1867,6 +1882,16 @@
   - test/core/end2end/fuzzers/client_fuzzer_corpus
   dict: test/core/end2end/fuzzers/hpack.dictionary
   maxlen: 2048
+- name: cmdline_test
+  build: test
+  language: c
+  src:
+  - test/core/util/cmdline_test.cc
+  deps:
+  - gpr
+  - gpr_test_util
+  - grpc_test_util
+  uses_polling: false
 - name: combiner_test
   cpu_cost: 10
   build: test
@@ -2128,24 +2153,6 @@
   - mac
   - linux
   - posix
-- name: gpr_avl_test
-  build: test
-  language: c
-  src:
-  - test/core/gpr/avl_test.cc
-  deps:
-  - gpr_test_util
-  - gpr
-  uses_polling: false
-- name: gpr_cmdline_test
-  build: test
-  language: c
-  src:
-  - test/core/gpr/cmdline_test.cc
-  deps:
-  - gpr_test_util
-  - gpr
-  uses_polling: false
 - name: gpr_cpu_test
   cpu_cost: 30
   build: test
@@ -2364,6 +2371,8 @@
   deps:
   - grpc
   - gpr
+  filegroups:
+  - cmdline
   secure: true
   uses_polling: false
 - name: grpc_credentials_test
@@ -2432,6 +2441,8 @@
   deps:
   - grpc
   - gpr
+  filegroups:
+  - cmdline
   uses_polling: false
 - name: grpc_security_connector_test
   build: test
@@ -2461,6 +2472,8 @@
   deps:
   - grpc
   - gpr
+  filegroups:
+  - cmdline
   uses_polling: false
 - name: handshake_client
   build: test
@@ -2675,7 +2688,9 @@
   src:
   - test/core/json/json_rewrite.cc
   deps:
+  - grpc_test_util
   - grpc
+  - gpr_test_util
   - gpr
   uses_polling: false
 - name: json_rewrite_test
diff --git a/config.m4 b/config.m4
index 54340ba..5bc2e58 100644
--- a/config.m4
+++ b/config.m4
@@ -42,8 +42,6 @@
     src/core/lib/gpr/alloc.cc \
     src/core/lib/gpr/arena.cc \
     src/core/lib/gpr/atm.cc \
-    src/core/lib/gpr/avl.cc \
-    src/core/lib/gpr/cmdline.cc \
     src/core/lib/gpr/cpu_iphone.cc \
     src/core/lib/gpr/cpu_linux.cc \
     src/core/lib/gpr/cpu_posix.cc \
@@ -64,8 +62,6 @@
     src/core/lib/gpr/string_posix.cc \
     src/core/lib/gpr/string_util_windows.cc \
     src/core/lib/gpr/string_windows.cc \
-    src/core/lib/gpr/subprocess_posix.cc \
-    src/core/lib/gpr/subprocess_windows.cc \
     src/core/lib/gpr/sync.cc \
     src/core/lib/gpr/sync_posix.cc \
     src/core/lib/gpr/sync_windows.cc \
@@ -84,6 +80,7 @@
     src/core/lib/profiling/basic_timers.cc \
     src/core/lib/profiling/stap_timers.cc \
     src/core/lib/surface/init.cc \
+    src/core/lib/avl/avl.cc \
     src/core/lib/backoff/backoff.cc \
     src/core/lib/channel/channel_args.cc \
     src/core/lib/channel/channel_stack.cc \
@@ -293,7 +290,6 @@
     src/core/ext/filters/client_channel/proxy_mapper.cc \
     src/core/ext/filters/client_channel/proxy_mapper_registry.cc \
     src/core/ext/filters/client_channel/resolver.cc \
-    src/core/ext/filters/client_channel/resolver_factory.cc \
     src/core/ext/filters/client_channel/resolver_registry.cc \
     src/core/ext/filters/client_channel/retry_throttle.cc \
     src/core/ext/filters/client_channel/subchannel.cc \
@@ -625,6 +621,7 @@
   PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/server/secure)
   PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/transport)
   PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/inproc)
+  PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/avl)
   PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/backoff)
   PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/channel)
   PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/compression)
diff --git a/config.w32 b/config.w32
index e50e7f3..2ef122b 100644
--- a/config.w32
+++ b/config.w32
@@ -19,8 +19,6 @@
     "src\\core\\lib\\gpr\\alloc.cc " +
     "src\\core\\lib\\gpr\\arena.cc " +
     "src\\core\\lib\\gpr\\atm.cc " +
-    "src\\core\\lib\\gpr\\avl.cc " +
-    "src\\core\\lib\\gpr\\cmdline.cc " +
     "src\\core\\lib\\gpr\\cpu_iphone.cc " +
     "src\\core\\lib\\gpr\\cpu_linux.cc " +
     "src\\core\\lib\\gpr\\cpu_posix.cc " +
@@ -41,8 +39,6 @@
     "src\\core\\lib\\gpr\\string_posix.cc " +
     "src\\core\\lib\\gpr\\string_util_windows.cc " +
     "src\\core\\lib\\gpr\\string_windows.cc " +
-    "src\\core\\lib\\gpr\\subprocess_posix.cc " +
-    "src\\core\\lib\\gpr\\subprocess_windows.cc " +
     "src\\core\\lib\\gpr\\sync.cc " +
     "src\\core\\lib\\gpr\\sync_posix.cc " +
     "src\\core\\lib\\gpr\\sync_windows.cc " +
@@ -61,6 +57,7 @@
     "src\\core\\lib\\profiling\\basic_timers.cc " +
     "src\\core\\lib\\profiling\\stap_timers.cc " +
     "src\\core\\lib\\surface\\init.cc " +
+    "src\\core\\lib\\avl\\avl.cc " +
     "src\\core\\lib\\backoff\\backoff.cc " +
     "src\\core\\lib\\channel\\channel_args.cc " +
     "src\\core\\lib\\channel\\channel_stack.cc " +
@@ -270,7 +267,6 @@
     "src\\core\\ext\\filters\\client_channel\\proxy_mapper.cc " +
     "src\\core\\ext\\filters\\client_channel\\proxy_mapper_registry.cc " +
     "src\\core\\ext\\filters\\client_channel\\resolver.cc " +
-    "src\\core\\ext\\filters\\client_channel\\resolver_factory.cc " +
     "src\\core\\ext\\filters\\client_channel\\resolver_registry.cc " +
     "src\\core\\ext\\filters\\client_channel\\retry_throttle.cc " +
     "src\\core\\ext\\filters\\client_channel\\subchannel.cc " +
@@ -637,6 +633,7 @@
   FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2\\transport");
   FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\inproc");
   FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib");
+  FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\avl");
   FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\backoff");
   FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\channel");
   FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\compression");
diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec
index bbf3f7f..5bd3b0b 100644
--- a/gRPC-C++.podspec
+++ b/gRPC-C++.podspec
@@ -206,6 +206,7 @@
                       'src/core/lib/gpr/arena.h',
                       'src/core/lib/gpr/env.h',
                       'src/core/lib/gpr/fork.h',
+                      'src/core/lib/gpr/host_port.h',
                       'src/core/lib/gpr/mpscq.h',
                       'src/core/lib/gpr/murmur_hash.h',
                       'src/core/lib/gpr/spinlock.h',
@@ -213,7 +214,12 @@
                       'src/core/lib/gpr/string_windows.h',
                       'src/core/lib/gpr/thd_internal.h',
                       'src/core/lib/gpr/time_precise.h',
+                      'src/core/lib/gpr/tls.h',
+                      'src/core/lib/gpr/tls_gcc.h',
+                      'src/core/lib/gpr/tls_msvc.h',
+                      'src/core/lib/gpr/tls_pthread.h',
                       'src/core/lib/gpr/tmpfile.h',
+                      'src/core/lib/gpr/useful.h',
                       'src/core/lib/gprpp/abstract.h',
                       'src/core/lib/gprpp/atomic.h',
                       'src/core/lib/gprpp/atomic_with_atm.h',
@@ -295,6 +301,7 @@
                       'src/core/ext/filters/deadline/deadline_filter.h',
                       'src/core/ext/transport/chttp2/client/chttp2_connector.h',
                       'src/core/ext/transport/inproc/inproc_transport.h',
+                      'src/core/lib/avl/avl.h',
                       'src/core/lib/backoff/backoff.h',
                       'src/core/lib/channel/channel_args.h',
                       'src/core/lib/channel/channel_stack.h',
@@ -451,6 +458,7 @@
                               'src/core/lib/gpr/arena.h',
                               'src/core/lib/gpr/env.h',
                               'src/core/lib/gpr/fork.h',
+                              'src/core/lib/gpr/host_port.h',
                               'src/core/lib/gpr/mpscq.h',
                               'src/core/lib/gpr/murmur_hash.h',
                               'src/core/lib/gpr/spinlock.h',
@@ -458,7 +466,12 @@
                               'src/core/lib/gpr/string_windows.h',
                               'src/core/lib/gpr/thd_internal.h',
                               'src/core/lib/gpr/time_precise.h',
+                              'src/core/lib/gpr/tls.h',
+                              'src/core/lib/gpr/tls_gcc.h',
+                              'src/core/lib/gpr/tls_msvc.h',
+                              'src/core/lib/gpr/tls_pthread.h',
                               'src/core/lib/gpr/tmpfile.h',
+                              'src/core/lib/gpr/useful.h',
                               'src/core/lib/gprpp/abstract.h',
                               'src/core/lib/gprpp/atomic.h',
                               'src/core/lib/gprpp/atomic_with_atm.h',
@@ -466,6 +479,7 @@
                               'src/core/lib/gprpp/manual_constructor.h',
                               'src/core/lib/gprpp/memory.h',
                               'src/core/lib/profiling/timers.h',
+                              'src/core/lib/avl/avl.h',
                               'src/core/lib/backoff/backoff.h',
                               'src/core/lib/channel/channel_args.h',
                               'src/core/lib/channel/channel_stack.h',
@@ -627,8 +641,34 @@
                       'test/core/util/port.h',
                       'test/core/util/port_server_client.h',
                       'test/core/util/slice_splitter.h',
+                      'test/core/util/subprocess.h',
                       'test/core/util/tracer_util.h',
                       'test/core/util/trickle_endpoint.h',
+                      'test/core/util/cmdline.h',
+                      'src/core/lib/gpr/arena.h',
+                      'src/core/lib/gpr/env.h',
+                      'src/core/lib/gpr/fork.h',
+                      'src/core/lib/gpr/host_port.h',
+                      'src/core/lib/gpr/mpscq.h',
+                      'src/core/lib/gpr/murmur_hash.h',
+                      'src/core/lib/gpr/spinlock.h',
+                      'src/core/lib/gpr/string.h',
+                      'src/core/lib/gpr/string_windows.h',
+                      'src/core/lib/gpr/thd_internal.h',
+                      'src/core/lib/gpr/time_precise.h',
+                      'src/core/lib/gpr/tls.h',
+                      'src/core/lib/gpr/tls_gcc.h',
+                      'src/core/lib/gpr/tls_msvc.h',
+                      'src/core/lib/gpr/tls_pthread.h',
+                      'src/core/lib/gpr/tmpfile.h',
+                      'src/core/lib/gpr/useful.h',
+                      'src/core/lib/gprpp/abstract.h',
+                      'src/core/lib/gprpp/atomic.h',
+                      'src/core/lib/gprpp/atomic_with_atm.h',
+                      'src/core/lib/gprpp/atomic_with_std.h',
+                      'src/core/lib/gprpp/manual_constructor.h',
+                      'src/core/lib/gprpp/memory.h',
+                      'src/core/lib/profiling/timers.h',
                       'src/core/ext/filters/client_channel/backup_poller.h',
                       'src/core/ext/filters/client_channel/client_channel.h',
                       'src/core/ext/filters/client_channel/client_channel_factory.h',
diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec
index c767b59..1798a0c 100644
--- a/gRPC-Core.podspec
+++ b/gRPC-Core.podspec
@@ -114,15 +114,11 @@
                       'include/grpc/support/atm_gcc_atomic.h',
                       'include/grpc/support/atm_gcc_sync.h',
                       'include/grpc/support/atm_windows.h',
-                      'include/grpc/support/avl.h',
-                      'include/grpc/support/cmdline.h',
                       'include/grpc/support/cpu.h',
-                      'include/grpc/support/host_port.h',
                       'include/grpc/support/log.h',
                       'include/grpc/support/log_windows.h',
                       'include/grpc/support/port_platform.h',
                       'include/grpc/support/string_util.h',
-                      'include/grpc/support/subprocess.h',
                       'include/grpc/support/sync.h',
                       'include/grpc/support/sync_custom.h',
                       'include/grpc/support/sync_generic.h',
@@ -130,11 +126,6 @@
                       'include/grpc/support/sync_windows.h',
                       'include/grpc/support/thd.h',
                       'include/grpc/support/time.h',
-                      'include/grpc/support/tls.h',
-                      'include/grpc/support/tls_gcc.h',
-                      'include/grpc/support/tls_msvc.h',
-                      'include/grpc/support/tls_pthread.h',
-                      'include/grpc/support/useful.h',
                       'include/grpc/impl/codegen/atm.h',
                       'include/grpc/impl/codegen/atm_gcc_atomic.h',
                       'include/grpc/impl/codegen/atm_gcc_sync.h',
@@ -195,6 +186,7 @@
     ss.source_files = 'src/core/lib/gpr/arena.h',
                       'src/core/lib/gpr/env.h',
                       'src/core/lib/gpr/fork.h',
+                      'src/core/lib/gpr/host_port.h',
                       'src/core/lib/gpr/mpscq.h',
                       'src/core/lib/gpr/murmur_hash.h',
                       'src/core/lib/gpr/spinlock.h',
@@ -202,7 +194,12 @@
                       'src/core/lib/gpr/string_windows.h',
                       'src/core/lib/gpr/thd_internal.h',
                       'src/core/lib/gpr/time_precise.h',
+                      'src/core/lib/gpr/tls.h',
+                      'src/core/lib/gpr/tls_gcc.h',
+                      'src/core/lib/gpr/tls_msvc.h',
+                      'src/core/lib/gpr/tls_pthread.h',
                       'src/core/lib/gpr/tmpfile.h',
+                      'src/core/lib/gpr/useful.h',
                       'src/core/lib/gprpp/abstract.h',
                       'src/core/lib/gprpp/atomic.h',
                       'src/core/lib/gprpp/atomic_with_atm.h',
@@ -213,8 +210,6 @@
                       'src/core/lib/gpr/alloc.cc',
                       'src/core/lib/gpr/arena.cc',
                       'src/core/lib/gpr/atm.cc',
-                      'src/core/lib/gpr/avl.cc',
-                      'src/core/lib/gpr/cmdline.cc',
                       'src/core/lib/gpr/cpu_iphone.cc',
                       'src/core/lib/gpr/cpu_linux.cc',
                       'src/core/lib/gpr/cpu_posix.cc',
@@ -235,8 +230,6 @@
                       'src/core/lib/gpr/string_posix.cc',
                       'src/core/lib/gpr/string_util_windows.cc',
                       'src/core/lib/gpr/string_windows.cc',
-                      'src/core/lib/gpr/subprocess_posix.cc',
-                      'src/core/lib/gpr/subprocess_windows.cc',
                       'src/core/lib/gpr/sync.cc',
                       'src/core/lib/gpr/sync_posix.cc',
                       'src/core/lib/gpr/sync_windows.cc',
@@ -328,6 +321,7 @@
                       'src/core/ext/filters/deadline/deadline_filter.h',
                       'src/core/ext/transport/chttp2/client/chttp2_connector.h',
                       'src/core/ext/transport/inproc/inproc_transport.h',
+                      'src/core/lib/avl/avl.h',
                       'src/core/lib/backoff/backoff.h',
                       'src/core/lib/channel/channel_args.h',
                       'src/core/lib/channel/channel_stack.h',
@@ -470,6 +464,7 @@
                       'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h',
                       'src/core/ext/filters/workarounds/workaround_utils.h',
                       'src/core/lib/surface/init.cc',
+                      'src/core/lib/avl/avl.cc',
                       'src/core/lib/backoff/backoff.cc',
                       'src/core/lib/channel/channel_args.cc',
                       'src/core/lib/channel/channel_stack.cc',
@@ -679,7 +674,6 @@
                       'src/core/ext/filters/client_channel/proxy_mapper.cc',
                       'src/core/ext/filters/client_channel/proxy_mapper_registry.cc',
                       'src/core/ext/filters/client_channel/resolver.cc',
-                      'src/core/ext/filters/client_channel/resolver_factory.cc',
                       'src/core/ext/filters/client_channel/resolver_registry.cc',
                       'src/core/ext/filters/client_channel/retry_throttle.cc',
                       'src/core/ext/filters/client_channel/subchannel.cc',
@@ -721,6 +715,7 @@
     ss.private_header_files = 'src/core/lib/gpr/arena.h',
                               'src/core/lib/gpr/env.h',
                               'src/core/lib/gpr/fork.h',
+                              'src/core/lib/gpr/host_port.h',
                               'src/core/lib/gpr/mpscq.h',
                               'src/core/lib/gpr/murmur_hash.h',
                               'src/core/lib/gpr/spinlock.h',
@@ -728,7 +723,12 @@
                               'src/core/lib/gpr/string_windows.h',
                               'src/core/lib/gpr/thd_internal.h',
                               'src/core/lib/gpr/time_precise.h',
+                              'src/core/lib/gpr/tls.h',
+                              'src/core/lib/gpr/tls_gcc.h',
+                              'src/core/lib/gpr/tls_msvc.h',
+                              'src/core/lib/gpr/tls_pthread.h',
                               'src/core/lib/gpr/tmpfile.h',
+                              'src/core/lib/gpr/useful.h',
                               'src/core/lib/gprpp/abstract.h',
                               'src/core/lib/gprpp/atomic.h',
                               'src/core/lib/gprpp/atomic_with_atm.h',
@@ -810,6 +810,7 @@
                               'src/core/ext/filters/deadline/deadline_filter.h',
                               'src/core/ext/transport/chttp2/client/chttp2_connector.h',
                               'src/core/ext/transport/inproc/inproc_transport.h',
+                              'src/core/lib/avl/avl.h',
                               'src/core/lib/backoff/backoff.h',
                               'src/core/lib/channel/channel_args.h',
                               'src/core/lib/channel/channel_stack.h',
@@ -999,8 +1000,11 @@
                       'test/core/util/port_isolated_runtime_environment.cc',
                       'test/core/util/port_server_client.cc',
                       'test/core/util/slice_splitter.cc',
+                      'test/core/util/subprocess_posix.cc',
+                      'test/core/util/subprocess_windows.cc',
                       'test/core/util/tracer_util.cc',
                       'test/core/util/trickle_endpoint.cc',
+                      'test/core/util/cmdline.cc',
                       'test/core/end2end/data/ssl_test_data.h',
                       'test/core/security/oauth2_utils.h',
                       'test/core/end2end/cq_verifier.h',
@@ -1017,8 +1021,10 @@
                       'test/core/util/port.h',
                       'test/core/util/port_server_client.h',
                       'test/core/util/slice_splitter.h',
+                      'test/core/util/subprocess.h',
                       'test/core/util/tracer_util.h',
                       'test/core/util/trickle_endpoint.h',
+                      'test/core/util/cmdline.h',
                       'test/core/end2end/end2end_tests.cc',
                       'test/core/end2end/end2end_test_utils.cc',
                       'test/core/end2end/tests/authority_not_supported.cc',
diff --git a/grpc.def b/grpc.def
index 102e551..8a62102 100644
--- a/grpc.def
+++ b/grpc.def
@@ -176,27 +176,8 @@
     gpr_free_aligned
     gpr_set_allocation_functions
     gpr_get_allocation_functions
-    gpr_avl_create
-    gpr_avl_ref
-    gpr_avl_unref
-    gpr_avl_add
-    gpr_avl_remove
-    gpr_avl_get
-    gpr_avl_maybe_get
-    gpr_avl_is_empty
-    gpr_cmdline_create
-    gpr_cmdline_add_int
-    gpr_cmdline_add_flag
-    gpr_cmdline_add_string
-    gpr_cmdline_on_extra_arg
-    gpr_cmdline_set_survive_failure
-    gpr_cmdline_parse
-    gpr_cmdline_destroy
-    gpr_cmdline_usage_string
     gpr_cpu_num_cores
     gpr_cpu_current_cpu
-    gpr_join_host_port
-    gpr_split_host_port
     gpr_log_severity_string
     gpr_log
     gpr_log_message
@@ -206,11 +187,6 @@
     gpr_format_message
     gpr_strdup
     gpr_asprintf
-    gpr_subprocess_binary_extension
-    gpr_subprocess_create
-    gpr_subprocess_destroy
-    gpr_subprocess_join
-    gpr_subprocess_interrupt
     gpr_mu_init
     gpr_mu_destroy
     gpr_mu_lock
diff --git a/grpc.gemspec b/grpc.gemspec
index f813596..6e51703 100644
--- a/grpc.gemspec
+++ b/grpc.gemspec
@@ -49,15 +49,11 @@
   s.files += %w( include/grpc/support/atm_gcc_atomic.h )
   s.files += %w( include/grpc/support/atm_gcc_sync.h )
   s.files += %w( include/grpc/support/atm_windows.h )
-  s.files += %w( include/grpc/support/avl.h )
-  s.files += %w( include/grpc/support/cmdline.h )
   s.files += %w( include/grpc/support/cpu.h )
-  s.files += %w( include/grpc/support/host_port.h )
   s.files += %w( include/grpc/support/log.h )
   s.files += %w( include/grpc/support/log_windows.h )
   s.files += %w( include/grpc/support/port_platform.h )
   s.files += %w( include/grpc/support/string_util.h )
-  s.files += %w( include/grpc/support/subprocess.h )
   s.files += %w( include/grpc/support/sync.h )
   s.files += %w( include/grpc/support/sync_custom.h )
   s.files += %w( include/grpc/support/sync_generic.h )
@@ -65,11 +61,6 @@
   s.files += %w( include/grpc/support/sync_windows.h )
   s.files += %w( include/grpc/support/thd.h )
   s.files += %w( include/grpc/support/time.h )
-  s.files += %w( include/grpc/support/tls.h )
-  s.files += %w( include/grpc/support/tls_gcc.h )
-  s.files += %w( include/grpc/support/tls_msvc.h )
-  s.files += %w( include/grpc/support/tls_pthread.h )
-  s.files += %w( include/grpc/support/useful.h )
   s.files += %w( include/grpc/impl/codegen/atm.h )
   s.files += %w( include/grpc/impl/codegen/atm_gcc_atomic.h )
   s.files += %w( include/grpc/impl/codegen/atm_gcc_sync.h )
@@ -86,6 +77,7 @@
   s.files += %w( src/core/lib/gpr/arena.h )
   s.files += %w( src/core/lib/gpr/env.h )
   s.files += %w( src/core/lib/gpr/fork.h )
+  s.files += %w( src/core/lib/gpr/host_port.h )
   s.files += %w( src/core/lib/gpr/mpscq.h )
   s.files += %w( src/core/lib/gpr/murmur_hash.h )
   s.files += %w( src/core/lib/gpr/spinlock.h )
@@ -93,7 +85,12 @@
   s.files += %w( src/core/lib/gpr/string_windows.h )
   s.files += %w( src/core/lib/gpr/thd_internal.h )
   s.files += %w( src/core/lib/gpr/time_precise.h )
+  s.files += %w( src/core/lib/gpr/tls.h )
+  s.files += %w( src/core/lib/gpr/tls_gcc.h )
+  s.files += %w( src/core/lib/gpr/tls_msvc.h )
+  s.files += %w( src/core/lib/gpr/tls_pthread.h )
   s.files += %w( src/core/lib/gpr/tmpfile.h )
+  s.files += %w( src/core/lib/gpr/useful.h )
   s.files += %w( src/core/lib/gprpp/abstract.h )
   s.files += %w( src/core/lib/gprpp/atomic.h )
   s.files += %w( src/core/lib/gprpp/atomic_with_atm.h )
@@ -104,8 +101,6 @@
   s.files += %w( src/core/lib/gpr/alloc.cc )
   s.files += %w( src/core/lib/gpr/arena.cc )
   s.files += %w( src/core/lib/gpr/atm.cc )
-  s.files += %w( src/core/lib/gpr/avl.cc )
-  s.files += %w( src/core/lib/gpr/cmdline.cc )
   s.files += %w( src/core/lib/gpr/cpu_iphone.cc )
   s.files += %w( src/core/lib/gpr/cpu_linux.cc )
   s.files += %w( src/core/lib/gpr/cpu_posix.cc )
@@ -126,8 +121,6 @@
   s.files += %w( src/core/lib/gpr/string_posix.cc )
   s.files += %w( src/core/lib/gpr/string_util_windows.cc )
   s.files += %w( src/core/lib/gpr/string_windows.cc )
-  s.files += %w( src/core/lib/gpr/subprocess_posix.cc )
-  s.files += %w( src/core/lib/gpr/subprocess_windows.cc )
   s.files += %w( src/core/lib/gpr/sync.cc )
   s.files += %w( src/core/lib/gpr/sync_posix.cc )
   s.files += %w( src/core/lib/gpr/sync_windows.cc )
@@ -254,6 +247,7 @@
   s.files += %w( src/core/ext/filters/deadline/deadline_filter.h )
   s.files += %w( src/core/ext/transport/chttp2/client/chttp2_connector.h )
   s.files += %w( src/core/ext/transport/inproc/inproc_transport.h )
+  s.files += %w( src/core/lib/avl/avl.h )
   s.files += %w( src/core/lib/backoff/backoff.h )
   s.files += %w( src/core/lib/channel/channel_args.h )
   s.files += %w( src/core/lib/channel/channel_stack.h )
@@ -400,6 +394,7 @@
   s.files += %w( src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h )
   s.files += %w( src/core/ext/filters/workarounds/workaround_utils.h )
   s.files += %w( src/core/lib/surface/init.cc )
+  s.files += %w( src/core/lib/avl/avl.cc )
   s.files += %w( src/core/lib/backoff/backoff.cc )
   s.files += %w( src/core/lib/channel/channel_args.cc )
   s.files += %w( src/core/lib/channel/channel_stack.cc )
@@ -609,7 +604,6 @@
   s.files += %w( src/core/ext/filters/client_channel/proxy_mapper.cc )
   s.files += %w( src/core/ext/filters/client_channel/proxy_mapper_registry.cc )
   s.files += %w( src/core/ext/filters/client_channel/resolver.cc )
-  s.files += %w( src/core/ext/filters/client_channel/resolver_factory.cc )
   s.files += %w( src/core/ext/filters/client_channel/resolver_registry.cc )
   s.files += %w( src/core/ext/filters/client_channel/retry_throttle.cc )
   s.files += %w( src/core/ext/filters/client_channel/subchannel.cc )
diff --git a/grpc.gyp b/grpc.gyp
index 728f27b..44bc7e8 100644
--- a/grpc.gyp
+++ b/grpc.gyp
@@ -164,8 +164,6 @@
         'src/core/lib/gpr/alloc.cc',
         'src/core/lib/gpr/arena.cc',
         'src/core/lib/gpr/atm.cc',
-        'src/core/lib/gpr/avl.cc',
-        'src/core/lib/gpr/cmdline.cc',
         'src/core/lib/gpr/cpu_iphone.cc',
         'src/core/lib/gpr/cpu_linux.cc',
         'src/core/lib/gpr/cpu_posix.cc',
@@ -186,8 +184,6 @@
         'src/core/lib/gpr/string_posix.cc',
         'src/core/lib/gpr/string_util_windows.cc',
         'src/core/lib/gpr/string_windows.cc',
-        'src/core/lib/gpr/subprocess_posix.cc',
-        'src/core/lib/gpr/subprocess_windows.cc',
         'src/core/lib/gpr/sync.cc',
         'src/core/lib/gpr/sync_posix.cc',
         'src/core/lib/gpr/sync_windows.cc',
@@ -225,6 +221,7 @@
       ],
       'sources': [
         'src/core/lib/surface/init.cc',
+        'src/core/lib/avl/avl.cc',
         'src/core/lib/backoff/backoff.cc',
         'src/core/lib/channel/channel_args.cc',
         'src/core/lib/channel/channel_stack.cc',
@@ -434,7 +431,6 @@
         'src/core/ext/filters/client_channel/proxy_mapper.cc',
         'src/core/ext/filters/client_channel/proxy_mapper_registry.cc',
         'src/core/ext/filters/client_channel/resolver.cc',
-        'src/core/ext/filters/client_channel/resolver_factory.cc',
         'src/core/ext/filters/client_channel/resolver_registry.cc',
         'src/core/ext/filters/client_channel/retry_throttle.cc',
         'src/core/ext/filters/client_channel/subchannel.cc',
@@ -517,8 +513,12 @@
         'test/core/util/port_isolated_runtime_environment.cc',
         'test/core/util/port_server_client.cc',
         'test/core/util/slice_splitter.cc',
+        'test/core/util/subprocess_posix.cc',
+        'test/core/util/subprocess_windows.cc',
         'test/core/util/tracer_util.cc',
         'test/core/util/trickle_endpoint.cc',
+        'test/core/util/cmdline.cc',
+        'src/core/lib/avl/avl.cc',
         'src/core/lib/backoff/backoff.cc',
         'src/core/lib/channel/channel_args.cc',
         'src/core/lib/channel/channel_stack.cc',
@@ -668,7 +668,6 @@
         'src/core/ext/filters/client_channel/proxy_mapper.cc',
         'src/core/ext/filters/client_channel/proxy_mapper_registry.cc',
         'src/core/ext/filters/client_channel/resolver.cc',
-        'src/core/ext/filters/client_channel/resolver_factory.cc',
         'src/core/ext/filters/client_channel/resolver_registry.cc',
         'src/core/ext/filters/client_channel/retry_throttle.cc',
         'src/core/ext/filters/client_channel/subchannel.cc',
@@ -729,8 +728,12 @@
         'test/core/util/port_isolated_runtime_environment.cc',
         'test/core/util/port_server_client.cc',
         'test/core/util/slice_splitter.cc',
+        'test/core/util/subprocess_posix.cc',
+        'test/core/util/subprocess_windows.cc',
         'test/core/util/tracer_util.cc',
         'test/core/util/trickle_endpoint.cc',
+        'test/core/util/cmdline.cc',
+        'src/core/lib/avl/avl.cc',
         'src/core/lib/backoff/backoff.cc',
         'src/core/lib/channel/channel_args.cc',
         'src/core/lib/channel/channel_stack.cc',
@@ -880,7 +883,6 @@
         'src/core/ext/filters/client_channel/proxy_mapper.cc',
         'src/core/ext/filters/client_channel/proxy_mapper_registry.cc',
         'src/core/ext/filters/client_channel/resolver.cc',
-        'src/core/ext/filters/client_channel/resolver_factory.cc',
         'src/core/ext/filters/client_channel/resolver_registry.cc',
         'src/core/ext/filters/client_channel/retry_throttle.cc',
         'src/core/ext/filters/client_channel/subchannel.cc',
@@ -925,6 +927,7 @@
       'sources': [
         'src/core/lib/surface/init.cc',
         'src/core/lib/surface/init_unsecure.cc',
+        'src/core/lib/avl/avl.cc',
         'src/core/lib/backoff/backoff.cc',
         'src/core/lib/channel/channel_args.cc',
         'src/core/lib/channel/channel_stack.cc',
@@ -1107,7 +1110,6 @@
         'src/core/ext/filters/client_channel/proxy_mapper.cc',
         'src/core/ext/filters/client_channel/proxy_mapper_registry.cc',
         'src/core/ext/filters/client_channel/resolver.cc',
-        'src/core/ext/filters/client_channel/resolver_factory.cc',
         'src/core/ext/filters/client_channel/resolver_registry.cc',
         'src/core/ext/filters/client_channel/retry_throttle.cc',
         'src/core/ext/filters/client_channel/subchannel.cc',
diff --git a/include/grpc++/impl/codegen/proto_utils.h b/include/grpc++/impl/codegen/proto_utils.h
index b763603..209250b 100644
--- a/include/grpc++/impl/codegen/proto_utils.h
+++ b/include/grpc++/impl/codegen/proto_utils.h
@@ -59,18 +59,22 @@
   bool Next(void** data, int* size) override {
     // Protobuf should not ask for more memory than total_size_.
     GPR_CODEGEN_ASSERT(byte_count_ < total_size_);
+    size_t remain = total_size_ - byte_count_;
     if (have_backup_) {
       slice_ = backup_slice_;
       have_backup_ = false;
+      if (GRPC_SLICE_LENGTH(slice_) > remain) {
+        GRPC_SLICE_SET_LENGTH(slice_, remain);
+      }
     } else {
       // When less than a whole block is needed, only allocate that much.
       // But make sure the allocated slice is not inlined.
-      size_t remain = total_size_ - byte_count_ > block_size_
-                          ? block_size_
-                          : total_size_ - byte_count_;
+      size_t allocate_length =
+          remain > static_cast<size_t>(block_size_) ? block_size_ : remain;
       slice_ = g_core_codegen_interface->grpc_slice_malloc(
-          remain > GRPC_SLICE_INLINED_SIZE ? remain
-                                           : GRPC_SLICE_INLINED_SIZE + 1);
+          allocate_length > GRPC_SLICE_INLINED_SIZE
+              ? allocate_length
+              : GRPC_SLICE_INLINED_SIZE + 1);
     }
     *data = GRPC_SLICE_START_PTR(slice_);
     // On win x64, int is only 32bit
diff --git a/include/grpc++/server_builder.h b/include/grpc++/server_builder.h
index e2bae4b..ea9834c 100644
--- a/include/grpc++/server_builder.h
+++ b/include/grpc++/server_builder.h
@@ -30,7 +30,6 @@
 #include <grpc++/support/config.h>
 #include <grpc/compression.h>
 #include <grpc/support/cpu.h>
-#include <grpc/support/useful.h>
 #include <grpc/support/workaround_list.h>
 
 struct grpc_resource_quota;
diff --git a/include/grpc/module.modulemap b/include/grpc/module.modulemap
index da95515..e5dac82 100644
--- a/include/grpc/module.modulemap
+++ b/include/grpc/module.modulemap
@@ -4,21 +4,15 @@
 
   header "support/alloc.h"
   header "support/atm.h"
-  header "support/avl.h"
-  header "support/cmdline.h"
   header "support/cpu.h"
-  header "support/host_port.h"
   header "support/log.h"
   header "support/log_windows.h"
   header "support/port_platform.h"
   header "support/string_util.h"
-  header "support/subprocess.h"
   header "support/sync.h"
   header "support/sync_generic.h"
   header "support/thd.h"
   header "support/time.h"
-  header "support/tls.h"
-  header "support/useful.h"
   header "impl/codegen/atm.h"
   header "impl/codegen/fork.h"
   header "impl/codegen/gpr_slice.h"
@@ -62,9 +56,6 @@
   textual header "support/sync_custom.h"
   textual header "support/sync_posix.h"
   textual header "support/sync_windows.h"
-  textual header "support/tls_gcc.h"
-  textual header "support/tls_msvc.h"
-  textual header "support/tls_pthread.h"
   textual header "impl/codegen/atm_gcc_atomic.h"
   textual header "impl/codegen/atm_gcc_sync.h"
   textual header "impl/codegen/atm_windows.h"
diff --git a/package.xml b/package.xml
index d8277fd..5b598c1 100644
--- a/package.xml
+++ b/package.xml
@@ -56,15 +56,11 @@
     <file baseinstalldir="/" name="include/grpc/support/atm_gcc_atomic.h" role="src" />
     <file baseinstalldir="/" name="include/grpc/support/atm_gcc_sync.h" role="src" />
     <file baseinstalldir="/" name="include/grpc/support/atm_windows.h" role="src" />
-    <file baseinstalldir="/" name="include/grpc/support/avl.h" role="src" />
-    <file baseinstalldir="/" name="include/grpc/support/cmdline.h" role="src" />
     <file baseinstalldir="/" name="include/grpc/support/cpu.h" role="src" />
-    <file baseinstalldir="/" name="include/grpc/support/host_port.h" role="src" />
     <file baseinstalldir="/" name="include/grpc/support/log.h" role="src" />
     <file baseinstalldir="/" name="include/grpc/support/log_windows.h" role="src" />
     <file baseinstalldir="/" name="include/grpc/support/port_platform.h" role="src" />
     <file baseinstalldir="/" name="include/grpc/support/string_util.h" role="src" />
-    <file baseinstalldir="/" name="include/grpc/support/subprocess.h" role="src" />
     <file baseinstalldir="/" name="include/grpc/support/sync.h" role="src" />
     <file baseinstalldir="/" name="include/grpc/support/sync_custom.h" role="src" />
     <file baseinstalldir="/" name="include/grpc/support/sync_generic.h" role="src" />
@@ -72,11 +68,6 @@
     <file baseinstalldir="/" name="include/grpc/support/sync_windows.h" role="src" />
     <file baseinstalldir="/" name="include/grpc/support/thd.h" role="src" />
     <file baseinstalldir="/" name="include/grpc/support/time.h" role="src" />
-    <file baseinstalldir="/" name="include/grpc/support/tls.h" role="src" />
-    <file baseinstalldir="/" name="include/grpc/support/tls_gcc.h" role="src" />
-    <file baseinstalldir="/" name="include/grpc/support/tls_msvc.h" role="src" />
-    <file baseinstalldir="/" name="include/grpc/support/tls_pthread.h" role="src" />
-    <file baseinstalldir="/" name="include/grpc/support/useful.h" role="src" />
     <file baseinstalldir="/" name="include/grpc/impl/codegen/atm.h" role="src" />
     <file baseinstalldir="/" name="include/grpc/impl/codegen/atm_gcc_atomic.h" role="src" />
     <file baseinstalldir="/" name="include/grpc/impl/codegen/atm_gcc_sync.h" role="src" />
@@ -93,6 +84,7 @@
     <file baseinstalldir="/" name="src/core/lib/gpr/arena.h" role="src" />
     <file baseinstalldir="/" name="src/core/lib/gpr/env.h" role="src" />
     <file baseinstalldir="/" name="src/core/lib/gpr/fork.h" role="src" />
+    <file baseinstalldir="/" name="src/core/lib/gpr/host_port.h" role="src" />
     <file baseinstalldir="/" name="src/core/lib/gpr/mpscq.h" role="src" />
     <file baseinstalldir="/" name="src/core/lib/gpr/murmur_hash.h" role="src" />
     <file baseinstalldir="/" name="src/core/lib/gpr/spinlock.h" role="src" />
@@ -100,7 +92,12 @@
     <file baseinstalldir="/" name="src/core/lib/gpr/string_windows.h" role="src" />
     <file baseinstalldir="/" name="src/core/lib/gpr/thd_internal.h" role="src" />
     <file baseinstalldir="/" name="src/core/lib/gpr/time_precise.h" role="src" />
+    <file baseinstalldir="/" name="src/core/lib/gpr/tls.h" role="src" />
+    <file baseinstalldir="/" name="src/core/lib/gpr/tls_gcc.h" role="src" />
+    <file baseinstalldir="/" name="src/core/lib/gpr/tls_msvc.h" role="src" />
+    <file baseinstalldir="/" name="src/core/lib/gpr/tls_pthread.h" role="src" />
     <file baseinstalldir="/" name="src/core/lib/gpr/tmpfile.h" role="src" />
+    <file baseinstalldir="/" name="src/core/lib/gpr/useful.h" role="src" />
     <file baseinstalldir="/" name="src/core/lib/gprpp/abstract.h" role="src" />
     <file baseinstalldir="/" name="src/core/lib/gprpp/atomic.h" role="src" />
     <file baseinstalldir="/" name="src/core/lib/gprpp/atomic_with_atm.h" role="src" />
@@ -111,8 +108,6 @@
     <file baseinstalldir="/" name="src/core/lib/gpr/alloc.cc" role="src" />
     <file baseinstalldir="/" name="src/core/lib/gpr/arena.cc" role="src" />
     <file baseinstalldir="/" name="src/core/lib/gpr/atm.cc" role="src" />
-    <file baseinstalldir="/" name="src/core/lib/gpr/avl.cc" role="src" />
-    <file baseinstalldir="/" name="src/core/lib/gpr/cmdline.cc" role="src" />
     <file baseinstalldir="/" name="src/core/lib/gpr/cpu_iphone.cc" role="src" />
     <file baseinstalldir="/" name="src/core/lib/gpr/cpu_linux.cc" role="src" />
     <file baseinstalldir="/" name="src/core/lib/gpr/cpu_posix.cc" role="src" />
@@ -133,8 +128,6 @@
     <file baseinstalldir="/" name="src/core/lib/gpr/string_posix.cc" role="src" />
     <file baseinstalldir="/" name="src/core/lib/gpr/string_util_windows.cc" role="src" />
     <file baseinstalldir="/" name="src/core/lib/gpr/string_windows.cc" role="src" />
-    <file baseinstalldir="/" name="src/core/lib/gpr/subprocess_posix.cc" role="src" />
-    <file baseinstalldir="/" name="src/core/lib/gpr/subprocess_windows.cc" role="src" />
     <file baseinstalldir="/" name="src/core/lib/gpr/sync.cc" role="src" />
     <file baseinstalldir="/" name="src/core/lib/gpr/sync_posix.cc" role="src" />
     <file baseinstalldir="/" name="src/core/lib/gpr/sync_windows.cc" role="src" />
@@ -261,6 +254,7 @@
     <file baseinstalldir="/" name="src/core/ext/filters/deadline/deadline_filter.h" role="src" />
     <file baseinstalldir="/" name="src/core/ext/transport/chttp2/client/chttp2_connector.h" role="src" />
     <file baseinstalldir="/" name="src/core/ext/transport/inproc/inproc_transport.h" role="src" />
+    <file baseinstalldir="/" name="src/core/lib/avl/avl.h" role="src" />
     <file baseinstalldir="/" name="src/core/lib/backoff/backoff.h" role="src" />
     <file baseinstalldir="/" name="src/core/lib/channel/channel_args.h" role="src" />
     <file baseinstalldir="/" name="src/core/lib/channel/channel_stack.h" role="src" />
@@ -407,6 +401,7 @@
     <file baseinstalldir="/" name="src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h" role="src" />
     <file baseinstalldir="/" name="src/core/ext/filters/workarounds/workaround_utils.h" role="src" />
     <file baseinstalldir="/" name="src/core/lib/surface/init.cc" role="src" />
+    <file baseinstalldir="/" name="src/core/lib/avl/avl.cc" role="src" />
     <file baseinstalldir="/" name="src/core/lib/backoff/backoff.cc" role="src" />
     <file baseinstalldir="/" name="src/core/lib/channel/channel_args.cc" role="src" />
     <file baseinstalldir="/" name="src/core/lib/channel/channel_stack.cc" role="src" />
@@ -616,7 +611,6 @@
     <file baseinstalldir="/" name="src/core/ext/filters/client_channel/proxy_mapper.cc" role="src" />
     <file baseinstalldir="/" name="src/core/ext/filters/client_channel/proxy_mapper_registry.cc" role="src" />
     <file baseinstalldir="/" name="src/core/ext/filters/client_channel/resolver.cc" role="src" />
-    <file baseinstalldir="/" name="src/core/ext/filters/client_channel/resolver_factory.cc" role="src" />
     <file baseinstalldir="/" name="src/core/ext/filters/client_channel/resolver_registry.cc" role="src" />
     <file baseinstalldir="/" name="src/core/ext/filters/client_channel/retry_throttle.cc" role="src" />
     <file baseinstalldir="/" name="src/core/ext/filters/client_channel/subchannel.cc" role="src" />
diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc
index f35bfd9..3a15a60 100644
--- a/src/compiler/cpp_generator.cc
+++ b/src/compiler/cpp_generator.cc
@@ -64,16 +64,15 @@
 
 void PrintIncludes(grpc_generator::Printer* printer,
                    const std::vector<grpc::string>& headers,
-                   const Parameters& params) {
+                   bool use_system_headers, const grpc::string& search_path) {
   std::map<grpc::string, grpc::string> vars;
 
-  vars["l"] = params.use_system_headers ? '<' : '"';
-  vars["r"] = params.use_system_headers ? '>' : '"';
+  vars["l"] = use_system_headers ? '<' : '"';
+  vars["r"] = use_system_headers ? '>' : '"';
 
-  auto& s = params.grpc_search_path;
-  if (!s.empty()) {
-    vars["l"] += s;
-    if (s[s.size() - 1] != '/') {
+  if (!search_path.empty()) {
+    vars["l"] += search_path;
+    if (search_path[search_path.size() - 1] != '/') {
       vars["l"] += '/';
     }
   }
@@ -124,6 +123,10 @@
     auto printer = file->CreatePrinter(&output);
     std::map<grpc::string, grpc::string> vars;
 
+    if (!params.additional_header_includes.empty()) {
+      PrintIncludes(printer.get(), params.additional_header_includes, false,
+                    "");
+    }
     static const char* headers_strs[] = {
         "grpc++/impl/codegen/async_stream.h",
         "grpc++/impl/codegen/async_unary_call.h",
@@ -135,7 +138,8 @@
         "grpc++/impl/codegen/stub_options.h",
         "grpc++/impl/codegen/sync_stream.h"};
     std::vector<grpc::string> headers(headers_strs, array_end(headers_strs));
-    PrintIncludes(printer.get(), headers, params);
+    PrintIncludes(printer.get(), headers, params.use_system_headers,
+                  params.grpc_search_path);
     printer->Print(vars, "\n");
     printer->Print(vars, "namespace grpc {\n");
     printer->Print(vars, "class CompletionQueue;\n");
@@ -1153,7 +1157,8 @@
         "grpc++/impl/codegen/service_type.h",
         "grpc++/impl/codegen/sync_stream.h"};
     std::vector<grpc::string> headers(headers_strs, array_end(headers_strs));
-    PrintIncludes(printer.get(), headers, params);
+    PrintIncludes(printer.get(), headers, params.use_system_headers,
+                  params.grpc_search_path);
 
     if (!file->package().empty()) {
       std::vector<grpc::string> parts = file->package_parts();
@@ -1570,20 +1575,19 @@
         "grpc++/impl/codegen/sync_stream.h",
     };
     std::vector<grpc::string> headers(headers_strs, array_end(headers_strs));
-    PrintIncludes(printer.get(), headers, params);
+    PrintIncludes(printer.get(), headers, params.use_system_headers,
+                  params.grpc_search_path);
 
     std::vector<grpc::string> gmock_header;
     if (params.gmock_search_path.empty()) {
       gmock_header.push_back("gmock/gmock.h");
-      PrintIncludes(printer.get(), gmock_header, params);
+      PrintIncludes(printer.get(), gmock_header, params.use_system_headers,
+                    params.grpc_search_path);
     } else {
       gmock_header.push_back("gmock.h");
-      // Copy a params to generate gmock header.
-      Parameters gmock_params(params);
       // We use local includes when a gmock_search_path is given
-      gmock_params.use_system_headers = false;
-      gmock_params.grpc_search_path = params.gmock_search_path;
-      PrintIncludes(printer.get(), gmock_header, gmock_params);
+      PrintIncludes(printer.get(), gmock_header, false,
+                    params.gmock_search_path);
     }
 
     if (!file->package().empty()) {
diff --git a/src/compiler/cpp_generator.h b/src/compiler/cpp_generator.h
index 300a27c..d88ef75 100644
--- a/src/compiler/cpp_generator.h
+++ b/src/compiler/cpp_generator.h
@@ -54,6 +54,8 @@
   bool generate_mock_code;
   // Google Mock search path, when non-empty, local includes will be used.
   grpc::string gmock_search_path;
+  // *EXPERIMENTAL* Additional include files in grpc.pb.h
+  std::vector<grpc::string> additional_header_includes;
 };
 
 // Return the prologue of the generated header file.
diff --git a/src/compiler/cpp_plugin.cc b/src/compiler/cpp_plugin.cc
index 661282f..c8ab788 100644
--- a/src/compiler/cpp_plugin.cc
+++ b/src/compiler/cpp_plugin.cc
@@ -80,6 +80,9 @@
           }
         } else if (param[0] == "gmock_search_path") {
           generator_parameters.gmock_search_path = param[1];
+        } else if (param[0] == "additional_header_includes") {
+          generator_parameters.additional_header_includes =
+              grpc_generator::tokenize(param[1], ":");
         } else {
           *error = grpc::string("Unknown parameter: ") + *parameter_string;
           return false;
diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc
index 6b93644..cbee74c 100644
--- a/src/core/ext/filters/client_channel/client_channel.cc
+++ b/src/core/ext/filters/client_channel/client_channel.cc
@@ -29,7 +29,6 @@
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/sync.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/ext/filters/client_channel/backup_poller.h"
 #include "src/core/ext/filters/client_channel/http_connect_handshaker.h"
@@ -165,7 +164,7 @@
 
 typedef struct client_channel_channel_data {
   /** resolver for this channel */
-  grpc_resolver* resolver;
+  grpc_core::OrphanablePtr<grpc_core::Resolver> resolver;
   /** have we started resolving this channel */
   bool started_resolving;
   /** is deadline checking enabled? */
@@ -300,8 +299,8 @@
   GPR_ASSERT(!chand->started_resolving);
   chand->started_resolving = true;
   GRPC_CHANNEL_STACK_REF(chand->owning_stack, "resolver");
-  grpc_resolver_next_locked(chand->resolver, &chand->resolver_result,
-                            &chand->on_resolver_result_changed);
+  chand->resolver->NextLocked(&chand->resolver_result,
+                              &chand->on_resolver_result_changed);
 }
 
 typedef struct {
@@ -378,7 +377,7 @@
   if (grpc_client_channel_trace.enabled()) {
     gpr_log(GPR_DEBUG, "chand=%p: started name re-resolving", chand);
   }
-  grpc_resolver_channel_saw_error_locked(chand->resolver);
+  chand->resolver->RequestReresolutionLocked();
   // Give back the closure to the LB policy.
   grpc_lb_policy_set_reresolve_closure_locked(chand->lb_policy, &args->closure);
 }
@@ -568,9 +567,7 @@
       if (grpc_client_channel_trace.enabled()) {
         gpr_log(GPR_DEBUG, "chand=%p: shutting down resolver", chand);
       }
-      grpc_resolver_shutdown_locked(chand->resolver);
-      GRPC_RESOLVER_UNREF(chand->resolver, "channel");
-      chand->resolver = nullptr;
+      chand->resolver.reset();
     }
     set_channel_connectivity_state_locked(
         chand, GRPC_CHANNEL_SHUTDOWN,
@@ -606,8 +603,8 @@
       set_channel_connectivity_state_locked(
           chand, state, GRPC_ERROR_REF(state_error), "new_lb+resolver");
     }
-    grpc_resolver_next_locked(chand->resolver, &chand->resolver_result,
-                              &chand->on_resolver_result_changed);
+    chand->resolver->NextLocked(&chand->resolver_result,
+                                &chand->on_resolver_result_changed);
     GRPC_ERROR_UNREF(state_error);
   }
 }
@@ -648,9 +645,7 @@
       set_channel_connectivity_state_locked(
           chand, GRPC_CHANNEL_SHUTDOWN,
           GRPC_ERROR_REF(op->disconnect_with_error), "disconnect");
-      grpc_resolver_shutdown_locked(chand->resolver);
-      GRPC_RESOLVER_UNREF(chand->resolver, "channel");
-      chand->resolver = nullptr;
+      chand->resolver.reset();
       if (!chand->started_resolving) {
         grpc_closure_list_fail_all(&chand->waiting_for_resolver_result_closures,
                                    GRPC_ERROR_REF(op->disconnect_with_error));
@@ -759,7 +754,7 @@
   grpc_proxy_mappers_map_name(arg->value.string, args->channel_args,
                               &proxy_name, &new_args);
   // Instantiate resolver.
-  chand->resolver = grpc_resolver_create(
+  chand->resolver = grpc_core::ResolverRegistry::CreateResolver(
       proxy_name != nullptr ? proxy_name : arg->value.string,
       new_args != nullptr ? new_args : args->channel_args,
       chand->interested_parties, chand->combiner);
@@ -774,9 +769,8 @@
 }
 
 static void shutdown_resolver_locked(void* arg, grpc_error* error) {
-  grpc_resolver* resolver = (grpc_resolver*)arg;
-  grpc_resolver_shutdown_locked(resolver);
-  GRPC_RESOLVER_UNREF(resolver, "channel");
+  grpc_core::Resolver* resolver = static_cast<grpc_core::Resolver*>(arg);
+  resolver->Orphan();
 }
 
 /* Destructor for channel_data */
@@ -784,7 +778,7 @@
   channel_data* chand = (channel_data*)elem->channel_data;
   if (chand->resolver != nullptr) {
     GRPC_CLOSURE_SCHED(
-        GRPC_CLOSURE_CREATE(shutdown_resolver_locked, chand->resolver,
+        GRPC_CLOSURE_CREATE(shutdown_resolver_locked, chand->resolver.release(),
                             grpc_combiner_scheduler(chand->combiner)),
         GRPC_ERROR_NONE);
   }
diff --git a/src/core/ext/filters/client_channel/client_channel_plugin.cc b/src/core/ext/filters/client_channel/client_channel_plugin.cc
index ea630d2..d756d9c 100644
--- a/src/core/ext/filters/client_channel/client_channel_plugin.cc
+++ b/src/core/ext/filters/client_channel/client_channel_plugin.cc
@@ -49,14 +49,14 @@
       return true;
     }
   }
-  char* default_authority = grpc_get_default_authority(
-      grpc_channel_stack_builder_get_target(builder));
-  if (default_authority != nullptr) {
+  grpc_core::UniquePtr<char> default_authority =
+      grpc_core::ResolverRegistry::GetDefaultAuthority(
+          grpc_channel_stack_builder_get_target(builder));
+  if (default_authority.get() != nullptr) {
     grpc_arg arg = grpc_channel_arg_string_create(
-        (char*)GRPC_ARG_DEFAULT_AUTHORITY, default_authority);
+        (char*)GRPC_ARG_DEFAULT_AUTHORITY, default_authority.get());
     grpc_channel_args* new_args = grpc_channel_args_copy_and_add(args, &arg, 1);
     grpc_channel_stack_builder_set_channel_arguments(builder, new_args);
-    gpr_free(default_authority);
     grpc_channel_args_destroy(new_args);
   }
   return true;
@@ -64,7 +64,7 @@
 
 void grpc_client_channel_init(void) {
   grpc_lb_policy_registry_init();
-  grpc_resolver_registry_init();
+  grpc_core::ResolverRegistry::Builder::InitRegistry();
   grpc_retry_throttle_map_init();
   grpc_proxy_mapper_registry_init();
   grpc_register_http_proxy_mapper();
@@ -82,6 +82,6 @@
   grpc_channel_init_shutdown();
   grpc_proxy_mapper_registry_shutdown();
   grpc_retry_throttle_map_shutdown();
-  grpc_resolver_registry_shutdown();
+  grpc_core::ResolverRegistry::Builder::ShutdownRegistry();
   grpc_lb_policy_registry_shutdown();
 }
diff --git a/src/core/ext/filters/client_channel/http_proxy.cc b/src/core/ext/filters/client_channel/http_proxy.cc
index 7c5f79f..d423764 100644
--- a/src/core/ext/filters/client_channel/http_proxy.cc
+++ b/src/core/ext/filters/client_channel/http_proxy.cc
@@ -22,7 +22,6 @@
 #include <string.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 
@@ -31,6 +30,7 @@
 #include "src/core/ext/filters/client_channel/uri_parser.h"
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/slice/b64.h"
 
diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
index 1709e56..ac47990 100644
--- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
@@ -87,7 +87,6 @@
 #include <grpc/byte_buffer_reader.h>
 #include <grpc/grpc.h>
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/time.h>
 
@@ -106,8 +105,10 @@
 #include "src/core/lib/backoff/backoff.h"
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/channel/channel_stack.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/gprpp/manual_constructor.h"
+#include "src/core/lib/gprpp/ref_counted_ptr.h"
 #include "src/core/lib/iomgr/combiner.h"
 #include "src/core/lib/iomgr/sockaddr.h"
 #include "src/core/lib/iomgr/sockaddr_utils.h"
@@ -242,7 +243,8 @@
   glb_lb_call_data* lb_calld;
 
   /** response generator to inject address updates into \a lb_channel */
-  grpc_fake_resolver_response_generator* response_generator;
+  grpc_core::RefCountedPtr<grpc_core::FakeResolverResponseGenerator>
+      response_generator;
 
   /** the RR policy to use of the backend servers returned by the LB server */
   grpc_lb_policy* rr_policy;
@@ -872,7 +874,7 @@
  *   - \a args: other args inherited from the grpclb policy. */
 static grpc_channel_args* build_lb_channel_args(
     const grpc_lb_addresses* addresses,
-    grpc_fake_resolver_response_generator* response_generator,
+    grpc_core::FakeResolverResponseGenerator* response_generator,
     const grpc_channel_args* args) {
   size_t num_grpclb_addrs = 0;
   for (size_t i = 0; i < addresses->num_addresses; ++i) {
@@ -941,7 +943,8 @@
   if (glb_policy->fallback_backend_addresses != nullptr) {
     grpc_lb_addresses_destroy(glb_policy->fallback_backend_addresses);
   }
-  grpc_fake_resolver_response_generator_unref(glb_policy->response_generator);
+  // TODO(roth): Remove this once the LB policy becomes a C++ object.
+  glb_policy->response_generator.reset();
   grpc_subchannel_index_unref();
   gpr_free(glb_policy);
 }
@@ -1701,9 +1704,8 @@
   // Propagate updates to the LB channel (pick_first) through the fake
   // resolver.
   grpc_channel_args* lb_channel_args = build_lb_channel_args(
-      addresses, glb_policy->response_generator, args->args);
-  grpc_fake_resolver_response_generator_set_response(
-      glb_policy->response_generator, lb_channel_args);
+      addresses, glb_policy->response_generator.get(), args->args);
+  glb_policy->response_generator->SetResponse(lb_channel_args);
   grpc_channel_args_destroy(lb_channel_args);
   // Start watching the LB channel connectivity for connection, if not
   // already doing so.
@@ -1858,17 +1860,16 @@
 
   /* Create a client channel over them to communicate with a LB service */
   glb_policy->response_generator =
-      grpc_fake_resolver_response_generator_create();
+      grpc_core::MakeRefCounted<grpc_core::FakeResolverResponseGenerator>();
   grpc_channel_args* lb_channel_args = build_lb_channel_args(
-      addresses, glb_policy->response_generator, args->args);
+      addresses, glb_policy->response_generator.get(), args->args);
   char* uri_str;
   gpr_asprintf(&uri_str, "fake:///%s", glb_policy->server_name);
   glb_policy->lb_channel = grpc_lb_policy_grpclb_create_lb_channel(
       uri_str, args->client_channel_factory, lb_channel_args);
 
   /* Propagate initial resolution */
-  grpc_fake_resolver_response_generator_set_response(
-      glb_policy->response_generator, lb_channel_args);
+  glb_policy->response_generator->SetResponse(lb_channel_args);
   grpc_channel_args_destroy(lb_channel_args);
   gpr_free(uri_str);
   if (glb_policy->lb_channel == nullptr) {
diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc
index 1e7f34b..013fb12 100644
--- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc
@@ -37,10 +37,11 @@
 
 grpc_channel_args* grpc_lb_policy_grpclb_build_lb_channel_args(
     grpc_slice_hash_table* targets_info,
-    grpc_fake_resolver_response_generator* response_generator,
+    grpc_core::FakeResolverResponseGenerator* response_generator,
     const grpc_channel_args* args) {
   const grpc_arg to_add[] = {
-      grpc_fake_resolver_response_generator_arg(response_generator)};
+      grpc_core::FakeResolverResponseGenerator::MakeChannelArg(
+          response_generator)};
   /* We remove:
    *
    * - The channel arg for the LB policy name, since we want to use the default
diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h
index 56104b2..2e34e3c 100644
--- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h
+++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h
@@ -37,7 +37,7 @@
 
 grpc_channel_args* grpc_lb_policy_grpclb_build_lb_channel_args(
     grpc_slice_hash_table* targets_info,
-    grpc_fake_resolver_response_generator* response_generator,
+    grpc_core::FakeResolverResponseGenerator* response_generator,
     const grpc_channel_args* args);
 
 #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_CHANNEL_H \
diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc
index 15233d3..5e615ad 100644
--- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc
@@ -63,11 +63,12 @@
 
 grpc_channel_args* grpc_lb_policy_grpclb_build_lb_channel_args(
     grpc_slice_hash_table* targets_info,
-    grpc_fake_resolver_response_generator* response_generator,
+    grpc_core::FakeResolverResponseGenerator* response_generator,
     const grpc_channel_args* args) {
   const grpc_arg to_add[] = {
       grpc_lb_targets_info_create_channel_arg(targets_info),
-      grpc_fake_resolver_response_generator_arg(response_generator)};
+      grpc_core::FakeResolverResponseGenerator::MakeChannelArg(
+          response_generator)};
   /* We remove:
    *
    * - The channel arg for the LB policy name, since we want to use the default
diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc
index e19a6a7..45c9f17 100644
--- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc
@@ -24,7 +24,6 @@
 #include <grpc/support/atm.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/sync.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/channel/channel_args.h"
 
diff --git a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
index 24c381a..ab6d3e6 100644
--- a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
@@ -328,18 +328,11 @@
    * 2) RULE: ANY subchannel is CONNECTING => policy is CONNECTING.
    *    CHECK: sd->curr_connectivity_state == CONNECTING.
    *
-   * 3) RULE: ALL subchannels are SHUTDOWN => policy is IDLE (and requests
-   *          re-resolution).
-   *    CHECK: subchannel_list->num_shutdown ==
-   *           subchannel_list->num_subchannels.
-   *
-   * 4) RULE: ALL subchannels are SHUTDOWN or TRANSIENT_FAILURE => policy is
-   *          TRANSIENT_FAILURE.
-   *    CHECK: subchannel_list->num_shutdown +
-   *             subchannel_list->num_transient_failures ==
+   * 3) RULE: ALL subchannels are TRANSIENT_FAILURE => policy is
+   *                                                   TRANSIENT_FAILURE.
+   *    CHECK: subchannel_list->num_transient_failures ==
    *           subchannel_list->num_subchannels.
    */
-  // TODO(juanlishen): For rule 4, we may want to re-resolve instead.
   grpc_lb_subchannel_list* subchannel_list = sd->subchannel_list;
   round_robin_lb_policy* p = (round_robin_lb_policy*)subchannel_list->policy;
   GPR_ASSERT(sd->curr_connectivity_state != GRPC_CHANNEL_IDLE);
@@ -351,22 +344,12 @@
     /* 2) CONNECTING */
     grpc_connectivity_state_set(&p->state_tracker, GRPC_CHANNEL_CONNECTING,
                                 GRPC_ERROR_NONE, "rr_connecting");
-  } else if (subchannel_list->num_shutdown ==
+  } else if (subchannel_list->num_transient_failures ==
              subchannel_list->num_subchannels) {
-    /* 3) IDLE and re-resolve */
-    grpc_connectivity_state_set(&p->state_tracker, GRPC_CHANNEL_IDLE,
-                                GRPC_ERROR_NONE,
-                                "rr_exhausted_subchannels+reresolve");
-    p->started_picking = false;
-    grpc_lb_policy_try_reresolve(&p->base, &grpc_lb_round_robin_trace,
-                                 GRPC_ERROR_NONE);
-  } else if (subchannel_list->num_shutdown +
-                 subchannel_list->num_transient_failures ==
-             subchannel_list->num_subchannels) {
-    /* 4) TRANSIENT_FAILURE */
-    grpc_connectivity_state_set(&p->state_tracker,
-                                GRPC_CHANNEL_TRANSIENT_FAILURE,
-                                GRPC_ERROR_REF(error), "rr_transient_failure");
+    /* 3) TRANSIENT_FAILURE */
+    grpc_connectivity_state_set(
+        &p->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
+        GRPC_ERROR_REF(error), "rr_exhausted_subchannels");
   }
   GRPC_ERROR_UNREF(error);
 }
@@ -387,6 +370,7 @@
         p->shutdown, sd->subchannel_list->shutting_down,
         grpc_error_string(error));
   }
+  GPR_ASSERT(sd->subchannel != nullptr);
   // If the policy is shutting down, unref and return.
   if (p->shutdown) {
     grpc_lb_subchannel_data_stop_connectivity_watch(sd);
@@ -412,14 +396,19 @@
   // state (which was set by the connectivity state watcher) to
   // curr_connectivity_state, which is what we use inside of the combiner.
   sd->curr_connectivity_state = sd->pending_connectivity_state_unsafe;
-  // Update state counters and new overall state.
-  update_state_counters_locked(sd);
-  update_lb_connectivity_status_locked(sd, GRPC_ERROR_REF(error));
   // If the sd's new state is TRANSIENT_FAILURE, unref the *connected*
   // subchannel, if any.
   switch (sd->curr_connectivity_state) {
     case GRPC_CHANNEL_TRANSIENT_FAILURE: {
       sd->connected_subchannel.reset();
+      if (grpc_lb_round_robin_trace.enabled()) {
+        gpr_log(GPR_DEBUG,
+                "[RR %p] Subchannel %p has gone into TRANSIENT_FAILURE. "
+                "Requesting re-resolution",
+                p, sd->subchannel);
+      }
+      grpc_lb_policy_try_reresolve(&p->base, &grpc_lb_round_robin_trace,
+                                   GRPC_ERROR_NONE);
       break;
     }
     case GRPC_CHANNEL_READY: {
@@ -442,8 +431,8 @@
           gpr_log(GPR_DEBUG,
                   "[RR %p] phasing out subchannel list %p (size %lu) in favor "
                   "of %p (size %lu)",
-                  (void*)p, (void*)p->subchannel_list, num_subchannels,
-                  (void*)sd->subchannel_list, num_subchannels);
+                  p, p->subchannel_list, num_subchannels, sd->subchannel_list,
+                  num_subchannels);
         }
         if (p->subchannel_list != nullptr) {
           // dispose of the current subchannel_list
@@ -455,7 +444,8 @@
       }
       /* at this point we know there's at least one suitable subchannel. Go
        * ahead and pick one and notify the pending suitors in
-       * p->pending_picks. This preemptively replicates rr_pick()'s actions. */
+       * p->pending_picks. This preemptively replicates rr_pick()'s actions.
+       */
       const size_t next_ready_index = get_next_ready_subchannel_index_locked(p);
       GPR_ASSERT(next_ready_index < p->subchannel_list->num_subchannels);
       grpc_lb_subchannel_data* selected =
@@ -488,6 +478,12 @@
     case GRPC_CHANNEL_CONNECTING:
     case GRPC_CHANNEL_IDLE:;  // fallthrough
   }
+  // Update state counters and new overall state.
+  update_state_counters_locked(sd);
+  // Only update connectivity based on the selected subchannel list.
+  if (sd->subchannel_list == p->subchannel_list) {
+    update_lb_connectivity_status_locked(sd, GRPC_ERROR_REF(error));
+  }
   // Renew notification.
   grpc_lb_subchannel_data_start_connectivity_watch(sd);
 }
@@ -562,6 +558,30 @@
     return;
   }
   if (p->started_picking) {
+    for (size_t i = 0; i < subchannel_list->num_subchannels; ++i) {
+      const grpc_connectivity_state subchannel_state =
+          grpc_subchannel_check_connectivity(
+              subchannel_list->subchannels[i].subchannel, nullptr);
+      // Override the default setting of IDLE for connectivity notification
+      // purposes if the subchannel is already in transient failure. Otherwise
+      // we'd be immediately notified of the IDLE-TRANSIENT_FAILURE
+      // discrepancy, attempt to re-resolve and end up here again.
+      // TODO(roth): As part of C++-ifying the subchannel_list API, design a
+      // better API for notifying the LB policy of subchannel states, which can
+      // be used both for the subchannel's initial state and for subsequent
+      // state changes. This will allow us to handle this more generally instead
+      // of special-casing TRANSIENT_FAILURE (e.g., we can also distribute any
+      // pending picks across all READY subchannels rather than sending them all
+      // to the first one).
+      if (subchannel_state == GRPC_CHANNEL_TRANSIENT_FAILURE) {
+        subchannel_list->subchannels[i].pending_connectivity_state_unsafe =
+            subchannel_list->subchannels[i].curr_connectivity_state =
+                subchannel_list->subchannels[i].prev_connectivity_state =
+                    subchannel_state;
+        --subchannel_list->num_idle;
+        ++subchannel_list->num_transient_failures;
+      }
+    }
     if (p->latest_pending_subchannel_list != nullptr) {
       if (grpc_lb_round_robin_trace.enabled()) {
         gpr_log(GPR_DEBUG,
diff --git a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc
index fa2ffcc..75f7ca2 100644
--- a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc
@@ -54,13 +54,15 @@
 void grpc_lb_subchannel_data_start_connectivity_watch(
     grpc_lb_subchannel_data* sd) {
   if (sd->subchannel_list->tracer->enabled()) {
-    gpr_log(GPR_DEBUG,
-            "[%s %p] subchannel list %p index %" PRIuPTR " of %" PRIuPTR
-            " (subchannel %p): requesting connectivity change notification",
-            sd->subchannel_list->tracer->name(), sd->subchannel_list->policy,
-            sd->subchannel_list,
-            (size_t)(sd - sd->subchannel_list->subchannels),
-            sd->subchannel_list->num_subchannels, sd->subchannel);
+    gpr_log(
+        GPR_DEBUG,
+        "[%s %p] subchannel list %p index %" PRIuPTR " of %" PRIuPTR
+        " (subchannel %p): requesting connectivity change "
+        "notification (from %s)",
+        sd->subchannel_list->tracer->name(), sd->subchannel_list->policy,
+        sd->subchannel_list, (size_t)(sd - sd->subchannel_list->subchannels),
+        sd->subchannel_list->num_subchannels, sd->subchannel,
+        grpc_connectivity_state_name(sd->pending_connectivity_state_unsafe));
   }
   sd->connectivity_notification_pending = true;
   grpc_subchannel_notify_on_state_change(
diff --git a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h
index 3377605..91537f3 100644
--- a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h
+++ b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h
@@ -101,8 +101,6 @@
   size_t num_ready;
   /** how many subchannels are in state TRANSIENT_FAILURE */
   size_t num_transient_failures;
-  /** how many subchannels are in state SHUTDOWN */
-  size_t num_shutdown;
   /** how many subchannels are in state IDLE */
   size_t num_idle;
 
diff --git a/src/core/ext/filters/client_channel/parse_address.cc b/src/core/ext/filters/client_channel/parse_address.cc
index c3309e3..4b6905e 100644
--- a/src/core/ext/filters/client_channel/parse_address.cc
+++ b/src/core/ext/filters/client_channel/parse_address.cc
@@ -26,9 +26,10 @@
 #endif
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
+
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 
 #ifdef GRPC_HAVE_UNIX_SOCKET
diff --git a/src/core/ext/filters/client_channel/resolver.cc b/src/core/ext/filters/client_channel/resolver.cc
index ff54e71..860c2ee 100644
--- a/src/core/ext/filters/client_channel/resolver.cc
+++ b/src/core/ext/filters/client_channel/resolver.cc
@@ -22,58 +22,12 @@
 grpc_core::DebugOnlyTraceFlag grpc_trace_resolver_refcount(false,
                                                            "resolver_refcount");
 
-void grpc_resolver_init(grpc_resolver* resolver,
-                        const grpc_resolver_vtable* vtable,
-                        grpc_combiner* combiner) {
-  resolver->vtable = vtable;
-  resolver->combiner = GRPC_COMBINER_REF(combiner, "resolver");
-  gpr_ref_init(&resolver->refs, 1);
-}
+namespace grpc_core {
 
-#ifndef NDEBUG
-void grpc_resolver_ref(grpc_resolver* resolver, const char* file, int line,
-                       const char* reason) {
-  if (grpc_trace_resolver_refcount.enabled()) {
-    gpr_atm old_refs = gpr_atm_no_barrier_load(&resolver->refs.count);
-    gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
-            "RESOLVER:%p   ref %" PRIdPTR " -> %" PRIdPTR " %s", resolver,
-            old_refs, old_refs + 1, reason);
-  }
-#else
-void grpc_resolver_ref(grpc_resolver* resolver) {
-#endif
-  gpr_ref(&resolver->refs);
-}
+Resolver::Resolver(grpc_combiner* combiner)
+    : InternallyRefCountedWithTracing(&grpc_trace_resolver_refcount),
+      combiner_(GRPC_COMBINER_REF(combiner, "resolver")) {}
 
-#ifndef NDEBUG
-void grpc_resolver_unref(grpc_resolver* resolver, const char* file, int line,
-                         const char* reason) {
-  if (grpc_trace_resolver_refcount.enabled()) {
-    gpr_atm old_refs = gpr_atm_no_barrier_load(&resolver->refs.count);
-    gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
-            "RESOLVER:%p unref %" PRIdPTR " -> %" PRIdPTR " %s", resolver,
-            old_refs, old_refs - 1, reason);
-  }
-#else
-void grpc_resolver_unref(grpc_resolver* resolver) {
-#endif
-  if (gpr_unref(&resolver->refs)) {
-    grpc_combiner* combiner = resolver->combiner;
-    resolver->vtable->destroy(resolver);
-    GRPC_COMBINER_UNREF(combiner, "resolver");
-  }
-}
+Resolver::~Resolver() { GRPC_COMBINER_UNREF(combiner_, "resolver"); }
 
-void grpc_resolver_shutdown_locked(grpc_resolver* resolver) {
-  resolver->vtable->shutdown_locked(resolver);
-}
-
-void grpc_resolver_channel_saw_error_locked(grpc_resolver* resolver) {
-  resolver->vtable->channel_saw_error_locked(resolver);
-}
-
-void grpc_resolver_next_locked(grpc_resolver* resolver,
-                               grpc_channel_args** result,
-                               grpc_closure* on_complete) {
-  resolver->vtable->next_locked(resolver, result, on_complete);
-}
+}  // namespace grpc_core
diff --git a/src/core/ext/filters/client_channel/resolver.h b/src/core/ext/filters/client_channel/resolver.h
index f6a4af0..62fcb49 100644
--- a/src/core/ext/filters/client_channel/resolver.h
+++ b/src/core/ext/filters/client_channel/resolver.h
@@ -19,67 +19,110 @@
 #ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_H
 #define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_H
 
-#include "src/core/ext/filters/client_channel/subchannel.h"
-#include "src/core/lib/iomgr/iomgr.h"
+#include <grpc/impl/codegen/grpc_types.h>
 
-typedef struct grpc_resolver grpc_resolver;
-typedef struct grpc_resolver_vtable grpc_resolver_vtable;
+#include "src/core/lib/gprpp/abstract.h"
+#include "src/core/lib/gprpp/orphanable.h"
+#include "src/core/lib/iomgr/combiner.h"
+#include "src/core/lib/iomgr/iomgr.h"
 
 extern grpc_core::DebugOnlyTraceFlag grpc_trace_resolver_refcount;
 
-/** \a grpc_resolver provides \a grpc_channel_args objects to its caller */
-struct grpc_resolver {
-  const grpc_resolver_vtable* vtable;
-  gpr_refcount refs;
-  grpc_combiner* combiner;
+namespace grpc_core {
+
+/// Interface for name resolution.
+///
+/// This interface is designed to support both push-based and pull-based
+/// mechanisms.  A push-based mechanism is one where the resolver will
+/// subscribe to updates for a given name, and the name service will
+/// proactively send new data to the resolver whenever the data associated
+/// with the name changes.  A pull-based mechanism is one where the resolver
+/// needs to query the name service again to get updated information (e.g.,
+/// DNS).
+///
+/// Note: All methods with a "Locked" suffix must be called from the
+/// combiner passed to the constructor.
+class Resolver : public InternallyRefCountedWithTracing<Resolver> {
+ public:
+  // Not copyable nor movable.
+  Resolver(const Resolver&) = delete;
+  Resolver& operator=(const Resolver&) = delete;
+
+  /// Requests a callback when a new result becomes available.
+  /// When the new result is available, sets \a *result to the new result
+  /// and schedules \a on_complete for execution.
+  /// If resolution is fatally broken, sets \a *result to nullptr and
+  /// schedules \a on_complete with an error.
+  ///
+  /// Note that the client channel will almost always have a request
+  /// to \a NextLocked() pending.  When it gets the callback, it will
+  /// process the new result and then immediately make another call to
+  /// \a NextLocked().  This allows push-based resolvers to provide new
+  /// data as soon as it becomes available.
+  virtual void NextLocked(grpc_channel_args** result,
+                          grpc_closure* on_complete) GRPC_ABSTRACT;
+
+  /// Asks the resolver to obtain an updated resolver result, if
+  /// applicable.
+  ///
+  /// This is useful for pull-based implementations to decide when to
+  /// re-resolve.  However, the implementation is not required to
+  /// re-resolve immediately upon receiving this call; it may instead
+  /// elect to delay based on some configured minimum time between
+  /// queries, to avoid hammering the name service with queries.
+  ///
+  /// For push-based implementations, this may be a no-op.
+  ///
+  /// If this causes new data to become available, then the currently
+  /// pending call to \a NextLocked() will return the new result.
+  ///
+  /// Note: Currently, all resolvers are required to return a new result
+  /// shortly after this method is called.  For pull-based mechanisms, if
+  /// the implementation decides to delay querying the name service, it
+  /// should immediately return a new copy of the previously returned
+  /// result (and it can then return the updated data later, when it
+  /// actually does query the name service).  For push-based mechanisms,
+  /// the implementation should immediately return a new copy of the
+  /// last-seen result.
+  /// TODO(roth): Remove this requirement once we fix pick_first to not
+  /// throw away unselected subchannels.
+  virtual void RequestReresolutionLocked() GRPC_ABSTRACT;
+
+  void Orphan() override {
+    // Invoke ShutdownAndUnrefLocked() inside of the combiner.
+    GRPC_CLOSURE_SCHED(
+        GRPC_CLOSURE_CREATE(&Resolver::ShutdownAndUnrefLocked, this,
+                            grpc_combiner_scheduler(combiner_)),
+        GRPC_ERROR_NONE);
+  }
+
+  GRPC_ABSTRACT_BASE_CLASS
+
+ protected:
+  /// Does NOT take ownership of the reference to \a combiner.
+  // TODO(roth): Once we have a C++-like interface for combiners, this
+  // API should change to take a RefCountedPtr<>, so that we always take
+  // ownership of a new ref.
+  explicit Resolver(grpc_combiner* combiner);
+
+  virtual ~Resolver();
+
+  /// Shuts down the resolver.  If there is a pending call to
+  /// NextLocked(), the callback will be scheduled with an error.
+  virtual void ShutdownLocked() GRPC_ABSTRACT;
+
+  grpc_combiner* combiner() const { return combiner_; }
+
+ private:
+  static void ShutdownAndUnrefLocked(void* arg, grpc_error* ignored) {
+    Resolver* resolver = static_cast<Resolver*>(arg);
+    resolver->ShutdownLocked();
+    resolver->Unref();
+  }
+
+  grpc_combiner* combiner_;
 };
 
-struct grpc_resolver_vtable {
-  void (*destroy)(grpc_resolver* resolver);
-  void (*shutdown_locked)(grpc_resolver* resolver);
-  void (*channel_saw_error_locked)(grpc_resolver* resolver);
-  void (*next_locked)(grpc_resolver* resolver, grpc_channel_args** result,
-                      grpc_closure* on_complete);
-};
-
-#ifndef NDEBUG
-#define GRPC_RESOLVER_REF(p, r) grpc_resolver_ref((p), __FILE__, __LINE__, (r))
-#define GRPC_RESOLVER_UNREF(p, r) \
-  grpc_resolver_unref((p), __FILE__, __LINE__, (r))
-void grpc_resolver_ref(grpc_resolver* policy, const char* file, int line,
-                       const char* reason);
-void grpc_resolver_unref(grpc_resolver* policy, const char* file, int line,
-                         const char* reason);
-#else
-#define GRPC_RESOLVER_REF(p, r) grpc_resolver_ref((p))
-#define GRPC_RESOLVER_UNREF(p, r) grpc_resolver_unref((p))
-void grpc_resolver_ref(grpc_resolver* policy);
-void grpc_resolver_unref(grpc_resolver* policy);
-#endif
-
-void grpc_resolver_init(grpc_resolver* resolver,
-                        const grpc_resolver_vtable* vtable,
-                        grpc_combiner* combiner);
-
-void grpc_resolver_shutdown_locked(grpc_resolver* resolver);
-
-/** Notification that the channel has seen an error on some address.
-    Can be used as a hint that re-resolution is desirable soon.
-
-    Must be called from the combiner passed as a resolver_arg at construction
-    time.*/
-void grpc_resolver_channel_saw_error_locked(grpc_resolver* resolver);
-
-/** Get the next result from the resolver.  Expected to set \a *result with
-    new channel args and then schedule \a on_complete for execution.
-
-    If resolution is fatally broken, set \a *result to NULL and
-    schedule \a on_complete.
-
-    Must be called from the combiner passed as a resolver_arg at construction
-    time.*/
-void grpc_resolver_next_locked(grpc_resolver* resolver,
-                               grpc_channel_args** result,
-                               grpc_closure* on_complete);
+}  // namespace grpc_core
 
 #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_H */
diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
index e5b2815..6e03ae4 100644
--- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
+++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
@@ -25,7 +25,6 @@
 #include <unistd.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/string_util.h>
 
 #include "src/core/ext/filters/client_channel/http_connect_handshaker.h"
@@ -35,6 +34,7 @@
 #include "src/core/lib/backoff/backoff.h"
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/gprpp/manual_constructor.h"
 #include "src/core/lib/iomgr/combiner.h"
@@ -49,109 +49,168 @@
 #define GRPC_DNS_RECONNECT_MAX_BACKOFF_SECONDS 120
 #define GRPC_DNS_RECONNECT_JITTER 0.2
 
-typedef struct {
-  /** base class: must be first */
-  grpc_resolver base;
-  /** DNS server to use (if not system default) */
-  char* dns_server;
-  /** name to resolve (usually the same as target_name) */
-  char* name_to_resolve;
-  /** default port to use */
-  char* default_port;
-  /** channel args. */
-  grpc_channel_args* channel_args;
-  /** whether to request the service config */
-  bool request_service_config;
-  /** pollset_set to drive the name resolution process */
-  grpc_pollset_set* interested_parties;
+namespace grpc_core {
 
-  /** Closures used by the combiner */
-  grpc_closure dns_ares_on_next_resolution_timer_closure;
-  grpc_closure dns_ares_on_resolved_closure;
+namespace {
 
-  /** Combiner guarding the rest of the state */
-  grpc_combiner* combiner;
-  /** are we currently resolving? */
-  bool resolving;
-  /** the pending resolving request */
-  grpc_ares_request* pending_request;
-  /** which version of the result have we published? */
-  int published_version;
-  /** which version of the result is current? */
-  int resolved_version;
-  /** pending next completion, or NULL */
-  grpc_closure* next_completion;
-  /** target result address for next completion */
-  grpc_channel_args** target_result;
-  /** current (fully resolved) result */
-  grpc_channel_args* resolved_result;
-  /** next resolution timer */
-  bool have_next_resolution_timer;
-  grpc_timer next_resolution_timer;
-  /** retry backoff state */
-  grpc_core::ManualConstructor<grpc_core::BackOff> backoff;
-  /** min resolution period. Max one resolution will happen per period */
-  grpc_millis min_time_between_resolutions;
-  /** when was the last resolution? -1 if no resolution has happened yet */
-  grpc_millis last_resolution_timestamp;
-  /** currently resolving addresses */
-  grpc_lb_addresses* lb_addresses;
-  /** currently resolving service config */
-  char* service_config_json;
-} ares_dns_resolver;
+const char kDefaultPort[] = "https";
 
-static void dns_ares_destroy(grpc_resolver* r);
+class AresDnsResolver : public Resolver {
+ public:
+  explicit AresDnsResolver(const ResolverArgs& args);
 
-static void dns_ares_start_resolving_locked(ares_dns_resolver* r);
-static void dns_ares_maybe_start_resolving_locked(ares_dns_resolver* r);
-static void dns_ares_maybe_finish_next_locked(ares_dns_resolver* r);
+  void NextLocked(grpc_channel_args** result,
+                  grpc_closure* on_complete) override;
 
-static void dns_ares_shutdown_locked(grpc_resolver* r);
-static void dns_ares_channel_saw_error_locked(grpc_resolver* r);
-static void dns_ares_next_locked(grpc_resolver* r,
-                                 grpc_channel_args** target_result,
-                                 grpc_closure* on_complete);
+  void RequestReresolutionLocked() override;
 
-static const grpc_resolver_vtable dns_ares_resolver_vtable = {
-    dns_ares_destroy, dns_ares_shutdown_locked,
-    dns_ares_channel_saw_error_locked, dns_ares_next_locked};
+  void ShutdownLocked() override;
 
-static void dns_ares_shutdown_locked(grpc_resolver* resolver) {
-  ares_dns_resolver* r = (ares_dns_resolver*)resolver;
-  if (r->have_next_resolution_timer) {
-    grpc_timer_cancel(&r->next_resolution_timer);
+ private:
+  virtual ~AresDnsResolver();
+
+  void MaybeStartResolvingLocked();
+  void StartResolvingLocked();
+  void MaybeFinishNextLocked();
+
+  static void OnNextResolutionLocked(void* arg, grpc_error* error);
+  static void OnResolvedLocked(void* arg, grpc_error* error);
+
+  /// DNS server to use (if not system default)
+  char* dns_server_;
+  /// name to resolve (usually the same as target_name)
+  char* name_to_resolve_;
+  /// channel args
+  grpc_channel_args* channel_args_;
+  /// whether to request the service config
+  bool request_service_config_;
+  /// pollset_set to drive the name resolution process
+  grpc_pollset_set* interested_parties_;
+  /// closures used by the combiner
+  grpc_closure on_next_resolution_;
+  grpc_closure on_resolved_;
+  /// are we currently resolving?
+  bool resolving_ = false;
+  /// the pending resolving request
+  grpc_ares_request* pending_request_ = nullptr;
+  /// which version of the result have we published?
+  int published_version_ = 0;
+  /// which version of the result is current?
+  int resolved_version_ = 0;
+  /// pending next completion, or NULL
+  grpc_closure* next_completion_ = nullptr;
+  /// target result address for next completion
+  grpc_channel_args** target_result_ = nullptr;
+  /// current (fully resolved) result
+  grpc_channel_args* resolved_result_ = nullptr;
+  /// next resolution timer
+  bool have_next_resolution_timer_ = false;
+  grpc_timer next_resolution_timer_;
+  /// min interval between DNS requests
+  grpc_millis min_time_between_resolutions_;
+  /// timestamp of last DNS request
+  grpc_millis last_resolution_timestamp_ = -1;
+  /// retry backoff state
+  BackOff backoff_;
+  /// currently resolving addresses
+  grpc_lb_addresses* lb_addresses_ = nullptr;
+  /// currently resolving service config
+  char* service_config_json_ = nullptr;
+};
+
+AresDnsResolver::AresDnsResolver(const ResolverArgs& args)
+    : Resolver(args.combiner),
+      backoff_(
+          BackOff::Options()
+              .set_initial_backoff(GRPC_DNS_INITIAL_CONNECT_BACKOFF_SECONDS *
+                                   1000)
+              .set_multiplier(GRPC_DNS_RECONNECT_BACKOFF_MULTIPLIER)
+              .set_jitter(GRPC_DNS_RECONNECT_JITTER)
+              .set_max_backoff(GRPC_DNS_RECONNECT_MAX_BACKOFF_SECONDS * 1000)) {
+  // Get name to resolve from URI path.
+  const char* path = args.uri->path;
+  if (path[0] == '/') ++path;
+  name_to_resolve_ = gpr_strdup(path);
+  // Get DNS server from URI authority.
+  if (0 != strcmp(args.uri->authority, "")) {
+    dns_server_ = gpr_strdup(args.uri->authority);
   }
-  if (r->pending_request != nullptr) {
-    grpc_cancel_ares_request(r->pending_request);
+  channel_args_ = grpc_channel_args_copy(args.args);
+  const grpc_arg* arg = grpc_channel_args_find(
+      channel_args_, GRPC_ARG_SERVICE_CONFIG_DISABLE_RESOLUTION);
+  request_service_config_ = !grpc_channel_arg_get_integer(
+      arg, (grpc_integer_options){false, false, true});
+  arg = grpc_channel_args_find(channel_args_,
+                               GRPC_ARG_DNS_MIN_TIME_BETWEEN_RESOLUTIONS_MS);
+  min_time_between_resolutions_ =
+      grpc_channel_arg_get_integer(arg, {1000, 0, INT_MAX});
+  interested_parties_ = grpc_pollset_set_create();
+  if (args.pollset_set != nullptr) {
+    grpc_pollset_set_add_pollset_set(interested_parties_, args.pollset_set);
   }
-  if (r->next_completion != nullptr) {
-    *r->target_result = nullptr;
-    GRPC_CLOSURE_SCHED(r->next_completion, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
-                                               "Resolver Shutdown"));
-    r->next_completion = nullptr;
+  GRPC_CLOSURE_INIT(&on_next_resolution_, OnNextResolutionLocked, this,
+                    grpc_combiner_scheduler(combiner()));
+  GRPC_CLOSURE_INIT(&on_resolved_, OnResolvedLocked, this,
+                    grpc_combiner_scheduler(combiner()));
+}
+
+AresDnsResolver::~AresDnsResolver() {
+  gpr_log(GPR_DEBUG, "destroying AresDnsResolver");
+  if (resolved_result_ != nullptr) {
+    grpc_channel_args_destroy(resolved_result_);
+  }
+  grpc_pollset_set_destroy(interested_parties_);
+  gpr_free(dns_server_);
+  gpr_free(name_to_resolve_);
+  grpc_channel_args_destroy(channel_args_);
+}
+
+void AresDnsResolver::NextLocked(grpc_channel_args** target_result,
+                                 grpc_closure* on_complete) {
+  gpr_log(GPR_DEBUG, "AresDnsResolver::NextLocked() is called.");
+  GPR_ASSERT(next_completion_ == nullptr);
+  next_completion_ = on_complete;
+  target_result_ = target_result;
+  if (resolved_version_ == 0 && !resolving_) {
+    MaybeStartResolvingLocked();
+  } else {
+    MaybeFinishNextLocked();
   }
 }
 
-static void dns_ares_channel_saw_error_locked(grpc_resolver* resolver) {
-  ares_dns_resolver* r = (ares_dns_resolver*)resolver;
-  if (!r->resolving) {
-    dns_ares_maybe_start_resolving_locked(r);
+void AresDnsResolver::RequestReresolutionLocked() {
+  if (!resolving_) {
+    MaybeStartResolvingLocked();
   }
 }
 
-static void dns_ares_on_next_resolution_timer_locked(void* arg,
-                                                     grpc_error* error) {
-  ares_dns_resolver* r = (ares_dns_resolver*)arg;
-  r->have_next_resolution_timer = false;
+void AresDnsResolver::ShutdownLocked() {
+  if (have_next_resolution_timer_) {
+    grpc_timer_cancel(&next_resolution_timer_);
+  }
+  if (pending_request_ != nullptr) {
+    grpc_cancel_ares_request(pending_request_);
+  }
+  if (next_completion_ != nullptr) {
+    *target_result_ = nullptr;
+    GRPC_CLOSURE_SCHED(next_completion_, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
+                                             "Resolver Shutdown"));
+    next_completion_ = nullptr;
+  }
+}
+
+void AresDnsResolver::OnNextResolutionLocked(void* arg, grpc_error* error) {
+  AresDnsResolver* r = static_cast<AresDnsResolver*>(arg);
+  r->have_next_resolution_timer_ = false;
   if (error == GRPC_ERROR_NONE) {
-    if (!r->resolving) {
-      dns_ares_start_resolving_locked(r);
+    if (!r->resolving_) {
+      r->StartResolvingLocked();
     }
   }
-  GRPC_RESOLVER_UNREF(&r->base, "next_resolution_timer");
+  r->Unref(DEBUG_LOCATION, "next_resolution_timer");
 }
 
-static bool value_in_json_array(grpc_json* array, const char* value) {
+bool ValueInJsonArray(grpc_json* array, const char* value) {
   for (grpc_json* entry = array->child; entry != nullptr; entry = entry->next) {
     if (entry->type == GRPC_JSON_STRING && strcmp(entry->value, value) == 0) {
       return true;
@@ -160,7 +219,7 @@
   return false;
 }
 
-static char* choose_service_config(char* service_config_choice_json) {
+char* ChooseServiceConfig(char* service_config_choice_json) {
   grpc_json* choices_json = grpc_json_parse_string(service_config_choice_json);
   if (choices_json == nullptr || choices_json->type != GRPC_JSON_ARRAY) {
     gpr_log(GPR_ERROR, "cannot parse service config JSON string");
@@ -178,8 +237,7 @@
          field = field->next) {
       // Check client language, if specified.
       if (strcmp(field->key, "clientLanguage") == 0) {
-        if (field->type != GRPC_JSON_ARRAY ||
-            !value_in_json_array(field, "c++")) {
+        if (field->type != GRPC_JSON_ARRAY || !ValueInJsonArray(field, "c++")) {
           service_config_json = nullptr;
           break;
         }
@@ -188,7 +246,7 @@
       if (strcmp(field->key, "clientHostname") == 0) {
         char* hostname = grpc_gethostname();
         if (hostname == nullptr || field->type != GRPC_JSON_ARRAY ||
-            !value_in_json_array(field, hostname)) {
+            !ValueInJsonArray(field, hostname)) {
           service_config_json = nullptr;
           break;
         }
@@ -223,24 +281,24 @@
   return service_config;
 }
 
-static void dns_ares_on_resolved_locked(void* arg, grpc_error* error) {
-  ares_dns_resolver* r = (ares_dns_resolver*)arg;
+void AresDnsResolver::OnResolvedLocked(void* arg, grpc_error* error) {
+  AresDnsResolver* r = static_cast<AresDnsResolver*>(arg);
   grpc_channel_args* result = nullptr;
-  GPR_ASSERT(r->resolving);
-  r->resolving = false;
-  r->pending_request = nullptr;
-  if (r->lb_addresses != nullptr) {
+  GPR_ASSERT(r->resolving_);
+  r->resolving_ = false;
+  r->pending_request_ = nullptr;
+  if (r->lb_addresses_ != nullptr) {
     static const char* args_to_remove[2];
     size_t num_args_to_remove = 0;
     grpc_arg new_args[3];
     size_t num_args_to_add = 0;
     new_args[num_args_to_add++] =
-        grpc_lb_addresses_create_channel_arg(r->lb_addresses);
+        grpc_lb_addresses_create_channel_arg(r->lb_addresses_);
     grpc_service_config* service_config = nullptr;
     char* service_config_string = nullptr;
-    if (r->service_config_json != nullptr) {
-      service_config_string = choose_service_config(r->service_config_json);
-      gpr_free(r->service_config_json);
+    if (r->service_config_json_ != nullptr) {
+      service_config_string = ChooseServiceConfig(r->service_config_json_);
+      gpr_free(r->service_config_json_);
       if (service_config_string != nullptr) {
         gpr_log(GPR_INFO, "selected service config choice: %s",
                 service_config_string);
@@ -260,221 +318,150 @@
       }
     }
     result = grpc_channel_args_copy_and_add_and_remove(
-        r->channel_args, args_to_remove, num_args_to_remove, new_args,
+        r->channel_args_, args_to_remove, num_args_to_remove, new_args,
         num_args_to_add);
     if (service_config != nullptr) grpc_service_config_destroy(service_config);
     gpr_free(service_config_string);
-    grpc_lb_addresses_destroy(r->lb_addresses);
+    grpc_lb_addresses_destroy(r->lb_addresses_);
     // Reset backoff state so that we start from the beginning when the
     // next request gets triggered.
-    r->backoff->Reset();
+    r->backoff_.Reset();
   } else {
     const char* msg = grpc_error_string(error);
     gpr_log(GPR_DEBUG, "dns resolution failed: %s", msg);
-    grpc_millis next_try = r->backoff->NextAttemptTime();
-    grpc_millis timeout = next_try - grpc_core::ExecCtx::Get()->Now();
+    grpc_millis next_try = r->backoff_.NextAttemptTime();
+    grpc_millis timeout = next_try - ExecCtx::Get()->Now();
     gpr_log(GPR_INFO, "dns resolution failed (will retry): %s",
             grpc_error_string(error));
-    GPR_ASSERT(!r->have_next_resolution_timer);
-    r->have_next_resolution_timer = true;
-    GRPC_RESOLVER_REF(&r->base, "next_resolution_timer");
+    GPR_ASSERT(!r->have_next_resolution_timer_);
+    r->have_next_resolution_timer_ = true;
+    // TODO(roth): We currently deal with this ref manually.  Once the
+    // new closure API is done, find a way to track this ref with the timer
+    // callback as part of the type system.
+    RefCountedPtr<Resolver> self = r->Ref(DEBUG_LOCATION, "retry-timer");
+    self.release();
     if (timeout > 0) {
       gpr_log(GPR_DEBUG, "retrying in %" PRIdPTR " milliseconds", timeout);
     } else {
       gpr_log(GPR_DEBUG, "retrying immediately");
     }
-    grpc_timer_init(&r->next_resolution_timer, next_try,
-                    &r->dns_ares_on_next_resolution_timer_closure);
+    grpc_timer_init(&r->next_resolution_timer_, next_try,
+                    &r->on_next_resolution_);
   }
-  if (r->resolved_result != nullptr) {
-    grpc_channel_args_destroy(r->resolved_result);
+  if (r->resolved_result_ != nullptr) {
+    grpc_channel_args_destroy(r->resolved_result_);
   }
-  r->resolved_result = result;
-  r->last_resolution_timestamp = grpc_core::ExecCtx::Get()->Now();
-  r->resolved_version++;
-  dns_ares_maybe_finish_next_locked(r);
-  GRPC_RESOLVER_UNREF(&r->base, "dns-resolving");
+  r->resolved_result_ = result;
+  ++r->resolved_version_;
+  r->MaybeFinishNextLocked();
+  r->Unref(DEBUG_LOCATION, "dns-resolving");
 }
 
-static void dns_ares_next_locked(grpc_resolver* resolver,
-                                 grpc_channel_args** target_result,
-                                 grpc_closure* on_complete) {
-  gpr_log(GPR_DEBUG, "dns_ares_next is called.");
-  ares_dns_resolver* r = (ares_dns_resolver*)resolver;
-  GPR_ASSERT(!r->next_completion);
-  r->next_completion = on_complete;
-  r->target_result = target_result;
-  if (r->resolved_version == 0 && !r->resolving) {
-    dns_ares_maybe_start_resolving_locked(r);
-  } else {
-    dns_ares_maybe_finish_next_locked(r);
-  }
-}
-
-static void dns_ares_start_resolving_locked(ares_dns_resolver* r) {
-  GRPC_RESOLVER_REF(&r->base, "dns-resolving");
-  GPR_ASSERT(!r->resolving);
-  r->resolving = true;
-  r->lb_addresses = nullptr;
-  r->service_config_json = nullptr;
-  r->pending_request = grpc_dns_lookup_ares(
-      r->dns_server, r->name_to_resolve, r->default_port, r->interested_parties,
-      &r->dns_ares_on_resolved_closure, &r->lb_addresses,
-      true /* check_grpclb */,
-      r->request_service_config ? &r->service_config_json : nullptr);
-}
-
-static void dns_ares_maybe_finish_next_locked(ares_dns_resolver* r) {
-  if (r->next_completion != nullptr &&
-      r->resolved_version != r->published_version) {
-    *r->target_result = r->resolved_result == nullptr
-                            ? nullptr
-                            : grpc_channel_args_copy(r->resolved_result);
-    gpr_log(GPR_DEBUG, "dns_ares_maybe_finish_next_locked");
-    GRPC_CLOSURE_SCHED(r->next_completion, GRPC_ERROR_NONE);
-    r->next_completion = nullptr;
-    r->published_version = r->resolved_version;
-  }
-}
-
-static void dns_ares_maybe_start_resolving_locked(ares_dns_resolver* r) {
-  if (r->last_resolution_timestamp >= 0) {
+void AresDnsResolver::MaybeStartResolvingLocked() {
+  if (last_resolution_timestamp_ >= 0) {
     const grpc_millis earliest_next_resolution =
-        r->last_resolution_timestamp + r->min_time_between_resolutions;
+        last_resolution_timestamp_ + min_time_between_resolutions_;
     const grpc_millis ms_until_next_resolution =
         earliest_next_resolution - grpc_core::ExecCtx::Get()->Now();
     if (ms_until_next_resolution > 0) {
       const grpc_millis last_resolution_ago =
-          grpc_core::ExecCtx::Get()->Now() - r->last_resolution_timestamp;
+          grpc_core::ExecCtx::Get()->Now() - last_resolution_timestamp_;
       gpr_log(GPR_DEBUG,
               "In cooldown from last resolution (from %" PRIdPTR
               " ms ago). Will resolve again in %" PRIdPTR " ms",
               last_resolution_ago, ms_until_next_resolution);
-      if (!r->have_next_resolution_timer) {
-        r->have_next_resolution_timer = true;
-        GRPC_RESOLVER_REF(&r->base, "next_resolution_timer_cooldown");
-        grpc_timer_init(&r->next_resolution_timer, ms_until_next_resolution,
-                        &r->dns_ares_on_next_resolution_timer_closure);
+      if (!have_next_resolution_timer_) {
+        have_next_resolution_timer_ = true;
+        // TODO(roth): We currently deal with this ref manually.  Once the
+        // new closure API is done, find a way to track this ref with the timer
+        // callback as part of the type system.
+        RefCountedPtr<Resolver> self =
+            Ref(DEBUG_LOCATION, "next_resolution_timer_cooldown");
+        self.release();
+        grpc_timer_init(&next_resolution_timer_, ms_until_next_resolution,
+                        &on_next_resolution_);
       }
       // TODO(dgq): remove the following two lines once Pick First stops
       // discarding subchannels after selecting.
-      ++r->resolved_version;
-      dns_ares_maybe_finish_next_locked(r);
+      ++resolved_version_;
+      MaybeFinishNextLocked();
       return;
     }
   }
-  dns_ares_start_resolving_locked(r);
+  StartResolvingLocked();
 }
 
-static void dns_ares_destroy(grpc_resolver* gr) {
-  gpr_log(GPR_DEBUG, "dns_ares_destroy");
-  ares_dns_resolver* r = (ares_dns_resolver*)gr;
-  if (r->resolved_result != nullptr) {
-    grpc_channel_args_destroy(r->resolved_result);
+void AresDnsResolver::StartResolvingLocked() {
+  // TODO(roth): We currently deal with this ref manually.  Once the
+  // new closure API is done, find a way to track this ref with the timer
+  // callback as part of the type system.
+  RefCountedPtr<Resolver> self = Ref(DEBUG_LOCATION, "dns-resolving");
+  self.release();
+  GPR_ASSERT(!resolving_);
+  resolving_ = true;
+  lb_addresses_ = nullptr;
+  service_config_json_ = nullptr;
+  pending_request_ = grpc_dns_lookup_ares(
+      dns_server_, name_to_resolve_, kDefaultPort, interested_parties_,
+      &on_resolved_, &lb_addresses_, true /* check_grpclb */,
+      request_service_config_ ? &service_config_json_ : nullptr);
+  last_resolution_timestamp_ = grpc_core::ExecCtx::Get()->Now();
+}
+
+void AresDnsResolver::MaybeFinishNextLocked() {
+  if (next_completion_ != nullptr && resolved_version_ != published_version_) {
+    *target_result_ = resolved_result_ == nullptr
+                          ? nullptr
+                          : grpc_channel_args_copy(resolved_result_);
+    gpr_log(GPR_DEBUG, "AresDnsResolver::MaybeFinishNextLocked()");
+    GRPC_CLOSURE_SCHED(next_completion_, GRPC_ERROR_NONE);
+    next_completion_ = nullptr;
+    published_version_ = resolved_version_;
   }
-  grpc_pollset_set_destroy(r->interested_parties);
-  gpr_free(r->dns_server);
-  gpr_free(r->name_to_resolve);
-  gpr_free(r->default_port);
-  grpc_channel_args_destroy(r->channel_args);
-  gpr_free(r);
 }
 
-static grpc_resolver* dns_ares_create(grpc_resolver_args* args,
-                                      const char* default_port) {
-  /* Get name from args. */
-  const char* path = args->uri->path;
-  if (path[0] == '/') ++path;
-  /* Create resolver. */
-  ares_dns_resolver* r =
-      (ares_dns_resolver*)gpr_zalloc(sizeof(ares_dns_resolver));
-  grpc_resolver_init(&r->base, &dns_ares_resolver_vtable, args->combiner);
-  if (0 != strcmp(args->uri->authority, "")) {
-    r->dns_server = gpr_strdup(args->uri->authority);
+//
+// Factory
+//
+
+class AresDnsResolverFactory : public ResolverFactory {
+ public:
+  OrphanablePtr<Resolver> CreateResolver(
+      const ResolverArgs& args) const override {
+    return OrphanablePtr<Resolver>(New<AresDnsResolver>(args));
   }
-  r->name_to_resolve = gpr_strdup(path);
-  r->default_port = gpr_strdup(default_port);
-  r->channel_args = grpc_channel_args_copy(args->args);
-  const grpc_arg* arg = grpc_channel_args_find(
-      r->channel_args, GRPC_ARG_SERVICE_CONFIG_DISABLE_RESOLUTION);
-  r->request_service_config = !grpc_channel_arg_get_integer(
-      arg, (grpc_integer_options){false, false, true});
-  r->interested_parties = grpc_pollset_set_create();
-  if (args->pollset_set != nullptr) {
-    grpc_pollset_set_add_pollset_set(r->interested_parties, args->pollset_set);
-  }
-  grpc_core::BackOff::Options backoff_options;
-  backoff_options
-      .set_initial_backoff(GRPC_DNS_INITIAL_CONNECT_BACKOFF_SECONDS * 1000)
-      .set_multiplier(GRPC_DNS_RECONNECT_BACKOFF_MULTIPLIER)
-      .set_jitter(GRPC_DNS_RECONNECT_JITTER)
-      .set_max_backoff(GRPC_DNS_RECONNECT_MAX_BACKOFF_SECONDS * 1000);
-  r->backoff.Init(grpc_core::BackOff(backoff_options));
-  GRPC_CLOSURE_INIT(&r->dns_ares_on_next_resolution_timer_closure,
-                    dns_ares_on_next_resolution_timer_locked, r,
-                    grpc_combiner_scheduler(r->base.combiner));
-  GRPC_CLOSURE_INIT(&r->dns_ares_on_resolved_closure,
-                    dns_ares_on_resolved_locked, r,
-                    grpc_combiner_scheduler(r->base.combiner));
-  const grpc_arg* period_arg = grpc_channel_args_find(
-      args->args, GRPC_ARG_DNS_MIN_TIME_BETWEEN_RESOLUTIONS_MS);
-  r->min_time_between_resolutions =
-      grpc_channel_arg_get_integer(period_arg, {1000, 0, INT_MAX});
-  r->last_resolution_timestamp = -1;
-  return &r->base;
-}
 
-/*
- * FACTORY
- */
+  const char* scheme() const override { return "dns"; }
+};
 
-static void dns_ares_factory_ref(grpc_resolver_factory* factory) {}
+}  // namespace
 
-static void dns_ares_factory_unref(grpc_resolver_factory* factory) {}
+}  // namespace grpc_core
 
-static grpc_resolver* dns_factory_create_resolver(
-    grpc_resolver_factory* factory, grpc_resolver_args* args) {
-  return dns_ares_create(args, "https");
-}
-
-static char* dns_ares_factory_get_default_host_name(
-    grpc_resolver_factory* factory, grpc_uri* uri) {
-  const char* path = uri->path;
-  if (path[0] == '/') ++path;
-  return gpr_strdup(path);
-}
-
-static const grpc_resolver_factory_vtable dns_ares_factory_vtable = {
-    dns_ares_factory_ref, dns_ares_factory_unref, dns_factory_create_resolver,
-    dns_ares_factory_get_default_host_name, "dns"};
-static grpc_resolver_factory dns_resolver_factory = {&dns_ares_factory_vtable};
-
-static grpc_resolver_factory* dns_ares_resolver_factory_create() {
-  return &dns_resolver_factory;
-}
-
-void grpc_resolver_dns_ares_init(void) {
-  char* resolver = gpr_getenv("GRPC_DNS_RESOLVER");
+void grpc_resolver_dns_ares_init() {
+  char* resolver_env = gpr_getenv("GRPC_DNS_RESOLVER");
   /* TODO(zyc): Turn on c-ares based resolver by default after the address
      sorter and the CNAME support are added. */
-  if (resolver != nullptr && gpr_stricmp(resolver, "ares") == 0) {
+  if (resolver_env != nullptr && gpr_stricmp(resolver_env, "ares") == 0) {
     grpc_error* error = grpc_ares_init();
     if (error != GRPC_ERROR_NONE) {
       GRPC_LOG_IF_ERROR("ares_library_init() failed", error);
       return;
     }
     grpc_resolve_address = grpc_resolve_address_ares;
-    grpc_register_resolver_type(dns_ares_resolver_factory_create());
+    grpc_core::ResolverRegistry::Builder::RegisterResolverFactory(
+        grpc_core::UniquePtr<grpc_core::ResolverFactory>(
+            grpc_core::New<grpc_core::AresDnsResolverFactory>()));
   }
-  gpr_free(resolver);
+  gpr_free(resolver_env);
 }
 
-void grpc_resolver_dns_ares_shutdown(void) {
-  char* resolver = gpr_getenv("GRPC_DNS_RESOLVER");
-  if (resolver != nullptr && gpr_stricmp(resolver, "ares") == 0) {
+void grpc_resolver_dns_ares_shutdown() {
+  char* resolver_env = gpr_getenv("GRPC_DNS_RESOLVER");
+  if (resolver_env != nullptr && gpr_stricmp(resolver_env, "ares") == 0) {
     grpc_ares_cleanup();
   }
-  gpr_free(resolver);
+  gpr_free(resolver_env);
 }
 
 #else /* GRPC_ARES == 1 && !defined(GRPC_UV) */
diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc
index 2eb2a9b..2bf86f8 100644
--- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc
+++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc
@@ -28,7 +28,6 @@
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/iomgr/ev_posix.h"
diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
index e05f9d2..3ec1b6f 100644
--- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
+++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
@@ -28,14 +28,13 @@
 
 #include <ares.h>
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/ext/filters/client_channel/parse_address.h"
 #include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/iomgr/error.h"
 #include "src/core/lib/iomgr/executor.h"
diff --git a/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc b/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc
index 2c79818..fbab136 100644
--- a/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc
+++ b/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc
@@ -23,7 +23,6 @@
 #include <cstring>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/time.h>
 
@@ -32,6 +31,7 @@
 #include "src/core/lib/backoff/backoff.h"
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/gprpp/manual_constructor.h"
 #include "src/core/lib/iomgr/combiner.h"
@@ -43,301 +43,298 @@
 #define GRPC_DNS_RECONNECT_MAX_BACKOFF_SECONDS 120
 #define GRPC_DNS_RECONNECT_JITTER 0.2
 
-typedef struct {
-  /** base class: must be first */
-  grpc_resolver base;
-  /** name to resolve */
-  char* name_to_resolve;
-  /** default port to use */
-  char* default_port;
-  /** channel args. */
-  grpc_channel_args* channel_args;
-  /** pollset_set to drive the name resolution process */
-  grpc_pollset_set* interested_parties;
+namespace grpc_core {
 
-  /** are we currently resolving? */
-  bool resolving;
-  /** which version of the result have we published? */
-  int published_version;
-  /** which version of the result is current? */
-  int resolved_version;
-  /** pending next completion, or NULL */
-  grpc_closure* next_completion;
-  /** target result address for next completion */
-  grpc_channel_args** target_result;
-  /** current (fully resolved) result */
-  grpc_channel_args* resolved_result;
-  /** next resolution timer */
-  bool have_next_resolution_timer;
-  grpc_timer next_resolution_timer;
-  grpc_closure next_resolution_closure;
-  /** retry backoff state */
-  grpc_core::ManualConstructor<grpc_core::BackOff> backoff;
-  /** min resolution period. Max one resolution will happen per period */
-  grpc_millis min_time_between_resolutions;
-  /** when was the last resolution? -1 if no resolution has happened yet */
-  grpc_millis last_resolution_timestamp;
-  /** currently resolving addresses */
-  grpc_resolved_addresses* addresses;
-} dns_resolver;
+namespace {
 
-static void dns_destroy(grpc_resolver* r);
+const char kDefaultPort[] = "https";
 
-static void dns_start_resolving_locked(dns_resolver* r);
-static void maybe_start_resolving_locked(dns_resolver* r);
-static void dns_maybe_finish_next_locked(dns_resolver* r);
+class NativeDnsResolver : public Resolver {
+ public:
+  explicit NativeDnsResolver(const ResolverArgs& args);
 
-static void dns_shutdown_locked(grpc_resolver* r);
-static void dns_channel_saw_error_locked(grpc_resolver* r);
-static void dns_next_locked(grpc_resolver* r, grpc_channel_args** target_result,
-                            grpc_closure* on_complete);
+  void NextLocked(grpc_channel_args** result,
+                  grpc_closure* on_complete) override;
 
-static const grpc_resolver_vtable dns_resolver_vtable = {
-    dns_destroy, dns_shutdown_locked, dns_channel_saw_error_locked,
-    dns_next_locked};
+  void RequestReresolutionLocked() override;
 
-static void dns_shutdown_locked(grpc_resolver* resolver) {
-  dns_resolver* r = (dns_resolver*)resolver;
-  if (r->have_next_resolution_timer) {
-    grpc_timer_cancel(&r->next_resolution_timer);
+  void ShutdownLocked() override;
+
+ private:
+  virtual ~NativeDnsResolver();
+
+  void MaybeStartResolvingLocked();
+  void StartResolvingLocked();
+  void MaybeFinishNextLocked();
+
+  static void OnNextResolutionLocked(void* arg, grpc_error* error);
+  static void OnResolvedLocked(void* arg, grpc_error* error);
+
+  /// name to resolve
+  char* name_to_resolve_ = nullptr;
+  /// channel args
+  grpc_channel_args* channel_args_ = nullptr;
+  /// pollset_set to drive the name resolution process
+  grpc_pollset_set* interested_parties_ = nullptr;
+  /// are we currently resolving?
+  bool resolving_ = false;
+  grpc_closure on_resolved_;
+  /// which version of the result have we published?
+  int published_version_ = 0;
+  /// which version of the result is current?
+  int resolved_version_ = 0;
+  /// pending next completion, or nullptr
+  grpc_closure* next_completion_ = nullptr;
+  /// target result address for next completion
+  grpc_channel_args** target_result_ = nullptr;
+  /// current (fully resolved) result
+  grpc_channel_args* resolved_result_ = nullptr;
+  /// next resolution timer
+  bool have_next_resolution_timer_ = false;
+  grpc_timer next_resolution_timer_;
+  grpc_closure on_next_resolution_;
+  /// min time between DNS requests
+  grpc_millis min_time_between_resolutions_;
+  /// timestamp of last DNS request
+  grpc_millis last_resolution_timestamp_ = -1;
+  /// retry backoff state
+  BackOff backoff_;
+  /// currently resolving addresses
+  grpc_resolved_addresses* addresses_ = nullptr;
+};
+
+NativeDnsResolver::NativeDnsResolver(const ResolverArgs& args)
+    : Resolver(args.combiner),
+      backoff_(
+          BackOff::Options()
+              .set_initial_backoff(GRPC_DNS_INITIAL_CONNECT_BACKOFF_SECONDS *
+                                   1000)
+              .set_multiplier(GRPC_DNS_RECONNECT_BACKOFF_MULTIPLIER)
+              .set_jitter(GRPC_DNS_RECONNECT_JITTER)
+              .set_max_backoff(GRPC_DNS_RECONNECT_MAX_BACKOFF_SECONDS * 1000)) {
+  char* path = args.uri->path;
+  if (path[0] == '/') ++path;
+  name_to_resolve_ = gpr_strdup(path);
+  channel_args_ = grpc_channel_args_copy(args.args);
+  const grpc_arg* arg = grpc_channel_args_find(
+      args.args, GRPC_ARG_DNS_MIN_TIME_BETWEEN_RESOLUTIONS_MS);
+  min_time_between_resolutions_ =
+      grpc_channel_arg_get_integer(arg, {1000, 0, INT_MAX});
+  interested_parties_ = grpc_pollset_set_create();
+  if (args.pollset_set != nullptr) {
+    grpc_pollset_set_add_pollset_set(interested_parties_, args.pollset_set);
   }
-  if (r->next_completion != nullptr) {
-    *r->target_result = nullptr;
-    GRPC_CLOSURE_SCHED(r->next_completion, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
-                                               "Resolver Shutdown"));
-    r->next_completion = nullptr;
-  }
+  GRPC_CLOSURE_INIT(&on_next_resolution_,
+                    NativeDnsResolver::OnNextResolutionLocked, this,
+                    grpc_combiner_scheduler(args.combiner));
+  GRPC_CLOSURE_INIT(&on_resolved_, NativeDnsResolver::OnResolvedLocked, this,
+                    grpc_combiner_scheduler(args.combiner));
 }
 
-static void dns_channel_saw_error_locked(grpc_resolver* resolver) {
-  dns_resolver* r = (dns_resolver*)resolver;
-  if (!r->resolving) {
-    maybe_start_resolving_locked(r);
+NativeDnsResolver::~NativeDnsResolver() {
+  if (resolved_result_ != nullptr) {
+    grpc_channel_args_destroy(resolved_result_);
   }
+  grpc_pollset_set_destroy(interested_parties_);
+  gpr_free(name_to_resolve_);
+  grpc_channel_args_destroy(channel_args_);
 }
 
-static void dns_next_locked(grpc_resolver* resolver,
-                            grpc_channel_args** target_result,
-                            grpc_closure* on_complete) {
-  dns_resolver* r = (dns_resolver*)resolver;
-  GPR_ASSERT(!r->next_completion);
-  r->next_completion = on_complete;
-  r->target_result = target_result;
-  if (r->resolved_version == 0 && !r->resolving) {
-    maybe_start_resolving_locked(r);
+void NativeDnsResolver::NextLocked(grpc_channel_args** result,
+                                   grpc_closure* on_complete) {
+  GPR_ASSERT(next_completion_ == nullptr);
+  next_completion_ = on_complete;
+  target_result_ = result;
+  if (resolved_version_ == 0 && !resolving_) {
+    MaybeStartResolvingLocked();
   } else {
-    dns_maybe_finish_next_locked(r);
+    MaybeFinishNextLocked();
   }
 }
 
-static void dns_on_next_resolution_timer_locked(void* arg, grpc_error* error) {
-  dns_resolver* r = (dns_resolver*)arg;
-  r->have_next_resolution_timer = false;
-  if (error == GRPC_ERROR_NONE && !r->resolving) {
-    dns_start_resolving_locked(r);
+void NativeDnsResolver::RequestReresolutionLocked() {
+  if (!resolving_) {
+    MaybeStartResolvingLocked();
   }
-  GRPC_RESOLVER_UNREF(&r->base, "next_resolution_timer");
 }
 
-static void dns_on_resolved_locked(void* arg, grpc_error* error) {
-  dns_resolver* r = (dns_resolver*)arg;
+void NativeDnsResolver::ShutdownLocked() {
+  if (have_next_resolution_timer_) {
+    grpc_timer_cancel(&next_resolution_timer_);
+  }
+  if (next_completion_ != nullptr) {
+    *target_result_ = nullptr;
+    GRPC_CLOSURE_SCHED(next_completion_, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
+                                             "Resolver Shutdown"));
+    next_completion_ = nullptr;
+  }
+}
+
+void NativeDnsResolver::OnNextResolutionLocked(void* arg, grpc_error* error) {
+  NativeDnsResolver* r = static_cast<NativeDnsResolver*>(arg);
+  r->have_next_resolution_timer_ = false;
+  if (error == GRPC_ERROR_NONE && !r->resolving_) {
+    r->StartResolvingLocked();
+  }
+  r->Unref(DEBUG_LOCATION, "retry-timer");
+}
+
+void NativeDnsResolver::OnResolvedLocked(void* arg, grpc_error* error) {
+  NativeDnsResolver* r = static_cast<NativeDnsResolver*>(arg);
   grpc_channel_args* result = nullptr;
-  GPR_ASSERT(r->resolving);
-  r->resolving = false;
+  GPR_ASSERT(r->resolving_);
+  r->resolving_ = false;
   GRPC_ERROR_REF(error);
-  error = grpc_error_set_str(error, GRPC_ERROR_STR_TARGET_ADDRESS,
-                             grpc_slice_from_copied_string(r->name_to_resolve));
-  if (r->addresses != nullptr) {
+  error =
+      grpc_error_set_str(error, GRPC_ERROR_STR_TARGET_ADDRESS,
+                         grpc_slice_from_copied_string(r->name_to_resolve_));
+  if (r->addresses_ != nullptr) {
     grpc_lb_addresses* addresses = grpc_lb_addresses_create(
-        r->addresses->naddrs, nullptr /* user_data_vtable */);
-    for (size_t i = 0; i < r->addresses->naddrs; ++i) {
+        r->addresses_->naddrs, nullptr /* user_data_vtable */);
+    for (size_t i = 0; i < r->addresses_->naddrs; ++i) {
       grpc_lb_addresses_set_address(
-          addresses, i, &r->addresses->addrs[i].addr,
-          r->addresses->addrs[i].len, false /* is_balancer */,
+          addresses, i, &r->addresses_->addrs[i].addr,
+          r->addresses_->addrs[i].len, false /* is_balancer */,
           nullptr /* balancer_name */, nullptr /* user_data */);
     }
     grpc_arg new_arg = grpc_lb_addresses_create_channel_arg(addresses);
-    result = grpc_channel_args_copy_and_add(r->channel_args, &new_arg, 1);
-    grpc_resolved_addresses_destroy(r->addresses);
+    result = grpc_channel_args_copy_and_add(r->channel_args_, &new_arg, 1);
+    grpc_resolved_addresses_destroy(r->addresses_);
     grpc_lb_addresses_destroy(addresses);
     // Reset backoff state so that we start from the beginning when the
     // next request gets triggered.
-    r->backoff->Reset();
+    r->backoff_.Reset();
   } else {
-    grpc_millis next_try = r->backoff->NextAttemptTime();
-    grpc_millis timeout = next_try - grpc_core::ExecCtx::Get()->Now();
+    grpc_millis next_try = r->backoff_.NextAttemptTime();
+    grpc_millis timeout = next_try - ExecCtx::Get()->Now();
     gpr_log(GPR_INFO, "dns resolution failed (will retry): %s",
             grpc_error_string(error));
-    GPR_ASSERT(!r->have_next_resolution_timer);
-    r->have_next_resolution_timer = true;
-    GRPC_RESOLVER_REF(&r->base, "next_resolution_timer");
+    GPR_ASSERT(!r->have_next_resolution_timer_);
+    r->have_next_resolution_timer_ = true;
+    // TODO(roth): We currently deal with this ref manually.  Once the
+    // new closure API is done, find a way to track this ref with the timer
+    // callback as part of the type system.
+    RefCountedPtr<Resolver> self =
+        r->Ref(DEBUG_LOCATION, "next_resolution_timer");
+    self.release();
     if (timeout > 0) {
       gpr_log(GPR_DEBUG, "retrying in %" PRIdPTR " milliseconds", timeout);
     } else {
       gpr_log(GPR_DEBUG, "retrying immediately");
     }
-    grpc_timer_init(&r->next_resolution_timer, next_try,
-                    &r->next_resolution_closure);
+    grpc_timer_init(&r->next_resolution_timer_, next_try,
+                    &r->on_next_resolution_);
   }
-  if (r->resolved_result != nullptr) {
-    grpc_channel_args_destroy(r->resolved_result);
+  if (r->resolved_result_ != nullptr) {
+    grpc_channel_args_destroy(r->resolved_result_);
   }
-  r->resolved_result = result;
-  r->resolved_version++;
-  dns_maybe_finish_next_locked(r);
+  r->resolved_result_ = result;
+  ++r->resolved_version_;
+  r->MaybeFinishNextLocked();
   GRPC_ERROR_UNREF(error);
-
-  GRPC_RESOLVER_UNREF(&r->base, "dns-resolving");
+  r->Unref(DEBUG_LOCATION, "dns-resolving");
 }
 
-static void maybe_start_resolving_locked(dns_resolver* r) {
-  if (r->last_resolution_timestamp >= 0) {
+void NativeDnsResolver::MaybeStartResolvingLocked() {
+  if (last_resolution_timestamp_ >= 0) {
     const grpc_millis earliest_next_resolution =
-        r->last_resolution_timestamp + r->min_time_between_resolutions;
+        last_resolution_timestamp_ + min_time_between_resolutions_;
     const grpc_millis ms_until_next_resolution =
         earliest_next_resolution - grpc_core::ExecCtx::Get()->Now();
     if (ms_until_next_resolution > 0) {
       const grpc_millis last_resolution_ago =
-          grpc_core::ExecCtx::Get()->Now() - r->last_resolution_timestamp;
+          grpc_core::ExecCtx::Get()->Now() - last_resolution_timestamp_;
       gpr_log(GPR_DEBUG,
               "In cooldown from last resolution (from %" PRIdPTR
               " ms ago). Will resolve again in %" PRIdPTR " ms",
               last_resolution_ago, ms_until_next_resolution);
-      if (!r->have_next_resolution_timer) {
-        r->have_next_resolution_timer = true;
-        GRPC_RESOLVER_REF(&r->base, "next_resolution_timer_cooldown");
-        grpc_timer_init(&r->next_resolution_timer, ms_until_next_resolution,
-                        &r->next_resolution_closure);
+      if (!have_next_resolution_timer_) {
+        have_next_resolution_timer_ = true;
+        // TODO(roth): We currently deal with this ref manually.  Once the
+        // new closure API is done, find a way to track this ref with the timer
+        // callback as part of the type system.
+        RefCountedPtr<Resolver> self =
+            Ref(DEBUG_LOCATION, "next_resolution_timer_cooldown");
+        self.release();
+        grpc_timer_init(&next_resolution_timer_, ms_until_next_resolution,
+                        &on_next_resolution_);
       }
       // TODO(dgq): remove the following two lines once Pick First stops
       // discarding subchannels after selecting.
-      ++r->resolved_version;
-      dns_maybe_finish_next_locked(r);
+      ++resolved_version_;
+      MaybeFinishNextLocked();
       return;
     }
   }
-  dns_start_resolving_locked(r);
+  StartResolvingLocked();
 }
 
-static void dns_start_resolving_locked(dns_resolver* r) {
-  GRPC_RESOLVER_REF(&r->base, "dns-resolving");
-  GPR_ASSERT(!r->resolving);
-  r->resolving = true;
-  r->addresses = nullptr;
-  grpc_resolve_address(
-      r->name_to_resolve, r->default_port, r->interested_parties,
-      GRPC_CLOSURE_CREATE(dns_on_resolved_locked, r,
-                          grpc_combiner_scheduler(r->base.combiner)),
-      &r->addresses);
-  r->last_resolution_timestamp = grpc_core::ExecCtx::Get()->Now();
+void NativeDnsResolver::StartResolvingLocked() {
+  // TODO(roth): We currently deal with this ref manually.  Once the
+  // new closure API is done, find a way to track this ref with the timer
+  // callback as part of the type system.
+  RefCountedPtr<Resolver> self = Ref(DEBUG_LOCATION, "dns-resolving");
+  self.release();
+  GPR_ASSERT(!resolving_);
+  resolving_ = true;
+  addresses_ = nullptr;
+  grpc_resolve_address(name_to_resolve_, kDefaultPort, interested_parties_,
+                       &on_resolved_, &addresses_);
+  last_resolution_timestamp_ = grpc_core::ExecCtx::Get()->Now();
 }
 
-static void dns_maybe_finish_next_locked(dns_resolver* r) {
-  if (r->next_completion != nullptr &&
-      r->resolved_version != r->published_version) {
-    *r->target_result = r->resolved_result == nullptr
-                            ? nullptr
-                            : grpc_channel_args_copy(r->resolved_result);
-    GRPC_CLOSURE_SCHED(r->next_completion, GRPC_ERROR_NONE);
-    r->next_completion = nullptr;
-    r->published_version = r->resolved_version;
+void NativeDnsResolver::MaybeFinishNextLocked() {
+  if (next_completion_ != nullptr && resolved_version_ != published_version_) {
+    *target_result_ = resolved_result_ == nullptr
+                          ? nullptr
+                          : grpc_channel_args_copy(resolved_result_);
+    GRPC_CLOSURE_SCHED(next_completion_, GRPC_ERROR_NONE);
+    next_completion_ = nullptr;
+    published_version_ = resolved_version_;
   }
 }
 
-static void dns_destroy(grpc_resolver* gr) {
-  dns_resolver* r = (dns_resolver*)gr;
-  if (r->resolved_result != nullptr) {
-    grpc_channel_args_destroy(r->resolved_result);
+//
+// Factory
+//
+
+class NativeDnsResolverFactory : public ResolverFactory {
+ public:
+  OrphanablePtr<Resolver> CreateResolver(
+      const ResolverArgs& args) const override {
+    if (0 != strcmp(args.uri->authority, "")) {
+      gpr_log(GPR_ERROR, "authority based dns uri's not supported");
+      return OrphanablePtr<Resolver>(nullptr);
+    }
+    return OrphanablePtr<Resolver>(New<NativeDnsResolver>(args));
   }
-  grpc_pollset_set_destroy(r->interested_parties);
-  gpr_free(r->name_to_resolve);
-  gpr_free(r->default_port);
-  grpc_channel_args_destroy(r->channel_args);
-  gpr_free(r);
-}
 
-static grpc_resolver* dns_create(grpc_resolver_args* args,
-                                 const char* default_port) {
-  if (0 != strcmp(args->uri->authority, "")) {
-    gpr_log(GPR_ERROR, "authority based dns uri's not supported");
-    return nullptr;
-  }
-  // Get name from args.
-  char* path = args->uri->path;
-  if (path[0] == '/') ++path;
-  // Create resolver.
-  dns_resolver* r = (dns_resolver*)gpr_zalloc(sizeof(dns_resolver));
-  grpc_resolver_init(&r->base, &dns_resolver_vtable, args->combiner);
-  r->name_to_resolve = gpr_strdup(path);
-  r->default_port = gpr_strdup(default_port);
-  r->channel_args = grpc_channel_args_copy(args->args);
-  r->interested_parties = grpc_pollset_set_create();
-  if (args->pollset_set != nullptr) {
-    grpc_pollset_set_add_pollset_set(r->interested_parties, args->pollset_set);
-  }
-  grpc_core::BackOff::Options backoff_options;
-  backoff_options
-      .set_initial_backoff(GRPC_DNS_INITIAL_CONNECT_BACKOFF_SECONDS * 1000)
-      .set_multiplier(GRPC_DNS_RECONNECT_BACKOFF_MULTIPLIER)
-      .set_jitter(GRPC_DNS_RECONNECT_JITTER)
-      .set_max_backoff(GRPC_DNS_RECONNECT_MAX_BACKOFF_SECONDS * 1000);
-  r->backoff.Init(grpc_core::BackOff(backoff_options));
-  const grpc_arg* period_arg = grpc_channel_args_find(
-      args->args, GRPC_ARG_DNS_MIN_TIME_BETWEEN_RESOLUTIONS_MS);
-  r->min_time_between_resolutions =
-      grpc_channel_arg_get_integer(period_arg, {1000, 0, INT_MAX});
-  r->last_resolution_timestamp = -1;
-  GRPC_CLOSURE_INIT(&r->next_resolution_closure,
-                    dns_on_next_resolution_timer_locked, r,
-                    grpc_combiner_scheduler(r->base.combiner));
-  return &r->base;
-}
+  const char* scheme() const override { return "dns"; }
+};
 
-/*
- * FACTORY
- */
+}  // namespace
 
-static void dns_factory_ref(grpc_resolver_factory* factory) {}
+}  // namespace grpc_core
 
-static void dns_factory_unref(grpc_resolver_factory* factory) {}
-
-static grpc_resolver* dns_factory_create_resolver(
-    grpc_resolver_factory* factory, grpc_resolver_args* args) {
-  return dns_create(args, "https");
-}
-
-static char* dns_factory_get_default_host_name(grpc_resolver_factory* factory,
-                                               grpc_uri* uri) {
-  const char* path = uri->path;
-  if (path[0] == '/') ++path;
-  return gpr_strdup(path);
-}
-
-static const grpc_resolver_factory_vtable dns_factory_vtable = {
-    dns_factory_ref, dns_factory_unref, dns_factory_create_resolver,
-    dns_factory_get_default_host_name, "dns"};
-static grpc_resolver_factory dns_resolver_factory = {&dns_factory_vtable};
-
-static grpc_resolver_factory* dns_resolver_factory_create() {
-  return &dns_resolver_factory;
-}
-
-void grpc_resolver_dns_native_init(void) {
-  char* resolver = gpr_getenv("GRPC_DNS_RESOLVER");
-  if (resolver != nullptr && gpr_stricmp(resolver, "native") == 0) {
+void grpc_resolver_dns_native_init() {
+  char* resolver_env = gpr_getenv("GRPC_DNS_RESOLVER");
+  if (resolver_env != nullptr && gpr_stricmp(resolver_env, "native") == 0) {
     gpr_log(GPR_DEBUG, "Using native dns resolver");
-    grpc_register_resolver_type(dns_resolver_factory_create());
+    grpc_core::ResolverRegistry::Builder::RegisterResolverFactory(
+        grpc_core::UniquePtr<grpc_core::ResolverFactory>(
+            grpc_core::New<grpc_core::NativeDnsResolverFactory>()));
   } else {
-    grpc_resolver_factory* existing_factory =
-        grpc_resolver_factory_lookup("dns");
+    grpc_core::ResolverRegistry::Builder::InitRegistry();
+    grpc_core::ResolverFactory* existing_factory =
+        grpc_core::ResolverRegistry::LookupResolverFactory("dns");
     if (existing_factory == nullptr) {
       gpr_log(GPR_DEBUG, "Using native dns resolver");
-      grpc_register_resolver_type(dns_resolver_factory_create());
-    } else {
-      grpc_resolver_factory_unref(existing_factory);
+      grpc_core::ResolverRegistry::Builder::RegisterResolverFactory(
+          grpc_core::UniquePtr<grpc_core::ResolverFactory>(
+              grpc_core::New<grpc_core::NativeDnsResolverFactory>()));
     }
   }
-  gpr_free(resolver);
+  gpr_free(resolver_env);
 }
 
-void grpc_resolver_dns_native_shutdown(void) {}
+void grpc_resolver_dns_native_shutdown() {}
diff --git a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc
index e945d08..b01e608 100644
--- a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc
+++ b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc
@@ -24,7 +24,6 @@
 #include <string.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/port_platform.h>
 #include <grpc/support/string_util.h>
 
@@ -32,6 +31,7 @@
 #include "src/core/ext/filters/client_channel/parse_address.h"
 #include "src/core/ext/filters/client_channel/resolver_registry.h"
 #include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/iomgr/closure.h"
 #include "src/core/lib/iomgr/combiner.h"
@@ -42,190 +42,177 @@
 
 #include "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h"
 
-//
-// fake_resolver
-//
+namespace grpc_core {
 
-typedef struct {
-  // Base class -- must be first
-  grpc_resolver base;
+// This cannot be in an anonymous namespace, because it is a friend of
+// FakeResolverResponseGenerator.
+class FakeResolver : public Resolver {
+ public:
+  explicit FakeResolver(const ResolverArgs& args);
 
-  // Passed-in parameters
-  grpc_channel_args* channel_args;
+  void NextLocked(grpc_channel_args** result,
+                  grpc_closure* on_complete) override;
 
+  void RequestReresolutionLocked() override;
+
+ private:
+  friend class FakeResolverResponseGenerator;
+
+  virtual ~FakeResolver();
+
+  void MaybeFinishNextLocked();
+
+  void ShutdownLocked() override;
+
+  // passed-in parameters
+  grpc_channel_args* channel_args_ = nullptr;
   // If not NULL, the next set of resolution results to be returned to
-  // grpc_resolver_next_locked()'s closure.
-  grpc_channel_args* next_results;
-
+  // NextLocked()'s closure.
+  grpc_channel_args* next_results_ = nullptr;
   // Results to use for the pretended re-resolution in
-  // fake_resolver_channel_saw_error_locked().
-  grpc_channel_args* results_upon_error;
-
+  // RequestReresolutionLocked().
+  grpc_channel_args* reresolution_results_ = nullptr;
   // TODO(juanlishen): This can go away once pick_first is changed to not throw
   // away its subchannels, since that will eliminate its dependence on
   // channel_saw_error_locked() causing an immediate resolver return.
   // A copy of the most-recently used resolution results.
-  grpc_channel_args* last_used_results;
-
-  // Pending next completion, or NULL
-  grpc_closure* next_completion;
-
-  // Target result address for next completion
-  grpc_channel_args** target_result;
-} fake_resolver;
-
-static void fake_resolver_destroy(grpc_resolver* gr) {
-  fake_resolver* r = (fake_resolver*)gr;
-  grpc_channel_args_destroy(r->next_results);
-  grpc_channel_args_destroy(r->results_upon_error);
-  grpc_channel_args_destroy(r->last_used_results);
-  grpc_channel_args_destroy(r->channel_args);
-  gpr_free(r);
-}
-
-static void fake_resolver_shutdown_locked(grpc_resolver* resolver) {
-  fake_resolver* r = (fake_resolver*)resolver;
-  if (r->next_completion != nullptr) {
-    *r->target_result = nullptr;
-    GRPC_CLOSURE_SCHED(r->next_completion, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
-                                               "Resolver Shutdown"));
-    r->next_completion = nullptr;
-  }
-}
-
-static void fake_resolver_maybe_finish_next_locked(fake_resolver* r) {
-  if (r->next_completion != nullptr && r->next_results != nullptr) {
-    *r->target_result =
-        grpc_channel_args_union(r->next_results, r->channel_args);
-    grpc_channel_args_destroy(r->next_results);
-    r->next_results = nullptr;
-    GRPC_CLOSURE_SCHED(r->next_completion, GRPC_ERROR_NONE);
-    r->next_completion = nullptr;
-  }
-}
-
-static void fake_resolver_channel_saw_error_locked(grpc_resolver* resolver) {
-  fake_resolver* r = (fake_resolver*)resolver;
-  // A resolution must have been returned before an error is seen.
-  GPR_ASSERT(r->last_used_results != nullptr);
-  grpc_channel_args_destroy(r->next_results);
-  if (r->results_upon_error != nullptr) {
-    r->next_results = grpc_channel_args_copy(r->results_upon_error);
-  } else {
-    // If results_upon_error is unavailable, re-resolve with the most-recently
-    // used results to avoid a no-op re-resolution.
-    r->next_results = grpc_channel_args_copy(r->last_used_results);
-  }
-  fake_resolver_maybe_finish_next_locked(r);
-}
-
-static void fake_resolver_next_locked(grpc_resolver* resolver,
-                                      grpc_channel_args** target_result,
-                                      grpc_closure* on_complete) {
-  fake_resolver* r = (fake_resolver*)resolver;
-  GPR_ASSERT(!r->next_completion);
-  r->next_completion = on_complete;
-  r->target_result = target_result;
-  fake_resolver_maybe_finish_next_locked(r);
-}
-
-static const grpc_resolver_vtable fake_resolver_vtable = {
-    fake_resolver_destroy, fake_resolver_shutdown_locked,
-    fake_resolver_channel_saw_error_locked, fake_resolver_next_locked};
-
-struct grpc_fake_resolver_response_generator {
-  fake_resolver* resolver;  // Set by the fake_resolver constructor to itself.
-  gpr_refcount refcount;
+  grpc_channel_args* last_used_results_ = nullptr;
+  // pending next completion, or NULL
+  grpc_closure* next_completion_ = nullptr;
+  // target result address for next completion
+  grpc_channel_args** target_result_ = nullptr;
 };
 
-grpc_fake_resolver_response_generator*
-grpc_fake_resolver_response_generator_create() {
-  grpc_fake_resolver_response_generator* generator =
-      (grpc_fake_resolver_response_generator*)gpr_zalloc(sizeof(*generator));
-  gpr_ref_init(&generator->refcount, 1);
-  return generator;
+FakeResolver::FakeResolver(const ResolverArgs& args) : Resolver(args.combiner) {
+  channel_args_ = grpc_channel_args_copy(args.args);
+  FakeResolverResponseGenerator* response_generator =
+      FakeResolverResponseGenerator::GetFromArgs(args.args);
+  if (response_generator != nullptr) response_generator->resolver_ = this;
 }
 
-grpc_fake_resolver_response_generator*
-grpc_fake_resolver_response_generator_ref(
-    grpc_fake_resolver_response_generator* generator) {
-  gpr_ref(&generator->refcount);
-  return generator;
+FakeResolver::~FakeResolver() {
+  grpc_channel_args_destroy(next_results_);
+  grpc_channel_args_destroy(reresolution_results_);
+  grpc_channel_args_destroy(last_used_results_);
+  grpc_channel_args_destroy(channel_args_);
 }
 
-void grpc_fake_resolver_response_generator_unref(
-    grpc_fake_resolver_response_generator* generator) {
-  if (gpr_unref(&generator->refcount)) {
-    gpr_free(generator);
-  }
+void FakeResolver::NextLocked(grpc_channel_args** target_result,
+                              grpc_closure* on_complete) {
+  GPR_ASSERT(next_completion_ == nullptr);
+  next_completion_ = on_complete;
+  target_result_ = target_result;
+  MaybeFinishNextLocked();
 }
 
-typedef struct set_response_closure_arg {
-  grpc_closure set_response_closure;
-  grpc_fake_resolver_response_generator* generator;
-  grpc_channel_args* response;
-  bool upon_error;
-} set_response_closure_arg;
-
-static void set_response_closure_locked(void* arg, grpc_error* error) {
-  set_response_closure_arg* closure_arg = (set_response_closure_arg*)arg;
-  grpc_fake_resolver_response_generator* generator = closure_arg->generator;
-  fake_resolver* r = generator->resolver;
-  if (!closure_arg->upon_error) {
-    grpc_channel_args_destroy(r->next_results);
-    r->next_results = closure_arg->response;
-    grpc_channel_args_destroy(r->last_used_results);
-    r->last_used_results = grpc_channel_args_copy(closure_arg->response);
-    fake_resolver_maybe_finish_next_locked(r);
+void FakeResolver::RequestReresolutionLocked() {
+  // A resolution must have been returned before an error is seen.
+  GPR_ASSERT(last_used_results_ != nullptr);
+  grpc_channel_args_destroy(next_results_);
+  if (reresolution_results_ != nullptr) {
+    next_results_ = grpc_channel_args_copy(reresolution_results_);
   } else {
-    grpc_channel_args_destroy(r->results_upon_error);
-    r->results_upon_error = closure_arg->response;
+    // If reresolution_results is unavailable, re-resolve with the most-recently
+    // used results to avoid a no-op re-resolution.
+    next_results_ = grpc_channel_args_copy(last_used_results_);
   }
-  gpr_free(closure_arg);
+  MaybeFinishNextLocked();
 }
 
-void grpc_fake_resolver_response_generator_set_response(
-    grpc_fake_resolver_response_generator* generator,
-    grpc_channel_args* response) {
-  GPR_ASSERT(generator->resolver != nullptr);
+void FakeResolver::MaybeFinishNextLocked() {
+  if (next_completion_ != nullptr && next_results_ != nullptr) {
+    *target_result_ = grpc_channel_args_union(next_results_, channel_args_);
+    grpc_channel_args_destroy(next_results_);
+    next_results_ = nullptr;
+    GRPC_CLOSURE_SCHED(next_completion_, GRPC_ERROR_NONE);
+    next_completion_ = nullptr;
+  }
+}
+
+void FakeResolver::ShutdownLocked() {
+  if (next_completion_ != nullptr) {
+    *target_result_ = nullptr;
+    GRPC_CLOSURE_SCHED(next_completion_, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
+                                             "Resolver Shutdown"));
+    next_completion_ = nullptr;
+  }
+}
+
+//
+// FakeResolverResponseGenerator
+//
+
+struct SetResponseClosureArg {
+  grpc_closure set_response_closure;
+  FakeResolverResponseGenerator* generator;
+  grpc_channel_args* response;
+};
+
+void FakeResolverResponseGenerator::SetResponseLocked(void* arg,
+                                                      grpc_error* error) {
+  SetResponseClosureArg* closure_arg = static_cast<SetResponseClosureArg*>(arg);
+  FakeResolver* resolver = closure_arg->generator->resolver_;
+  grpc_channel_args_destroy(resolver->next_results_);
+  resolver->next_results_ = closure_arg->response;
+  grpc_channel_args_destroy(resolver->last_used_results_);
+  resolver->last_used_results_ = grpc_channel_args_copy(closure_arg->response);
+  resolver->MaybeFinishNextLocked();
+  Delete(closure_arg);
+}
+
+void FakeResolverResponseGenerator::SetResponse(grpc_channel_args* response) {
   GPR_ASSERT(response != nullptr);
-  set_response_closure_arg* closure_arg =
-      (set_response_closure_arg*)gpr_zalloc(sizeof(*closure_arg));
-  closure_arg->generator = generator;
+  GPR_ASSERT(resolver_ != nullptr);
+  SetResponseClosureArg* closure_arg = New<SetResponseClosureArg>();
+  closure_arg->generator = this;
   closure_arg->response = grpc_channel_args_copy(response);
-  closure_arg->upon_error = false;
-  GRPC_CLOSURE_SCHED(GRPC_CLOSURE_INIT(&closure_arg->set_response_closure,
-                                       set_response_closure_locked, closure_arg,
-                                       grpc_combiner_scheduler(
-                                           generator->resolver->base.combiner)),
-                     GRPC_ERROR_NONE);
+  GRPC_CLOSURE_SCHED(
+      GRPC_CLOSURE_INIT(&closure_arg->set_response_closure, SetResponseLocked,
+                        closure_arg,
+                        grpc_combiner_scheduler(resolver_->combiner())),
+      GRPC_ERROR_NONE);
 }
 
-void grpc_fake_resolver_response_generator_set_response_upon_error(
-    grpc_fake_resolver_response_generator* generator,
+void FakeResolverResponseGenerator::SetReresolutionResponseLocked(
+    void* arg, grpc_error* error) {
+  SetResponseClosureArg* closure_arg = static_cast<SetResponseClosureArg*>(arg);
+  FakeResolver* resolver = closure_arg->generator->resolver_;
+  grpc_channel_args_destroy(resolver->reresolution_results_);
+  resolver->reresolution_results_ = closure_arg->response;
+  Delete(closure_arg);
+}
+
+void FakeResolverResponseGenerator::SetReresolutionResponse(
     grpc_channel_args* response) {
-  GPR_ASSERT(generator->resolver != nullptr);
-  set_response_closure_arg* closure_arg =
-      (set_response_closure_arg*)gpr_zalloc(sizeof(*closure_arg));
-  closure_arg->generator = generator;
+  GPR_ASSERT(resolver_ != nullptr);
+  SetResponseClosureArg* closure_arg = New<SetResponseClosureArg>();
+  closure_arg->generator = this;
   closure_arg->response =
       response != nullptr ? grpc_channel_args_copy(response) : nullptr;
-  closure_arg->upon_error = true;
-  GRPC_CLOSURE_SCHED(GRPC_CLOSURE_INIT(&closure_arg->set_response_closure,
-                                       set_response_closure_locked, closure_arg,
-                                       grpc_combiner_scheduler(
-                                           generator->resolver->base.combiner)),
-                     GRPC_ERROR_NONE);
+  GRPC_CLOSURE_SCHED(
+      GRPC_CLOSURE_INIT(&closure_arg->set_response_closure,
+                        SetReresolutionResponseLocked, closure_arg,
+                        grpc_combiner_scheduler(resolver_->combiner())),
+      GRPC_ERROR_NONE);
 }
 
+namespace {
+
 static void* response_generator_arg_copy(void* p) {
-  return grpc_fake_resolver_response_generator_ref(
-      (grpc_fake_resolver_response_generator*)p);
+  FakeResolverResponseGenerator* generator =
+      static_cast<FakeResolverResponseGenerator*>(p);
+  // TODO(roth): We currently deal with this ref manually.  Once the
+  // new channel args code is converted to C++, find a way to track this ref
+  // in a cleaner way.
+  RefCountedPtr<FakeResolverResponseGenerator> copy = generator->Ref();
+  copy.release();
+  return p;
 }
 
 static void response_generator_arg_destroy(void* p) {
-  grpc_fake_resolver_response_generator_unref(
-      (grpc_fake_resolver_response_generator*)p);
+  FakeResolverResponseGenerator* generator =
+      static_cast<FakeResolverResponseGenerator*>(p);
+  generator->Unref();
 }
 
 static int response_generator_cmp(void* a, void* b) { return GPR_ICMP(a, b); }
@@ -234,8 +221,10 @@
     response_generator_arg_copy, response_generator_arg_destroy,
     response_generator_cmp};
 
-grpc_arg grpc_fake_resolver_response_generator_arg(
-    grpc_fake_resolver_response_generator* generator) {
+}  // namespace
+
+grpc_arg FakeResolverResponseGenerator::MakeChannelArg(
+    FakeResolverResponseGenerator* generator) {
   grpc_arg arg;
   arg.type = GRPC_ARG_POINTER;
   arg.key = (char*)GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR;
@@ -244,49 +233,38 @@
   return arg;
 }
 
-grpc_fake_resolver_response_generator*
-grpc_fake_resolver_get_response_generator(const grpc_channel_args* args) {
+FakeResolverResponseGenerator* FakeResolverResponseGenerator::GetFromArgs(
+    const grpc_channel_args* args) {
   const grpc_arg* arg =
       grpc_channel_args_find(args, GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR);
   if (arg == nullptr || arg->type != GRPC_ARG_POINTER) return nullptr;
-  return (grpc_fake_resolver_response_generator*)arg->value.pointer.p;
+  return static_cast<FakeResolverResponseGenerator*>(arg->value.pointer.p);
 }
 
 //
-// fake_resolver_factory
+// Factory
 //
 
-static void fake_resolver_factory_ref(grpc_resolver_factory* factory) {}
+namespace {
 
-static void fake_resolver_factory_unref(grpc_resolver_factory* factory) {}
+class FakeResolverFactory : public ResolverFactory {
+ public:
+  OrphanablePtr<Resolver> CreateResolver(
+      const ResolverArgs& args) const override {
+    return OrphanablePtr<Resolver>(New<FakeResolver>(args));
+  }
 
-static grpc_resolver* fake_resolver_create(grpc_resolver_factory* factory,
-                                           grpc_resolver_args* args) {
-  fake_resolver* r = (fake_resolver*)gpr_zalloc(sizeof(*r));
-  r->channel_args = grpc_channel_args_copy(args->args);
-  grpc_resolver_init(&r->base, &fake_resolver_vtable, args->combiner);
-  grpc_fake_resolver_response_generator* response_generator =
-      grpc_fake_resolver_get_response_generator(args->args);
-  if (response_generator != nullptr) response_generator->resolver = r;
-  return &r->base;
+  const char* scheme() const override { return "fake"; }
+};
+
+}  // namespace
+
+}  // namespace grpc_core
+
+void grpc_resolver_fake_init() {
+  grpc_core::ResolverRegistry::Builder::RegisterResolverFactory(
+      grpc_core::UniquePtr<grpc_core::ResolverFactory>(
+          grpc_core::New<grpc_core::FakeResolverFactory>()));
 }
 
-static char* fake_resolver_get_default_authority(grpc_resolver_factory* factory,
-                                                 grpc_uri* uri) {
-  const char* path = uri->path;
-  if (path[0] == '/') ++path;
-  return gpr_strdup(path);
-}
-
-static const grpc_resolver_factory_vtable fake_resolver_factory_vtable = {
-    fake_resolver_factory_ref, fake_resolver_factory_unref,
-    fake_resolver_create, fake_resolver_get_default_authority, "fake"};
-
-static grpc_resolver_factory fake_resolver_factory = {
-    &fake_resolver_factory_vtable};
-
-void grpc_resolver_fake_init(void) {
-  grpc_register_resolver_type(&fake_resolver_factory);
-}
-
-void grpc_resolver_fake_shutdown(void) {}
+void grpc_resolver_fake_shutdown() {}
diff --git a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h
index 94f9a8e..d42811d 100644
--- a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h
+++ b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h
@@ -20,50 +20,57 @@
 #include "src/core/ext/filters/client_channel/lb_policy_factory.h"
 #include "src/core/ext/filters/client_channel/uri_parser.h"
 #include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gprpp/ref_counted.h"
 
 #define GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR \
   "grpc.fake_resolver.response_generator"
 
-void grpc_resolver_fake_init();
+namespace grpc_core {
 
-// Instances of \a grpc_fake_resolver_response_generator are passed to the
-// fake resolver in a channel argument (see \a
-// grpc_fake_resolver_response_generator_arg) in order to inject and trigger
-// custom resolutions. See also \a
-// grpc_fake_resolver_response_generator_set_response.
-typedef struct grpc_fake_resolver_response_generator
-    grpc_fake_resolver_response_generator;
-grpc_fake_resolver_response_generator*
-grpc_fake_resolver_response_generator_create();
+class FakeResolver;
 
-// Set next response of the fake resolver associated with the \a
-// response_generator instance and trigger a new resolution.
-void grpc_fake_resolver_response_generator_set_response(
-    grpc_fake_resolver_response_generator* generator,
-    grpc_channel_args* response);
+/// A mechanism for generating responses for the fake resolver.
+/// An instance of this class is passed to the fake resolver via a channel
+/// argument (see \a MakeChannelArg()) and used to inject and trigger custom
+/// resolutions.
+// TODO(roth): I would ideally like this to be InternallyRefCounted
+// instead of RefCounted, but external refs are currently needed to
+// encode this in channel args.  Once channel_args are converted to C++,
+// see if we can find a way to fix this.
+class FakeResolverResponseGenerator
+    : public RefCounted<FakeResolverResponseGenerator> {
+ public:
+  FakeResolverResponseGenerator() {}
 
-// Set results_upon_error of the fake resolver associated with the \a
-// response_generator instance. When fake_resolver_channel_saw_error_locked() is
-// called, results_upon_error will be returned as long as it's non-NULL,
-// otherwise the last value set by
-// grpc_fake_resolver_response_generator_set_response() will be returned.
-void grpc_fake_resolver_response_generator_set_response_upon_error(
-    grpc_fake_resolver_response_generator* generator,
-    grpc_channel_args* response);
+  // Instructs the fake resolver associated with the response generator
+  // instance to trigger a new resolution with the specified response.
+  void SetResponse(grpc_channel_args* next_response);
 
-// Return a \a grpc_arg for a \a grpc_fake_resolver_response_generator instance.
-grpc_arg grpc_fake_resolver_response_generator_arg(
-    grpc_fake_resolver_response_generator* generator);
-// Return the \a grpc_fake_resolver_response_generator instance in \a args or
-// NULL.
-grpc_fake_resolver_response_generator*
-grpc_fake_resolver_get_response_generator(const grpc_channel_args* args);
+  // Sets the re-resolution response, which is returned by the fake resolver
+  // when re-resolution is requested (via \a RequestReresolutionLocked()).
+  // The new re-resolution response replaces any previous re-resolution
+  // response that may have been set by a previous call.
+  // If the re-resolution response is set to NULL, then the fake
+  // resolver will return the last value set via \a SetResponse().
+  void SetReresolutionResponse(grpc_channel_args* response);
 
-grpc_fake_resolver_response_generator*
-grpc_fake_resolver_response_generator_ref(
-    grpc_fake_resolver_response_generator* generator);
-void grpc_fake_resolver_response_generator_unref(
-    grpc_fake_resolver_response_generator* generator);
+  // Returns a channel arg containing \a generator.
+  static grpc_arg MakeChannelArg(FakeResolverResponseGenerator* generator);
+
+  // Returns the response generator in \a args, or null if not found.
+  static FakeResolverResponseGenerator* GetFromArgs(
+      const grpc_channel_args* args);
+
+ private:
+  friend class FakeResolver;
+
+  static void SetResponseLocked(void* arg, grpc_error* error);
+  static void SetReresolutionResponseLocked(void* arg, grpc_error* error);
+
+  FakeResolver* resolver_ = nullptr;  // Do not own.
+};
+
+}  // namespace grpc_core
 
 #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_FAKE_FAKE_RESOLVER_H \
         */
diff --git a/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc b/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc
index 99ad78e..966b9fd 100644
--- a/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc
+++ b/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc
@@ -22,7 +22,6 @@
 #include <string.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/port_platform.h>
 #include <grpc/support/string_util.h>
 
@@ -30,6 +29,7 @@
 #include "src/core/ext/filters/client_channel/parse_address.h"
 #include "src/core/ext/filters/client_channel/resolver_registry.h"
 #include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/iomgr/combiner.h"
 #include "src/core/lib/iomgr/resolve_address.h"
@@ -37,115 +37,99 @@
 #include "src/core/lib/slice/slice_internal.h"
 #include "src/core/lib/slice/slice_string_helpers.h"
 
-typedef struct {
-  /** base class: must be first */
-  grpc_resolver base;
-  /** the addresses that we've 'resolved' */
-  grpc_lb_addresses* addresses;
-  /** channel args */
-  grpc_channel_args* channel_args;
-  /** have we published? */
-  bool published;
-  /** pending next completion, or NULL */
-  grpc_closure* next_completion;
-  /** target result address for next completion */
-  grpc_channel_args** target_result;
-} sockaddr_resolver;
+namespace grpc_core {
 
-static void sockaddr_destroy(grpc_resolver* r);
+namespace {
 
-static void sockaddr_maybe_finish_next_locked(sockaddr_resolver* r);
+class SockaddrResolver : public Resolver {
+ public:
+  /// Takes ownership of \a addresses.
+  SockaddrResolver(const ResolverArgs& args, grpc_lb_addresses* addresses);
 
-static void sockaddr_shutdown_locked(grpc_resolver* r);
-static void sockaddr_channel_saw_error_locked(grpc_resolver* r);
-static void sockaddr_next_locked(grpc_resolver* r,
-                                 grpc_channel_args** target_result,
-                                 grpc_closure* on_complete);
+  void NextLocked(grpc_channel_args** result,
+                  grpc_closure* on_complete) override;
 
-static const grpc_resolver_vtable sockaddr_resolver_vtable = {
-    sockaddr_destroy, sockaddr_shutdown_locked,
-    sockaddr_channel_saw_error_locked, sockaddr_next_locked};
+  void RequestReresolutionLocked() override;
 
-static void sockaddr_shutdown_locked(grpc_resolver* resolver) {
-  sockaddr_resolver* r = (sockaddr_resolver*)resolver;
-  if (r->next_completion != nullptr) {
-    *r->target_result = nullptr;
-    GRPC_CLOSURE_SCHED(r->next_completion, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
-                                               "Resolver Shutdown"));
-    r->next_completion = nullptr;
+  void ShutdownLocked() override;
+
+ private:
+  virtual ~SockaddrResolver();
+
+  void MaybeFinishNextLocked();
+
+  /// the addresses that we've "resolved"
+  grpc_lb_addresses* addresses_ = nullptr;
+  /// channel args
+  grpc_channel_args* channel_args_ = nullptr;
+  /// have we published?
+  bool published_ = false;
+  /// pending next completion, or NULL
+  grpc_closure* next_completion_ = nullptr;
+  /// target result address for next completion
+  grpc_channel_args** target_result_ = nullptr;
+};
+
+SockaddrResolver::SockaddrResolver(const ResolverArgs& args,
+                                   grpc_lb_addresses* addresses)
+    : Resolver(args.combiner),
+      addresses_(addresses),
+      channel_args_(grpc_channel_args_copy(args.args)) {}
+
+SockaddrResolver::~SockaddrResolver() {
+  grpc_lb_addresses_destroy(addresses_);
+  grpc_channel_args_destroy(channel_args_);
+}
+
+void SockaddrResolver::NextLocked(grpc_channel_args** target_result,
+                                  grpc_closure* on_complete) {
+  GPR_ASSERT(!next_completion_);
+  next_completion_ = on_complete;
+  target_result_ = target_result;
+  MaybeFinishNextLocked();
+}
+
+void SockaddrResolver::RequestReresolutionLocked() {
+  published_ = false;
+  MaybeFinishNextLocked();
+}
+
+void SockaddrResolver::ShutdownLocked() {
+  if (next_completion_ != nullptr) {
+    *target_result_ = nullptr;
+    GRPC_CLOSURE_SCHED(next_completion_, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
+                                             "Resolver Shutdown"));
+    next_completion_ = nullptr;
   }
 }
 
-static void sockaddr_channel_saw_error_locked(grpc_resolver* resolver) {
-  sockaddr_resolver* r = (sockaddr_resolver*)resolver;
-  r->published = false;
-  sockaddr_maybe_finish_next_locked(r);
-}
-
-static void sockaddr_next_locked(grpc_resolver* resolver,
-                                 grpc_channel_args** target_result,
-                                 grpc_closure* on_complete) {
-  sockaddr_resolver* r = (sockaddr_resolver*)resolver;
-  GPR_ASSERT(!r->next_completion);
-  r->next_completion = on_complete;
-  r->target_result = target_result;
-  sockaddr_maybe_finish_next_locked(r);
-}
-
-static void sockaddr_maybe_finish_next_locked(sockaddr_resolver* r) {
-  if (r->next_completion != nullptr && !r->published) {
-    r->published = true;
-    grpc_arg arg = grpc_lb_addresses_create_channel_arg(r->addresses);
-    *r->target_result =
-        grpc_channel_args_copy_and_add(r->channel_args, &arg, 1);
-    GRPC_CLOSURE_SCHED(r->next_completion, GRPC_ERROR_NONE);
-    r->next_completion = nullptr;
+void SockaddrResolver::MaybeFinishNextLocked() {
+  if (next_completion_ != nullptr && !published_) {
+    published_ = true;
+    grpc_arg arg = grpc_lb_addresses_create_channel_arg(addresses_);
+    *target_result_ = grpc_channel_args_copy_and_add(channel_args_, &arg, 1);
+    GRPC_CLOSURE_SCHED(next_completion_, GRPC_ERROR_NONE);
+    next_completion_ = nullptr;
   }
 }
 
-static void sockaddr_destroy(grpc_resolver* gr) {
-  sockaddr_resolver* r = (sockaddr_resolver*)gr;
-  grpc_lb_addresses_destroy(r->addresses);
-  grpc_channel_args_destroy(r->channel_args);
-  gpr_free(r);
-}
+//
+// Factory
+//
 
-static char* ip_get_default_authority(grpc_uri* uri) {
-  const char* path = uri->path;
-  if (path[0] == '/') ++path;
-  return gpr_strdup(path);
-}
+void DoNothing(void* ignored) {}
 
-static char* ipv4_get_default_authority(grpc_resolver_factory* factory,
-                                        grpc_uri* uri) {
-  return ip_get_default_authority(uri);
-}
-
-static char* ipv6_get_default_authority(grpc_resolver_factory* factory,
-                                        grpc_uri* uri) {
-  return ip_get_default_authority(uri);
-}
-
-#ifdef GRPC_HAVE_UNIX_SOCKET
-char* unix_get_default_authority(grpc_resolver_factory* factory,
-                                 grpc_uri* uri) {
-  return gpr_strdup("localhost");
-}
-#endif
-
-static void do_nothing(void* ignored) {}
-
-static grpc_resolver* sockaddr_create(grpc_resolver_args* args,
-                                      bool parse(const grpc_uri* uri,
-                                                 grpc_resolved_address* dst)) {
-  if (0 != strcmp(args->uri->authority, "")) {
-    gpr_log(GPR_ERROR, "authority based uri's not supported by the %s scheme",
-            args->uri->scheme);
-    return nullptr;
+OrphanablePtr<Resolver> CreateSockaddrResolver(
+    const ResolverArgs& args,
+    bool parse(const grpc_uri* uri, grpc_resolved_address* dst)) {
+  if (0 != strcmp(args.uri->authority, "")) {
+    gpr_log(GPR_ERROR, "authority-based URIs not supported by the %s scheme",
+            args.uri->scheme);
+    return OrphanablePtr<Resolver>(nullptr);
   }
-  /* Construct addresses. */
+  // Construct addresses.
   grpc_slice path_slice =
-      grpc_slice_new(args->uri->path, strlen(args->uri->path), do_nothing);
+      grpc_slice_new(args.uri->path, strlen(args.uri->path), DoNothing);
   grpc_slice_buffer path_parts;
   grpc_slice_buffer_init(&path_parts);
   grpc_slice_split(path_slice, ",", &path_parts);
@@ -153,7 +137,7 @@
       path_parts.count, nullptr /* user_data_vtable */);
   bool errors_found = false;
   for (size_t i = 0; i < addresses->num_addresses; i++) {
-    grpc_uri ith_uri = *args->uri;
+    grpc_uri ith_uri = *args.uri;
     char* part_str = grpc_slice_to_c_string(path_parts.slices[i]);
     ith_uri.path = part_str;
     if (!parse(&ith_uri, &addresses->addresses[i].address)) {
@@ -166,48 +150,64 @@
   grpc_slice_unref_internal(path_slice);
   if (errors_found) {
     grpc_lb_addresses_destroy(addresses);
-    return nullptr;
+    return OrphanablePtr<Resolver>(nullptr);
   }
-  /* Instantiate resolver. */
-  sockaddr_resolver* r =
-      (sockaddr_resolver*)gpr_zalloc(sizeof(sockaddr_resolver));
-  r->addresses = addresses;
-  r->channel_args = grpc_channel_args_copy(args->args);
-  grpc_resolver_init(&r->base, &sockaddr_resolver_vtable, args->combiner);
-  return &r->base;
+  // Instantiate resolver.
+  return OrphanablePtr<Resolver>(New<SockaddrResolver>(args, addresses));
 }
 
-/*
- * FACTORY
- */
+class IPv4ResolverFactory : public ResolverFactory {
+ public:
+  OrphanablePtr<Resolver> CreateResolver(
+      const ResolverArgs& args) const override {
+    return CreateSockaddrResolver(args, grpc_parse_ipv4);
+  }
 
-static void sockaddr_factory_ref(grpc_resolver_factory* factory) {}
+  const char* scheme() const override { return "ipv4"; }
+};
 
-static void sockaddr_factory_unref(grpc_resolver_factory* factory) {}
+class IPv6ResolverFactory : public ResolverFactory {
+ public:
+  OrphanablePtr<Resolver> CreateResolver(
+      const ResolverArgs& args) const override {
+    return CreateSockaddrResolver(args, grpc_parse_ipv6);
+  }
 
-#define DECL_FACTORY(name)                                                  \
-  static grpc_resolver* name##_factory_create_resolver(                     \
-      grpc_resolver_factory* factory, grpc_resolver_args* args) {           \
-    return sockaddr_create(args, grpc_parse_##name);                        \
-  }                                                                         \
-  static const grpc_resolver_factory_vtable name##_factory_vtable = {       \
-      sockaddr_factory_ref, sockaddr_factory_unref,                         \
-      name##_factory_create_resolver, name##_get_default_authority, #name}; \
-  static grpc_resolver_factory name##_resolver_factory = {                  \
-      &name##_factory_vtable}
+  const char* scheme() const override { return "ipv6"; }
+};
 
 #ifdef GRPC_HAVE_UNIX_SOCKET
-DECL_FACTORY(unix);
-#endif
-DECL_FACTORY(ipv4);
-DECL_FACTORY(ipv6);
+class UnixResolverFactory : public ResolverFactory {
+ public:
+  OrphanablePtr<Resolver> CreateResolver(
+      const ResolverArgs& args) const override {
+    return CreateSockaddrResolver(args, grpc_parse_unix);
+  }
 
-void grpc_resolver_sockaddr_init(void) {
-  grpc_register_resolver_type(&ipv4_resolver_factory);
-  grpc_register_resolver_type(&ipv6_resolver_factory);
+  UniquePtr<char> GetDefaultAuthority(grpc_uri* uri) const override {
+    return UniquePtr<char>(gpr_strdup("localhost"));
+  }
+
+  const char* scheme() const override { return "unix"; }
+};
+#endif  // GRPC_HAVE_UNIX_SOCKET
+
+}  // namespace
+
+}  // namespace grpc_core
+
+void grpc_resolver_sockaddr_init() {
+  grpc_core::ResolverRegistry::Builder::RegisterResolverFactory(
+      grpc_core::UniquePtr<grpc_core::ResolverFactory>(
+          grpc_core::New<grpc_core::IPv4ResolverFactory>()));
+  grpc_core::ResolverRegistry::Builder::RegisterResolverFactory(
+      grpc_core::UniquePtr<grpc_core::ResolverFactory>(
+          grpc_core::New<grpc_core::IPv6ResolverFactory>()));
 #ifdef GRPC_HAVE_UNIX_SOCKET
-  grpc_register_resolver_type(&unix_resolver_factory);
+  grpc_core::ResolverRegistry::Builder::RegisterResolverFactory(
+      grpc_core::UniquePtr<grpc_core::ResolverFactory>(
+          grpc_core::New<grpc_core::UnixResolverFactory>()));
 #endif
 }
 
-void grpc_resolver_sockaddr_shutdown(void) {}
+void grpc_resolver_sockaddr_shutdown() {}
diff --git a/src/core/ext/filters/client_channel/resolver_factory.cc b/src/core/ext/filters/client_channel/resolver_factory.cc
deleted file mode 100644
index 9b3ec2f..0000000
--- a/src/core/ext/filters/client_channel/resolver_factory.cc
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *
- * Copyright 2015 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "src/core/ext/filters/client_channel/resolver_factory.h"
-
-void grpc_resolver_factory_ref(grpc_resolver_factory* factory) {
-  factory->vtable->ref(factory);
-}
-
-void grpc_resolver_factory_unref(grpc_resolver_factory* factory) {
-  factory->vtable->unref(factory);
-}
-
-/** Create a resolver instance for a name */
-grpc_resolver* grpc_resolver_factory_create_resolver(
-    grpc_resolver_factory* factory, grpc_resolver_args* args) {
-  if (factory == nullptr) return nullptr;
-  return factory->vtable->create_resolver(factory, args);
-}
-
-char* grpc_resolver_factory_get_default_authority(
-    grpc_resolver_factory* factory, grpc_uri* uri) {
-  if (factory == nullptr) return nullptr;
-  return factory->vtable->get_default_authority(factory, uri);
-}
diff --git a/src/core/ext/filters/client_channel/resolver_factory.h b/src/core/ext/filters/client_channel/resolver_factory.h
index 170ecc0..f9b9501 100644
--- a/src/core/ext/filters/client_channel/resolver_factory.h
+++ b/src/core/ext/filters/client_channel/resolver_factory.h
@@ -19,50 +19,51 @@
 #ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_FACTORY_H
 #define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_FACTORY_H
 
-#include "src/core/ext/filters/client_channel/client_channel_factory.h"
+#include <grpc/support/string_util.h>
+
 #include "src/core/ext/filters/client_channel/resolver.h"
 #include "src/core/ext/filters/client_channel/uri_parser.h"
+#include "src/core/lib/gprpp/abstract.h"
+#include "src/core/lib/gprpp/memory.h"
+#include "src/core/lib/gprpp/orphanable.h"
 #include "src/core/lib/iomgr/pollset_set.h"
 
-typedef struct grpc_resolver_factory grpc_resolver_factory;
-typedef struct grpc_resolver_factory_vtable grpc_resolver_factory_vtable;
+namespace grpc_core {
 
-struct grpc_resolver_factory {
-  const grpc_resolver_factory_vtable* vtable;
+struct ResolverArgs {
+  /// The parsed URI to resolve.
+  grpc_uri* uri = nullptr;
+  /// Channel args to be included in resolver results.
+  const grpc_channel_args* args = nullptr;
+  /// Used to drive I/O in the name resolution process.
+  grpc_pollset_set* pollset_set = nullptr;
+  /// The combiner under which all resolver calls will be run.
+  grpc_combiner* combiner = nullptr;
 };
 
-typedef struct grpc_resolver_args {
-  grpc_uri* uri;
-  const grpc_channel_args* args;
-  grpc_pollset_set* pollset_set;
-  grpc_combiner* combiner;
-} grpc_resolver_args;
+class ResolverFactory {
+ public:
+  /// Returns a new resolver instance.
+  virtual OrphanablePtr<Resolver> CreateResolver(const ResolverArgs& args) const
+      GRPC_ABSTRACT;
 
-struct grpc_resolver_factory_vtable {
-  void (*ref)(grpc_resolver_factory* factory);
-  void (*unref)(grpc_resolver_factory* factory);
+  /// Returns a string representing the default authority to use for this
+  /// scheme.
+  virtual UniquePtr<char> GetDefaultAuthority(grpc_uri* uri) const {
+    const char* path = uri->path;
+    if (path[0] == '/') ++path;
+    return UniquePtr<char>(gpr_strdup(path));
+  }
 
-  /** Implementation of grpc_resolver_factory_create_resolver */
-  grpc_resolver* (*create_resolver)(grpc_resolver_factory* factory,
-                                    grpc_resolver_args* args);
+  /// Returns the URI scheme that this factory implements.
+  /// Caller does NOT take ownership of result.
+  virtual const char* scheme() const GRPC_ABSTRACT;
 
-  /** Implementation of grpc_resolver_factory_get_default_authority */
-  char* (*get_default_authority)(grpc_resolver_factory* factory, grpc_uri* uri);
+  virtual ~ResolverFactory() {}
 
-  /** URI scheme that this factory implements */
-  const char* scheme;
+  GRPC_ABSTRACT_BASE_CLASS
 };
 
-void grpc_resolver_factory_ref(grpc_resolver_factory* resolver);
-void grpc_resolver_factory_unref(grpc_resolver_factory* resolver);
-
-/** Create a resolver instance for a name */
-grpc_resolver* grpc_resolver_factory_create_resolver(
-    grpc_resolver_factory* factory, grpc_resolver_args* args);
-
-/** Return a (freshly allocated with gpr_malloc) string representing
-    the default authority to use for this scheme. */
-char* grpc_resolver_factory_get_default_authority(
-    grpc_resolver_factory* factory, grpc_uri* uri);
+}  // namespace grpc_core
 
 #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_FACTORY_H */
diff --git a/src/core/ext/filters/client_channel/resolver_registry.cc b/src/core/ext/filters/client_channel/resolver_registry.cc
index 3f8451d..036e81d 100644
--- a/src/core/ext/filters/client_channel/resolver_registry.cc
+++ b/src/core/ext/filters/client_channel/resolver_registry.cc
@@ -24,133 +24,153 @@
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 
-#define MAX_RESOLVERS 10
-#define DEFAULT_RESOLVER_PREFIX_MAX_LENGTH 32
+namespace grpc_core {
 
-static grpc_resolver_factory* g_all_of_the_resolvers[MAX_RESOLVERS];
-static int g_number_of_resolvers = 0;
+namespace {
 
-static char g_default_resolver_prefix[DEFAULT_RESOLVER_PREFIX_MAX_LENGTH] =
-    "dns:///";
+class RegistryState {
+ public:
+  RegistryState() : default_prefix_(gpr_strdup("dns:///")) {}
 
-void grpc_resolver_registry_init() {}
-
-void grpc_resolver_registry_shutdown(void) {
-  for (int i = 0; i < g_number_of_resolvers; i++) {
-    grpc_resolver_factory_unref(g_all_of_the_resolvers[i]);
+  void SetDefaultPrefix(const char* default_resolver_prefix) {
+    GPR_ASSERT(default_resolver_prefix != nullptr);
+    GPR_ASSERT(*default_resolver_prefix != '\0');
+    default_prefix_.reset(gpr_strdup(default_resolver_prefix));
   }
-  // FIXME(ctiller): this should live in grpc_resolver_registry_init,
-  // however that would have the client_channel plugin call this AFTER we start
-  // registering resolvers from third party plugins, and so they'd never show
-  // up.
-  // We likely need some kind of dependency system for plugins.... what form
-  // that takes is TBD.
-  g_number_of_resolvers = 0;
-}
 
-void grpc_resolver_registry_set_default_prefix(
-    const char* default_resolver_prefix) {
-  const size_t len = strlen(default_resolver_prefix);
-  GPR_ASSERT(len < DEFAULT_RESOLVER_PREFIX_MAX_LENGTH &&
-             "default resolver prefix too long");
-  GPR_ASSERT(len > 0 && "default resolver prefix can't be empty");
-  // By the previous assert, default_resolver_prefix is safe to be copied with a
-  // plain strcpy.
-  strcpy(g_default_resolver_prefix, default_resolver_prefix);
-}
-
-void grpc_register_resolver_type(grpc_resolver_factory* factory) {
-  int i;
-  for (i = 0; i < g_number_of_resolvers; i++) {
-    GPR_ASSERT(0 != strcmp(factory->vtable->scheme,
-                           g_all_of_the_resolvers[i]->vtable->scheme));
-  }
-  GPR_ASSERT(g_number_of_resolvers != MAX_RESOLVERS);
-  grpc_resolver_factory_ref(factory);
-  g_all_of_the_resolvers[g_number_of_resolvers++] = factory;
-}
-
-static grpc_resolver_factory* lookup_factory(const char* name) {
-  int i;
-
-  for (i = 0; i < g_number_of_resolvers; i++) {
-    if (0 == strcmp(name, g_all_of_the_resolvers[i]->vtable->scheme)) {
-      return g_all_of_the_resolvers[i];
+  void RegisterResolverFactory(UniquePtr<ResolverFactory> factory) {
+    for (size_t i = 0; i < factories_.size(); ++i) {
+      GPR_ASSERT(strcmp(factories_[i]->scheme(), factory->scheme()) != 0);
     }
+    factories_.push_back(std::move(factory));
   }
-  return nullptr;
-}
 
-grpc_resolver_factory* grpc_resolver_factory_lookup(const char* name) {
-  grpc_resolver_factory* f = lookup_factory(name);
-  if (f) grpc_resolver_factory_ref(f);
-  return f;
-}
+  ResolverFactory* LookupResolverFactory(const char* scheme) const {
+    for (size_t i = 0; i < factories_.size(); ++i) {
+      if (strcmp(scheme, factories_[i]->scheme()) == 0) {
+        return factories_[i].get();
+      }
+    }
+    return nullptr;
+  }
 
-static grpc_resolver_factory* lookup_factory_by_uri(grpc_uri* uri) {
-  if (!uri) return nullptr;
-  return lookup_factory(uri->scheme);
-}
-
-static grpc_resolver_factory* resolve_factory(const char* target,
-                                              grpc_uri** uri,
-                                              char** canonical_target) {
-  grpc_resolver_factory* factory = nullptr;
-
-  GPR_ASSERT(uri != nullptr);
-  *uri = grpc_uri_parse(target, 1);
-  factory = lookup_factory_by_uri(*uri);
-  if (factory == nullptr) {
-    grpc_uri_destroy(*uri);
-    gpr_asprintf(canonical_target, "%s%s", g_default_resolver_prefix, target);
-    *uri = grpc_uri_parse(*canonical_target, 1);
-    factory = lookup_factory_by_uri(*uri);
+  // Returns the factory for the scheme of \a target.  If \a target does
+  // not parse as a URI, prepends \a default_prefix_ and tries again.
+  // If URI parsing is successful (in either attempt), sets \a uri to
+  // point to the parsed URI.
+  // If \a default_prefix_ needs to be prepended, sets \a canonical_target
+  // to the canonical target string.
+  ResolverFactory* FindResolverFactory(const char* target, grpc_uri** uri,
+                                       char** canonical_target) const {
+    GPR_ASSERT(uri != nullptr);
+    *uri = grpc_uri_parse(target, 1);
+    ResolverFactory* factory =
+        *uri == nullptr ? nullptr : LookupResolverFactory((*uri)->scheme);
     if (factory == nullptr) {
-      grpc_uri_destroy(grpc_uri_parse(target, 0));
-      grpc_uri_destroy(grpc_uri_parse(*canonical_target, 0));
-      gpr_log(GPR_ERROR, "don't know how to resolve '%s' or '%s'", target,
-              *canonical_target);
+      grpc_uri_destroy(*uri);
+      gpr_asprintf(canonical_target, "%s%s", default_prefix_.get(), target);
+      *uri = grpc_uri_parse(*canonical_target, 1);
+      factory =
+          *uri == nullptr ? nullptr : LookupResolverFactory((*uri)->scheme);
+      if (factory == nullptr) {
+        grpc_uri_destroy(grpc_uri_parse(target, 0));
+        grpc_uri_destroy(grpc_uri_parse(*canonical_target, 0));
+        gpr_log(GPR_ERROR, "don't know how to resolve '%s' or '%s'", target,
+                *canonical_target);
+      }
     }
+    return factory;
   }
-  return factory;
+
+ private:
+  // We currently support 10 factories without doing additional
+  // allocation.  This number could be raised if there is a case where
+  // more factories are needed and the additional allocations are
+  // hurting performance (which is unlikely, since these allocations
+  // only occur at gRPC initialization time).
+  InlinedVector<UniquePtr<ResolverFactory>, 10> factories_;
+  UniquePtr<char> default_prefix_;
+};
+
+static RegistryState* g_state = nullptr;
+
+}  // namespace
+
+//
+// ResolverRegistry::Builder
+//
+
+void ResolverRegistry::Builder::InitRegistry() {
+  if (g_state == nullptr) g_state = New<RegistryState>();
 }
 
-grpc_resolver* grpc_resolver_create(const char* target,
-                                    const grpc_channel_args* args,
-                                    grpc_pollset_set* pollset_set,
-                                    grpc_combiner* combiner) {
+void ResolverRegistry::Builder::ShutdownRegistry() {
+  Delete(g_state);
+  g_state = nullptr;
+}
+
+void ResolverRegistry::Builder::SetDefaultPrefix(
+    const char* default_resolver_prefix) {
+  InitRegistry();
+  g_state->SetDefaultPrefix(default_resolver_prefix);
+}
+
+void ResolverRegistry::Builder::RegisterResolverFactory(
+    UniquePtr<ResolverFactory> factory) {
+  InitRegistry();
+  g_state->RegisterResolverFactory(std::move(factory));
+}
+
+//
+// ResolverRegistry
+//
+
+ResolverFactory* ResolverRegistry::LookupResolverFactory(const char* scheme) {
+  GPR_ASSERT(g_state != nullptr);
+  return g_state->LookupResolverFactory(scheme);
+}
+
+OrphanablePtr<Resolver> ResolverRegistry::CreateResolver(
+    const char* target, const grpc_channel_args* args,
+    grpc_pollset_set* pollset_set, grpc_combiner* combiner) {
+  GPR_ASSERT(g_state != nullptr);
   grpc_uri* uri = nullptr;
   char* canonical_target = nullptr;
-  grpc_resolver_factory* factory =
-      resolve_factory(target, &uri, &canonical_target);
-  grpc_resolver* resolver;
-  grpc_resolver_args resolver_args;
-  memset(&resolver_args, 0, sizeof(resolver_args));
+  ResolverFactory* factory =
+      g_state->FindResolverFactory(target, &uri, &canonical_target);
+  ResolverArgs resolver_args;
   resolver_args.uri = uri;
   resolver_args.args = args;
   resolver_args.pollset_set = pollset_set;
   resolver_args.combiner = combiner;
-  resolver = grpc_resolver_factory_create_resolver(factory, &resolver_args);
+  OrphanablePtr<Resolver> resolver =
+      factory == nullptr ? nullptr : factory->CreateResolver(resolver_args);
   grpc_uri_destroy(uri);
   gpr_free(canonical_target);
   return resolver;
 }
 
-char* grpc_get_default_authority(const char* target) {
+UniquePtr<char> ResolverRegistry::GetDefaultAuthority(const char* target) {
+  GPR_ASSERT(g_state != nullptr);
   grpc_uri* uri = nullptr;
   char* canonical_target = nullptr;
-  grpc_resolver_factory* factory =
-      resolve_factory(target, &uri, &canonical_target);
-  char* authority = grpc_resolver_factory_get_default_authority(factory, uri);
+  ResolverFactory* factory =
+      g_state->FindResolverFactory(target, &uri, &canonical_target);
+  UniquePtr<char> authority =
+      factory == nullptr ? nullptr : factory->GetDefaultAuthority(uri);
   grpc_uri_destroy(uri);
   gpr_free(canonical_target);
   return authority;
 }
 
-char* grpc_resolver_factory_add_default_prefix_if_needed(const char* target) {
+UniquePtr<char> ResolverRegistry::AddDefaultPrefixIfNeeded(const char* target) {
+  GPR_ASSERT(g_state != nullptr);
   grpc_uri* uri = nullptr;
   char* canonical_target = nullptr;
-  resolve_factory(target, &uri, &canonical_target);
+  g_state->FindResolverFactory(target, &uri, &canonical_target);
   grpc_uri_destroy(uri);
-  return canonical_target == nullptr ? gpr_strdup(target) : canonical_target;
+  return UniquePtr<char>(canonical_target == nullptr ? gpr_strdup(target)
+                                                     : canonical_target);
 }
+
+}  // namespace grpc_core
diff --git a/src/core/ext/filters/client_channel/resolver_registry.h b/src/core/ext/filters/client_channel/resolver_registry.h
index bbd30df..260336d 100644
--- a/src/core/ext/filters/client_channel/resolver_registry.h
+++ b/src/core/ext/filters/client_channel/resolver_registry.h
@@ -20,49 +20,62 @@
 #define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_REGISTRY_H
 
 #include "src/core/ext/filters/client_channel/resolver_factory.h"
+#include "src/core/lib/gprpp/inlined_vector.h"
+#include "src/core/lib/gprpp/memory.h"
+#include "src/core/lib/gprpp/orphanable.h"
 #include "src/core/lib/iomgr/pollset_set.h"
 
-void grpc_resolver_registry_init();
-void grpc_resolver_registry_shutdown(void);
+namespace grpc_core {
 
-/** Set the default URI prefix to \a default_prefix. */
-void grpc_resolver_registry_set_default_prefix(const char* default_prefix);
+class ResolverRegistry {
+ public:
+  /// Methods used to create and populate the ResolverRegistry.
+  /// NOT THREAD SAFE -- to be used only during global gRPC
+  /// initialization and shutdown.
+  class Builder {
+   public:
+    /// Global initialization and shutdown hooks.
+    static void InitRegistry();
+    static void ShutdownRegistry();
 
-/** Register a resolver type.
-    URI's of \a scheme will be resolved with the given resolver.
-    If \a priority is greater than zero, then the resolver will be eligible
-    to resolve names that are passed in with no scheme. Higher priority
-    resolvers will be tried before lower priority schemes. */
-void grpc_register_resolver_type(grpc_resolver_factory* factory);
+    /// Sets the default URI prefix to \a default_prefix.
+    /// Calls InitRegistry() if it has not already been called.
+    static void SetDefaultPrefix(const char* default_prefix);
 
-/** Create a resolver given \a target.
-    First tries to parse \a target as a URI. If this succeeds, tries
-    to locate a registered resolver factory based on the URI scheme.
-    If parsing or location fails, prefixes default_prefix from
-    grpc_resolver_registry_init to target, and tries again (if default_prefix
-    was not NULL).
-    If a resolver factory was found, use it to instantiate a resolver and
-    return it.
-    If a resolver factory was not found, return NULL.
-    \a args is a set of channel arguments to be included in the result
-    (typically the set of arguments passed in from the client API).
-    \a pollset_set is used to drive IO in the name resolution process, it
-    should not be NULL. */
-grpc_resolver* grpc_resolver_create(const char* target,
-                                    const grpc_channel_args* args,
-                                    grpc_pollset_set* pollset_set,
-                                    grpc_combiner* combiner);
+    /// Registers a resolver factory.  The factory will be used to create a
+    /// resolver for any URI whose scheme matches that of the factory.
+    /// Calls InitRegistry() if it has not already been called.
+    static void RegisterResolverFactory(UniquePtr<ResolverFactory> factory);
+  };
 
-/** Find a resolver factory given a name and return an (owned-by-the-caller)
- *  reference to it */
-grpc_resolver_factory* grpc_resolver_factory_lookup(const char* name);
+  /// Creates a resolver given \a target.
+  /// First tries to parse \a target as a URI. If this succeeds, tries
+  /// to locate a registered resolver factory based on the URI scheme.
+  /// If parsing fails or there is no factory for the URI's scheme,
+  /// prepends default_prefix to target and tries again.
+  /// If a resolver factory is found, uses it to instantiate a resolver and
+  /// returns it; otherwise, returns nullptr.
+  /// \a args, \a pollset_set, and \a combiner are passed to the factory's
+  /// \a CreateResolver() method.
+  /// \a args are the channel args to be included in resolver results.
+  /// \a pollset_set is used to drive I/O in the name resolution process.
+  /// \a combiner is the combiner under which all resolver calls will be run.
+  static OrphanablePtr<Resolver> CreateResolver(const char* target,
+                                                const grpc_channel_args* args,
+                                                grpc_pollset_set* pollset_set,
+                                                grpc_combiner* combiner);
 
-/** Given a target, return a (freshly allocated with gpr_malloc) string
-    representing the default authority to pass from a client. */
-char* grpc_get_default_authority(const char* target);
+  /// Returns the default authority to pass from a client for \a target.
+  static UniquePtr<char> GetDefaultAuthority(const char* target);
 
-/** Returns a newly allocated string containing \a target, adding the
-    default prefix if needed. */
-char* grpc_resolver_factory_add_default_prefix_if_needed(const char* target);
+  /// Returns \a target with the default prefix prepended, if needed.
+  static UniquePtr<char> AddDefaultPrefixIfNeeded(const char* target);
+
+  /// Returns the resolver factory for \a scheme.
+  /// Caller does NOT own the return value.
+  static ResolverFactory* LookupResolverFactory(const char* scheme);
+};
+
+}  // namespace grpc_core
 
 #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_REGISTRY_H */
diff --git a/src/core/ext/filters/client_channel/retry_throttle.cc b/src/core/ext/filters/client_channel/retry_throttle.cc
index 867d775..0d38feb 100644
--- a/src/core/ext/filters/client_channel/retry_throttle.cc
+++ b/src/core/ext/filters/client_channel/retry_throttle.cc
@@ -23,10 +23,11 @@
 
 #include <grpc/support/alloc.h>
 #include <grpc/support/atm.h>
-#include <grpc/support/avl.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/sync.h>
 
+#include "src/core/lib/avl/avl.h"
+
 //
 // server_retry_throttle_data
 //
@@ -152,7 +153,7 @@
 
 static void destroy_server_name(void* key, void* unused) { gpr_free(key); }
 
-static const gpr_avl_vtable avl_vtable = {
+static const grpc_avl_vtable avl_vtable = {
     destroy_server_name, copy_server_name, compare_server_name,
     destroy_server_retry_throttle_data, copy_server_retry_throttle_data};
 
@@ -161,29 +162,29 @@
 //
 
 static gpr_mu g_mu;
-static gpr_avl g_avl;
+static grpc_avl g_avl;
 
 void grpc_retry_throttle_map_init() {
   gpr_mu_init(&g_mu);
-  g_avl = gpr_avl_create(&avl_vtable);
+  g_avl = grpc_avl_create(&avl_vtable);
 }
 
 void grpc_retry_throttle_map_shutdown() {
   gpr_mu_destroy(&g_mu);
-  gpr_avl_unref(g_avl, nullptr);
+  grpc_avl_unref(g_avl, nullptr);
 }
 
 grpc_server_retry_throttle_data* grpc_retry_throttle_map_get_data_for_server(
     const char* server_name, int max_milli_tokens, int milli_token_ratio) {
   gpr_mu_lock(&g_mu);
   grpc_server_retry_throttle_data* throttle_data =
-      (grpc_server_retry_throttle_data*)gpr_avl_get(g_avl, (char*)server_name,
-                                                    nullptr);
+      (grpc_server_retry_throttle_data*)grpc_avl_get(g_avl, (char*)server_name,
+                                                     nullptr);
   if (throttle_data == nullptr) {
     // Entry not found.  Create a new one.
     throttle_data = grpc_server_retry_throttle_data_create(
         max_milli_tokens, milli_token_ratio, nullptr);
-    g_avl = gpr_avl_add(g_avl, (char*)server_name, throttle_data, nullptr);
+    g_avl = grpc_avl_add(g_avl, (char*)server_name, throttle_data, nullptr);
   } else {
     if (throttle_data->max_milli_tokens != max_milli_tokens ||
         throttle_data->milli_token_ratio != milli_token_ratio) {
@@ -191,7 +192,7 @@
       // the original one.
       throttle_data = grpc_server_retry_throttle_data_create(
           max_milli_tokens, milli_token_ratio, throttle_data);
-      g_avl = gpr_avl_add(g_avl, (char*)server_name, throttle_data, nullptr);
+      g_avl = grpc_avl_add(g_avl, (char*)server_name, throttle_data, nullptr);
     } else {
       // Entry found.  Increase refcount.
       grpc_server_retry_throttle_data_ref(throttle_data);
diff --git a/src/core/ext/filters/client_channel/subchannel.cc b/src/core/ext/filters/client_channel/subchannel.cc
index 6bf710c..6d4c4f9 100644
--- a/src/core/ext/filters/client_channel/subchannel.cc
+++ b/src/core/ext/filters/client_channel/subchannel.cc
@@ -25,7 +25,6 @@
 #include <cstring>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/avl.h>
 #include <grpc/support/string_util.h>
 
 #include "src/core/ext/filters/client_channel/client_channel.h"
diff --git a/src/core/ext/filters/client_channel/subchannel_index.cc b/src/core/ext/filters/client_channel/subchannel_index.cc
index 052b047..69dbdcc 100644
--- a/src/core/ext/filters/client_channel/subchannel_index.cc
+++ b/src/core/ext/filters/client_channel/subchannel_index.cc
@@ -22,15 +22,15 @@
 #include <string.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/avl.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/tls.h>
 
+#include "src/core/lib/avl/avl.h"
 #include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gpr/tls.h"
 
 // a map of subchannel_key --> subchannel, used for detecting connections
 // to the same destination in order to share them
-static gpr_avl g_subchannel_index;
+static grpc_avl g_subchannel_index;
 
 static gpr_mu g_mu;
 
@@ -109,7 +109,7 @@
   return p;
 }
 
-static const gpr_avl_vtable subchannel_avl_vtable = {
+static const grpc_avl_vtable subchannel_avl_vtable = {
     sck_avl_destroy,  // destroy_key
     sck_avl_copy,     // copy_key
     sck_avl_compare,  // compare_keys
@@ -118,7 +118,7 @@
 };
 
 void grpc_subchannel_index_init(void) {
-  g_subchannel_index = gpr_avl_create(&subchannel_avl_vtable);
+  g_subchannel_index = grpc_avl_create(&subchannel_avl_vtable);
   gpr_mu_init(&g_mu);
   gpr_ref_init(&g_refcount, 1);
 }
@@ -133,7 +133,7 @@
 void grpc_subchannel_index_unref(void) {
   if (gpr_unref(&g_refcount)) {
     gpr_mu_destroy(&g_mu);
-    gpr_avl_unref(g_subchannel_index, grpc_core::ExecCtx::Get());
+    grpc_avl_unref(g_subchannel_index, grpc_core::ExecCtx::Get());
   }
 }
 
@@ -143,13 +143,13 @@
   // Lock, and take a reference to the subchannel index.
   // We don't need to do the search under a lock as avl's are immutable.
   gpr_mu_lock(&g_mu);
-  gpr_avl index = gpr_avl_ref(g_subchannel_index, grpc_core::ExecCtx::Get());
+  grpc_avl index = grpc_avl_ref(g_subchannel_index, grpc_core::ExecCtx::Get());
   gpr_mu_unlock(&g_mu);
 
   grpc_subchannel* c = GRPC_SUBCHANNEL_REF_FROM_WEAK_REF(
-      (grpc_subchannel*)gpr_avl_get(index, key, grpc_core::ExecCtx::Get()),
+      (grpc_subchannel*)grpc_avl_get(index, key, grpc_core::ExecCtx::Get()),
       "index_find");
-  gpr_avl_unref(index, grpc_core::ExecCtx::Get());
+  grpc_avl_unref(index, grpc_core::ExecCtx::Get());
 
   return c;
 }
@@ -165,11 +165,12 @@
     // Compare and swap loop:
     // - take a reference to the current index
     gpr_mu_lock(&g_mu);
-    gpr_avl index = gpr_avl_ref(g_subchannel_index, grpc_core::ExecCtx::Get());
+    grpc_avl index =
+        grpc_avl_ref(g_subchannel_index, grpc_core::ExecCtx::Get());
     gpr_mu_unlock(&g_mu);
 
     // - Check to see if a subchannel already exists
-    c = (grpc_subchannel*)gpr_avl_get(index, key, grpc_core::ExecCtx::Get());
+    c = (grpc_subchannel*)grpc_avl_get(index, key, grpc_core::ExecCtx::Get());
     if (c != nullptr) {
       c = GRPC_SUBCHANNEL_REF_FROM_WEAK_REF(c, "index_register");
     }
@@ -178,25 +179,25 @@
       need_to_unref_constructed = true;
     } else {
       // no -> update the avl and compare/swap
-      gpr_avl updated =
-          gpr_avl_add(gpr_avl_ref(index, grpc_core::ExecCtx::Get()),
-                      subchannel_key_copy(key),
-                      GRPC_SUBCHANNEL_WEAK_REF(constructed, "index_register"),
-                      grpc_core::ExecCtx::Get());
+      grpc_avl updated =
+          grpc_avl_add(grpc_avl_ref(index, grpc_core::ExecCtx::Get()),
+                       subchannel_key_copy(key),
+                       GRPC_SUBCHANNEL_WEAK_REF(constructed, "index_register"),
+                       grpc_core::ExecCtx::Get());
 
       // it may happen (but it's expected to be unlikely)
       // that some other thread has changed the index:
       // compare/swap here to check that, and retry as necessary
       gpr_mu_lock(&g_mu);
       if (index.root == g_subchannel_index.root) {
-        GPR_SWAP(gpr_avl, updated, g_subchannel_index);
+        GPR_SWAP(grpc_avl, updated, g_subchannel_index);
         c = constructed;
       }
       gpr_mu_unlock(&g_mu);
 
-      gpr_avl_unref(updated, grpc_core::ExecCtx::Get());
+      grpc_avl_unref(updated, grpc_core::ExecCtx::Get());
     }
-    gpr_avl_unref(index, grpc_core::ExecCtx::Get());
+    grpc_avl_unref(index, grpc_core::ExecCtx::Get());
   }
 
   if (need_to_unref_constructed) {
@@ -213,33 +214,34 @@
     // Compare and swap loop:
     // - take a reference to the current index
     gpr_mu_lock(&g_mu);
-    gpr_avl index = gpr_avl_ref(g_subchannel_index, grpc_core::ExecCtx::Get());
+    grpc_avl index =
+        grpc_avl_ref(g_subchannel_index, grpc_core::ExecCtx::Get());
     gpr_mu_unlock(&g_mu);
 
     // Check to see if this key still refers to the previously
     // registered subchannel
     grpc_subchannel* c =
-        (grpc_subchannel*)gpr_avl_get(index, key, grpc_core::ExecCtx::Get());
+        (grpc_subchannel*)grpc_avl_get(index, key, grpc_core::ExecCtx::Get());
     if (c != constructed) {
-      gpr_avl_unref(index, grpc_core::ExecCtx::Get());
+      grpc_avl_unref(index, grpc_core::ExecCtx::Get());
       break;
     }
 
     // compare and swap the update (some other thread may have
     // mutated the index behind us)
-    gpr_avl updated =
-        gpr_avl_remove(gpr_avl_ref(index, grpc_core::ExecCtx::Get()), key,
-                       grpc_core::ExecCtx::Get());
+    grpc_avl updated =
+        grpc_avl_remove(grpc_avl_ref(index, grpc_core::ExecCtx::Get()), key,
+                        grpc_core::ExecCtx::Get());
 
     gpr_mu_lock(&g_mu);
     if (index.root == g_subchannel_index.root) {
-      GPR_SWAP(gpr_avl, updated, g_subchannel_index);
+      GPR_SWAP(grpc_avl, updated, g_subchannel_index);
       done = true;
     }
     gpr_mu_unlock(&g_mu);
 
-    gpr_avl_unref(updated, grpc_core::ExecCtx::Get());
-    gpr_avl_unref(index, grpc_core::ExecCtx::Get());
+    grpc_avl_unref(updated, grpc_core::ExecCtx::Get());
+    grpc_avl_unref(index, grpc_core::ExecCtx::Get());
   }
 }
 
diff --git a/src/core/ext/transport/chttp2/alpn/alpn.cc b/src/core/ext/transport/chttp2/alpn/alpn.cc
index 8989245..5c4bfd0 100644
--- a/src/core/ext/transport/chttp2/alpn/alpn.cc
+++ b/src/core/ext/transport/chttp2/alpn/alpn.cc
@@ -18,7 +18,8 @@
 
 #include "src/core/ext/transport/chttp2/alpn/alpn.h"
 #include <grpc/support/log.h>
-#include <grpc/support/useful.h>
+
+#include "src/core/lib/gpr/useful.h"
 
 /* in order of preference */
 static const char* const supported_versions[] = {"grpc-exp", "h2"};
diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc
index 6a1b709..ef1d3fb 100644
--- a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc
+++ b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc
@@ -52,13 +52,13 @@
     return nullptr;
   }
   // Add channel arg containing the server URI.
-  grpc_arg arg = grpc_channel_arg_string_create(
-      (char*)GRPC_ARG_SERVER_URI,
-      grpc_resolver_factory_add_default_prefix_if_needed(target));
+  grpc_core::UniquePtr<char> canonical_target =
+      grpc_core::ResolverRegistry::AddDefaultPrefixIfNeeded(target);
+  grpc_arg arg = grpc_channel_arg_string_create((char*)GRPC_ARG_SERVER_URI,
+                                                canonical_target.get());
   const char* to_remove[] = {GRPC_ARG_SERVER_URI};
   grpc_channel_args* new_args =
       grpc_channel_args_copy_and_add_and_remove(args, to_remove, 1, &arg, 1);
-  gpr_free(arg.value.string);
   grpc_channel* channel =
       grpc_channel_create(target, new_args, GRPC_CLIENT_CHANNEL, nullptr);
   grpc_channel_args_destroy(new_args);
diff --git a/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc b/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc
index 27c5b96..d39c362 100644
--- a/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc
+++ b/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc
@@ -161,13 +161,13 @@
     return nullptr;
   }
   // Add channel arg containing the server URI.
-  grpc_arg arg = grpc_channel_arg_string_create(
-      (char*)GRPC_ARG_SERVER_URI,
-      grpc_resolver_factory_add_default_prefix_if_needed(target));
+  grpc_core::UniquePtr<char> canonical_target =
+      grpc_core::ResolverRegistry::AddDefaultPrefixIfNeeded(target);
+  grpc_arg arg = grpc_channel_arg_string_create((char*)GRPC_ARG_SERVER_URI,
+                                                canonical_target.get());
   const char* to_remove[] = {GRPC_ARG_SERVER_URI};
   grpc_channel_args* new_args =
       grpc_channel_args_copy_and_add_and_remove(args, to_remove, 1, &arg, 1);
-  gpr_free(arg.value.string);
   grpc_channel* channel =
       grpc_channel_create(target, new_args, GRPC_CLIENT_CHANNEL, nullptr);
   grpc_channel_args_destroy(new_args);
diff --git a/src/core/ext/transport/chttp2/server/chttp2_server.cc b/src/core/ext/transport/chttp2/server/chttp2_server.cc
index 5669fa4..bab46f8 100644
--- a/src/core/ext/transport/chttp2/server/chttp2_server.cc
+++ b/src/core/ext/transport/chttp2/server/chttp2_server.cc
@@ -28,7 +28,6 @@
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/sync.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/ext/filters/http/server/http_server_filter.h"
 #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
index fe05e43..7c35faf 100644
--- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
+++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
@@ -30,7 +30,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/ext/transport/chttp2/transport/frame_data.h"
 #include "src/core/ext/transport/chttp2/transport/internal.h"
@@ -1668,6 +1667,7 @@
   if (error == GRPC_ERROR_NONE) {
     grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_RETRY_SEND_PING);
   }
+  GRPC_CHTTP2_UNREF_TRANSPORT(t, "retry_initiate_ping_locked");
 }
 
 void grpc_chttp2_ack_ping(grpc_chttp2_transport* t, uint64_t id) {
diff --git a/src/core/ext/transport/chttp2/transport/flow_control.cc b/src/core/ext/transport/chttp2/transport/flow_control.cc
index 581241d..311fbd6 100644
--- a/src/core/ext/transport/chttp2/transport/flow_control.cc
+++ b/src/core/ext/transport/chttp2/transport/flow_control.cc
@@ -26,7 +26,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/ext/transport/chttp2/transport/internal.h"
 #include "src/core/lib/gpr/string.h"
diff --git a/src/core/ext/transport/chttp2/transport/flow_control.h b/src/core/ext/transport/chttp2/transport/flow_control.h
index 2ee1345..19c1893 100644
--- a/src/core/ext/transport/chttp2/transport/flow_control.h
+++ b/src/core/ext/transport/chttp2/transport/flow_control.h
@@ -22,8 +22,8 @@
 #include <grpc/support/port_platform.h>
 #include <stdint.h>
 
-#include <grpc/support/useful.h>
 #include "src/core/ext/transport/chttp2/transport/http2_settings.h"
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/gprpp/abstract.h"
 #include "src/core/lib/gprpp/manual_constructor.h"
 #include "src/core/lib/transport/bdp_estimator.h"
diff --git a/src/core/ext/transport/chttp2/transport/frame_data.cc b/src/core/ext/transport/chttp2/transport/frame_data.cc
index 043b80a..5ea495f 100644
--- a/src/core/ext/transport/chttp2/transport/frame_data.cc
+++ b/src/core/ext/transport/chttp2/transport/frame_data.cc
@@ -23,7 +23,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
 #include "src/core/ext/transport/chttp2/transport/internal.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/slice/slice_internal.h"
diff --git a/src/core/ext/transport/chttp2/transport/frame_settings.cc b/src/core/ext/transport/chttp2/transport/frame_settings.cc
index 0d245f4..36d6b48 100644
--- a/src/core/ext/transport/chttp2/transport/frame_settings.cc
+++ b/src/core/ext/transport/chttp2/transport/frame_settings.cc
@@ -24,7 +24,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
 #include "src/core/ext/transport/chttp2/transport/frame.h"
diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc
index 3a5692a..ba6b43b 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc
+++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc
@@ -28,7 +28,6 @@
 
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/ext/transport/chttp2/transport/bin_encoder.h"
 #include "src/core/ext/transport/chttp2/transport/hpack_table.h"
diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.cc b/src/core/ext/transport/chttp2/transport/hpack_parser.cc
index 8d1c57a..66cc288 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_parser.cc
+++ b/src/core/ext/transport/chttp2/transport/hpack_parser.cc
@@ -27,7 +27,6 @@
 #include <grpc/support/log.h>
 #include <grpc/support/port_platform.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/ext/transport/chttp2/transport/bin_encoder.h"
 #include "src/core/lib/debug/stats.h"
diff --git a/src/core/ext/transport/chttp2/transport/http2_settings.cc b/src/core/ext/transport/chttp2/transport/http2_settings.cc
index 0aab864..4248496 100644
--- a/src/core/ext/transport/chttp2/transport/http2_settings.cc
+++ b/src/core/ext/transport/chttp2/transport/http2_settings.cc
@@ -20,7 +20,7 @@
 
 #include "src/core/ext/transport/chttp2/transport/http2_settings.h"
 
-#include <grpc/support/useful.h>
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/transport/http2_errors.h"
 
 const uint16_t grpc_setting_id_to_wire_id[] = {1, 2, 3, 4, 5, 6, 65027};
diff --git a/src/core/ext/transport/chttp2/transport/stream_map.cc b/src/core/ext/transport/chttp2/transport/stream_map.cc
index e4f08f5..d59ff40 100644
--- a/src/core/ext/transport/chttp2/transport/stream_map.cc
+++ b/src/core/ext/transport/chttp2/transport/stream_map.cc
@@ -22,7 +22,6 @@
 
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
-#include <grpc/support/useful.h>
 
 void grpc_chttp2_stream_map_init(grpc_chttp2_stream_map* map,
                                  size_t initial_capacity) {
diff --git a/src/core/ext/transport/chttp2/transport/writing.cc b/src/core/ext/transport/chttp2/transport/writing.cc
index 95358ab..1d6c9b0 100644
--- a/src/core/ext/transport/chttp2/transport/writing.cc
+++ b/src/core/ext/transport/chttp2/transport/writing.cc
@@ -88,6 +88,7 @@
     }
     if (!t->ping_state.is_delayed_ping_timer_set) {
       t->ping_state.is_delayed_ping_timer_set = true;
+      GRPC_CHTTP2_REF_TRANSPORT(t, "retry_initiate_ping_locked");
       grpc_timer_init(&t->ping_state.delayed_ping_timer, next_allowed_ping,
                       &t->retry_initiate_ping_locked);
     }
diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.cc b/src/core/ext/transport/cronet/transport/cronet_transport.cc
index 5b1c6ab..e23c07f 100644
--- a/src/core/ext/transport/cronet/transport/cronet_transport.cc
+++ b/src/core/ext/transport/cronet/transport/cronet_transport.cc
@@ -21,13 +21,12 @@
 #include <grpc/impl/codegen/port_platform.h>
 #include <grpc/slice_buffer.h>
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/ext/transport/chttp2/transport/incoming_metadata.h"
 #include "src/core/ext/transport/cronet/transport/cronet_transport.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/iomgr/endpoint.h"
 #include "src/core/lib/iomgr/exec_ctx.h"
diff --git a/src/core/lib/gpr/avl.cc b/src/core/lib/avl/avl.cc
similarity index 66%
rename from src/core/lib/gpr/avl.cc
rename to src/core/lib/avl/avl.cc
index 0b67a21..acc0432 100644
--- a/src/core/lib/gpr/avl.cc
+++ b/src/core/lib/avl/avl.cc
@@ -16,30 +16,31 @@
  *
  */
 
-#include <grpc/support/avl.h>
+#include "src/core/lib/avl/avl.h"
 
 #include <assert.h>
 #include <stdlib.h>
 
 #include <grpc/support/alloc.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
 
-gpr_avl gpr_avl_create(const gpr_avl_vtable* vtable) {
-  gpr_avl out;
+#include "src/core/lib/gpr/useful.h"
+
+grpc_avl grpc_avl_create(const grpc_avl_vtable* vtable) {
+  grpc_avl out;
   out.vtable = vtable;
   out.root = nullptr;
   return out;
 }
 
-static gpr_avl_node* ref_node(gpr_avl_node* node) {
+static grpc_avl_node* ref_node(grpc_avl_node* node) {
   if (node) {
     gpr_ref(&node->refs);
   }
   return node;
 }
 
-static void unref_node(const gpr_avl_vtable* vtable, gpr_avl_node* node,
+static void unref_node(const grpc_avl_vtable* vtable, grpc_avl_node* node,
                        void* user_data) {
   if (node == nullptr) {
     return;
@@ -53,18 +54,18 @@
   }
 }
 
-static long node_height(gpr_avl_node* node) {
+static long node_height(grpc_avl_node* node) {
   return node == nullptr ? 0 : node->height;
 }
 
 #ifndef NDEBUG
-static long calculate_height(gpr_avl_node* node) {
+static long calculate_height(grpc_avl_node* node) {
   return node == nullptr ? 0
                          : 1 + GPR_MAX(calculate_height(node->left),
                                        calculate_height(node->right));
 }
 
-static gpr_avl_node* assert_invariants(gpr_avl_node* n) {
+static grpc_avl_node* assert_invariants(grpc_avl_node* n) {
   if (n == nullptr) return nullptr;
   assert_invariants(n->left);
   assert_invariants(n->right);
@@ -73,12 +74,12 @@
   return n;
 }
 #else
-static gpr_avl_node* assert_invariants(gpr_avl_node* n) { return n; }
+static grpc_avl_node* assert_invariants(grpc_avl_node* n) { return n; }
 #endif
 
-gpr_avl_node* new_node(void* key, void* value, gpr_avl_node* left,
-                       gpr_avl_node* right) {
-  gpr_avl_node* node = (gpr_avl_node*)gpr_malloc(sizeof(*node));
+grpc_avl_node* new_node(void* key, void* value, grpc_avl_node* left,
+                        grpc_avl_node* right) {
+  grpc_avl_node* node = (grpc_avl_node*)gpr_malloc(sizeof(*node));
   gpr_ref_init(&node->refs, 1);
   node->key = key;
   node->value = value;
@@ -88,8 +89,8 @@
   return node;
 }
 
-static gpr_avl_node* get(const gpr_avl_vtable* vtable, gpr_avl_node* node,
-                         void* key, void* user_data) {
+static grpc_avl_node* get(const grpc_avl_vtable* vtable, grpc_avl_node* node,
+                          void* key, void* user_data) {
   long cmp;
 
   if (node == nullptr) {
@@ -106,13 +107,13 @@
   }
 }
 
-void* gpr_avl_get(gpr_avl avl, void* key, void* user_data) {
-  gpr_avl_node* node = get(avl.vtable, avl.root, key, user_data);
+void* grpc_avl_get(grpc_avl avl, void* key, void* user_data) {
+  grpc_avl_node* node = get(avl.vtable, avl.root, key, user_data);
   return node ? node->value : nullptr;
 }
 
-int gpr_avl_maybe_get(gpr_avl avl, void* key, void** value, void* user_data) {
-  gpr_avl_node* node = get(avl.vtable, avl.root, key, user_data);
+int grpc_avl_maybe_get(grpc_avl avl, void* key, void** value, void* user_data) {
+  grpc_avl_node* node = get(avl.vtable, avl.root, key, user_data);
   if (node != nullptr) {
     *value = node->value;
     return 1;
@@ -120,21 +121,21 @@
   return 0;
 }
 
-static gpr_avl_node* rotate_left(const gpr_avl_vtable* vtable, void* key,
-                                 void* value, gpr_avl_node* left,
-                                 gpr_avl_node* right, void* user_data) {
-  gpr_avl_node* n = new_node(vtable->copy_key(right->key, user_data),
-                             vtable->copy_value(right->value, user_data),
-                             new_node(key, value, left, ref_node(right->left)),
-                             ref_node(right->right));
+static grpc_avl_node* rotate_left(const grpc_avl_vtable* vtable, void* key,
+                                  void* value, grpc_avl_node* left,
+                                  grpc_avl_node* right, void* user_data) {
+  grpc_avl_node* n = new_node(vtable->copy_key(right->key, user_data),
+                              vtable->copy_value(right->value, user_data),
+                              new_node(key, value, left, ref_node(right->left)),
+                              ref_node(right->right));
   unref_node(vtable, right, user_data);
   return n;
 }
 
-static gpr_avl_node* rotate_right(const gpr_avl_vtable* vtable, void* key,
-                                  void* value, gpr_avl_node* left,
-                                  gpr_avl_node* right, void* user_data) {
-  gpr_avl_node* n =
+static grpc_avl_node* rotate_right(const grpc_avl_vtable* vtable, void* key,
+                                   void* value, grpc_avl_node* left,
+                                   grpc_avl_node* right, void* user_data) {
+  grpc_avl_node* n =
       new_node(vtable->copy_key(left->key, user_data),
                vtable->copy_value(left->value, user_data), ref_node(left->left),
                new_node(key, value, ref_node(left->right), right));
@@ -142,11 +143,12 @@
   return n;
 }
 
-static gpr_avl_node* rotate_left_right(const gpr_avl_vtable* vtable, void* key,
-                                       void* value, gpr_avl_node* left,
-                                       gpr_avl_node* right, void* user_data) {
+static grpc_avl_node* rotate_left_right(const grpc_avl_vtable* vtable,
+                                        void* key, void* value,
+                                        grpc_avl_node* left,
+                                        grpc_avl_node* right, void* user_data) {
   /* rotate_right(..., rotate_left(left), right) */
-  gpr_avl_node* n =
+  grpc_avl_node* n =
       new_node(vtable->copy_key(left->right->key, user_data),
                vtable->copy_value(left->right->value, user_data),
                new_node(vtable->copy_key(left->key, user_data),
@@ -157,11 +159,12 @@
   return n;
 }
 
-static gpr_avl_node* rotate_right_left(const gpr_avl_vtable* vtable, void* key,
-                                       void* value, gpr_avl_node* left,
-                                       gpr_avl_node* right, void* user_data) {
+static grpc_avl_node* rotate_right_left(const grpc_avl_vtable* vtable,
+                                        void* key, void* value,
+                                        grpc_avl_node* left,
+                                        grpc_avl_node* right, void* user_data) {
   /* rotate_left(..., left, rotate_right(right)) */
-  gpr_avl_node* n =
+  grpc_avl_node* n =
       new_node(vtable->copy_key(right->left->key, user_data),
                vtable->copy_value(right->left->value, user_data),
                new_node(key, value, left, ref_node(right->left->left)),
@@ -172,9 +175,9 @@
   return n;
 }
 
-static gpr_avl_node* rebalance(const gpr_avl_vtable* vtable, void* key,
-                               void* value, gpr_avl_node* left,
-                               gpr_avl_node* right, void* user_data) {
+static grpc_avl_node* rebalance(const grpc_avl_vtable* vtable, void* key,
+                                void* value, grpc_avl_node* left,
+                                grpc_avl_node* right, void* user_data) {
   switch (node_height(left) - node_height(right)) {
     case 2:
       if (node_height(left->left) - node_height(left->right) == -1) {
@@ -197,8 +200,9 @@
   }
 }
 
-static gpr_avl_node* add_key(const gpr_avl_vtable* vtable, gpr_avl_node* node,
-                             void* key, void* value, void* user_data) {
+static grpc_avl_node* add_key(const grpc_avl_vtable* vtable,
+                              grpc_avl_node* node, void* key, void* value,
+                              void* user_data) {
   long cmp;
   if (node == nullptr) {
     return new_node(key, value, nullptr, nullptr);
@@ -219,31 +223,31 @@
   }
 }
 
-gpr_avl gpr_avl_add(gpr_avl avl, void* key, void* value, void* user_data) {
-  gpr_avl_node* old_root = avl.root;
+grpc_avl grpc_avl_add(grpc_avl avl, void* key, void* value, void* user_data) {
+  grpc_avl_node* old_root = avl.root;
   avl.root = add_key(avl.vtable, avl.root, key, value, user_data);
   assert_invariants(avl.root);
   unref_node(avl.vtable, old_root, user_data);
   return avl;
 }
 
-static gpr_avl_node* in_order_head(gpr_avl_node* node) {
+static grpc_avl_node* in_order_head(grpc_avl_node* node) {
   while (node->left != nullptr) {
     node = node->left;
   }
   return node;
 }
 
-static gpr_avl_node* in_order_tail(gpr_avl_node* node) {
+static grpc_avl_node* in_order_tail(grpc_avl_node* node) {
   while (node->right != nullptr) {
     node = node->right;
   }
   return node;
 }
 
-static gpr_avl_node* remove_key(const gpr_avl_vtable* vtable,
-                                gpr_avl_node* node, void* key,
-                                void* user_data) {
+static grpc_avl_node* remove_key(const grpc_avl_vtable* vtable,
+                                 grpc_avl_node* node, void* key,
+                                 void* user_data) {
   long cmp;
   if (node == nullptr) {
     return nullptr;
@@ -255,13 +259,13 @@
     } else if (node->right == nullptr) {
       return ref_node(node->left);
     } else if (node->left->height < node->right->height) {
-      gpr_avl_node* h = in_order_head(node->right);
+      grpc_avl_node* h = in_order_head(node->right);
       return rebalance(
           vtable, vtable->copy_key(h->key, user_data),
           vtable->copy_value(h->value, user_data), ref_node(node->left),
           remove_key(vtable, node->right, h->key, user_data), user_data);
     } else {
-      gpr_avl_node* h = in_order_tail(node->left);
+      grpc_avl_node* h = in_order_tail(node->left);
       return rebalance(vtable, vtable->copy_key(h->key, user_data),
                        vtable->copy_value(h->value, user_data),
                        remove_key(vtable, node->left, h->key, user_data),
@@ -280,21 +284,21 @@
   }
 }
 
-gpr_avl gpr_avl_remove(gpr_avl avl, void* key, void* user_data) {
-  gpr_avl_node* old_root = avl.root;
+grpc_avl grpc_avl_remove(grpc_avl avl, void* key, void* user_data) {
+  grpc_avl_node* old_root = avl.root;
   avl.root = remove_key(avl.vtable, avl.root, key, user_data);
   assert_invariants(avl.root);
   unref_node(avl.vtable, old_root, user_data);
   return avl;
 }
 
-gpr_avl gpr_avl_ref(gpr_avl avl, void* user_data) {
+grpc_avl grpc_avl_ref(grpc_avl avl, void* user_data) {
   ref_node(avl.root);
   return avl;
 }
 
-void gpr_avl_unref(gpr_avl avl, void* user_data) {
+void grpc_avl_unref(grpc_avl avl, void* user_data) {
   unref_node(avl.vtable, avl.root, user_data);
 }
 
-int gpr_avl_is_empty(gpr_avl avl) { return avl.root == nullptr; }
+int grpc_avl_is_empty(grpc_avl avl) { return avl.root == nullptr; }
diff --git a/include/grpc/support/avl.h b/src/core/lib/avl/avl.h
similarity index 66%
rename from include/grpc/support/avl.h
rename to src/core/lib/avl/avl.h
index b5a8c0f..df5d2e8 100644
--- a/include/grpc/support/avl.h
+++ b/src/core/lib/avl/avl.h
@@ -16,31 +16,27 @@
  *
  */
 
-#ifndef GRPC_SUPPORT_AVL_H
-#define GRPC_SUPPORT_AVL_H
+#ifndef GRPC_CORE_LIB_AVL_AVL_H
+#define GRPC_CORE_LIB_AVL_AVL_H
 
 #include <grpc/support/sync.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /** internal node of an AVL tree */
-typedef struct gpr_avl_node {
+typedef struct grpc_avl_node {
   gpr_refcount refs;
   void* key;
   void* value;
-  struct gpr_avl_node* left;
-  struct gpr_avl_node* right;
+  struct grpc_avl_node* left;
+  struct grpc_avl_node* right;
   long height;
-} gpr_avl_node;
+} grpc_avl_node;
 
 /** vtable for the AVL tree
- * The optional user_data is propagated from the top level gpr_avl_XXX API.
+ * The optional user_data is propagated from the top level grpc_avl_XXX API.
  * From the same API call, multiple vtable functions may be called multiple
  * times.
  */
-typedef struct gpr_avl_vtable {
+typedef struct grpc_avl_vtable {
   /** destroy a key */
   void (*destroy_key)(void* key, void* user_data);
   /** copy a key, returning new value */
@@ -52,51 +48,45 @@
   void (*destroy_value)(void* value, void* user_data);
   /** copy a value */
   void* (*copy_value)(void* value, void* user_data);
-} gpr_avl_vtable;
+} grpc_avl_vtable;
 
 /** "pointer" to an AVL tree - this is a reference
-    counted object - use gpr_avl_ref to add a reference,
-    gpr_avl_unref when done with a reference */
-typedef struct gpr_avl {
-  const gpr_avl_vtable* vtable;
-  gpr_avl_node* root;
-} gpr_avl;
+    counted object - use grpc_avl_ref to add a reference,
+    grpc_avl_unref when done with a reference */
+typedef struct grpc_avl {
+  const grpc_avl_vtable* vtable;
+  grpc_avl_node* root;
+} grpc_avl;
 
 /** Create an immutable AVL tree. */
-GPRAPI gpr_avl gpr_avl_create(const gpr_avl_vtable* vtable);
+grpc_avl grpc_avl_create(const grpc_avl_vtable* vtable);
 /** Add a reference to an existing tree - returns
     the tree as a convenience. The optional user_data will be passed to vtable
     functions. */
-GPRAPI gpr_avl gpr_avl_ref(gpr_avl avl, void* user_data);
+grpc_avl grpc_avl_ref(grpc_avl avl, void* user_data);
 /** Remove a reference to a tree - destroying it if there
     are no references left. The optional user_data will be passed to vtable
     functions. */
-GPRAPI void gpr_avl_unref(gpr_avl avl, void* user_data);
+void grpc_avl_unref(grpc_avl avl, void* user_data);
 /** Return a new tree with (key, value) added to avl.
     implicitly unrefs avl to allow easy chaining.
     if key exists in avl, the new tree's key entry updated
     (i.e. a duplicate is not created). The optional user_data will be passed to
     vtable functions. */
-GPRAPI gpr_avl gpr_avl_add(gpr_avl avl, void* key, void* value,
-                           void* user_data);
+grpc_avl grpc_avl_add(grpc_avl avl, void* key, void* value, void* user_data);
 /** Return a new tree with key deleted
     implicitly unrefs avl to allow easy chaining. The optional user_data will be
     passed to vtable functions. */
-GPRAPI gpr_avl gpr_avl_remove(gpr_avl avl, void* key, void* user_data);
+grpc_avl grpc_avl_remove(grpc_avl avl, void* key, void* user_data);
 /** Lookup key, and return the associated value.
     Does not mutate avl.
     Returns NULL if key is not found. The optional user_data will be passed to
     vtable functions.*/
-GPRAPI void* gpr_avl_get(gpr_avl avl, void* key, void* user_data);
+void* grpc_avl_get(grpc_avl avl, void* key, void* user_data);
 /** Return 1 if avl contains key, 0 otherwise; if it has the key, sets *value to
-    its value. THe optional user_data will be passed to vtable functions. */
-GPRAPI int gpr_avl_maybe_get(gpr_avl avl, void* key, void** value,
-                             void* user_data);
+    its value. The optional user_data will be passed to vtable functions. */
+int grpc_avl_maybe_get(grpc_avl avl, void* key, void** value, void* user_data);
 /** Return 1 if avl is empty, 0 otherwise */
-GPRAPI int gpr_avl_is_empty(gpr_avl avl);
+int grpc_avl_is_empty(grpc_avl avl);
 
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_SUPPORT_AVL_H */
+#endif /* GRPC_CORE_LIB_AVL_AVL_H */
diff --git a/src/core/lib/backoff/backoff.cc b/src/core/lib/backoff/backoff.cc
index d561fc7..9275fc2 100644
--- a/src/core/lib/backoff/backoff.cc
+++ b/src/core/lib/backoff/backoff.cc
@@ -20,7 +20,7 @@
 
 #include <algorithm>
 
-#include <grpc/support/useful.h>
+#include "src/core/lib/gpr/useful.h"
 
 namespace grpc_core {
 
diff --git a/src/core/lib/channel/channel_args.cc b/src/core/lib/channel/channel_args.cc
index 101a6ff..5cd158a 100644
--- a/src/core/lib/channel/channel_args.cc
+++ b/src/core/lib/channel/channel_args.cc
@@ -26,10 +26,10 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gpr/useful.h"
 
 static grpc_arg copy_arg(const grpc_arg* src) {
   grpc_arg dst;
diff --git a/src/core/lib/compression/compression.cc b/src/core/lib/compression/compression.cc
index 167e90f..69d70ea 100644
--- a/src/core/lib/compression/compression.cc
+++ b/src/core/lib/compression/compression.cc
@@ -20,10 +20,10 @@
 #include <string.h>
 
 #include <grpc/compression.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/compression/algorithm_metadata.h"
 #include "src/core/lib/compression/compression_internal.h"
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/surface/api_trace.h"
 #include "src/core/lib/transport/static_metadata.h"
 
diff --git a/src/core/lib/compression/compression_internal.cc b/src/core/lib/compression/compression_internal.cc
index 1b7ead3..4bbaca2 100644
--- a/src/core/lib/compression/compression_internal.cc
+++ b/src/core/lib/compression/compression_internal.cc
@@ -20,10 +20,10 @@
 #include <string.h>
 
 #include <grpc/compression.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/compression/algorithm_metadata.h"
 #include "src/core/lib/compression/compression_internal.h"
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/surface/api_trace.h"
 #include "src/core/lib/transport/static_metadata.h"
 
diff --git a/src/core/lib/debug/stats.cc b/src/core/lib/debug/stats.cc
index 465c761..40355c2 100644
--- a/src/core/lib/debug/stats.cc
+++ b/src/core/lib/debug/stats.cc
@@ -23,9 +23,9 @@
 
 #include <grpc/support/alloc.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gpr/useful.h"
 
 grpc_stats_data* grpc_stats_per_cpu_storage = nullptr;
 static size_t g_num_cores;
diff --git a/src/core/lib/debug/stats_data.cc b/src/core/lib/debug/stats_data.cc
index 996ed3d..e2d3a6d 100644
--- a/src/core/lib/debug/stats_data.cc
+++ b/src/core/lib/debug/stats_data.cc
@@ -19,9 +19,10 @@
  */
 
 #include "src/core/lib/debug/stats_data.h"
-#include <grpc/support/useful.h>
 #include "src/core/lib/debug/stats.h"
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/exec_ctx.h"
+
 const char* grpc_stats_counter_name[GRPC_STATS_COUNTER_COUNT] = {
     "client_calls_created",
     "server_calls_created",
diff --git a/src/core/lib/gpr/arena.cc b/src/core/lib/gpr/arena.cc
index 687592a..5a8d7ff 100644
--- a/src/core/lib/gpr/arena.cc
+++ b/src/core/lib/gpr/arena.cc
@@ -23,7 +23,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/atm.h>
 #include <grpc/support/log.h>
-#include <grpc/support/useful.h>
 
 // TODO(roth): We currently assume that all callers need alignment of 16
 // bytes, which may be wrong in some cases.  As part of converting the
diff --git a/src/core/lib/gpr/atm.cc b/src/core/lib/gpr/atm.cc
index 15bfe52..3d0b430 100644
--- a/src/core/lib/gpr/atm.cc
+++ b/src/core/lib/gpr/atm.cc
@@ -17,7 +17,8 @@
  */
 
 #include <grpc/support/atm.h>
-#include <grpc/support/useful.h>
+
+#include "src/core/lib/gpr/useful.h"
 
 gpr_atm gpr_atm_no_barrier_clamped_add(gpr_atm* value, gpr_atm delta,
                                        gpr_atm min, gpr_atm max) {
diff --git a/src/core/lib/gpr/cpu_posix.cc b/src/core/lib/gpr/cpu_posix.cc
index bca14a0..7a77f7a 100644
--- a/src/core/lib/gpr/cpu_posix.cc
+++ b/src/core/lib/gpr/cpu_posix.cc
@@ -29,7 +29,8 @@
 #include <grpc/support/cpu.h>
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
-#include <grpc/support/useful.h>
+
+#include "src/core/lib/gpr/useful.h"
 
 static long ncpus = 0;
 
diff --git a/src/core/lib/gpr/env_linux.cc b/src/core/lib/gpr/env_linux.cc
index 17902c3..fadc42f 100644
--- a/src/core/lib/gpr/env_linux.cc
+++ b/src/core/lib/gpr/env_linux.cc
@@ -34,9 +34,9 @@
 
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gpr/useful.h"
 
 const char* gpr_getenv_silent(const char* name, char** dst) {
   const char* insecure_func_used = nullptr;
diff --git a/src/core/lib/gpr/env_windows.cc b/src/core/lib/gpr/env_windows.cc
index 9ca1e02..cf8ed60 100644
--- a/src/core/lib/gpr/env_windows.cc
+++ b/src/core/lib/gpr/env_windows.cc
@@ -22,14 +22,14 @@
 
 #include <windows.h>
 
-#include "src/core/lib/gpr/env.h"
-#include "src/core/lib/gpr/string.h"
-#include "src/core/lib/gpr/string_windows.h"
-
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 
+#include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gpr/string_windows.h"
+
 const char* gpr_getenv_silent(const char* name, char** dst) {
   *dst = gpr_getenv(name);
   return NULL;
diff --git a/src/core/lib/gpr/fork.cc b/src/core/lib/gpr/fork.cc
index 92023f4..4651d22 100644
--- a/src/core/lib/gpr/fork.cc
+++ b/src/core/lib/gpr/fork.cc
@@ -21,9 +21,9 @@
 #include <string.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/useful.h"
 
 /*
  * NOTE: FORKING IS NOT GENERALLY SUPPORTED, THIS IS ONLY INTENDED TO WORK
diff --git a/src/core/lib/gpr/host_port.cc b/src/core/lib/gpr/host_port.cc
index 2917827..0776727 100644
--- a/src/core/lib/gpr/host_port.cc
+++ b/src/core/lib/gpr/host_port.cc
@@ -16,13 +16,14 @@
  *
  */
 
-#include <grpc/support/host_port.h>
+#include "src/core/lib/gpr/host_port.h"
 
 #include <string.h>
 
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
+
 #include "src/core/lib/gpr/string.h"
 
 int gpr_join_host_port(char** out, const char* host, int port) {
diff --git a/include/grpc/support/host_port.h b/src/core/lib/gpr/host_port.h
similarity index 81%
rename from include/grpc/support/host_port.h
rename to src/core/lib/gpr/host_port.h
index 9805811..0bf0960 100644
--- a/include/grpc/support/host_port.h
+++ b/src/core/lib/gpr/host_port.h
@@ -16,15 +16,11 @@
  *
  */
 
-#ifndef GRPC_SUPPORT_HOST_PORT_H
-#define GRPC_SUPPORT_HOST_PORT_H
+#ifndef GRPC_CORE_LIB_GPR_HOST_PORT_H
+#define GRPC_CORE_LIB_GPR_HOST_PORT_H
 
 #include <grpc/support/port_platform.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /** Given a host and port, creates a newly-allocated string of the form
    "host:port" or "[ho:st]:port", depending on whether the host contains colons
    like an IPv6 literal.  If the host is already bracketed, then additional
@@ -35,17 +31,13 @@
    destroyed using gpr_free().
 
    In the unlikely event of an error, returns -1 and sets *out to NULL. */
-GPRAPI int gpr_join_host_port(char** out, const char* host, int port);
+int gpr_join_host_port(char** out, const char* host, int port);
 
 /** Given a name in the form "host:port" or "[ho:st]:port", split into hostname
    and port number, into newly allocated strings, which must later be
    destroyed using gpr_free().
    Return 1 on success, 0 on failure. Guarantees *host and *port == NULL on
    failure. */
-GPRAPI int gpr_split_host_port(const char* name, char** host, char** port);
+int gpr_split_host_port(const char* name, char** host, char** port);
 
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_SUPPORT_HOST_PORT_H */
+#endif /* GRPC_CORE_LIB_GPR_HOST_PORT_H */
diff --git a/src/core/lib/gpr/string.cc b/src/core/lib/gpr/string.cc
index 919d957..6b360e4 100644
--- a/src/core/lib/gpr/string.cc
+++ b/src/core/lib/gpr/string.cc
@@ -28,7 +28,8 @@
 #include <grpc/support/log.h>
 #include <grpc/support/port_platform.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
+
+#include "src/core/lib/gpr/useful.h"
 
 char* gpr_strdup(const char* src) {
   char* dst;
diff --git a/src/core/lib/gpr/thd_posix.cc b/src/core/lib/gpr/thd_posix.cc
index cfff0df..683fd45 100644
--- a/src/core/lib/gpr/thd_posix.cc
+++ b/src/core/lib/gpr/thd_posix.cc
@@ -26,12 +26,12 @@
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/useful.h>
 #include <pthread.h>
 #include <stdlib.h>
 #include <string.h>
 
 #include "src/core/lib/gpr/fork.h"
+#include "src/core/lib/gpr/useful.h"
 
 static gpr_mu g_mu;
 static gpr_cv g_cv;
diff --git a/include/grpc/support/tls.h b/src/core/lib/gpr/tls.h
similarity index 87%
rename from include/grpc/support/tls.h
rename to src/core/lib/gpr/tls.h
index 4c9e79b..aee8f4d 100644
--- a/include/grpc/support/tls.h
+++ b/src/core/lib/gpr/tls.h
@@ -16,8 +16,8 @@
  *
  */
 
-#ifndef GRPC_SUPPORT_TLS_H
-#define GRPC_SUPPORT_TLS_H
+#ifndef GRPC_CORE_LIB_GPR_TLS_H
+#define GRPC_CORE_LIB_GPR_TLS_H
 
 #include <grpc/support/port_platform.h>
 
@@ -54,15 +54,15 @@
    ALL functions here may be implemented as macros. */
 
 #ifdef GPR_GCC_TLS
-#include <grpc/support/tls_gcc.h>
+#include "src/core/lib/gpr/tls_gcc.h"
 #endif
 
 #ifdef GPR_MSVC_TLS
-#include <grpc/support/tls_msvc.h>
+#include "src/core/lib/gpr/tls_msvc.h"
 #endif
 
 #ifdef GPR_PTHREAD_TLS
-#include <grpc/support/tls_pthread.h>
+#include "src/core/lib/gpr/tls_pthread.h"
 #endif
 
-#endif /* GRPC_SUPPORT_TLS_H */
+#endif /* GRPC_CORE_LIB_GPR_TLS_H */
diff --git a/include/grpc/support/tls_gcc.h b/src/core/lib/gpr/tls_gcc.h
similarity index 91%
rename from include/grpc/support/tls_gcc.h
rename to src/core/lib/gpr/tls_gcc.h
index b44f0f1..14c59ec 100644
--- a/include/grpc/support/tls_gcc.h
+++ b/src/core/lib/gpr/tls_gcc.h
@@ -16,8 +16,8 @@
  *
  */
 
-#ifndef GRPC_SUPPORT_TLS_GCC_H
-#define GRPC_SUPPORT_TLS_GCC_H
+#ifndef GRPC_CORE_LIB_GPR_TLS_GCC_H
+#define GRPC_CORE_LIB_GPR_TLS_GCC_H
 
 #include <stdbool.h>
 
@@ -47,4 +47,4 @@
 #define gpr_tls_set(tls, new_value) (((tls)->value) = (new_value))
 #define gpr_tls_get(tls) ((tls)->value)
 
-#endif /* GRPC_SUPPORT_TLS_GCC_H */
+#endif /* GRPC_CORE_LIB_GPR_TLS_GCC_H */
diff --git a/include/grpc/support/tls_msvc.h b/src/core/lib/gpr/tls_msvc.h
similarity index 92%
rename from include/grpc/support/tls_msvc.h
rename to src/core/lib/gpr/tls_msvc.h
index 68a411f..a6cc417 100644
--- a/include/grpc/support/tls_msvc.h
+++ b/src/core/lib/gpr/tls_msvc.h
@@ -16,8 +16,8 @@
  *
  */
 
-#ifndef GRPC_SUPPORT_TLS_MSVC_H
-#define GRPC_SUPPORT_TLS_MSVC_H
+#ifndef GRPC_CORE_LIB_GPR_TLS_MSVC_H
+#define GRPC_CORE_LIB_GPR_TLS_MSVC_H
 
 /** Thread local storage based on ms visual c compiler primitives.
    #include tls.h to use this - and see that file for documentation */
@@ -47,4 +47,4 @@
 #define gpr_tls_set(tls, new_value) (((tls)->value) = (new_value))
 #define gpr_tls_get(tls) ((tls)->value)
 
-#endif /* GRPC_SUPPORT_TLS_MSVC_H */
+#endif /* GRPC_CORE_LIB_GPR_TLS_MSVC_H */
diff --git a/src/core/lib/gpr/tls_pthread.cc b/src/core/lib/gpr/tls_pthread.cc
index ebeef2a..2e5b306 100644
--- a/src/core/lib/gpr/tls_pthread.cc
+++ b/src/core/lib/gpr/tls_pthread.cc
@@ -20,7 +20,7 @@
 
 #ifdef GPR_PTHREAD_TLS
 
-#include <grpc/support/tls.h>
+#include "src/core/lib/gpr/tls.h"
 
 intptr_t gpr_tls_set(struct gpr_pthread_thread_local* tls, intptr_t value) {
   GPR_ASSERT(0 == pthread_setspecific(tls->key, (void*)value));
diff --git a/include/grpc/support/tls_pthread.h b/src/core/lib/gpr/tls_pthread.h
similarity index 93%
rename from include/grpc/support/tls_pthread.h
rename to src/core/lib/gpr/tls_pthread.h
index 249c8b1..9202653 100644
--- a/include/grpc/support/tls_pthread.h
+++ b/src/core/lib/gpr/tls_pthread.h
@@ -16,8 +16,8 @@
  *
  */
 
-#ifndef GRPC_SUPPORT_TLS_PTHREAD_H
-#define GRPC_SUPPORT_TLS_PTHREAD_H
+#ifndef GRPC_CORE_LIB_GPR_TLS_PTHREAD_H
+#define GRPC_CORE_LIB_GPR_TLS_PTHREAD_H
 
 #include <grpc/support/log.h> /* for GPR_ASSERT */
 #include <pthread.h>
@@ -51,4 +51,4 @@
 }
 #endif
 
-#endif /* GRPC_SUPPORT_TLS_PTHREAD_H */
+#endif /* GRPC_CORE_LIB_GPR_TLS_PTHREAD_H */
diff --git a/include/grpc/support/useful.h b/src/core/lib/gpr/useful.h
similarity index 94%
rename from include/grpc/support/useful.h
rename to src/core/lib/gpr/useful.h
index bd66d3b..a4e73b9 100644
--- a/include/grpc/support/useful.h
+++ b/src/core/lib/gpr/useful.h
@@ -16,8 +16,8 @@
  *
  */
 
-#ifndef GRPC_SUPPORT_USEFUL_H
-#define GRPC_SUPPORT_USEFUL_H
+#ifndef GRPC_CORE_LIB_GPR_USEFUL_H
+#define GRPC_CORE_LIB_GPR_USEFUL_H
 
 /** useful macros that don't belong anywhere else */
 
@@ -62,4 +62,4 @@
 #define GPR_HASH_POINTER(x, range) \
   ((((size_t)x) >> 4) ^ (((size_t)x) >> 9) ^ (((size_t)x) >> 14)) % (range)
 
-#endif /* GRPC_SUPPORT_USEFUL_H */
+#endif /* GRPC_CORE_LIB_GPR_USEFUL_H */
diff --git a/src/core/lib/http/format_request.cc b/src/core/lib/http/format_request.cc
index 473fa71..884a70e 100644
--- a/src/core/lib/http/format_request.cc
+++ b/src/core/lib/http/format_request.cc
@@ -25,7 +25,6 @@
 #include <grpc/slice.h>
 #include <grpc/support/alloc.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
 #include "src/core/lib/gpr/string.h"
 
 static void fill_common_header(const grpc_httpcli_request* request,
diff --git a/src/core/lib/http/httpcli.cc b/src/core/lib/http/httpcli.cc
index c43c92b..9775ed0 100644
--- a/src/core/lib/http/httpcli.cc
+++ b/src/core/lib/http/httpcli.cc
@@ -23,7 +23,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/gpr/string.h"
diff --git a/src/core/lib/http/parser.cc b/src/core/lib/http/parser.cc
index fb4eb23..ee6941f 100644
--- a/src/core/lib/http/parser.cc
+++ b/src/core/lib/http/parser.cc
@@ -23,7 +23,8 @@
 
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
-#include <grpc/support/useful.h>
+
+#include "src/core/lib/gpr/useful.h"
 
 grpc_core::TraceFlag grpc_http1_trace(false, "http1");
 
diff --git a/src/core/lib/iomgr/error.cc b/src/core/lib/iomgr/error.cc
index 0e27ad4..d5b5013 100644
--- a/src/core/lib/iomgr/error.cc
+++ b/src/core/lib/iomgr/error.cc
@@ -26,13 +26,13 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
 
 #ifdef GPR_WINDOWS
 #include <grpc/support/log_windows.h>
 #endif
 
 #include "src/core/lib/debug/trace.h"
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/error_internal.h"
 #include "src/core/lib/profiling/timers.h"
 #include "src/core/lib/slice/slice_internal.h"
diff --git a/src/core/lib/iomgr/ev_epoll1_linux.cc b/src/core/lib/iomgr/ev_epoll1_linux.cc
index 1ef70d2..a05d74c 100644
--- a/src/core/lib/iomgr/ev_epoll1_linux.cc
+++ b/src/core/lib/iomgr/ev_epoll1_linux.cc
@@ -39,11 +39,11 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/cpu.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/tls.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/debug/stats.h"
 #include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gpr/tls.h"
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/gprpp/manual_constructor.h"
 #include "src/core/lib/iomgr/block_annotate.h"
 #include "src/core/lib/iomgr/ev_posix.h"
diff --git a/src/core/lib/iomgr/ev_epollex_linux.cc b/src/core/lib/iomgr/ev_epollex_linux.cc
index 30c7a89..000faed 100644
--- a/src/core/lib/iomgr/ev_epollex_linux.cc
+++ b/src/core/lib/iomgr/ev_epollex_linux.cc
@@ -37,11 +37,11 @@
 
 #include <grpc/support/alloc.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/tls.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/debug/stats.h"
 #include "src/core/lib/gpr/spinlock.h"
+#include "src/core/lib/gpr/tls.h"
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/gprpp/manual_constructor.h"
 #include "src/core/lib/iomgr/block_annotate.h"
 #include "src/core/lib/iomgr/iomgr_internal.h"
diff --git a/src/core/lib/iomgr/ev_epollsig_linux.cc b/src/core/lib/iomgr/ev_epollsig_linux.cc
index c895489..4c26bbd 100644
--- a/src/core/lib/iomgr/ev_epollsig_linux.cc
+++ b/src/core/lib/iomgr/ev_epollsig_linux.cc
@@ -39,10 +39,10 @@
 
 #include <grpc/support/alloc.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/tls.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/debug/stats.h"
+#include "src/core/lib/gpr/tls.h"
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/gprpp/manual_constructor.h"
 #include "src/core/lib/iomgr/block_annotate.h"
 #include "src/core/lib/iomgr/ev_posix.h"
diff --git a/src/core/lib/iomgr/ev_poll_posix.cc b/src/core/lib/iomgr/ev_poll_posix.cc
index 8ccc256..9833b47 100644
--- a/src/core/lib/iomgr/ev_poll_posix.cc
+++ b/src/core/lib/iomgr/ev_poll_posix.cc
@@ -34,11 +34,11 @@
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/tls.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/debug/stats.h"
 #include "src/core/lib/gpr/murmur_hash.h"
+#include "src/core/lib/gpr/tls.h"
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/block_annotate.h"
 #include "src/core/lib/iomgr/iomgr_internal.h"
 #include "src/core/lib/iomgr/wakeup_fd_cv.h"
diff --git a/src/core/lib/iomgr/ev_posix.cc b/src/core/lib/iomgr/ev_posix.cc
index 8100bec..af5dfe5 100644
--- a/src/core/lib/iomgr/ev_posix.cc
+++ b/src/core/lib/iomgr/ev_posix.cc
@@ -27,10 +27,10 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/debug/trace.h"
 #include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/ev_epoll1_linux.h"
 #include "src/core/lib/iomgr/ev_epollex_linux.h"
 #include "src/core/lib/iomgr/ev_epollsig_linux.h"
diff --git a/src/core/lib/iomgr/exec_ctx.h b/src/core/lib/iomgr/exec_ctx.h
index 2e71482..3d9a157 100644
--- a/src/core/lib/iomgr/exec_ctx.h
+++ b/src/core/lib/iomgr/exec_ctx.h
@@ -22,8 +22,8 @@
 #include <grpc/support/atm.h>
 #include <grpc/support/cpu.h>
 #include <grpc/support/log.h>
-#include <grpc/support/tls.h>
 
+#include "src/core/lib/gpr/tls.h"
 #include "src/core/lib/iomgr/closure.h"
 
 typedef gpr_atm grpc_millis;
diff --git a/src/core/lib/iomgr/executor.cc b/src/core/lib/iomgr/executor.cc
index 835dc9d..3288ea3 100644
--- a/src/core/lib/iomgr/executor.cc
+++ b/src/core/lib/iomgr/executor.cc
@@ -25,11 +25,11 @@
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/tls.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/debug/stats.h"
 #include "src/core/lib/gpr/spinlock.h"
+#include "src/core/lib/gpr/tls.h"
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/exec_ctx.h"
 
 #define MAX_DEPTH 2
diff --git a/src/core/lib/iomgr/fork_posix.cc b/src/core/lib/iomgr/fork_posix.cc
index 9bfa792..c581dae 100644
--- a/src/core/lib/iomgr/fork_posix.cc
+++ b/src/core/lib/iomgr/fork_posix.cc
@@ -25,7 +25,6 @@
 #include <grpc/fork.h>
 #include <grpc/support/log.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/gpr/env.h"
 #include "src/core/lib/gpr/fork.h"
diff --git a/src/core/lib/iomgr/iocp_windows.cc b/src/core/lib/iomgr/iocp_windows.cc
index 0b6e682..d730ce4 100644
--- a/src/core/lib/iomgr/iocp_windows.cc
+++ b/src/core/lib/iomgr/iocp_windows.cc
@@ -27,7 +27,6 @@
 #include <grpc/support/log.h>
 #include <grpc/support/log_windows.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/debug/stats.h"
 #include "src/core/lib/iomgr/iocp_windows.h"
diff --git a/src/core/lib/iomgr/iomgr.cc b/src/core/lib/iomgr/iomgr.cc
index 4cd0a4f..9e407a2 100644
--- a/src/core/lib/iomgr/iomgr.cc
+++ b/src/core/lib/iomgr/iomgr.cc
@@ -29,10 +29,10 @@
 #include <grpc/support/string_util.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/gpr/env.h"
 #include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/exec_ctx.h"
 #include "src/core/lib/iomgr/executor.h"
 #include "src/core/lib/iomgr/iomgr_internal.h"
diff --git a/src/core/lib/iomgr/resolve_address_posix.cc b/src/core/lib/iomgr/resolve_address_posix.cc
index 176caee..3eea709 100644
--- a/src/core/lib/iomgr/resolve_address_posix.cc
+++ b/src/core/lib/iomgr/resolve_address_posix.cc
@@ -27,13 +27,14 @@
 #include <sys/types.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/thd.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
+
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/block_annotate.h"
 #include "src/core/lib/iomgr/executor.h"
 #include "src/core/lib/iomgr/iomgr_internal.h"
diff --git a/src/core/lib/iomgr/resolve_address_uv.cc b/src/core/lib/iomgr/resolve_address_uv.cc
index 3eab04f..6eb6fe3 100644
--- a/src/core/lib/iomgr/resolve_address_uv.cc
+++ b/src/core/lib/iomgr/resolve_address_uv.cc
@@ -22,11 +22,11 @@
 #include <uv.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
 
+#include "src/core/lib/gpr/host_port.h"
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/closure.h"
 #include "src/core/lib/iomgr/error.h"
 #include "src/core/lib/iomgr/exec_ctx.h"
diff --git a/src/core/lib/iomgr/resolve_address_windows.cc b/src/core/lib/iomgr/resolve_address_windows.cc
index e44ab39..e875d77 100644
--- a/src/core/lib/iomgr/resolve_address_windows.cc
+++ b/src/core/lib/iomgr/resolve_address_windows.cc
@@ -28,12 +28,13 @@
 #include <sys/types.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/log_windows.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/thd.h>
 #include <grpc/support/time.h>
+
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/iomgr/block_annotate.h"
 #include "src/core/lib/iomgr/executor.h"
diff --git a/src/core/lib/iomgr/resource_quota.cc b/src/core/lib/iomgr/resource_quota.cc
index eaf2f5d..e64d772 100644
--- a/src/core/lib/iomgr/resource_quota.cc
+++ b/src/core/lib/iomgr/resource_quota.cc
@@ -27,8 +27,8 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
 
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/combiner.h"
 
 grpc_core::TraceFlag grpc_resource_quota_trace(false, "resource_quota");
diff --git a/src/core/lib/iomgr/sockaddr_utils.cc b/src/core/lib/iomgr/sockaddr_utils.cc
index 71e3e38..ac97af4 100644
--- a/src/core/lib/iomgr/sockaddr_utils.cc
+++ b/src/core/lib/iomgr/sockaddr_utils.cc
@@ -23,11 +23,11 @@
 #include <string.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/port_platform.h>
 #include <grpc/support/string_util.h>
 
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/iomgr/sockaddr.h"
 #include "src/core/lib/iomgr/socket_utils.h"
diff --git a/src/core/lib/iomgr/socket_factory_posix.cc b/src/core/lib/iomgr/socket_factory_posix.cc
index bc7d0b1..1c1b2fb 100644
--- a/src/core/lib/iomgr/socket_factory_posix.cc
+++ b/src/core/lib/iomgr/socket_factory_posix.cc
@@ -21,11 +21,11 @@
 #ifdef GRPC_POSIX_SOCKET
 
 #include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/socket_factory_posix.h"
 
 #include <grpc/impl/codegen/grpc_types.h>
 #include <grpc/support/sync.h>
-#include <grpc/support/useful.h>
 
 void grpc_socket_factory_init(grpc_socket_factory* factory,
                               const grpc_socket_factory_vtable* vtable) {
diff --git a/src/core/lib/iomgr/socket_mutator.cc b/src/core/lib/iomgr/socket_mutator.cc
index 9d30e46..8c8f0e5 100644
--- a/src/core/lib/iomgr/socket_mutator.cc
+++ b/src/core/lib/iomgr/socket_mutator.cc
@@ -18,11 +18,11 @@
 
 #include "src/core/lib/iomgr/socket_mutator.h"
 
-#include "src/core/lib/channel/channel_args.h"
-
 #include <grpc/impl/codegen/grpc_types.h>
 #include <grpc/support/sync.h>
-#include <grpc/support/useful.h>
+
+#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gpr/useful.h"
 
 void grpc_socket_mutator_init(grpc_socket_mutator* mutator,
                               const grpc_socket_mutator_vtable* vtable) {
diff --git a/src/core/lib/iomgr/socket_utils_common_posix.cc b/src/core/lib/iomgr/socket_utils_common_posix.cc
index 5068a80..d02d77e 100644
--- a/src/core/lib/iomgr/socket_utils_common_posix.cc
+++ b/src/core/lib/iomgr/socket_utils_common_posix.cc
@@ -36,10 +36,11 @@
 #include <unistd.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/port_platform.h>
 #include <grpc/support/sync.h>
+
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/iomgr/sockaddr_utils.h"
 
diff --git a/src/core/lib/iomgr/tcp_client_windows.cc b/src/core/lib/iomgr/tcp_client_windows.cc
index 97aa923..d46569d 100644
--- a/src/core/lib/iomgr/tcp_client_windows.cc
+++ b/src/core/lib/iomgr/tcp_client_windows.cc
@@ -28,7 +28,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/log_windows.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/iomgr/iocp_windows.h"
diff --git a/src/core/lib/iomgr/tcp_posix.cc b/src/core/lib/iomgr/tcp_posix.cc
index 07aed2d..e78e197 100644
--- a/src/core/lib/iomgr/tcp_posix.cc
+++ b/src/core/lib/iomgr/tcp_posix.cc
@@ -37,12 +37,12 @@
 #include <grpc/support/string_util.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/debug/stats.h"
 #include "src/core/lib/debug/trace.h"
 #include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/ev_posix.h"
 #include "src/core/lib/iomgr/executor.h"
 #include "src/core/lib/profiling/timers.h"
diff --git a/src/core/lib/iomgr/tcp_server_posix.cc b/src/core/lib/iomgr/tcp_server_posix.cc
index 2fa00a8..89d9160 100644
--- a/src/core/lib/iomgr/tcp_server_posix.cc
+++ b/src/core/lib/iomgr/tcp_server_posix.cc
@@ -42,7 +42,6 @@
 #include <grpc/support/string_util.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/gpr/string.h"
diff --git a/src/core/lib/iomgr/tcp_windows.cc b/src/core/lib/iomgr/tcp_windows.cc
index 6d091b7..6777719 100644
--- a/src/core/lib/iomgr/tcp_windows.cc
+++ b/src/core/lib/iomgr/tcp_windows.cc
@@ -30,8 +30,8 @@
 #include <grpc/support/log.h>
 #include <grpc/support/log_windows.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
 
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/iocp_windows.h"
 #include "src/core/lib/iomgr/sockaddr.h"
 #include "src/core/lib/iomgr/sockaddr_utils.h"
diff --git a/src/core/lib/iomgr/timer_generic.cc b/src/core/lib/iomgr/timer_generic.cc
index 177bdec..ef86d23 100644
--- a/src/core/lib/iomgr/timer_generic.cc
+++ b/src/core/lib/iomgr/timer_generic.cc
@@ -29,10 +29,11 @@
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/sync.h>
-#include <grpc/support/tls.h>
-#include <grpc/support/useful.h>
+
 #include "src/core/lib/debug/trace.h"
 #include "src/core/lib/gpr/spinlock.h"
+#include "src/core/lib/gpr/tls.h"
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/time_averaged_stats.h"
 #include "src/core/lib/iomgr/timer_heap.h"
 
diff --git a/src/core/lib/iomgr/timer_heap.cc b/src/core/lib/iomgr/timer_heap.cc
index b350452..632928f 100644
--- a/src/core/lib/iomgr/timer_heap.cc
+++ b/src/core/lib/iomgr/timer_heap.cc
@@ -25,7 +25,8 @@
 #include <string.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/useful.h>
+
+#include "src/core/lib/gpr/useful.h"
 
 /* Adjusts a heap so as to move a hole at position i closer to the root,
    until a suitable position is found for element t. Then, copies t into that
diff --git a/src/core/lib/iomgr/unix_sockets_posix.cc b/src/core/lib/iomgr/unix_sockets_posix.cc
index af862c0..91b7cb1 100644
--- a/src/core/lib/iomgr/unix_sockets_posix.cc
+++ b/src/core/lib/iomgr/unix_sockets_posix.cc
@@ -30,7 +30,8 @@
 
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
-#include <grpc/support/useful.h>
+
+#include "src/core/lib/gpr/useful.h"
 
 void grpc_create_socketpair_if_unix(int sv[2]) {
   GPR_ASSERT(socketpair(AF_UNIX, SOCK_STREAM, 0, sv) == 0);
diff --git a/src/core/lib/iomgr/wakeup_fd_cv.cc b/src/core/lib/iomgr/wakeup_fd_cv.cc
index c785114..4818caf 100644
--- a/src/core/lib/iomgr/wakeup_fd_cv.cc
+++ b/src/core/lib/iomgr/wakeup_fd_cv.cc
@@ -30,7 +30,8 @@
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
+
+#include "src/core/lib/gpr/useful.h"
 
 #define MAX_TABLE_RESIZE 256
 
diff --git a/src/core/lib/security/credentials/jwt/jwt_verifier.cc b/src/core/lib/security/credentials/jwt/jwt_verifier.cc
index 860506d..8b22307 100644
--- a/src/core/lib/security/credentials/jwt/jwt_verifier.cc
+++ b/src/core/lib/security/credentials/jwt/jwt_verifier.cc
@@ -25,7 +25,6 @@
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/sync.h>
-#include <grpc/support/useful.h>
 
 extern "C" {
 #include <openssl/pem.h>
diff --git a/src/core/lib/security/transport/security_connector.cc b/src/core/lib/security/transport/security_connector.cc
index 1d962f9..fd632bd 100644
--- a/src/core/lib/security/transport/security_connector.cc
+++ b/src/core/lib/security/transport/security_connector.cc
@@ -23,7 +23,6 @@
 
 #include <grpc/slice_buffer.h>
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 
@@ -31,6 +30,7 @@
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/channel/handshaker.h"
 #include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/iomgr/load_file.h"
 #include "src/core/lib/security/context/security_context.h"
diff --git a/src/core/lib/slice/b64.cc b/src/core/lib/slice/b64.cc
index f36b13e..5c6610c 100644
--- a/src/core/lib/slice/b64.cc
+++ b/src/core/lib/slice/b64.cc
@@ -23,8 +23,8 @@
 
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
-#include <grpc/support/useful.h>
 
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/slice/slice_internal.h"
 
 /* --- Constants. --- */
diff --git a/src/core/lib/slice/slice_buffer.cc b/src/core/lib/slice/slice_buffer.cc
index 33ec2af..178c7f9 100644
--- a/src/core/lib/slice/slice_buffer.cc
+++ b/src/core/lib/slice/slice_buffer.cc
@@ -23,8 +23,8 @@
 
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
-#include <grpc/support/useful.h>
 
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/slice/slice_internal.h"
 
 /* grow a buffer; requires GRPC_SLICE_BUFFER_INLINE_ELEMENTS > 1 */
diff --git a/src/core/lib/surface/call.cc b/src/core/lib/surface/call.cc
index b538cc0..a7b932b 100644
--- a/src/core/lib/surface/call.cc
+++ b/src/core/lib/surface/call.cc
@@ -28,13 +28,13 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/channel/channel_stack.h"
 #include "src/core/lib/compression/algorithm_metadata.h"
 #include "src/core/lib/debug/stats.h"
 #include "src/core/lib/gpr/arena.h"
 #include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/timer.h"
 #include "src/core/lib/profiling/timers.h"
 #include "src/core/lib/slice/slice_internal.h"
diff --git a/src/core/lib/surface/channel_init.cc b/src/core/lib/surface/channel_init.cc
index 95cbbbd..99690e6 100644
--- a/src/core/lib/surface/channel_init.cc
+++ b/src/core/lib/surface/channel_init.cc
@@ -19,7 +19,6 @@
 #include "src/core/lib/surface/channel_init.h"
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/useful.h>
 
 typedef struct stage_slot {
   grpc_channel_init_stage fn;
diff --git a/src/core/lib/surface/completion_queue.cc b/src/core/lib/surface/completion_queue.cc
index 8362522..a2c5208 100644
--- a/src/core/lib/surface/completion_queue.cc
+++ b/src/core/lib/surface/completion_queue.cc
@@ -28,11 +28,11 @@
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/time.h>
-#include <grpc/support/tls.h>
 
 #include "src/core/lib/debug/stats.h"
 #include "src/core/lib/gpr/spinlock.h"
 #include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gpr/tls.h"
 #include "src/core/lib/iomgr/pollset.h"
 #include "src/core/lib/iomgr/timer.h"
 #include "src/core/lib/profiling/timers.h"
diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc
index c8c1db3..1e59434 100644
--- a/src/core/lib/surface/server.cc
+++ b/src/core/lib/surface/server.cc
@@ -25,7 +25,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/channel/connected_channel.h"
diff --git a/src/core/lib/transport/bdp_estimator.cc b/src/core/lib/transport/bdp_estimator.cc
index 5fcc62e..2ba1cfd 100644
--- a/src/core/lib/transport/bdp_estimator.cc
+++ b/src/core/lib/transport/bdp_estimator.cc
@@ -21,7 +21,7 @@
 #include <inttypes.h>
 #include <stdlib.h>
 
-#include <grpc/support/useful.h>
+#include "src/core/lib/gpr/useful.h"
 
 grpc_core::TraceFlag grpc_bdp_estimator_trace(false, "bdp_estimator");
 
diff --git a/src/core/lib/transport/metadata.h b/src/core/lib/transport/metadata.h
index 78e6bef..82142eb 100644
--- a/src/core/lib/transport/metadata.h
+++ b/src/core/lib/transport/metadata.h
@@ -21,8 +21,8 @@
 
 #include <grpc/grpc.h>
 #include <grpc/slice.h>
-#include <grpc/support/useful.h>
 
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/exec_ctx.h"
 
 extern grpc_core::DebugOnlyTraceFlag grpc_trace_metadata;
diff --git a/src/core/lib/transport/pid_controller.cc b/src/core/lib/transport/pid_controller.cc
index e31cc85..b33ea63 100644
--- a/src/core/lib/transport/pid_controller.cc
+++ b/src/core/lib/transport/pid_controller.cc
@@ -17,7 +17,8 @@
  */
 
 #include "src/core/lib/transport/pid_controller.h"
-#include <grpc/support/useful.h>
+
+#include "src/core/lib/gpr/useful.h"
 
 namespace grpc_core {
 
diff --git a/src/core/lib/transport/transport_op_string.cc b/src/core/lib/transport/transport_op_string.cc
index 58a21e9..6898da1 100644
--- a/src/core/lib/transport/transport_op_string.cc
+++ b/src/core/lib/transport/transport_op_string.cc
@@ -27,7 +27,6 @@
 
 #include <grpc/support/alloc.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/slice/slice_string_helpers.h"
 #include "src/core/lib/transport/connectivity_state.h"
diff --git a/src/core/tsi/fake_transport_security.cc b/src/core/tsi/fake_transport_security.cc
index b907636..7d5aaa7 100644
--- a/src/core/tsi/fake_transport_security.cc
+++ b/src/core/tsi/fake_transport_security.cc
@@ -24,7 +24,8 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/port_platform.h>
-#include <grpc/support/useful.h>
+
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/slice/slice_internal.h"
 #include "src/core/tsi/transport_security_grpc.h"
 
diff --git a/src/core/tsi/ssl_transport_security.cc b/src/core/tsi/ssl_transport_security.cc
index b396a62..6de02d4 100644
--- a/src/core/tsi/ssl_transport_security.cc
+++ b/src/core/tsi/ssl_transport_security.cc
@@ -37,7 +37,6 @@
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/useful.h>
 
 extern "C" {
 #include <openssl/bio.h>
diff --git a/src/cpp/client/channel_cc.cc b/src/cpp/client/channel_cc.cc
index 362dff6..e4ed349 100644
--- a/src/cpp/client/channel_cc.cc
+++ b/src/cpp/client/channel_cc.cc
@@ -41,7 +41,6 @@
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "src/core/lib/gpr/env.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/profiling/timers.h"
diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc
index 200e477..790095e 100644
--- a/src/cpp/server/server_builder.cc
+++ b/src/cpp/server/server_builder.cc
@@ -23,8 +23,8 @@
 #include <grpc++/server.h>
 #include <grpc/support/cpu.h>
 #include <grpc/support/log.h>
-#include <grpc/support/useful.h>
 
+#include "src/core/lib/gpr/useful.h"
 #include "src/cpp/server/thread_pool_interface.h"
 
 namespace grpc {
diff --git a/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.mm b/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.mm
index 16940a4..d91b5cf 100644
--- a/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.mm
+++ b/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.mm
@@ -34,12 +34,12 @@
 #include <string.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/security/credentials/credentials.h"
 #include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/gpr/tmpfile.h"
 #include "test/core/end2end/data/ssl_test_data.h"
diff --git a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m
index 09ee062..28414b8 100644
--- a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m
+++ b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m
@@ -23,7 +23,6 @@
 #import <Cronet/Cronet.h>
 #import <grpc/grpc.h>
 #import <grpc/grpc_cronet.h>
-#import <grpc/support/host_port.h>
 #import "test/core/end2end/cq_verifier.h"
 #import "test/core/util/port.h"
 
@@ -32,6 +31,7 @@
 
 #import "src/core/lib/channel/channel_args.h"
 #import "src/core/lib/gpr/env.h"
+#import "src/core/lib/gpr/host_port.h"
 #import "src/core/lib/gpr/string.h"
 #import "src/core/lib/gpr/tmpfile.h"
 #import "test/core/end2end/data/ssl_test_data.h"
diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py
index 3d8ee10..2da3c0b 100644
--- a/src/python/grpcio/grpc_core_dependencies.py
+++ b/src/python/grpcio/grpc_core_dependencies.py
@@ -18,8 +18,6 @@
     'src/core/lib/gpr/alloc.cc',
     'src/core/lib/gpr/arena.cc',
     'src/core/lib/gpr/atm.cc',
-    'src/core/lib/gpr/avl.cc',
-    'src/core/lib/gpr/cmdline.cc',
     'src/core/lib/gpr/cpu_iphone.cc',
     'src/core/lib/gpr/cpu_linux.cc',
     'src/core/lib/gpr/cpu_posix.cc',
@@ -40,8 +38,6 @@
     'src/core/lib/gpr/string_posix.cc',
     'src/core/lib/gpr/string_util_windows.cc',
     'src/core/lib/gpr/string_windows.cc',
-    'src/core/lib/gpr/subprocess_posix.cc',
-    'src/core/lib/gpr/subprocess_windows.cc',
     'src/core/lib/gpr/sync.cc',
     'src/core/lib/gpr/sync_posix.cc',
     'src/core/lib/gpr/sync_windows.cc',
@@ -60,6 +56,7 @@
     'src/core/lib/profiling/basic_timers.cc',
     'src/core/lib/profiling/stap_timers.cc',
     'src/core/lib/surface/init.cc',
+    'src/core/lib/avl/avl.cc',
     'src/core/lib/backoff/backoff.cc',
     'src/core/lib/channel/channel_args.cc',
     'src/core/lib/channel/channel_stack.cc',
@@ -269,7 +266,6 @@
     'src/core/ext/filters/client_channel/proxy_mapper.cc',
     'src/core/ext/filters/client_channel/proxy_mapper_registry.cc',
     'src/core/ext/filters/client_channel/resolver.cc',
-    'src/core/ext/filters/client_channel/resolver_factory.cc',
     'src/core/ext/filters/client_channel/resolver_registry.cc',
     'src/core/ext/filters/client_channel/retry_throttle.cc',
     'src/core/ext/filters/client_channel/subchannel.cc',
diff --git a/src/ruby/ext/grpc/rb_channel.c b/src/ruby/ext/grpc/rb_channel.c
index c56ac21..e8bfeb3 100644
--- a/src/ruby/ext/grpc/rb_channel.c
+++ b/src/ruby/ext/grpc/rb_channel.c
@@ -427,16 +427,15 @@
     parent_call = grpc_rb_get_wrapped_call(parent);
   }
 
-  cq = grpc_completion_queue_create_for_pluck(NULL);
   TypedData_Get_Struct(self, grpc_rb_channel, &grpc_channel_data_type, wrapper);
   if (wrapper->bg_wrapped == NULL) {
     rb_raise(rb_eRuntimeError, "closed!");
     return Qnil;
   }
 
+  cq = grpc_completion_queue_create_for_pluck(NULL);
   method_slice =
       grpc_slice_from_copied_buffer(RSTRING_PTR(method), RSTRING_LEN(method));
-
   call = grpc_channel_create_call(wrapper->bg_wrapped->channel, parent_call,
                                   flags, cq, method_slice, host_slice_ptr,
                                   grpc_rb_time_timeval(deadline,
diff --git a/src/ruby/ext/grpc/rb_compression_options.c b/src/ruby/ext/grpc/rb_compression_options.c
index e24f20d..7fdec2e 100644
--- a/src/ruby/ext/grpc/rb_compression_options.c
+++ b/src/ruby/ext/grpc/rb_compression_options.c
@@ -27,6 +27,8 @@
 #include <grpc/impl/codegen/compression_types.h>
 #include <grpc/impl/codegen/grpc_types.h>
 #include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
+#include <grpc/support/string_util.h>
 #include <string.h>
 
 #include "rb_grpc.h"
@@ -159,7 +161,6 @@
     grpc_compression_algorithm* algorithm_value, VALUE algorithm_name) {
   grpc_slice name_slice;
   VALUE algorithm_name_as_string = Qnil;
-  char* tmp_str = NULL;
 
   Check_Type(algorithm_name, T_SYMBOL);
 
@@ -175,8 +176,17 @@
    * the algorithm parse function
    * in GRPC core. */
   if (!grpc_compression_algorithm_parse(name_slice, algorithm_value)) {
-    tmp_str = grpc_slice_to_c_string(name_slice);
-    rb_raise(rb_eNameError, "Invalid compression algorithm name: %s", tmp_str);
+    char* name_slice_str = grpc_slice_to_c_string(name_slice);
+    char* error_message_str = NULL;
+    VALUE error_message_ruby_str = Qnil;
+    GPR_ASSERT(gpr_asprintf(&error_message_str,
+                            "Invalid compression algorithm name: %s",
+                            name_slice_str) != -1);
+    gpr_free(name_slice_str);
+    error_message_ruby_str =
+        rb_str_new(error_message_str, strlen(error_message_str));
+    gpr_free(error_message_str);
+    rb_raise(rb_eNameError, StringValueCStr(error_message_ruby_str));
   }
 
   grpc_slice_unref(name_slice);
diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.c b/src/ruby/ext/grpc/rb_grpc_imports.generated.c
index 576084b..38e085e 100644
--- a/src/ruby/ext/grpc/rb_grpc_imports.generated.c
+++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.c
@@ -199,27 +199,8 @@
 gpr_free_aligned_type gpr_free_aligned_import;
 gpr_set_allocation_functions_type gpr_set_allocation_functions_import;
 gpr_get_allocation_functions_type gpr_get_allocation_functions_import;
-gpr_avl_create_type gpr_avl_create_import;
-gpr_avl_ref_type gpr_avl_ref_import;
-gpr_avl_unref_type gpr_avl_unref_import;
-gpr_avl_add_type gpr_avl_add_import;
-gpr_avl_remove_type gpr_avl_remove_import;
-gpr_avl_get_type gpr_avl_get_import;
-gpr_avl_maybe_get_type gpr_avl_maybe_get_import;
-gpr_avl_is_empty_type gpr_avl_is_empty_import;
-gpr_cmdline_create_type gpr_cmdline_create_import;
-gpr_cmdline_add_int_type gpr_cmdline_add_int_import;
-gpr_cmdline_add_flag_type gpr_cmdline_add_flag_import;
-gpr_cmdline_add_string_type gpr_cmdline_add_string_import;
-gpr_cmdline_on_extra_arg_type gpr_cmdline_on_extra_arg_import;
-gpr_cmdline_set_survive_failure_type gpr_cmdline_set_survive_failure_import;
-gpr_cmdline_parse_type gpr_cmdline_parse_import;
-gpr_cmdline_destroy_type gpr_cmdline_destroy_import;
-gpr_cmdline_usage_string_type gpr_cmdline_usage_string_import;
 gpr_cpu_num_cores_type gpr_cpu_num_cores_import;
 gpr_cpu_current_cpu_type gpr_cpu_current_cpu_import;
-gpr_join_host_port_type gpr_join_host_port_import;
-gpr_split_host_port_type gpr_split_host_port_import;
 gpr_log_severity_string_type gpr_log_severity_string_import;
 gpr_log_type gpr_log_import;
 gpr_log_message_type gpr_log_message_import;
@@ -229,11 +210,6 @@
 gpr_format_message_type gpr_format_message_import;
 gpr_strdup_type gpr_strdup_import;
 gpr_asprintf_type gpr_asprintf_import;
-gpr_subprocess_binary_extension_type gpr_subprocess_binary_extension_import;
-gpr_subprocess_create_type gpr_subprocess_create_import;
-gpr_subprocess_destroy_type gpr_subprocess_destroy_import;
-gpr_subprocess_join_type gpr_subprocess_join_import;
-gpr_subprocess_interrupt_type gpr_subprocess_interrupt_import;
 gpr_mu_init_type gpr_mu_init_import;
 gpr_mu_destroy_type gpr_mu_destroy_import;
 gpr_mu_lock_type gpr_mu_lock_import;
@@ -466,27 +442,8 @@
   gpr_free_aligned_import = (gpr_free_aligned_type) GetProcAddress(library, "gpr_free_aligned");
   gpr_set_allocation_functions_import = (gpr_set_allocation_functions_type) GetProcAddress(library, "gpr_set_allocation_functions");
   gpr_get_allocation_functions_import = (gpr_get_allocation_functions_type) GetProcAddress(library, "gpr_get_allocation_functions");
-  gpr_avl_create_import = (gpr_avl_create_type) GetProcAddress(library, "gpr_avl_create");
-  gpr_avl_ref_import = (gpr_avl_ref_type) GetProcAddress(library, "gpr_avl_ref");
-  gpr_avl_unref_import = (gpr_avl_unref_type) GetProcAddress(library, "gpr_avl_unref");
-  gpr_avl_add_import = (gpr_avl_add_type) GetProcAddress(library, "gpr_avl_add");
-  gpr_avl_remove_import = (gpr_avl_remove_type) GetProcAddress(library, "gpr_avl_remove");
-  gpr_avl_get_import = (gpr_avl_get_type) GetProcAddress(library, "gpr_avl_get");
-  gpr_avl_maybe_get_import = (gpr_avl_maybe_get_type) GetProcAddress(library, "gpr_avl_maybe_get");
-  gpr_avl_is_empty_import = (gpr_avl_is_empty_type) GetProcAddress(library, "gpr_avl_is_empty");
-  gpr_cmdline_create_import = (gpr_cmdline_create_type) GetProcAddress(library, "gpr_cmdline_create");
-  gpr_cmdline_add_int_import = (gpr_cmdline_add_int_type) GetProcAddress(library, "gpr_cmdline_add_int");
-  gpr_cmdline_add_flag_import = (gpr_cmdline_add_flag_type) GetProcAddress(library, "gpr_cmdline_add_flag");
-  gpr_cmdline_add_string_import = (gpr_cmdline_add_string_type) GetProcAddress(library, "gpr_cmdline_add_string");
-  gpr_cmdline_on_extra_arg_import = (gpr_cmdline_on_extra_arg_type) GetProcAddress(library, "gpr_cmdline_on_extra_arg");
-  gpr_cmdline_set_survive_failure_import = (gpr_cmdline_set_survive_failure_type) GetProcAddress(library, "gpr_cmdline_set_survive_failure");
-  gpr_cmdline_parse_import = (gpr_cmdline_parse_type) GetProcAddress(library, "gpr_cmdline_parse");
-  gpr_cmdline_destroy_import = (gpr_cmdline_destroy_type) GetProcAddress(library, "gpr_cmdline_destroy");
-  gpr_cmdline_usage_string_import = (gpr_cmdline_usage_string_type) GetProcAddress(library, "gpr_cmdline_usage_string");
   gpr_cpu_num_cores_import = (gpr_cpu_num_cores_type) GetProcAddress(library, "gpr_cpu_num_cores");
   gpr_cpu_current_cpu_import = (gpr_cpu_current_cpu_type) GetProcAddress(library, "gpr_cpu_current_cpu");
-  gpr_join_host_port_import = (gpr_join_host_port_type) GetProcAddress(library, "gpr_join_host_port");
-  gpr_split_host_port_import = (gpr_split_host_port_type) GetProcAddress(library, "gpr_split_host_port");
   gpr_log_severity_string_import = (gpr_log_severity_string_type) GetProcAddress(library, "gpr_log_severity_string");
   gpr_log_import = (gpr_log_type) GetProcAddress(library, "gpr_log");
   gpr_log_message_import = (gpr_log_message_type) GetProcAddress(library, "gpr_log_message");
@@ -496,11 +453,6 @@
   gpr_format_message_import = (gpr_format_message_type) GetProcAddress(library, "gpr_format_message");
   gpr_strdup_import = (gpr_strdup_type) GetProcAddress(library, "gpr_strdup");
   gpr_asprintf_import = (gpr_asprintf_type) GetProcAddress(library, "gpr_asprintf");
-  gpr_subprocess_binary_extension_import = (gpr_subprocess_binary_extension_type) GetProcAddress(library, "gpr_subprocess_binary_extension");
-  gpr_subprocess_create_import = (gpr_subprocess_create_type) GetProcAddress(library, "gpr_subprocess_create");
-  gpr_subprocess_destroy_import = (gpr_subprocess_destroy_type) GetProcAddress(library, "gpr_subprocess_destroy");
-  gpr_subprocess_join_import = (gpr_subprocess_join_type) GetProcAddress(library, "gpr_subprocess_join");
-  gpr_subprocess_interrupt_import = (gpr_subprocess_interrupt_type) GetProcAddress(library, "gpr_subprocess_interrupt");
   gpr_mu_init_import = (gpr_mu_init_type) GetProcAddress(library, "gpr_mu_init");
   gpr_mu_destroy_import = (gpr_mu_destroy_type) GetProcAddress(library, "gpr_mu_destroy");
   gpr_mu_lock_import = (gpr_mu_lock_type) GetProcAddress(library, "gpr_mu_lock");
diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.h b/src/ruby/ext/grpc/rb_grpc_imports.generated.h
index 60f2409..9eb0a3f 100644
--- a/src/ruby/ext/grpc/rb_grpc_imports.generated.h
+++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.h
@@ -33,14 +33,10 @@
 #include <grpc/slice.h>
 #include <grpc/slice_buffer.h>
 #include <grpc/support/alloc.h>
-#include <grpc/support/avl.h>
-#include <grpc/support/cmdline.h>
 #include <grpc/support/cpu.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/log_windows.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/subprocess.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
 #include <grpc/support/time.h>
@@ -576,69 +572,12 @@
 typedef gpr_allocation_functions(*gpr_get_allocation_functions_type)(void);
 extern gpr_get_allocation_functions_type gpr_get_allocation_functions_import;
 #define gpr_get_allocation_functions gpr_get_allocation_functions_import
-typedef gpr_avl(*gpr_avl_create_type)(const gpr_avl_vtable* vtable);
-extern gpr_avl_create_type gpr_avl_create_import;
-#define gpr_avl_create gpr_avl_create_import
-typedef gpr_avl(*gpr_avl_ref_type)(gpr_avl avl, void* user_data);
-extern gpr_avl_ref_type gpr_avl_ref_import;
-#define gpr_avl_ref gpr_avl_ref_import
-typedef void(*gpr_avl_unref_type)(gpr_avl avl, void* user_data);
-extern gpr_avl_unref_type gpr_avl_unref_import;
-#define gpr_avl_unref gpr_avl_unref_import
-typedef gpr_avl(*gpr_avl_add_type)(gpr_avl avl, void* key, void* value, void* user_data);
-extern gpr_avl_add_type gpr_avl_add_import;
-#define gpr_avl_add gpr_avl_add_import
-typedef gpr_avl(*gpr_avl_remove_type)(gpr_avl avl, void* key, void* user_data);
-extern gpr_avl_remove_type gpr_avl_remove_import;
-#define gpr_avl_remove gpr_avl_remove_import
-typedef void*(*gpr_avl_get_type)(gpr_avl avl, void* key, void* user_data);
-extern gpr_avl_get_type gpr_avl_get_import;
-#define gpr_avl_get gpr_avl_get_import
-typedef int(*gpr_avl_maybe_get_type)(gpr_avl avl, void* key, void** value, void* user_data);
-extern gpr_avl_maybe_get_type gpr_avl_maybe_get_import;
-#define gpr_avl_maybe_get gpr_avl_maybe_get_import
-typedef int(*gpr_avl_is_empty_type)(gpr_avl avl);
-extern gpr_avl_is_empty_type gpr_avl_is_empty_import;
-#define gpr_avl_is_empty gpr_avl_is_empty_import
-typedef gpr_cmdline*(*gpr_cmdline_create_type)(const char* description);
-extern gpr_cmdline_create_type gpr_cmdline_create_import;
-#define gpr_cmdline_create gpr_cmdline_create_import
-typedef void(*gpr_cmdline_add_int_type)(gpr_cmdline* cl, const char* name, const char* help, int* value);
-extern gpr_cmdline_add_int_type gpr_cmdline_add_int_import;
-#define gpr_cmdline_add_int gpr_cmdline_add_int_import
-typedef void(*gpr_cmdline_add_flag_type)(gpr_cmdline* cl, const char* name, const char* help, int* value);
-extern gpr_cmdline_add_flag_type gpr_cmdline_add_flag_import;
-#define gpr_cmdline_add_flag gpr_cmdline_add_flag_import
-typedef void(*gpr_cmdline_add_string_type)(gpr_cmdline* cl, const char* name, const char* help, const char** value);
-extern gpr_cmdline_add_string_type gpr_cmdline_add_string_import;
-#define gpr_cmdline_add_string gpr_cmdline_add_string_import
-typedef void(*gpr_cmdline_on_extra_arg_type)(gpr_cmdline* cl, const char* name, const char* help, void (*on_extra_arg)(void* user_data, const char* arg), void* user_data);
-extern gpr_cmdline_on_extra_arg_type gpr_cmdline_on_extra_arg_import;
-#define gpr_cmdline_on_extra_arg gpr_cmdline_on_extra_arg_import
-typedef void(*gpr_cmdline_set_survive_failure_type)(gpr_cmdline* cl);
-extern gpr_cmdline_set_survive_failure_type gpr_cmdline_set_survive_failure_import;
-#define gpr_cmdline_set_survive_failure gpr_cmdline_set_survive_failure_import
-typedef int(*gpr_cmdline_parse_type)(gpr_cmdline* cl, int argc, char** argv);
-extern gpr_cmdline_parse_type gpr_cmdline_parse_import;
-#define gpr_cmdline_parse gpr_cmdline_parse_import
-typedef void(*gpr_cmdline_destroy_type)(gpr_cmdline* cl);
-extern gpr_cmdline_destroy_type gpr_cmdline_destroy_import;
-#define gpr_cmdline_destroy gpr_cmdline_destroy_import
-typedef char*(*gpr_cmdline_usage_string_type)(gpr_cmdline* cl, const char* argv0);
-extern gpr_cmdline_usage_string_type gpr_cmdline_usage_string_import;
-#define gpr_cmdline_usage_string gpr_cmdline_usage_string_import
 typedef unsigned(*gpr_cpu_num_cores_type)(void);
 extern gpr_cpu_num_cores_type gpr_cpu_num_cores_import;
 #define gpr_cpu_num_cores gpr_cpu_num_cores_import
 typedef unsigned(*gpr_cpu_current_cpu_type)(void);
 extern gpr_cpu_current_cpu_type gpr_cpu_current_cpu_import;
 #define gpr_cpu_current_cpu gpr_cpu_current_cpu_import
-typedef int(*gpr_join_host_port_type)(char** out, const char* host, int port);
-extern gpr_join_host_port_type gpr_join_host_port_import;
-#define gpr_join_host_port gpr_join_host_port_import
-typedef int(*gpr_split_host_port_type)(const char* name, char** host, char** port);
-extern gpr_split_host_port_type gpr_split_host_port_import;
-#define gpr_split_host_port gpr_split_host_port_import
 typedef const char*(*gpr_log_severity_string_type)(gpr_log_severity severity);
 extern gpr_log_severity_string_type gpr_log_severity_string_import;
 #define gpr_log_severity_string gpr_log_severity_string_import
@@ -666,21 +605,6 @@
 typedef int(*gpr_asprintf_type)(char** strp, const char* format, ...) GPR_PRINT_FORMAT_CHECK(2, 3);
 extern gpr_asprintf_type gpr_asprintf_import;
 #define gpr_asprintf gpr_asprintf_import
-typedef const char*(*gpr_subprocess_binary_extension_type)();
-extern gpr_subprocess_binary_extension_type gpr_subprocess_binary_extension_import;
-#define gpr_subprocess_binary_extension gpr_subprocess_binary_extension_import
-typedef gpr_subprocess*(*gpr_subprocess_create_type)(int argc, const char** argv);
-extern gpr_subprocess_create_type gpr_subprocess_create_import;
-#define gpr_subprocess_create gpr_subprocess_create_import
-typedef void(*gpr_subprocess_destroy_type)(gpr_subprocess* p);
-extern gpr_subprocess_destroy_type gpr_subprocess_destroy_import;
-#define gpr_subprocess_destroy gpr_subprocess_destroy_import
-typedef int(*gpr_subprocess_join_type)(gpr_subprocess* p);
-extern gpr_subprocess_join_type gpr_subprocess_join_import;
-#define gpr_subprocess_join gpr_subprocess_join_import
-typedef void(*gpr_subprocess_interrupt_type)(gpr_subprocess* p);
-extern gpr_subprocess_interrupt_type gpr_subprocess_interrupt_import;
-#define gpr_subprocess_interrupt gpr_subprocess_interrupt_import
 typedef void(*gpr_mu_init_type)(gpr_mu* mu);
 extern gpr_mu_init_type gpr_mu_init_import;
 #define gpr_mu_init gpr_mu_init_import
diff --git a/templates/test/cpp/naming/create_private_dns_zone_defs.include b/templates/test/cpp/naming/create_private_dns_zone_defs.include
index 465dd63..76af9ab 100644
--- a/templates/test/cpp/naming/create_private_dns_zone_defs.include
+++ b/templates/test/cpp/naming/create_private_dns_zone_defs.include
@@ -17,7 +17,7 @@
 
 set -ex
 
-cd $(dirname $0)/../../..
+cd "$(dirname "$0")/../../.."
 
 gcloud alpha dns managed-zones create \\
 
diff --git a/templates/test/cpp/naming/private_dns_zone_init_defs.include b/templates/test/cpp/naming/private_dns_zone_init_defs.include
index 06bc8ad..1a6a590 100644
--- a/templates/test/cpp/naming/private_dns_zone_init_defs.include
+++ b/templates/test/cpp/naming/private_dns_zone_init_defs.include
@@ -17,7 +17,7 @@
 
 set -ex
 
-cd $(dirname $0)/../../..
+cd "$(dirname "$0")/../../.."
 
 gcloud dns record-sets transaction start -z=${resolver_gce_integration_tests_zone_id}
 
diff --git a/templates/test/cpp/naming/resolver_component_tests_defs.include b/templates/test/cpp/naming/resolver_component_tests_defs.include
index 6fa91c7..efa54a4 100644
--- a/templates/test/cpp/naming/resolver_component_tests_defs.include
+++ b/templates/test/cpp/naming/resolver_component_tests_defs.include
@@ -18,10 +18,10 @@
 set -ex
 
 # all command args required in this set order
-FLAGS_test_bin_path=`echo "$1" | grep '\--test_bin_path=' | cut -d "=" -f 2`
-FLAGS_dns_server_bin_path=`echo "$2" | grep '\--dns_server_bin_path=' | cut -d "=" -f 2`
-FLAGS_records_config_path=`echo "$3" | grep '\--records_config_path=' | cut -d "=" -f 2`
-FLAGS_test_dns_server_port=`echo "$4" | grep '\--test_dns_server_port=' | cut -d "=" -f 2`
+FLAGS_test_bin_path=$(echo "$1" | grep '\--test_bin_path=' | cut -d "=" -f 2)
+FLAGS_dns_server_bin_path=$(echo "$2" | grep '\--dns_server_bin_path=' | cut -d "=" -f 2)
+FLAGS_records_config_path=$(echo "$3" | grep '\--records_config_path=' | cut -d "=" -f 2)
+FLAGS_test_dns_server_port=$(echo "$4" | grep '\--test_dns_server_port=' | cut -d "=" -f 2)
 
 for cmd_arg in "$FLAGS_test_bin_path" "$FLAGS_dns_server_bin_path" "$FLAGS_records_config_path" "$FLAGS_test_dns_server_port"; do
   if [[ "$cmd_arg" == "" ]]; then
@@ -34,7 +34,7 @@
 fi
 export GRPC_DNS_RESOLVER=ares
 
-"$FLAGS_dns_server_bin_path" --records_config_path="$FLAGS_records_config_path" --port="$FLAGS_test_dns_server_port" 2>&1 > /dev/null &
+"$FLAGS_dns_server_bin_path" --records_config_path="$FLAGS_records_config_path" --port="$FLAGS_test_dns_server_port" > /dev/null 2>&1 &
 DNS_SERVER_PID=$!
 echo "Local DNS server started. PID: $DNS_SERVER_PID"
 
@@ -53,15 +53,15 @@
 
 if [[ $RETRY == 1 ]]; then
   echo "FAILED TO START LOCAL DNS SERVER"
-  kill -SIGTERM $DNS_SERVER_PID
+  kill -SIGTERM "$DNS_SERVER_PID"
   wait
   exit 1
 fi
 
 function terminate_all {
   echo "Received signal. Terminating $! and $DNS_SERVER_PID"
-  kill -SIGTERM $! || true
-  kill -SIGTERM $DNS_SERVER_PID || true
+  kill -SIGTERM "$!" || true
+  kill -SIGTERM "$DNS_SERVER_PID" || true
   wait
   exit 1
 }
@@ -83,10 +83,10 @@
 
   --expected_lb_policy='${test['expected_lb_policy']}' \\
 
-  --local_dns_server_address=127.0.0.1:$FLAGS_test_dns_server_port &
-wait $! || EXIT_CODE=1
+  --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" &
+wait "$!" || EXIT_CODE=1
 
 % endfor
-kill -SIGTERM $DNS_SERVER_PID || true
+kill -SIGTERM "$DNS_SERVER_PID" || true
 wait
 exit $EXIT_CODE</%def>
diff --git a/templates/test/cpp/naming/resolver_gce_integration_tests_defs.include b/templates/test/cpp/naming/resolver_gce_integration_tests_defs.include
index 2413ec5..0cb8a1b 100644
--- a/templates/test/cpp/naming/resolver_gce_integration_tests_defs.include
+++ b/templates/test/cpp/naming/resolver_gce_integration_tests_defs.include
@@ -24,7 +24,7 @@
   exit 1
 fi
 
-cd $(dirname $0)/../../..
+cd "$(dirname "$0")/../../.."
 
 if [[ "$CONFIG" == "" ]]; then
   export CONFIG=opt
diff --git a/templates/tools/openssl/use_openssl.sh.template b/templates/tools/openssl/use_openssl.sh.template
index 8050816..b07ce13 100644
--- a/templates/tools/openssl/use_openssl.sh.template
+++ b/templates/tools/openssl/use_openssl.sh.template
@@ -18,7 +18,7 @@
 
   set -ex
 
-  cd $(dirname $0)/../..
+  cd "$(dirname "$0")/../.."
   set root=`pwd`
   CC=${"${CC:-cc}"}
 
diff --git a/test/core/avl/BUILD b/test/core/avl/BUILD
new file mode 100644
index 0000000..48f5bae
--- /dev/null
+++ b/test/core/avl/BUILD
@@ -0,0 +1,30 @@
+# Copyright 2018 gRPC authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package")
+
+licenses(["notice"])  # Apache v2
+
+grpc_package(name = "test/core/avl")
+
+grpc_cc_test(
+    name = "avl_test",
+    srcs = ["avl_test.cc"],
+    language = "C++",
+    deps = [
+        "//:gpr",
+        "//:grpc",
+        "//test/core/util:gpr_test_util",
+    ],
+)
diff --git a/test/core/avl/avl_test.cc b/test/core/avl/avl_test.cc
new file mode 100644
index 0000000..ac1ab5c
--- /dev/null
+++ b/test/core/avl/avl_test.cc
@@ -0,0 +1,3659 @@
+/*
+ *
+ * Copyright 2015 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "src/core/lib/avl/avl.h"
+
+#include <stdio.h>
+#include <string.h>
+
+#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
+
+#include "src/core/lib/gpr/useful.h"
+#include "test/core/util/test_config.h"
+
+static int* box(int x) {
+  int* b = static_cast<int*>(gpr_malloc(sizeof(*b)));
+  *b = x;
+  return b;
+}
+
+static long int_compare(void* int1, void* int2, void* unused) {
+  return (*(int*)int1) - (*(int*)int2);
+}
+static void* int_copy(void* p, void* unused) { return box(*(int*)p); }
+
+static void destroy(void* p, void* unused) { gpr_free(p); }
+
+static const grpc_avl_vtable int_int_vtable = {destroy, int_copy, int_compare,
+                                               destroy, int_copy};
+
+static void check_get(grpc_avl avl, int key, int value) {
+  int* k = box(key);
+  GPR_ASSERT(*(int*)grpc_avl_get(avl, k, nullptr) == value);
+  gpr_free(k);
+}
+
+static void check_negget(grpc_avl avl, int key) {
+  int* k = box(key);
+  GPR_ASSERT(grpc_avl_get(avl, k, nullptr) == nullptr);
+  gpr_free(k);
+}
+
+static grpc_avl remove_int(grpc_avl avl, int key) {
+  int* k = box(key);
+  avl = grpc_avl_remove(avl, k, nullptr);
+  gpr_free(k);
+  return avl;
+}
+
+static void test_get(void) {
+  grpc_avl avl;
+  gpr_log(GPR_DEBUG, "test_get");
+  avl = grpc_avl_create(&int_int_vtable);
+  avl = grpc_avl_add(avl, box(1), box(11), nullptr);
+  avl = grpc_avl_add(avl, box(2), box(22), nullptr);
+  avl = grpc_avl_add(avl, box(3), box(33), nullptr);
+  check_get(avl, 1, 11);
+  check_get(avl, 2, 22);
+  check_get(avl, 3, 33);
+  check_negget(avl, 4);
+  grpc_avl_unref(avl, nullptr);
+}
+
+static void test_ll(void) {
+  grpc_avl avl;
+  gpr_log(GPR_DEBUG, "test_ll");
+  avl = grpc_avl_create(&int_int_vtable);
+  avl = grpc_avl_add(avl, box(5), box(1), nullptr);
+  avl = grpc_avl_add(avl, box(4), box(2), nullptr);
+  avl = grpc_avl_add(avl, box(3), box(3), nullptr);
+  GPR_ASSERT(*(int*)avl.root->key == 4);
+  GPR_ASSERT(*(int*)avl.root->left->key == 3);
+  GPR_ASSERT(*(int*)avl.root->right->key == 5);
+  grpc_avl_unref(avl, nullptr);
+}
+
+static void test_lr(void) {
+  grpc_avl avl;
+  gpr_log(GPR_DEBUG, "test_lr");
+  avl = grpc_avl_create(&int_int_vtable);
+  avl = grpc_avl_add(avl, box(5), box(1), nullptr);
+  avl = grpc_avl_add(avl, box(3), box(2), nullptr);
+  avl = grpc_avl_add(avl, box(4), box(3), nullptr);
+  GPR_ASSERT(*(int*)avl.root->key == 4);
+  GPR_ASSERT(*(int*)avl.root->left->key == 3);
+  GPR_ASSERT(*(int*)avl.root->right->key == 5);
+  grpc_avl_unref(avl, nullptr);
+}
+
+static void test_rr(void) {
+  grpc_avl avl;
+  gpr_log(GPR_DEBUG, "test_rr");
+  avl = grpc_avl_create(&int_int_vtable);
+  avl = grpc_avl_add(avl, box(3), box(1), nullptr);
+  avl = grpc_avl_add(avl, box(4), box(2), nullptr);
+  avl = grpc_avl_add(avl, box(5), box(3), nullptr);
+  GPR_ASSERT(*(int*)avl.root->key == 4);
+  GPR_ASSERT(*(int*)avl.root->left->key == 3);
+  GPR_ASSERT(*(int*)avl.root->right->key == 5);
+  grpc_avl_unref(avl, nullptr);
+}
+
+static void test_rl(void) {
+  grpc_avl avl;
+  gpr_log(GPR_DEBUG, "test_rl");
+  avl = grpc_avl_create(&int_int_vtable);
+  avl = grpc_avl_add(avl, box(3), box(1), nullptr);
+  avl = grpc_avl_add(avl, box(5), box(2), nullptr);
+  avl = grpc_avl_add(avl, box(4), box(3), nullptr);
+  GPR_ASSERT(*(int*)avl.root->key == 4);
+  GPR_ASSERT(*(int*)avl.root->left->key == 3);
+  GPR_ASSERT(*(int*)avl.root->right->key == 5);
+  grpc_avl_unref(avl, nullptr);
+}
+
+static void test_unbalanced(void) {
+  grpc_avl avl;
+  gpr_log(GPR_DEBUG, "test_unbalanced");
+  avl = grpc_avl_create(&int_int_vtable);
+  avl = grpc_avl_add(avl, box(5), box(1), nullptr);
+  avl = grpc_avl_add(avl, box(4), box(2), nullptr);
+  avl = grpc_avl_add(avl, box(3), box(3), nullptr);
+  avl = grpc_avl_add(avl, box(2), box(4), nullptr);
+  avl = grpc_avl_add(avl, box(1), box(5), nullptr);
+  GPR_ASSERT(*(int*)avl.root->key == 4);
+  GPR_ASSERT(*(int*)avl.root->left->key == 2);
+  GPR_ASSERT(*(int*)avl.root->left->left->key == 1);
+  GPR_ASSERT(*(int*)avl.root->left->right->key == 3);
+  GPR_ASSERT(*(int*)avl.root->right->key == 5);
+  grpc_avl_unref(avl, nullptr);
+}
+
+static void test_replace(void) {
+  grpc_avl avl;
+  gpr_log(GPR_DEBUG, "test_replace");
+  avl = grpc_avl_create(&int_int_vtable);
+  avl = grpc_avl_add(avl, box(1), box(1), nullptr);
+  avl = grpc_avl_add(avl, box(1), box(2), nullptr);
+  check_get(avl, 1, 2);
+  check_negget(avl, 2);
+  grpc_avl_unref(avl, nullptr);
+}
+
+static void test_remove(void) {
+  grpc_avl avl;
+  grpc_avl avl3, avl4, avl5, avln;
+  gpr_log(GPR_DEBUG, "test_remove");
+  avl = grpc_avl_create(&int_int_vtable);
+  avl = grpc_avl_add(avl, box(3), box(1), nullptr);
+  avl = grpc_avl_add(avl, box(4), box(2), nullptr);
+  avl = grpc_avl_add(avl, box(5), box(3), nullptr);
+
+  avl3 = remove_int(grpc_avl_ref(avl, nullptr), 3);
+  avl4 = remove_int(grpc_avl_ref(avl, nullptr), 4);
+  avl5 = remove_int(grpc_avl_ref(avl, nullptr), 5);
+  avln = remove_int(grpc_avl_ref(avl, nullptr), 1);
+
+  grpc_avl_unref(avl, nullptr);
+
+  check_negget(avl3, 3);
+  check_get(avl3, 4, 2);
+  check_get(avl3, 5, 3);
+  grpc_avl_unref(avl3, nullptr);
+
+  check_get(avl4, 3, 1);
+  check_negget(avl4, 4);
+  check_get(avl4, 5, 3);
+  grpc_avl_unref(avl4, nullptr);
+
+  check_get(avl5, 3, 1);
+  check_get(avl5, 4, 2);
+  check_negget(avl5, 5);
+  grpc_avl_unref(avl5, nullptr);
+
+  check_get(avln, 3, 1);
+  check_get(avln, 4, 2);
+  check_get(avln, 5, 3);
+  grpc_avl_unref(avln, nullptr);
+}
+
+static void test_badcase1(void) {
+  grpc_avl avl;
+
+  gpr_log(GPR_DEBUG, "test_badcase1");
+
+  avl = grpc_avl_create(&int_int_vtable);
+  avl = grpc_avl_add(avl, box(88), box(1), nullptr);
+  avl = remove_int(avl, 643);
+  avl = remove_int(avl, 983);
+  avl = grpc_avl_add(avl, box(985), box(4), nullptr);
+  avl = grpc_avl_add(avl, box(640), box(5), nullptr);
+  avl = grpc_avl_add(avl, box(41), box(6), nullptr);
+  avl = grpc_avl_add(avl, box(112), box(7), nullptr);
+  avl = grpc_avl_add(avl, box(342), box(8), nullptr);
+  avl = remove_int(avl, 1013);
+  avl = grpc_avl_add(avl, box(434), box(10), nullptr);
+  avl = grpc_avl_add(avl, box(520), box(11), nullptr);
+  avl = grpc_avl_add(avl, box(231), box(12), nullptr);
+  avl = grpc_avl_add(avl, box(852), box(13), nullptr);
+  avl = remove_int(avl, 461);
+  avl = grpc_avl_add(avl, box(108), box(15), nullptr);
+  avl = grpc_avl_add(avl, box(806), box(16), nullptr);
+  avl = grpc_avl_add(avl, box(827), box(17), nullptr);
+  avl = remove_int(avl, 796);
+  avl = grpc_avl_add(avl, box(340), box(19), nullptr);
+  avl = grpc_avl_add(avl, box(498), box(20), nullptr);
+  avl = grpc_avl_add(avl, box(203), box(21), nullptr);
+  avl = grpc_avl_add(avl, box(751), box(22), nullptr);
+  avl = grpc_avl_add(avl, box(150), box(23), nullptr);
+  avl = remove_int(avl, 237);
+  avl = grpc_avl_add(avl, box(830), box(25), nullptr);
+  avl = remove_int(avl, 1007);
+  avl = remove_int(avl, 394);
+  avl = grpc_avl_add(avl, box(65), box(28), nullptr);
+  avl = remove_int(avl, 904);
+  avl = remove_int(avl, 123);
+  avl = grpc_avl_add(avl, box(238), box(31), nullptr);
+  avl = grpc_avl_add(avl, box(184), box(32), nullptr);
+  avl = remove_int(avl, 331);
+  avl = grpc_avl_add(avl, box(827), box(34), nullptr);
+
+  check_get(avl, 830, 25);
+
+  grpc_avl_unref(avl, nullptr);
+}
+
+static void test_badcase2(void) {
+  grpc_avl avl;
+
+  gpr_log(GPR_DEBUG, "test_badcase2");
+
+  avl = grpc_avl_create(&int_int_vtable);
+  avl = grpc_avl_add(avl, box(288), box(1), nullptr);
+  avl = remove_int(avl, 415);
+  avl = grpc_avl_add(avl, box(953), box(3), nullptr);
+  avl = grpc_avl_add(avl, box(101), box(4), nullptr);
+  avl = grpc_avl_add(avl, box(516), box(5), nullptr);
+  avl = grpc_avl_add(avl, box(547), box(6), nullptr);
+  avl = grpc_avl_add(avl, box(467), box(7), nullptr);
+  avl = grpc_avl_add(avl, box(793), box(8), nullptr);
+  avl = remove_int(avl, 190);
+  avl = grpc_avl_add(avl, box(687), box(10), nullptr);
+  avl = grpc_avl_add(avl, box(242), box(11), nullptr);
+  avl = grpc_avl_add(avl, box(142), box(12), nullptr);
+  avl = remove_int(avl, 705);
+  avl = remove_int(avl, 578);
+  avl = remove_int(avl, 767);
+  avl = remove_int(avl, 183);
+  avl = grpc_avl_add(avl, box(950), box(17), nullptr);
+  avl = grpc_avl_add(avl, box(622), box(18), nullptr);
+  avl = remove_int(avl, 513);
+  avl = remove_int(avl, 429);
+  avl = grpc_avl_add(avl, box(205), box(21), nullptr);
+  avl = remove_int(avl, 663);
+  avl = remove_int(avl, 953);
+  avl = remove_int(avl, 892);
+  avl = grpc_avl_add(avl, box(236), box(25), nullptr);
+  avl = remove_int(avl, 982);
+  avl = remove_int(avl, 201);
+  avl = remove_int(avl, 684);
+  avl = grpc_avl_add(avl, box(572), box(29), nullptr);
+  avl = remove_int(avl, 817);
+  avl = grpc_avl_add(avl, box(970), box(31), nullptr);
+  avl = remove_int(avl, 347);
+  avl = remove_int(avl, 574);
+  avl = grpc_avl_add(avl, box(752), box(34), nullptr);
+  avl = grpc_avl_add(avl, box(670), box(35), nullptr);
+  avl = grpc_avl_add(avl, box(69), box(36), nullptr);
+  avl = remove_int(avl, 111);
+  avl = remove_int(avl, 523);
+  avl = grpc_avl_add(avl, box(141), box(39), nullptr);
+  avl = remove_int(avl, 159);
+  avl = grpc_avl_add(avl, box(947), box(41), nullptr);
+  avl = grpc_avl_add(avl, box(855), box(42), nullptr);
+  avl = remove_int(avl, 218);
+  avl = remove_int(avl, 6);
+  avl = grpc_avl_add(avl, box(753), box(45), nullptr);
+  avl = remove_int(avl, 82);
+  avl = remove_int(avl, 799);
+  avl = grpc_avl_add(avl, box(572), box(48), nullptr);
+  avl = remove_int(avl, 376);
+  avl = remove_int(avl, 413);
+  avl = grpc_avl_add(avl, box(458), box(51), nullptr);
+  avl = remove_int(avl, 897);
+  avl = grpc_avl_add(avl, box(191), box(53), nullptr);
+  avl = grpc_avl_add(avl, box(609), box(54), nullptr);
+  avl = remove_int(avl, 787);
+  avl = remove_int(avl, 710);
+  avl = remove_int(avl, 886);
+  avl = remove_int(avl, 835);
+  avl = remove_int(avl, 33);
+  avl = grpc_avl_add(avl, box(871), box(60), nullptr);
+  avl = remove_int(avl, 641);
+  avl = grpc_avl_add(avl, box(462), box(62), nullptr);
+  avl = remove_int(avl, 359);
+  avl = remove_int(avl, 767);
+  avl = grpc_avl_add(avl, box(310), box(65), nullptr);
+  avl = remove_int(avl, 757);
+  avl = remove_int(avl, 639);
+  avl = remove_int(avl, 314);
+  avl = grpc_avl_add(avl, box(2), box(69), nullptr);
+  avl = remove_int(avl, 138);
+  avl = grpc_avl_add(avl, box(669), box(71), nullptr);
+  avl = remove_int(avl, 477);
+  avl = grpc_avl_add(avl, box(366), box(73), nullptr);
+  avl = grpc_avl_add(avl, box(612), box(74), nullptr);
+  avl = grpc_avl_add(avl, box(106), box(75), nullptr);
+  avl = remove_int(avl, 161);
+  avl = grpc_avl_add(avl, box(388), box(77), nullptr);
+  avl = grpc_avl_add(avl, box(141), box(78), nullptr);
+  avl = remove_int(avl, 633);
+  avl = remove_int(avl, 459);
+  avl = grpc_avl_add(avl, box(40), box(81), nullptr);
+  avl = remove_int(avl, 689);
+  avl = grpc_avl_add(avl, box(823), box(83), nullptr);
+  avl = remove_int(avl, 485);
+  avl = grpc_avl_add(avl, box(903), box(85), nullptr);
+  avl = grpc_avl_add(avl, box(592), box(86), nullptr);
+  avl = remove_int(avl, 448);
+  avl = grpc_avl_add(avl, box(56), box(88), nullptr);
+  avl = remove_int(avl, 333);
+  avl = grpc_avl_add(avl, box(189), box(90), nullptr);
+  avl = grpc_avl_add(avl, box(103), box(91), nullptr);
+  avl = remove_int(avl, 164);
+  avl = remove_int(avl, 974);
+  avl = grpc_avl_add(avl, box(215), box(94), nullptr);
+  avl = remove_int(avl, 189);
+  avl = remove_int(avl, 504);
+  avl = grpc_avl_add(avl, box(868), box(97), nullptr);
+  avl = remove_int(avl, 909);
+  avl = remove_int(avl, 148);
+  avl = remove_int(avl, 469);
+  avl = grpc_avl_add(avl, box(994), box(101), nullptr);
+  avl = grpc_avl_add(avl, box(576), box(102), nullptr);
+  avl = remove_int(avl, 82);
+  avl = remove_int(avl, 209);
+  avl = grpc_avl_add(avl, box(276), box(105), nullptr);
+  avl = remove_int(avl, 856);
+  avl = grpc_avl_add(avl, box(750), box(107), nullptr);
+  avl = remove_int(avl, 871);
+  avl = grpc_avl_add(avl, box(301), box(109), nullptr);
+  avl = remove_int(avl, 260);
+  avl = remove_int(avl, 737);
+  avl = remove_int(avl, 719);
+  avl = grpc_avl_add(avl, box(933), box(113), nullptr);
+  avl = grpc_avl_add(avl, box(225), box(114), nullptr);
+  avl = grpc_avl_add(avl, box(975), box(115), nullptr);
+  avl = grpc_avl_add(avl, box(86), box(116), nullptr);
+  avl = remove_int(avl, 732);
+  avl = grpc_avl_add(avl, box(340), box(118), nullptr);
+  avl = grpc_avl_add(avl, box(271), box(119), nullptr);
+  avl = remove_int(avl, 206);
+  avl = grpc_avl_add(avl, box(949), box(121), nullptr);
+  avl = grpc_avl_add(avl, box(927), box(122), nullptr);
+  avl = grpc_avl_add(avl, box(34), box(123), nullptr);
+  avl = grpc_avl_add(avl, box(351), box(124), nullptr);
+  avl = remove_int(avl, 836);
+  avl = grpc_avl_add(avl, box(825), box(126), nullptr);
+  avl = grpc_avl_add(avl, box(352), box(127), nullptr);
+  avl = remove_int(avl, 107);
+  avl = remove_int(avl, 101);
+  avl = grpc_avl_add(avl, box(320), box(130), nullptr);
+  avl = grpc_avl_add(avl, box(3), box(131), nullptr);
+  avl = remove_int(avl, 998);
+  avl = remove_int(avl, 44);
+  avl = grpc_avl_add(avl, box(525), box(134), nullptr);
+  avl = grpc_avl_add(avl, box(864), box(135), nullptr);
+  avl = grpc_avl_add(avl, box(863), box(136), nullptr);
+  avl = remove_int(avl, 770);
+  avl = grpc_avl_add(avl, box(440), box(138), nullptr);
+  avl = remove_int(avl, 516);
+  avl = grpc_avl_add(avl, box(116), box(140), nullptr);
+  avl = remove_int(avl, 380);
+  avl = grpc_avl_add(avl, box(878), box(142), nullptr);
+  avl = remove_int(avl, 439);
+  avl = grpc_avl_add(avl, box(994), box(144), nullptr);
+  avl = remove_int(avl, 294);
+  avl = remove_int(avl, 593);
+  avl = grpc_avl_add(avl, box(696), box(147), nullptr);
+  avl = remove_int(avl, 8);
+  avl = grpc_avl_add(avl, box(881), box(149), nullptr);
+  avl = remove_int(avl, 32);
+  avl = remove_int(avl, 242);
+  avl = grpc_avl_add(avl, box(487), box(152), nullptr);
+  avl = grpc_avl_add(avl, box(637), box(153), nullptr);
+  avl = grpc_avl_add(avl, box(793), box(154), nullptr);
+  avl = grpc_avl_add(avl, box(696), box(155), nullptr);
+  avl = remove_int(avl, 458);
+  avl = grpc_avl_add(avl, box(828), box(157), nullptr);
+  avl = remove_int(avl, 784);
+  avl = remove_int(avl, 274);
+  avl = grpc_avl_add(avl, box(783), box(160), nullptr);
+  avl = remove_int(avl, 21);
+  avl = grpc_avl_add(avl, box(866), box(162), nullptr);
+  avl = remove_int(avl, 919);
+  avl = grpc_avl_add(avl, box(435), box(164), nullptr);
+  avl = remove_int(avl, 385);
+  avl = grpc_avl_add(avl, box(475), box(166), nullptr);
+  avl = remove_int(avl, 339);
+  avl = grpc_avl_add(avl, box(615), box(168), nullptr);
+  avl = remove_int(avl, 866);
+  avl = remove_int(avl, 82);
+  avl = remove_int(avl, 271);
+  avl = grpc_avl_add(avl, box(590), box(172), nullptr);
+  avl = grpc_avl_add(avl, box(852), box(173), nullptr);
+  avl = remove_int(avl, 318);
+  avl = remove_int(avl, 82);
+  avl = grpc_avl_add(avl, box(672), box(176), nullptr);
+  avl = remove_int(avl, 430);
+  avl = grpc_avl_add(avl, box(821), box(178), nullptr);
+  avl = grpc_avl_add(avl, box(365), box(179), nullptr);
+  avl = remove_int(avl, 78);
+  avl = grpc_avl_add(avl, box(700), box(181), nullptr);
+  avl = grpc_avl_add(avl, box(353), box(182), nullptr);
+  avl = remove_int(avl, 492);
+  avl = grpc_avl_add(avl, box(991), box(184), nullptr);
+  avl = remove_int(avl, 330);
+  avl = grpc_avl_add(avl, box(873), box(186), nullptr);
+  avl = remove_int(avl, 589);
+  avl = grpc_avl_add(avl, box(676), box(188), nullptr);
+  avl = grpc_avl_add(avl, box(790), box(189), nullptr);
+  avl = remove_int(avl, 521);
+  avl = remove_int(avl, 47);
+  avl = grpc_avl_add(avl, box(976), box(192), nullptr);
+  avl = grpc_avl_add(avl, box(683), box(193), nullptr);
+  avl = remove_int(avl, 803);
+  avl = remove_int(avl, 1006);
+  avl = grpc_avl_add(avl, box(775), box(196), nullptr);
+  avl = grpc_avl_add(avl, box(411), box(197), nullptr);
+  avl = grpc_avl_add(avl, box(697), box(198), nullptr);
+  avl = remove_int(avl, 50);
+  avl = grpc_avl_add(avl, box(213), box(200), nullptr);
+  avl = remove_int(avl, 714);
+  avl = grpc_avl_add(avl, box(981), box(202), nullptr);
+  avl = grpc_avl_add(avl, box(502), box(203), nullptr);
+  avl = grpc_avl_add(avl, box(697), box(204), nullptr);
+  avl = grpc_avl_add(avl, box(603), box(205), nullptr);
+  avl = grpc_avl_add(avl, box(117), box(206), nullptr);
+  avl = remove_int(avl, 363);
+  avl = grpc_avl_add(avl, box(104), box(208), nullptr);
+  avl = remove_int(avl, 842);
+  avl = grpc_avl_add(avl, box(48), box(210), nullptr);
+  avl = remove_int(avl, 764);
+  avl = grpc_avl_add(avl, box(482), box(212), nullptr);
+  avl = grpc_avl_add(avl, box(928), box(213), nullptr);
+  avl = grpc_avl_add(avl, box(30), box(214), nullptr);
+  avl = grpc_avl_add(avl, box(820), box(215), nullptr);
+  avl = grpc_avl_add(avl, box(334), box(216), nullptr);
+  avl = remove_int(avl, 306);
+  avl = grpc_avl_add(avl, box(789), box(218), nullptr);
+  avl = remove_int(avl, 924);
+  avl = grpc_avl_add(avl, box(53), box(220), nullptr);
+  avl = remove_int(avl, 657);
+  avl = grpc_avl_add(avl, box(130), box(222), nullptr);
+  avl = grpc_avl_add(avl, box(239), box(223), nullptr);
+  avl = remove_int(avl, 20);
+  avl = grpc_avl_add(avl, box(117), box(225), nullptr);
+  avl = remove_int(avl, 882);
+  avl = remove_int(avl, 891);
+  avl = grpc_avl_add(avl, box(9), box(228), nullptr);
+  avl = grpc_avl_add(avl, box(496), box(229), nullptr);
+  avl = grpc_avl_add(avl, box(750), box(230), nullptr);
+  avl = grpc_avl_add(avl, box(283), box(231), nullptr);
+  avl = grpc_avl_add(avl, box(802), box(232), nullptr);
+  avl = remove_int(avl, 352);
+  avl = grpc_avl_add(avl, box(374), box(234), nullptr);
+  avl = grpc_avl_add(avl, box(6), box(235), nullptr);
+  avl = grpc_avl_add(avl, box(756), box(236), nullptr);
+  avl = grpc_avl_add(avl, box(597), box(237), nullptr);
+  avl = grpc_avl_add(avl, box(661), box(238), nullptr);
+  avl = remove_int(avl, 96);
+  avl = grpc_avl_add(avl, box(894), box(240), nullptr);
+  avl = remove_int(avl, 749);
+  avl = grpc_avl_add(avl, box(71), box(242), nullptr);
+  avl = remove_int(avl, 68);
+  avl = grpc_avl_add(avl, box(388), box(244), nullptr);
+  avl = remove_int(avl, 119);
+  avl = remove_int(avl, 856);
+  avl = grpc_avl_add(avl, box(176), box(247), nullptr);
+  avl = grpc_avl_add(avl, box(993), box(248), nullptr);
+  avl = remove_int(avl, 178);
+  avl = remove_int(avl, 781);
+  avl = remove_int(avl, 771);
+  avl = remove_int(avl, 848);
+  avl = remove_int(avl, 376);
+  avl = remove_int(avl, 157);
+  avl = remove_int(avl, 142);
+  avl = remove_int(avl, 686);
+  avl = grpc_avl_add(avl, box(779), box(257), nullptr);
+  avl = grpc_avl_add(avl, box(484), box(258), nullptr);
+  avl = remove_int(avl, 837);
+  avl = grpc_avl_add(avl, box(388), box(260), nullptr);
+  avl = remove_int(avl, 987);
+  avl = grpc_avl_add(avl, box(336), box(262), nullptr);
+  avl = remove_int(avl, 855);
+  avl = grpc_avl_add(avl, box(668), box(264), nullptr);
+  avl = remove_int(avl, 648);
+  avl = grpc_avl_add(avl, box(193), box(266), nullptr);
+  avl = remove_int(avl, 939);
+  avl = grpc_avl_add(avl, box(740), box(268), nullptr);
+  avl = grpc_avl_add(avl, box(503), box(269), nullptr);
+  avl = grpc_avl_add(avl, box(765), box(270), nullptr);
+  avl = remove_int(avl, 924);
+  avl = remove_int(avl, 513);
+  avl = grpc_avl_add(avl, box(161), box(273), nullptr);
+  avl = grpc_avl_add(avl, box(502), box(274), nullptr);
+  avl = grpc_avl_add(avl, box(846), box(275), nullptr);
+  avl = remove_int(avl, 931);
+  avl = grpc_avl_add(avl, box(87), box(277), nullptr);
+  avl = grpc_avl_add(avl, box(949), box(278), nullptr);
+  avl = grpc_avl_add(avl, box(548), box(279), nullptr);
+  avl = grpc_avl_add(avl, box(951), box(280), nullptr);
+  avl = remove_int(avl, 1018);
+  avl = remove_int(avl, 568);
+  avl = grpc_avl_add(avl, box(138), box(283), nullptr);
+  avl = grpc_avl_add(avl, box(202), box(284), nullptr);
+  avl = grpc_avl_add(avl, box(157), box(285), nullptr);
+  avl = grpc_avl_add(avl, box(264), box(286), nullptr);
+  avl = grpc_avl_add(avl, box(370), box(287), nullptr);
+  avl = remove_int(avl, 736);
+  avl = remove_int(avl, 751);
+  avl = remove_int(avl, 506);
+  avl = remove_int(avl, 81);
+  avl = remove_int(avl, 358);
+  avl = remove_int(avl, 657);
+  avl = remove_int(avl, 86);
+  avl = grpc_avl_add(avl, box(876), box(295), nullptr);
+  avl = remove_int(avl, 354);
+  avl = grpc_avl_add(avl, box(134), box(297), nullptr);
+  avl = remove_int(avl, 781);
+  avl = remove_int(avl, 183);
+  avl = grpc_avl_add(avl, box(914), box(300), nullptr);
+  avl = remove_int(avl, 926);
+  avl = remove_int(avl, 398);
+  avl = remove_int(avl, 932);
+  avl = remove_int(avl, 804);
+  avl = remove_int(avl, 326);
+  avl = grpc_avl_add(avl, box(208), box(306), nullptr);
+  avl = grpc_avl_add(avl, box(699), box(307), nullptr);
+  avl = remove_int(avl, 576);
+  avl = remove_int(avl, 850);
+  avl = remove_int(avl, 514);
+  avl = remove_int(avl, 676);
+  avl = remove_int(avl, 549);
+  avl = remove_int(avl, 767);
+  avl = grpc_avl_add(avl, box(58), box(314), nullptr);
+  avl = grpc_avl_add(avl, box(265), box(315), nullptr);
+  avl = grpc_avl_add(avl, box(268), box(316), nullptr);
+  avl = grpc_avl_add(avl, box(103), box(317), nullptr);
+  avl = grpc_avl_add(avl, box(440), box(318), nullptr);
+  avl = remove_int(avl, 777);
+  avl = grpc_avl_add(avl, box(670), box(320), nullptr);
+  avl = remove_int(avl, 506);
+  avl = remove_int(avl, 487);
+  avl = grpc_avl_add(avl, box(421), box(323), nullptr);
+  avl = remove_int(avl, 514);
+  avl = grpc_avl_add(avl, box(701), box(325), nullptr);
+  avl = remove_int(avl, 949);
+  avl = remove_int(avl, 872);
+  avl = remove_int(avl, 139);
+  avl = grpc_avl_add(avl, box(781), box(329), nullptr);
+  avl = grpc_avl_add(avl, box(543), box(330), nullptr);
+  avl = grpc_avl_add(avl, box(147), box(331), nullptr);
+  avl = remove_int(avl, 190);
+  avl = grpc_avl_add(avl, box(453), box(333), nullptr);
+  avl = remove_int(avl, 262);
+  avl = remove_int(avl, 850);
+  avl = remove_int(avl, 286);
+  avl = remove_int(avl, 787);
+  avl = grpc_avl_add(avl, box(514), box(338), nullptr);
+  avl = remove_int(avl, 812);
+  avl = grpc_avl_add(avl, box(431), box(340), nullptr);
+  avl = grpc_avl_add(avl, box(8), box(341), nullptr);
+  avl = remove_int(avl, 843);
+  avl = grpc_avl_add(avl, box(831), box(343), nullptr);
+  avl = remove_int(avl, 472);
+  avl = remove_int(avl, 157);
+  avl = grpc_avl_add(avl, box(612), box(346), nullptr);
+  avl = grpc_avl_add(avl, box(802), box(347), nullptr);
+  avl = remove_int(avl, 554);
+  avl = grpc_avl_add(avl, box(409), box(349), nullptr);
+  avl = grpc_avl_add(avl, box(439), box(350), nullptr);
+  avl = grpc_avl_add(avl, box(725), box(351), nullptr);
+  avl = grpc_avl_add(avl, box(568), box(352), nullptr);
+  avl = remove_int(avl, 475);
+  avl = remove_int(avl, 672);
+  avl = remove_int(avl, 62);
+  avl = remove_int(avl, 753);
+  avl = grpc_avl_add(avl, box(435), box(357), nullptr);
+  avl = grpc_avl_add(avl, box(950), box(358), nullptr);
+  avl = grpc_avl_add(avl, box(532), box(359), nullptr);
+  avl = grpc_avl_add(avl, box(832), box(360), nullptr);
+  avl = remove_int(avl, 390);
+  avl = grpc_avl_add(avl, box(993), box(362), nullptr);
+  avl = remove_int(avl, 198);
+  avl = remove_int(avl, 401);
+  avl = grpc_avl_add(avl, box(316), box(365), nullptr);
+  avl = remove_int(avl, 843);
+  avl = grpc_avl_add(avl, box(541), box(367), nullptr);
+  avl = grpc_avl_add(avl, box(505), box(368), nullptr);
+  avl = remove_int(avl, 445);
+  avl = remove_int(avl, 256);
+  avl = grpc_avl_add(avl, box(232), box(371), nullptr);
+  avl = remove_int(avl, 577);
+  avl = remove_int(avl, 558);
+  avl = grpc_avl_add(avl, box(910), box(374), nullptr);
+  avl = remove_int(avl, 902);
+  avl = remove_int(avl, 755);
+  avl = remove_int(avl, 114);
+  avl = remove_int(avl, 438);
+  avl = remove_int(avl, 224);
+  avl = grpc_avl_add(avl, box(920), box(380), nullptr);
+  avl = grpc_avl_add(avl, box(655), box(381), nullptr);
+  avl = remove_int(avl, 557);
+  avl = remove_int(avl, 102);
+  avl = remove_int(avl, 165);
+  avl = grpc_avl_add(avl, box(191), box(385), nullptr);
+  avl = remove_int(avl, 30);
+  avl = grpc_avl_add(avl, box(406), box(387), nullptr);
+  avl = grpc_avl_add(avl, box(66), box(388), nullptr);
+  avl = grpc_avl_add(avl, box(87), box(389), nullptr);
+  avl = remove_int(avl, 7);
+  avl = remove_int(avl, 671);
+  avl = grpc_avl_add(avl, box(234), box(392), nullptr);
+  avl = remove_int(avl, 463);
+  avl = grpc_avl_add(avl, box(75), box(394), nullptr);
+  avl = grpc_avl_add(avl, box(487), box(395), nullptr);
+  avl = remove_int(avl, 203);
+  avl = grpc_avl_add(avl, box(711), box(397), nullptr);
+  avl = remove_int(avl, 291);
+  avl = remove_int(avl, 798);
+  avl = remove_int(avl, 337);
+  avl = grpc_avl_add(avl, box(877), box(401), nullptr);
+  avl = grpc_avl_add(avl, box(388), box(402), nullptr);
+  avl = remove_int(avl, 975);
+  avl = grpc_avl_add(avl, box(200), box(404), nullptr);
+  avl = grpc_avl_add(avl, box(408), box(405), nullptr);
+  avl = grpc_avl_add(avl, box(3), box(406), nullptr);
+  avl = grpc_avl_add(avl, box(971), box(407), nullptr);
+  avl = remove_int(avl, 841);
+  avl = remove_int(avl, 910);
+  avl = remove_int(avl, 74);
+  avl = remove_int(avl, 888);
+  avl = grpc_avl_add(avl, box(492), box(412), nullptr);
+  avl = remove_int(avl, 14);
+  avl = remove_int(avl, 364);
+  avl = grpc_avl_add(avl, box(215), box(415), nullptr);
+  avl = remove_int(avl, 778);
+  avl = remove_int(avl, 45);
+  avl = grpc_avl_add(avl, box(328), box(418), nullptr);
+  avl = grpc_avl_add(avl, box(597), box(419), nullptr);
+  avl = remove_int(avl, 34);
+  avl = grpc_avl_add(avl, box(736), box(421), nullptr);
+  avl = remove_int(avl, 37);
+  avl = grpc_avl_add(avl, box(275), box(423), nullptr);
+  avl = grpc_avl_add(avl, box(70), box(424), nullptr);
+  avl = grpc_avl_add(avl, box(771), box(425), nullptr);
+  avl = remove_int(avl, 536);
+  avl = remove_int(avl, 421);
+  avl = grpc_avl_add(avl, box(186), box(428), nullptr);
+  avl = grpc_avl_add(avl, box(788), box(429), nullptr);
+  avl = grpc_avl_add(avl, box(224), box(430), nullptr);
+  avl = remove_int(avl, 228);
+  avl = grpc_avl_add(avl, box(48), box(432), nullptr);
+  avl = grpc_avl_add(avl, box(120), box(433), nullptr);
+  avl = grpc_avl_add(avl, box(269), box(434), nullptr);
+  avl = grpc_avl_add(avl, box(904), box(435), nullptr);
+  avl = remove_int(avl, 699);
+  avl = grpc_avl_add(avl, box(340), box(437), nullptr);
+  avl = remove_int(avl, 276);
+  avl = grpc_avl_add(avl, box(591), box(439), nullptr);
+  avl = grpc_avl_add(avl, box(778), box(440), nullptr);
+  avl = remove_int(avl, 490);
+  avl = remove_int(avl, 973);
+  avl = grpc_avl_add(avl, box(294), box(443), nullptr);
+  avl = grpc_avl_add(avl, box(323), box(444), nullptr);
+  avl = remove_int(avl, 685);
+  avl = grpc_avl_add(avl, box(38), box(446), nullptr);
+  avl = grpc_avl_add(avl, box(525), box(447), nullptr);
+  avl = remove_int(avl, 162);
+  avl = grpc_avl_add(avl, box(462), box(449), nullptr);
+  avl = grpc_avl_add(avl, box(340), box(450), nullptr);
+  avl = remove_int(avl, 734);
+  avl = remove_int(avl, 959);
+  avl = grpc_avl_add(avl, box(752), box(453), nullptr);
+  avl = grpc_avl_add(avl, box(667), box(454), nullptr);
+  avl = remove_int(avl, 558);
+  avl = remove_int(avl, 657);
+  avl = grpc_avl_add(avl, box(711), box(457), nullptr);
+  avl = remove_int(avl, 937);
+  avl = grpc_avl_add(avl, box(741), box(459), nullptr);
+  avl = grpc_avl_add(avl, box(40), box(460), nullptr);
+  avl = remove_int(avl, 784);
+  avl = grpc_avl_add(avl, box(292), box(462), nullptr);
+  avl = remove_int(avl, 164);
+  avl = remove_int(avl, 931);
+  avl = remove_int(avl, 886);
+  avl = grpc_avl_add(avl, box(968), box(466), nullptr);
+  avl = remove_int(avl, 263);
+  avl = grpc_avl_add(avl, box(647), box(468), nullptr);
+  avl = grpc_avl_add(avl, box(92), box(469), nullptr);
+  avl = remove_int(avl, 310);
+  avl = grpc_avl_add(avl, box(711), box(471), nullptr);
+  avl = grpc_avl_add(avl, box(675), box(472), nullptr);
+  avl = remove_int(avl, 549);
+  avl = grpc_avl_add(avl, box(380), box(474), nullptr);
+  avl = remove_int(avl, 825);
+  avl = grpc_avl_add(avl, box(668), box(476), nullptr);
+  avl = remove_int(avl, 498);
+  avl = grpc_avl_add(avl, box(870), box(478), nullptr);
+  avl = grpc_avl_add(avl, box(391), box(479), nullptr);
+  avl = grpc_avl_add(avl, box(264), box(480), nullptr);
+  avl = remove_int(avl, 1);
+  avl = remove_int(avl, 849);
+  avl = remove_int(avl, 88);
+  avl = remove_int(avl, 255);
+  avl = remove_int(avl, 763);
+  avl = remove_int(avl, 831);
+  avl = grpc_avl_add(avl, box(508), box(487), nullptr);
+  avl = remove_int(avl, 849);
+  avl = remove_int(avl, 47);
+  avl = grpc_avl_add(avl, box(299), box(490), nullptr);
+  avl = remove_int(avl, 625);
+  avl = remove_int(avl, 433);
+  avl = remove_int(avl, 904);
+  avl = remove_int(avl, 761);
+  avl = grpc_avl_add(avl, box(33), box(495), nullptr);
+  avl = grpc_avl_add(avl, box(524), box(496), nullptr);
+  avl = remove_int(avl, 210);
+  avl = remove_int(avl, 299);
+  avl = grpc_avl_add(avl, box(823), box(499), nullptr);
+  avl = remove_int(avl, 479);
+  avl = remove_int(avl, 96);
+  avl = remove_int(avl, 1013);
+  avl = grpc_avl_add(avl, box(768), box(503), nullptr);
+  avl = remove_int(avl, 638);
+  avl = remove_int(avl, 20);
+  avl = grpc_avl_add(avl, box(663), box(506), nullptr);
+  avl = remove_int(avl, 882);
+  avl = grpc_avl_add(avl, box(745), box(508), nullptr);
+  avl = remove_int(avl, 352);
+  avl = grpc_avl_add(avl, box(10), box(510), nullptr);
+  avl = remove_int(avl, 484);
+  avl = grpc_avl_add(avl, box(420), box(512), nullptr);
+  avl = grpc_avl_add(avl, box(884), box(513), nullptr);
+  avl = grpc_avl_add(avl, box(993), box(514), nullptr);
+  avl = grpc_avl_add(avl, box(251), box(515), nullptr);
+  avl = remove_int(avl, 222);
+  avl = grpc_avl_add(avl, box(734), box(517), nullptr);
+  avl = grpc_avl_add(avl, box(952), box(518), nullptr);
+  avl = remove_int(avl, 26);
+  avl = remove_int(avl, 270);
+  avl = remove_int(avl, 481);
+  avl = remove_int(avl, 693);
+  avl = remove_int(avl, 1006);
+  avl = grpc_avl_add(avl, box(77), box(524), nullptr);
+  avl = remove_int(avl, 897);
+  avl = grpc_avl_add(avl, box(719), box(526), nullptr);
+  avl = grpc_avl_add(avl, box(622), box(527), nullptr);
+  avl = remove_int(avl, 28);
+  avl = remove_int(avl, 836);
+  avl = remove_int(avl, 142);
+  avl = grpc_avl_add(avl, box(445), box(531), nullptr);
+  avl = grpc_avl_add(avl, box(410), box(532), nullptr);
+  avl = remove_int(avl, 575);
+  avl = grpc_avl_add(avl, box(634), box(534), nullptr);
+  avl = grpc_avl_add(avl, box(906), box(535), nullptr);
+  avl = remove_int(avl, 649);
+  avl = grpc_avl_add(avl, box(813), box(537), nullptr);
+  avl = remove_int(avl, 702);
+  avl = remove_int(avl, 732);
+  avl = grpc_avl_add(avl, box(105), box(540), nullptr);
+  avl = grpc_avl_add(avl, box(867), box(541), nullptr);
+  avl = remove_int(avl, 964);
+  avl = remove_int(avl, 941);
+  avl = grpc_avl_add(avl, box(947), box(544), nullptr);
+  avl = remove_int(avl, 990);
+  avl = grpc_avl_add(avl, box(816), box(546), nullptr);
+  avl = remove_int(avl, 429);
+  avl = remove_int(avl, 567);
+  avl = remove_int(avl, 541);
+  avl = remove_int(avl, 583);
+  avl = grpc_avl_add(avl, box(57), box(551), nullptr);
+  avl = grpc_avl_add(avl, box(786), box(552), nullptr);
+  avl = grpc_avl_add(avl, box(526), box(553), nullptr);
+  avl = remove_int(avl, 642);
+  avl = remove_int(avl, 220);
+  avl = remove_int(avl, 840);
+  avl = remove_int(avl, 548);
+  avl = grpc_avl_add(avl, box(528), box(558), nullptr);
+  avl = grpc_avl_add(avl, box(749), box(559), nullptr);
+  avl = grpc_avl_add(avl, box(194), box(560), nullptr);
+  avl = remove_int(avl, 517);
+  avl = grpc_avl_add(avl, box(102), box(562), nullptr);
+  avl = remove_int(avl, 189);
+  avl = grpc_avl_add(avl, box(927), box(564), nullptr);
+  avl = remove_int(avl, 846);
+  avl = remove_int(avl, 130);
+  avl = grpc_avl_add(avl, box(694), box(567), nullptr);
+  avl = remove_int(avl, 750);
+  avl = grpc_avl_add(avl, box(357), box(569), nullptr);
+  avl = remove_int(avl, 431);
+  avl = remove_int(avl, 91);
+  avl = grpc_avl_add(avl, box(640), box(572), nullptr);
+  avl = remove_int(avl, 4);
+  avl = grpc_avl_add(avl, box(81), box(574), nullptr);
+  avl = grpc_avl_add(avl, box(595), box(575), nullptr);
+  avl = remove_int(avl, 444);
+  avl = remove_int(avl, 262);
+  avl = remove_int(avl, 11);
+  avl = grpc_avl_add(avl, box(192), box(579), nullptr);
+  avl = grpc_avl_add(avl, box(158), box(580), nullptr);
+  avl = remove_int(avl, 401);
+  avl = remove_int(avl, 918);
+  avl = grpc_avl_add(avl, box(180), box(583), nullptr);
+  avl = remove_int(avl, 268);
+  avl = grpc_avl_add(avl, box(1012), box(585), nullptr);
+  avl = grpc_avl_add(avl, box(90), box(586), nullptr);
+  avl = grpc_avl_add(avl, box(946), box(587), nullptr);
+  avl = remove_int(avl, 719);
+  avl = grpc_avl_add(avl, box(874), box(589), nullptr);
+  avl = grpc_avl_add(avl, box(679), box(590), nullptr);
+  avl = remove_int(avl, 53);
+  avl = remove_int(avl, 534);
+  avl = grpc_avl_add(avl, box(646), box(593), nullptr);
+  avl = grpc_avl_add(avl, box(767), box(594), nullptr);
+  avl = grpc_avl_add(avl, box(460), box(595), nullptr);
+  avl = grpc_avl_add(avl, box(852), box(596), nullptr);
+  avl = grpc_avl_add(avl, box(189), box(597), nullptr);
+  avl = remove_int(avl, 932);
+  avl = remove_int(avl, 366);
+  avl = remove_int(avl, 907);
+  avl = grpc_avl_add(avl, box(875), box(601), nullptr);
+  avl = grpc_avl_add(avl, box(434), box(602), nullptr);
+  avl = grpc_avl_add(avl, box(704), box(603), nullptr);
+  avl = grpc_avl_add(avl, box(724), box(604), nullptr);
+  avl = grpc_avl_add(avl, box(930), box(605), nullptr);
+  avl = grpc_avl_add(avl, box(1000), box(606), nullptr);
+  avl = remove_int(avl, 479);
+  avl = grpc_avl_add(avl, box(275), box(608), nullptr);
+  avl = remove_int(avl, 32);
+  avl = grpc_avl_add(avl, box(939), box(610), nullptr);
+  avl = remove_int(avl, 943);
+  avl = remove_int(avl, 329);
+  avl = grpc_avl_add(avl, box(490), box(613), nullptr);
+  avl = remove_int(avl, 477);
+  avl = remove_int(avl, 414);
+  avl = remove_int(avl, 187);
+  avl = remove_int(avl, 334);
+  avl = grpc_avl_add(avl, box(40), box(618), nullptr);
+  avl = remove_int(avl, 751);
+  avl = grpc_avl_add(avl, box(568), box(620), nullptr);
+  avl = grpc_avl_add(avl, box(120), box(621), nullptr);
+  avl = grpc_avl_add(avl, box(617), box(622), nullptr);
+  avl = grpc_avl_add(avl, box(32), box(623), nullptr);
+  avl = remove_int(avl, 701);
+  avl = grpc_avl_add(avl, box(910), box(625), nullptr);
+  avl = remove_int(avl, 557);
+  avl = remove_int(avl, 361);
+  avl = remove_int(avl, 937);
+  avl = remove_int(avl, 100);
+  avl = remove_int(avl, 684);
+  avl = grpc_avl_add(avl, box(751), box(631), nullptr);
+  avl = remove_int(avl, 781);
+  avl = remove_int(avl, 469);
+  avl = remove_int(avl, 75);
+  avl = remove_int(avl, 561);
+  avl = grpc_avl_add(avl, box(854), box(636), nullptr);
+  avl = remove_int(avl, 164);
+  avl = remove_int(avl, 258);
+  avl = remove_int(avl, 315);
+  avl = remove_int(avl, 261);
+  avl = grpc_avl_add(avl, box(552), box(641), nullptr);
+  avl = grpc_avl_add(avl, box(6), box(642), nullptr);
+  avl = grpc_avl_add(avl, box(680), box(643), nullptr);
+  avl = remove_int(avl, 741);
+  avl = remove_int(avl, 309);
+  avl = remove_int(avl, 272);
+  avl = grpc_avl_add(avl, box(249), box(647), nullptr);
+  avl = remove_int(avl, 97);
+  avl = remove_int(avl, 850);
+  avl = grpc_avl_add(avl, box(915), box(650), nullptr);
+  avl = grpc_avl_add(avl, box(816), box(651), nullptr);
+  avl = grpc_avl_add(avl, box(45), box(652), nullptr);
+  avl = grpc_avl_add(avl, box(168), box(653), nullptr);
+  avl = remove_int(avl, 153);
+  avl = remove_int(avl, 239);
+  avl = grpc_avl_add(avl, box(684), box(656), nullptr);
+  avl = grpc_avl_add(avl, box(208), box(657), nullptr);
+  avl = grpc_avl_add(avl, box(681), box(658), nullptr);
+  avl = grpc_avl_add(avl, box(609), box(659), nullptr);
+  avl = grpc_avl_add(avl, box(645), box(660), nullptr);
+  avl = remove_int(avl, 799);
+  avl = grpc_avl_add(avl, box(955), box(662), nullptr);
+  avl = grpc_avl_add(avl, box(946), box(663), nullptr);
+  avl = grpc_avl_add(avl, box(744), box(664), nullptr);
+  avl = grpc_avl_add(avl, box(201), box(665), nullptr);
+  avl = grpc_avl_add(avl, box(136), box(666), nullptr);
+  avl = remove_int(avl, 357);
+  avl = grpc_avl_add(avl, box(974), box(668), nullptr);
+  avl = remove_int(avl, 485);
+  avl = grpc_avl_add(avl, box(1009), box(670), nullptr);
+  avl = grpc_avl_add(avl, box(517), box(671), nullptr);
+  avl = remove_int(avl, 491);
+  avl = grpc_avl_add(avl, box(336), box(673), nullptr);
+  avl = grpc_avl_add(avl, box(589), box(674), nullptr);
+  avl = remove_int(avl, 546);
+  avl = remove_int(avl, 840);
+  avl = remove_int(avl, 104);
+  avl = remove_int(avl, 347);
+  avl = grpc_avl_add(avl, box(801), box(679), nullptr);
+  avl = remove_int(avl, 799);
+  avl = remove_int(avl, 702);
+  avl = remove_int(avl, 996);
+  avl = remove_int(avl, 93);
+  avl = grpc_avl_add(avl, box(561), box(684), nullptr);
+  avl = grpc_avl_add(avl, box(25), box(685), nullptr);
+  avl = remove_int(avl, 278);
+  avl = grpc_avl_add(avl, box(191), box(687), nullptr);
+  avl = remove_int(avl, 243);
+  avl = remove_int(avl, 918);
+  avl = remove_int(avl, 449);
+  avl = grpc_avl_add(avl, box(19), box(691), nullptr);
+  avl = grpc_avl_add(avl, box(762), box(692), nullptr);
+  avl = grpc_avl_add(avl, box(13), box(693), nullptr);
+  avl = grpc_avl_add(avl, box(151), box(694), nullptr);
+  avl = grpc_avl_add(avl, box(152), box(695), nullptr);
+  avl = grpc_avl_add(avl, box(793), box(696), nullptr);
+  avl = remove_int(avl, 862);
+  avl = remove_int(avl, 890);
+  avl = grpc_avl_add(avl, box(687), box(699), nullptr);
+  avl = grpc_avl_add(avl, box(509), box(700), nullptr);
+  avl = grpc_avl_add(avl, box(973), box(701), nullptr);
+  avl = remove_int(avl, 230);
+  avl = grpc_avl_add(avl, box(532), box(703), nullptr);
+  avl = remove_int(avl, 668);
+  avl = grpc_avl_add(avl, box(281), box(705), nullptr);
+  avl = grpc_avl_add(avl, box(867), box(706), nullptr);
+  avl = grpc_avl_add(avl, box(359), box(707), nullptr);
+  avl = remove_int(avl, 425);
+  avl = grpc_avl_add(avl, box(691), box(709), nullptr);
+  avl = grpc_avl_add(avl, box(163), box(710), nullptr);
+  avl = grpc_avl_add(avl, box(502), box(711), nullptr);
+  avl = remove_int(avl, 674);
+  avl = grpc_avl_add(avl, box(697), box(713), nullptr);
+  avl = remove_int(avl, 271);
+  avl = grpc_avl_add(avl, box(968), box(715), nullptr);
+  avl = grpc_avl_add(avl, box(48), box(716), nullptr);
+  avl = remove_int(avl, 543);
+  avl = grpc_avl_add(avl, box(35), box(718), nullptr);
+  avl = grpc_avl_add(avl, box(751), box(719), nullptr);
+  avl = grpc_avl_add(avl, box(478), box(720), nullptr);
+  avl = remove_int(avl, 797);
+  avl = remove_int(avl, 309);
+  avl = grpc_avl_add(avl, box(927), box(723), nullptr);
+  avl = remove_int(avl, 504);
+  avl = grpc_avl_add(avl, box(286), box(725), nullptr);
+  avl = grpc_avl_add(avl, box(413), box(726), nullptr);
+  avl = grpc_avl_add(avl, box(599), box(727), nullptr);
+  avl = remove_int(avl, 105);
+  avl = remove_int(avl, 605);
+  avl = grpc_avl_add(avl, box(632), box(730), nullptr);
+  avl = grpc_avl_add(avl, box(133), box(731), nullptr);
+  avl = remove_int(avl, 443);
+  avl = grpc_avl_add(avl, box(958), box(733), nullptr);
+  avl = grpc_avl_add(avl, box(729), box(734), nullptr);
+  avl = remove_int(avl, 158);
+  avl = grpc_avl_add(avl, box(694), box(736), nullptr);
+  avl = grpc_avl_add(avl, box(505), box(737), nullptr);
+  avl = remove_int(avl, 63);
+  avl = remove_int(avl, 714);
+  avl = grpc_avl_add(avl, box(1002), box(740), nullptr);
+  avl = remove_int(avl, 211);
+  avl = grpc_avl_add(avl, box(765), box(742), nullptr);
+  avl = grpc_avl_add(avl, box(455), box(743), nullptr);
+  avl = remove_int(avl, 59);
+  avl = remove_int(avl, 224);
+  avl = grpc_avl_add(avl, box(586), box(746), nullptr);
+  avl = grpc_avl_add(avl, box(348), box(747), nullptr);
+  avl = remove_int(avl, 10);
+  avl = remove_int(avl, 484);
+  avl = grpc_avl_add(avl, box(968), box(750), nullptr);
+  avl = grpc_avl_add(avl, box(923), box(751), nullptr);
+  avl = remove_int(avl, 573);
+  avl = remove_int(avl, 617);
+  avl = grpc_avl_add(avl, box(812), box(754), nullptr);
+  avl = grpc_avl_add(avl, box(179), box(755), nullptr);
+  avl = remove_int(avl, 284);
+  avl = remove_int(avl, 157);
+  avl = remove_int(avl, 177);
+  avl = remove_int(avl, 896);
+  avl = grpc_avl_add(avl, box(649), box(760), nullptr);
+  avl = grpc_avl_add(avl, box(927), box(761), nullptr);
+  avl = grpc_avl_add(avl, box(454), box(762), nullptr);
+  avl = grpc_avl_add(avl, box(217), box(763), nullptr);
+  avl = remove_int(avl, 534);
+  avl = grpc_avl_add(avl, box(180), box(765), nullptr);
+  avl = grpc_avl_add(avl, box(319), box(766), nullptr);
+  avl = remove_int(avl, 92);
+  avl = grpc_avl_add(avl, box(483), box(768), nullptr);
+  avl = remove_int(avl, 504);
+  avl = remove_int(avl, 1017);
+  avl = remove_int(avl, 37);
+  avl = remove_int(avl, 50);
+  avl = grpc_avl_add(avl, box(302), box(773), nullptr);
+  avl = remove_int(avl, 807);
+  avl = grpc_avl_add(avl, box(463), box(775), nullptr);
+  avl = grpc_avl_add(avl, box(271), box(776), nullptr);
+  avl = grpc_avl_add(avl, box(644), box(777), nullptr);
+  avl = remove_int(avl, 618);
+  avl = grpc_avl_add(avl, box(166), box(779), nullptr);
+  avl = grpc_avl_add(avl, box(538), box(780), nullptr);
+  avl = remove_int(avl, 606);
+  avl = grpc_avl_add(avl, box(425), box(782), nullptr);
+  avl = remove_int(avl, 725);
+  avl = remove_int(avl, 383);
+  avl = grpc_avl_add(avl, box(155), box(785), nullptr);
+  avl = remove_int(avl, 889);
+  avl = grpc_avl_add(avl, box(653), box(787), nullptr);
+  avl = remove_int(avl, 386);
+  avl = grpc_avl_add(avl, box(142), box(789), nullptr);
+  avl = remove_int(avl, 107);
+  avl = remove_int(avl, 603);
+  avl = remove_int(avl, 971);
+  avl = grpc_avl_add(avl, box(80), box(793), nullptr);
+  avl = grpc_avl_add(avl, box(61), box(794), nullptr);
+  avl = grpc_avl_add(avl, box(693), box(795), nullptr);
+  avl = grpc_avl_add(avl, box(592), box(796), nullptr);
+  avl = grpc_avl_add(avl, box(433), box(797), nullptr);
+  avl = grpc_avl_add(avl, box(973), box(798), nullptr);
+  avl = remove_int(avl, 901);
+  avl = remove_int(avl, 340);
+  avl = remove_int(avl, 709);
+  avl = grpc_avl_add(avl, box(224), box(802), nullptr);
+  avl = remove_int(avl, 120);
+  avl = remove_int(avl, 271);
+  avl = grpc_avl_add(avl, box(780), box(805), nullptr);
+  avl = grpc_avl_add(avl, box(867), box(806), nullptr);
+  avl = grpc_avl_add(avl, box(756), box(807), nullptr);
+  avl = grpc_avl_add(avl, box(583), box(808), nullptr);
+  avl = grpc_avl_add(avl, box(356), box(809), nullptr);
+  avl = grpc_avl_add(avl, box(58), box(810), nullptr);
+  avl = remove_int(avl, 219);
+  avl = grpc_avl_add(avl, box(301), box(812), nullptr);
+  avl = remove_int(avl, 643);
+  avl = remove_int(avl, 787);
+  avl = remove_int(avl, 583);
+  avl = remove_int(avl, 552);
+  avl = remove_int(avl, 308);
+  avl = remove_int(avl, 608);
+  avl = remove_int(avl, 363);
+  avl = remove_int(avl, 690);
+  avl = grpc_avl_add(avl, box(233), box(821), nullptr);
+  avl = grpc_avl_add(avl, box(479), box(822), nullptr);
+  avl = grpc_avl_add(avl, box(323), box(823), nullptr);
+  avl = grpc_avl_add(avl, box(802), box(824), nullptr);
+  avl = remove_int(avl, 682);
+  avl = remove_int(avl, 705);
+  avl = remove_int(avl, 487);
+  avl = grpc_avl_add(avl, box(530), box(828), nullptr);
+  avl = grpc_avl_add(avl, box(232), box(829), nullptr);
+  avl = remove_int(avl, 627);
+  avl = grpc_avl_add(avl, box(396), box(831), nullptr);
+  avl = grpc_avl_add(avl, box(61), box(832), nullptr);
+  avl = grpc_avl_add(avl, box(932), box(833), nullptr);
+  avl = grpc_avl_add(avl, box(108), box(834), nullptr);
+  avl = grpc_avl_add(avl, box(524), box(835), nullptr);
+  avl = remove_int(avl, 390);
+  avl = remove_int(avl, 307);
+  avl = grpc_avl_add(avl, box(722), box(838), nullptr);
+  avl = grpc_avl_add(avl, box(907), box(839), nullptr);
+  avl = remove_int(avl, 286);
+  avl = remove_int(avl, 337);
+  avl = remove_int(avl, 443);
+  avl = grpc_avl_add(avl, box(973), box(843), nullptr);
+  avl = remove_int(avl, 930);
+  avl = remove_int(avl, 242);
+  avl = grpc_avl_add(avl, box(997), box(846), nullptr);
+  avl = grpc_avl_add(avl, box(689), box(847), nullptr);
+  avl = remove_int(avl, 318);
+  avl = grpc_avl_add(avl, box(703), box(849), nullptr);
+  avl = grpc_avl_add(avl, box(868), box(850), nullptr);
+  avl = grpc_avl_add(avl, box(200), box(851), nullptr);
+  avl = grpc_avl_add(avl, box(960), box(852), nullptr);
+  avl = grpc_avl_add(avl, box(80), box(853), nullptr);
+  avl = remove_int(avl, 113);
+  avl = grpc_avl_add(avl, box(135), box(855), nullptr);
+  avl = remove_int(avl, 529);
+  avl = grpc_avl_add(avl, box(366), box(857), nullptr);
+  avl = remove_int(avl, 272);
+  avl = grpc_avl_add(avl, box(921), box(859), nullptr);
+  avl = remove_int(avl, 497);
+  avl = grpc_avl_add(avl, box(712), box(861), nullptr);
+  avl = remove_int(avl, 777);
+  avl = remove_int(avl, 505);
+  avl = remove_int(avl, 974);
+  avl = remove_int(avl, 497);
+  avl = grpc_avl_add(avl, box(388), box(866), nullptr);
+  avl = grpc_avl_add(avl, box(29), box(867), nullptr);
+  avl = grpc_avl_add(avl, box(180), box(868), nullptr);
+  avl = grpc_avl_add(avl, box(983), box(869), nullptr);
+  avl = grpc_avl_add(avl, box(72), box(870), nullptr);
+  avl = grpc_avl_add(avl, box(693), box(871), nullptr);
+  avl = grpc_avl_add(avl, box(567), box(872), nullptr);
+  avl = remove_int(avl, 549);
+  avl = remove_int(avl, 351);
+  avl = grpc_avl_add(avl, box(1019), box(875), nullptr);
+  avl = remove_int(avl, 585);
+  avl = remove_int(avl, 294);
+  avl = remove_int(avl, 61);
+  avl = grpc_avl_add(avl, box(409), box(879), nullptr);
+  avl = grpc_avl_add(avl, box(984), box(880), nullptr);
+  avl = grpc_avl_add(avl, box(830), box(881), nullptr);
+  avl = remove_int(avl, 579);
+  avl = grpc_avl_add(avl, box(672), box(883), nullptr);
+  avl = remove_int(avl, 968);
+
+  grpc_avl_unref(avl, nullptr);
+}
+
+static void test_badcase3(void) {
+  grpc_avl avl;
+
+  gpr_log(GPR_DEBUG, "test_badcase3");
+
+  avl = grpc_avl_create(&int_int_vtable);
+  avl = remove_int(avl, 624);
+  avl = grpc_avl_add(avl, box(59), box(2), nullptr);
+  avl = grpc_avl_add(avl, box(494), box(3), nullptr);
+  avl = grpc_avl_add(avl, box(226), box(4), nullptr);
+  avl = remove_int(avl, 524);
+  avl = grpc_avl_add(avl, box(540), box(6), nullptr);
+  avl = remove_int(avl, 1008);
+  avl = grpc_avl_add(avl, box(502), box(8), nullptr);
+  avl = remove_int(avl, 267);
+  avl = remove_int(avl, 764);
+  avl = remove_int(avl, 443);
+  avl = grpc_avl_add(avl, box(8), box(12), nullptr);
+  avl = remove_int(avl, 291);
+  avl = remove_int(avl, 796);
+  avl = remove_int(avl, 1002);
+  avl = grpc_avl_add(avl, box(778), box(16), nullptr);
+  avl = remove_int(avl, 621);
+  avl = remove_int(avl, 891);
+  avl = remove_int(avl, 880);
+  avl = grpc_avl_add(avl, box(197), box(20), nullptr);
+  avl = grpc_avl_add(avl, box(441), box(21), nullptr);
+  avl = grpc_avl_add(avl, box(719), box(22), nullptr);
+  avl = remove_int(avl, 109);
+  avl = grpc_avl_add(avl, box(458), box(24), nullptr);
+  avl = remove_int(avl, 86);
+  avl = grpc_avl_add(avl, box(897), box(26), nullptr);
+  avl = grpc_avl_add(avl, box(997), box(27), nullptr);
+  avl = remove_int(avl, 235);
+  avl = remove_int(avl, 425);
+  avl = remove_int(avl, 186);
+  avl = grpc_avl_add(avl, box(887), box(31), nullptr);
+  avl = grpc_avl_add(avl, box(1005), box(32), nullptr);
+  avl = grpc_avl_add(avl, box(778), box(33), nullptr);
+  avl = grpc_avl_add(avl, box(575), box(34), nullptr);
+  avl = remove_int(avl, 966);
+  avl = remove_int(avl, 1015);
+  avl = grpc_avl_add(avl, box(486), box(37), nullptr);
+  avl = grpc_avl_add(avl, box(809), box(38), nullptr);
+  avl = grpc_avl_add(avl, box(907), box(39), nullptr);
+  avl = grpc_avl_add(avl, box(971), box(40), nullptr);
+  avl = remove_int(avl, 441);
+  avl = remove_int(avl, 498);
+  avl = grpc_avl_add(avl, box(727), box(43), nullptr);
+  avl = remove_int(avl, 679);
+  avl = remove_int(avl, 740);
+  avl = remove_int(avl, 532);
+  avl = grpc_avl_add(avl, box(805), box(47), nullptr);
+  avl = remove_int(avl, 64);
+  avl = grpc_avl_add(avl, box(362), box(49), nullptr);
+  avl = grpc_avl_add(avl, box(170), box(50), nullptr);
+  avl = grpc_avl_add(avl, box(389), box(51), nullptr);
+  avl = grpc_avl_add(avl, box(689), box(52), nullptr);
+  avl = remove_int(avl, 871);
+  avl = grpc_avl_add(avl, box(447), box(54), nullptr);
+  avl = remove_int(avl, 718);
+  avl = grpc_avl_add(avl, box(724), box(56), nullptr);
+  avl = remove_int(avl, 215);
+  avl = grpc_avl_add(avl, box(550), box(58), nullptr);
+  avl = remove_int(avl, 932);
+  avl = grpc_avl_add(avl, box(47), box(60), nullptr);
+  avl = remove_int(avl, 46);
+  avl = remove_int(avl, 229);
+  avl = grpc_avl_add(avl, box(68), box(63), nullptr);
+  avl = grpc_avl_add(avl, box(387), box(64), nullptr);
+  avl = remove_int(avl, 933);
+  avl = remove_int(avl, 736);
+  avl = remove_int(avl, 719);
+  avl = grpc_avl_add(avl, box(150), box(68), nullptr);
+  avl = remove_int(avl, 875);
+  avl = remove_int(avl, 298);
+  avl = grpc_avl_add(avl, box(991), box(71), nullptr);
+  avl = remove_int(avl, 705);
+  avl = grpc_avl_add(avl, box(197), box(73), nullptr);
+  avl = grpc_avl_add(avl, box(101), box(74), nullptr);
+  avl = remove_int(avl, 436);
+  avl = grpc_avl_add(avl, box(755), box(76), nullptr);
+  avl = grpc_avl_add(avl, box(727), box(77), nullptr);
+  avl = remove_int(avl, 309);
+  avl = remove_int(avl, 253);
+  avl = grpc_avl_add(avl, box(203), box(80), nullptr);
+  avl = remove_int(avl, 231);
+  avl = grpc_avl_add(avl, box(461), box(82), nullptr);
+  avl = remove_int(avl, 316);
+  avl = remove_int(avl, 493);
+  avl = grpc_avl_add(avl, box(184), box(85), nullptr);
+  avl = remove_int(avl, 737);
+  avl = grpc_avl_add(avl, box(790), box(87), nullptr);
+  avl = grpc_avl_add(avl, box(335), box(88), nullptr);
+  avl = remove_int(avl, 649);
+  avl = grpc_avl_add(avl, box(69), box(90), nullptr);
+  avl = remove_int(avl, 585);
+  avl = remove_int(avl, 543);
+  avl = grpc_avl_add(avl, box(784), box(93), nullptr);
+  avl = grpc_avl_add(avl, box(60), box(94), nullptr);
+  avl = grpc_avl_add(avl, box(525), box(95), nullptr);
+  avl = grpc_avl_add(avl, box(177), box(96), nullptr);
+  avl = grpc_avl_add(avl, box(178), box(97), nullptr);
+  avl = grpc_avl_add(avl, box(683), box(98), nullptr);
+  avl = grpc_avl_add(avl, box(226), box(99), nullptr);
+  avl = grpc_avl_add(avl, box(662), box(100), nullptr);
+  avl = remove_int(avl, 944);
+  avl = grpc_avl_add(avl, box(562), box(102), nullptr);
+  avl = grpc_avl_add(avl, box(793), box(103), nullptr);
+  avl = remove_int(avl, 673);
+  avl = grpc_avl_add(avl, box(310), box(105), nullptr);
+  avl = remove_int(avl, 479);
+  avl = remove_int(avl, 543);
+  avl = remove_int(avl, 159);
+  avl = remove_int(avl, 850);
+  avl = grpc_avl_add(avl, box(318), box(110), nullptr);
+  avl = grpc_avl_add(avl, box(483), box(111), nullptr);
+  avl = grpc_avl_add(avl, box(84), box(112), nullptr);
+  avl = remove_int(avl, 109);
+  avl = grpc_avl_add(avl, box(132), box(114), nullptr);
+  avl = grpc_avl_add(avl, box(920), box(115), nullptr);
+  avl = remove_int(avl, 746);
+  avl = grpc_avl_add(avl, box(145), box(117), nullptr);
+  avl = grpc_avl_add(avl, box(526), box(118), nullptr);
+  avl = remove_int(avl, 158);
+  avl = grpc_avl_add(avl, box(332), box(120), nullptr);
+  avl = grpc_avl_add(avl, box(918), box(121), nullptr);
+  avl = remove_int(avl, 339);
+  avl = grpc_avl_add(avl, box(809), box(123), nullptr);
+  avl = grpc_avl_add(avl, box(742), box(124), nullptr);
+  avl = grpc_avl_add(avl, box(718), box(125), nullptr);
+  avl = remove_int(avl, 988);
+  avl = remove_int(avl, 531);
+  avl = remove_int(avl, 840);
+  avl = grpc_avl_add(avl, box(816), box(129), nullptr);
+  avl = grpc_avl_add(avl, box(976), box(130), nullptr);
+  avl = remove_int(avl, 743);
+  avl = remove_int(avl, 528);
+  avl = remove_int(avl, 982);
+  avl = grpc_avl_add(avl, box(803), box(134), nullptr);
+  avl = grpc_avl_add(avl, box(205), box(135), nullptr);
+  avl = grpc_avl_add(avl, box(584), box(136), nullptr);
+  avl = remove_int(avl, 923);
+  avl = remove_int(avl, 538);
+  avl = remove_int(avl, 398);
+  avl = remove_int(avl, 320);
+  avl = remove_int(avl, 292);
+  avl = grpc_avl_add(avl, box(270), box(142), nullptr);
+  avl = grpc_avl_add(avl, box(333), box(143), nullptr);
+  avl = remove_int(avl, 439);
+  avl = grpc_avl_add(avl, box(35), box(145), nullptr);
+  avl = grpc_avl_add(avl, box(837), box(146), nullptr);
+  avl = remove_int(avl, 65);
+  avl = remove_int(avl, 642);
+  avl = remove_int(avl, 371);
+  avl = remove_int(avl, 140);
+  avl = remove_int(avl, 533);
+  avl = remove_int(avl, 676);
+  avl = grpc_avl_add(avl, box(624), box(153), nullptr);
+  avl = grpc_avl_add(avl, box(116), box(154), nullptr);
+  avl = grpc_avl_add(avl, box(446), box(155), nullptr);
+  avl = remove_int(avl, 91);
+  avl = remove_int(avl, 721);
+  avl = remove_int(avl, 537);
+  avl = grpc_avl_add(avl, box(448), box(159), nullptr);
+  avl = remove_int(avl, 155);
+  avl = remove_int(avl, 344);
+  avl = remove_int(avl, 237);
+  avl = grpc_avl_add(avl, box(309), box(163), nullptr);
+  avl = grpc_avl_add(avl, box(434), box(164), nullptr);
+  avl = grpc_avl_add(avl, box(277), box(165), nullptr);
+  avl = remove_int(avl, 233);
+  avl = grpc_avl_add(avl, box(275), box(167), nullptr);
+  avl = grpc_avl_add(avl, box(218), box(168), nullptr);
+  avl = grpc_avl_add(avl, box(76), box(169), nullptr);
+  avl = grpc_avl_add(avl, box(898), box(170), nullptr);
+  avl = remove_int(avl, 771);
+  avl = grpc_avl_add(avl, box(237), box(172), nullptr);
+  avl = remove_int(avl, 327);
+  avl = grpc_avl_add(avl, box(499), box(174), nullptr);
+  avl = remove_int(avl, 727);
+  avl = remove_int(avl, 234);
+  avl = remove_int(avl, 623);
+  avl = remove_int(avl, 458);
+  avl = remove_int(avl, 326);
+  avl = remove_int(avl, 589);
+  avl = grpc_avl_add(avl, box(442), box(181), nullptr);
+  avl = remove_int(avl, 389);
+  avl = grpc_avl_add(avl, box(708), box(183), nullptr);
+  avl = grpc_avl_add(avl, box(594), box(184), nullptr);
+  avl = grpc_avl_add(avl, box(942), box(185), nullptr);
+  avl = grpc_avl_add(avl, box(282), box(186), nullptr);
+  avl = remove_int(avl, 434);
+  avl = remove_int(avl, 134);
+  avl = remove_int(avl, 270);
+  avl = remove_int(avl, 512);
+  avl = remove_int(avl, 265);
+  avl = remove_int(avl, 21);
+  avl = remove_int(avl, 193);
+  avl = remove_int(avl, 797);
+  avl = remove_int(avl, 347);
+  avl = grpc_avl_add(avl, box(99), box(196), nullptr);
+  avl = grpc_avl_add(avl, box(161), box(197), nullptr);
+  avl = remove_int(avl, 484);
+  avl = grpc_avl_add(avl, box(72), box(199), nullptr);
+  avl = remove_int(avl, 629);
+  avl = grpc_avl_add(avl, box(522), box(201), nullptr);
+  avl = remove_int(avl, 679);
+  avl = grpc_avl_add(avl, box(407), box(203), nullptr);
+  avl = remove_int(avl, 693);
+  avl = grpc_avl_add(avl, box(424), box(205), nullptr);
+  avl = grpc_avl_add(avl, box(651), box(206), nullptr);
+  avl = grpc_avl_add(avl, box(927), box(207), nullptr);
+  avl = remove_int(avl, 553);
+  avl = grpc_avl_add(avl, box(128), box(209), nullptr);
+  avl = grpc_avl_add(avl, box(616), box(210), nullptr);
+  avl = grpc_avl_add(avl, box(690), box(211), nullptr);
+  avl = remove_int(avl, 241);
+  avl = remove_int(avl, 179);
+  avl = grpc_avl_add(avl, box(697), box(214), nullptr);
+  avl = remove_int(avl, 779);
+  avl = grpc_avl_add(avl, box(241), box(216), nullptr);
+  avl = remove_int(avl, 190);
+  avl = remove_int(avl, 210);
+  avl = grpc_avl_add(avl, box(711), box(219), nullptr);
+  avl = remove_int(avl, 251);
+  avl = remove_int(avl, 61);
+  avl = grpc_avl_add(avl, box(800), box(222), nullptr);
+  avl = remove_int(avl, 551);
+  avl = grpc_avl_add(avl, box(61), box(224), nullptr);
+  avl = grpc_avl_add(avl, box(656), box(225), nullptr);
+  avl = remove_int(avl, 130);
+  avl = remove_int(avl, 368);
+  avl = remove_int(avl, 150);
+  avl = remove_int(avl, 73);
+  avl = grpc_avl_add(avl, box(799), box(230), nullptr);
+  avl = grpc_avl_add(avl, box(125), box(231), nullptr);
+  avl = remove_int(avl, 107);
+  avl = grpc_avl_add(avl, box(938), box(233), nullptr);
+  avl = grpc_avl_add(avl, box(914), box(234), nullptr);
+  avl = grpc_avl_add(avl, box(197), box(235), nullptr);
+  avl = remove_int(avl, 736);
+  avl = grpc_avl_add(avl, box(20), box(237), nullptr);
+  avl = remove_int(avl, 224);
+  avl = remove_int(avl, 841);
+  avl = grpc_avl_add(avl, box(226), box(240), nullptr);
+  avl = remove_int(avl, 963);
+  avl = remove_int(avl, 796);
+  avl = remove_int(avl, 728);
+  avl = grpc_avl_add(avl, box(855), box(244), nullptr);
+  avl = grpc_avl_add(avl, box(769), box(245), nullptr);
+  avl = grpc_avl_add(avl, box(631), box(246), nullptr);
+  avl = remove_int(avl, 648);
+  avl = grpc_avl_add(avl, box(187), box(248), nullptr);
+  avl = grpc_avl_add(avl, box(31), box(249), nullptr);
+  avl = remove_int(avl, 163);
+  avl = grpc_avl_add(avl, box(218), box(251), nullptr);
+  avl = grpc_avl_add(avl, box(488), box(252), nullptr);
+  avl = grpc_avl_add(avl, box(387), box(253), nullptr);
+  avl = grpc_avl_add(avl, box(809), box(254), nullptr);
+  avl = grpc_avl_add(avl, box(997), box(255), nullptr);
+  avl = remove_int(avl, 678);
+  avl = grpc_avl_add(avl, box(368), box(257), nullptr);
+  avl = grpc_avl_add(avl, box(220), box(258), nullptr);
+  avl = grpc_avl_add(avl, box(373), box(259), nullptr);
+  avl = remove_int(avl, 874);
+  avl = remove_int(avl, 682);
+  avl = remove_int(avl, 1014);
+  avl = remove_int(avl, 195);
+  avl = grpc_avl_add(avl, box(868), box(264), nullptr);
+  avl = remove_int(avl, 254);
+  avl = remove_int(avl, 456);
+  avl = grpc_avl_add(avl, box(906), box(267), nullptr);
+  avl = remove_int(avl, 711);
+  avl = grpc_avl_add(avl, box(632), box(269), nullptr);
+  avl = remove_int(avl, 474);
+  avl = grpc_avl_add(avl, box(508), box(271), nullptr);
+  avl = grpc_avl_add(avl, box(518), box(272), nullptr);
+  avl = remove_int(avl, 579);
+  avl = remove_int(avl, 948);
+  avl = grpc_avl_add(avl, box(789), box(275), nullptr);
+  avl = grpc_avl_add(avl, box(48), box(276), nullptr);
+  avl = grpc_avl_add(avl, box(256), box(277), nullptr);
+  avl = grpc_avl_add(avl, box(754), box(278), nullptr);
+  avl = remove_int(avl, 215);
+  avl = grpc_avl_add(avl, box(679), box(280), nullptr);
+  avl = grpc_avl_add(avl, box(606), box(281), nullptr);
+  avl = remove_int(avl, 941);
+  avl = remove_int(avl, 31);
+  avl = grpc_avl_add(avl, box(758), box(284), nullptr);
+  avl = remove_int(avl, 101);
+  avl = grpc_avl_add(avl, box(244), box(286), nullptr);
+  avl = grpc_avl_add(avl, box(337), box(287), nullptr);
+  avl = grpc_avl_add(avl, box(461), box(288), nullptr);
+  avl = remove_int(avl, 476);
+  avl = grpc_avl_add(avl, box(845), box(290), nullptr);
+  avl = remove_int(avl, 160);
+  avl = grpc_avl_add(avl, box(690), box(292), nullptr);
+  avl = remove_int(avl, 931);
+  avl = grpc_avl_add(avl, box(869), box(294), nullptr);
+  avl = grpc_avl_add(avl, box(1019), box(295), nullptr);
+  avl = remove_int(avl, 591);
+  avl = remove_int(avl, 635);
+  avl = remove_int(avl, 67);
+  avl = grpc_avl_add(avl, box(113), box(299), nullptr);
+  avl = remove_int(avl, 305);
+  avl = grpc_avl_add(avl, box(10), box(301), nullptr);
+  avl = remove_int(avl, 823);
+  avl = remove_int(avl, 288);
+  avl = remove_int(avl, 239);
+  avl = grpc_avl_add(avl, box(646), box(305), nullptr);
+  avl = grpc_avl_add(avl, box(1006), box(306), nullptr);
+  avl = grpc_avl_add(avl, box(954), box(307), nullptr);
+  avl = grpc_avl_add(avl, box(199), box(308), nullptr);
+  avl = grpc_avl_add(avl, box(69), box(309), nullptr);
+  avl = grpc_avl_add(avl, box(984), box(310), nullptr);
+  avl = remove_int(avl, 568);
+  avl = remove_int(avl, 666);
+  avl = remove_int(avl, 37);
+  avl = grpc_avl_add(avl, box(845), box(314), nullptr);
+  avl = remove_int(avl, 535);
+  avl = remove_int(avl, 365);
+  avl = remove_int(avl, 676);
+  avl = remove_int(avl, 892);
+  avl = remove_int(avl, 425);
+  avl = remove_int(avl, 704);
+  avl = remove_int(avl, 168);
+  avl = grpc_avl_add(avl, box(853), box(322), nullptr);
+  avl = grpc_avl_add(avl, box(335), box(323), nullptr);
+  avl = grpc_avl_add(avl, box(961), box(324), nullptr);
+  avl = grpc_avl_add(avl, box(73), box(325), nullptr);
+  avl = remove_int(avl, 469);
+  avl = grpc_avl_add(avl, box(449), box(327), nullptr);
+  avl = remove_int(avl, 821);
+  avl = grpc_avl_add(avl, box(845), box(329), nullptr);
+  avl = remove_int(avl, 637);
+  avl = grpc_avl_add(avl, box(769), box(331), nullptr);
+  avl = grpc_avl_add(avl, box(901), box(332), nullptr);
+  avl = remove_int(avl, 142);
+  avl = remove_int(avl, 361);
+  avl = remove_int(avl, 876);
+  avl = grpc_avl_add(avl, box(614), box(336), nullptr);
+  avl = grpc_avl_add(avl, box(729), box(337), nullptr);
+  avl = remove_int(avl, 120);
+  avl = remove_int(avl, 473);
+  avl = remove_int(avl, 445);
+  avl = grpc_avl_add(avl, box(978), box(341), nullptr);
+  avl = grpc_avl_add(avl, box(164), box(342), nullptr);
+  avl = grpc_avl_add(avl, box(1), box(343), nullptr);
+  avl = remove_int(avl, 890);
+  avl = grpc_avl_add(avl, box(605), box(345), nullptr);
+  avl = grpc_avl_add(avl, box(178), box(346), nullptr);
+  avl = grpc_avl_add(avl, box(481), box(347), nullptr);
+  avl = grpc_avl_add(avl, box(772), box(348), nullptr);
+  avl = remove_int(avl, 824);
+  avl = remove_int(avl, 167);
+  avl = remove_int(avl, 151);
+  avl = grpc_avl_add(avl, box(698), box(352), nullptr);
+  avl = grpc_avl_add(avl, box(202), box(353), nullptr);
+  avl = grpc_avl_add(avl, box(921), box(354), nullptr);
+  avl = grpc_avl_add(avl, box(875), box(355), nullptr);
+  avl = remove_int(avl, 197);
+  avl = remove_int(avl, 232);
+  avl = grpc_avl_add(avl, box(209), box(358), nullptr);
+  avl = remove_int(avl, 324);
+  avl = remove_int(avl, 56);
+  avl = remove_int(avl, 579);
+  avl = remove_int(avl, 255);
+  avl = remove_int(avl, 290);
+  avl = grpc_avl_add(avl, box(661), box(364), nullptr);
+  avl = grpc_avl_add(avl, box(113), box(365), nullptr);
+  avl = remove_int(avl, 767);
+  avl = grpc_avl_add(avl, box(586), box(367), nullptr);
+  avl = grpc_avl_add(avl, box(121), box(368), nullptr);
+  avl = remove_int(avl, 235);
+  avl = remove_int(avl, 439);
+  avl = remove_int(avl, 360);
+  avl = grpc_avl_add(avl, box(916), box(372), nullptr);
+  avl = remove_int(avl, 999);
+  avl = grpc_avl_add(avl, box(825), box(374), nullptr);
+  avl = grpc_avl_add(avl, box(177), box(375), nullptr);
+  avl = remove_int(avl, 204);
+  avl = remove_int(avl, 92);
+  avl = grpc_avl_add(avl, box(794), box(378), nullptr);
+  avl = grpc_avl_add(avl, box(463), box(379), nullptr);
+  avl = grpc_avl_add(avl, box(472), box(380), nullptr);
+  avl = remove_int(avl, 235);
+  avl = grpc_avl_add(avl, box(840), box(382), nullptr);
+  avl = remove_int(avl, 657);
+  avl = grpc_avl_add(avl, box(586), box(384), nullptr);
+  avl = grpc_avl_add(avl, box(979), box(385), nullptr);
+  avl = remove_int(avl, 979);
+  avl = grpc_avl_add(avl, box(639), box(387), nullptr);
+  avl = remove_int(avl, 907);
+  avl = remove_int(avl, 973);
+  avl = grpc_avl_add(avl, box(913), box(390), nullptr);
+  avl = grpc_avl_add(avl, box(566), box(391), nullptr);
+  avl = grpc_avl_add(avl, box(883), box(392), nullptr);
+  avl = grpc_avl_add(avl, box(552), box(393), nullptr);
+  avl = grpc_avl_add(avl, box(16), box(394), nullptr);
+  avl = remove_int(avl, 60);
+  avl = grpc_avl_add(avl, box(567), box(396), nullptr);
+  avl = grpc_avl_add(avl, box(705), box(397), nullptr);
+  avl = grpc_avl_add(avl, box(94), box(398), nullptr);
+  avl = remove_int(avl, 321);
+  avl = grpc_avl_add(avl, box(207), box(400), nullptr);
+  avl = grpc_avl_add(avl, box(682), box(401), nullptr);
+  avl = grpc_avl_add(avl, box(592), box(402), nullptr);
+  avl = grpc_avl_add(avl, box(10), box(403), nullptr);
+  avl = remove_int(avl, 911);
+  avl = remove_int(avl, 161);
+  avl = grpc_avl_add(avl, box(86), box(406), nullptr);
+  avl = remove_int(avl, 893);
+  avl = remove_int(avl, 362);
+  avl = grpc_avl_add(avl, box(599), box(409), nullptr);
+  avl = remove_int(avl, 413);
+  avl = grpc_avl_add(avl, box(867), box(411), nullptr);
+  avl = remove_int(avl, 955);
+  avl = grpc_avl_add(avl, box(341), box(413), nullptr);
+  avl = grpc_avl_add(avl, box(887), box(414), nullptr);
+  avl = remove_int(avl, 706);
+  avl = grpc_avl_add(avl, box(939), box(416), nullptr);
+  avl = remove_int(avl, 233);
+  avl = remove_int(avl, 662);
+  avl = remove_int(avl, 984);
+  avl = remove_int(avl, 203);
+  avl = grpc_avl_add(avl, box(326), box(421), nullptr);
+  avl = remove_int(avl, 848);
+  avl = grpc_avl_add(avl, box(235), box(423), nullptr);
+  avl = remove_int(avl, 617);
+  avl = grpc_avl_add(avl, box(565), box(425), nullptr);
+  avl = remove_int(avl, 469);
+  avl = grpc_avl_add(avl, box(988), box(427), nullptr);
+  avl = remove_int(avl, 957);
+  avl = grpc_avl_add(avl, box(426), box(429), nullptr);
+  avl = remove_int(avl, 967);
+  avl = grpc_avl_add(avl, box(890), box(431), nullptr);
+  avl = grpc_avl_add(avl, box(473), box(432), nullptr);
+  avl = remove_int(avl, 367);
+  avl = remove_int(avl, 344);
+  avl = remove_int(avl, 660);
+  avl = remove_int(avl, 448);
+  avl = remove_int(avl, 837);
+  avl = remove_int(avl, 158);
+  avl = grpc_avl_add(avl, box(459), box(439), nullptr);
+  avl = remove_int(avl, 882);
+  avl = remove_int(avl, 782);
+  avl = grpc_avl_add(avl, box(408), box(442), nullptr);
+  avl = grpc_avl_add(avl, box(728), box(443), nullptr);
+  avl = remove_int(avl, 27);
+  avl = grpc_avl_add(avl, box(137), box(445), nullptr);
+  avl = grpc_avl_add(avl, box(239), box(446), nullptr);
+  avl = remove_int(avl, 854);
+  avl = grpc_avl_add(avl, box(104), box(448), nullptr);
+  avl = grpc_avl_add(avl, box(823), box(449), nullptr);
+  avl = grpc_avl_add(avl, box(524), box(450), nullptr);
+  avl = grpc_avl_add(avl, box(995), box(451), nullptr);
+  avl = remove_int(avl, 422);
+  avl = remove_int(avl, 220);
+  avl = grpc_avl_add(avl, box(856), box(454), nullptr);
+  avl = remove_int(avl, 332);
+  avl = grpc_avl_add(avl, box(679), box(456), nullptr);
+  avl = remove_int(avl, 18);
+  avl = grpc_avl_add(avl, box(837), box(458), nullptr);
+  avl = remove_int(avl, 405);
+  avl = remove_int(avl, 877);
+  avl = remove_int(avl, 835);
+  avl = grpc_avl_add(avl, box(547), box(462), nullptr);
+  avl = remove_int(avl, 805);
+  avl = remove_int(avl, 862);
+  avl = grpc_avl_add(avl, box(75), box(465), nullptr);
+  avl = remove_int(avl, 41);
+  avl = grpc_avl_add(avl, box(310), box(467), nullptr);
+  avl = remove_int(avl, 855);
+  avl = grpc_avl_add(avl, box(20), box(469), nullptr);
+  avl = remove_int(avl, 186);
+  avl = remove_int(avl, 378);
+  avl = remove_int(avl, 442);
+  avl = remove_int(avl, 930);
+  avl = grpc_avl_add(avl, box(118), box(474), nullptr);
+  avl = grpc_avl_add(avl, box(96), box(475), nullptr);
+  avl = remove_int(avl, 854);
+  avl = grpc_avl_add(avl, box(65), box(477), nullptr);
+  avl = grpc_avl_add(avl, box(573), box(478), nullptr);
+  avl = grpc_avl_add(avl, box(4), box(479), nullptr);
+  avl = grpc_avl_add(avl, box(451), box(480), nullptr);
+  avl = grpc_avl_add(avl, box(774), box(481), nullptr);
+  avl = grpc_avl_add(avl, box(126), box(482), nullptr);
+  avl = remove_int(avl, 956);
+  avl = remove_int(avl, 591);
+  avl = remove_int(avl, 644);
+  avl = grpc_avl_add(avl, box(304), box(486), nullptr);
+  avl = remove_int(avl, 620);
+  avl = remove_int(avl, 394);
+  avl = grpc_avl_add(avl, box(1002), box(489), nullptr);
+  avl = grpc_avl_add(avl, box(837), box(490), nullptr);
+  avl = remove_int(avl, 485);
+  avl = grpc_avl_add(avl, box(1005), box(492), nullptr);
+  avl = remove_int(avl, 21);
+  avl = grpc_avl_add(avl, box(396), box(494), nullptr);
+  avl = remove_int(avl, 966);
+  avl = grpc_avl_add(avl, box(105), box(496), nullptr);
+  avl = grpc_avl_add(avl, box(316), box(497), nullptr);
+  avl = remove_int(avl, 776);
+  avl = grpc_avl_add(avl, box(188), box(499), nullptr);
+  avl = remove_int(avl, 200);
+  avl = grpc_avl_add(avl, box(98), box(501), nullptr);
+  avl = grpc_avl_add(avl, box(831), box(502), nullptr);
+  avl = grpc_avl_add(avl, box(227), box(503), nullptr);
+  avl = grpc_avl_add(avl, box(220), box(504), nullptr);
+  avl = remove_int(avl, 715);
+  avl = remove_int(avl, 279);
+  avl = grpc_avl_add(avl, box(701), box(507), nullptr);
+  avl = grpc_avl_add(avl, box(726), box(508), nullptr);
+  avl = grpc_avl_add(avl, box(815), box(509), nullptr);
+  avl = grpc_avl_add(avl, box(749), box(510), nullptr);
+  avl = remove_int(avl, 946);
+  avl = remove_int(avl, 449);
+  avl = remove_int(avl, 62);
+  avl = remove_int(avl, 487);
+  avl = grpc_avl_add(avl, box(545), box(515), nullptr);
+  avl = remove_int(avl, 59);
+  avl = grpc_avl_add(avl, box(168), box(517), nullptr);
+  avl = remove_int(avl, 337);
+  avl = grpc_avl_add(avl, box(69), box(519), nullptr);
+  avl = remove_int(avl, 600);
+  avl = grpc_avl_add(avl, box(591), box(521), nullptr);
+  avl = grpc_avl_add(avl, box(960), box(522), nullptr);
+  avl = grpc_avl_add(avl, box(116), box(523), nullptr);
+  avl = remove_int(avl, 991);
+  avl = grpc_avl_add(avl, box(760), box(525), nullptr);
+  avl = grpc_avl_add(avl, box(664), box(526), nullptr);
+  avl = grpc_avl_add(avl, box(547), box(527), nullptr);
+  avl = remove_int(avl, 922);
+  avl = grpc_avl_add(avl, box(290), box(529), nullptr);
+  avl = grpc_avl_add(avl, box(859), box(530), nullptr);
+  avl = grpc_avl_add(avl, box(49), box(531), nullptr);
+  avl = remove_int(avl, 455);
+  avl = remove_int(avl, 786);
+  avl = grpc_avl_add(avl, box(613), box(534), nullptr);
+  avl = grpc_avl_add(avl, box(326), box(535), nullptr);
+  avl = remove_int(avl, 615);
+  avl = grpc_avl_add(avl, box(45), box(537), nullptr);
+  avl = grpc_avl_add(avl, box(162), box(538), nullptr);
+  avl = grpc_avl_add(avl, box(189), box(539), nullptr);
+  avl = remove_int(avl, 68);
+  avl = remove_int(avl, 846);
+  avl = grpc_avl_add(avl, box(608), box(542), nullptr);
+  avl = remove_int(avl, 821);
+  avl = grpc_avl_add(avl, box(978), box(544), nullptr);
+  avl = grpc_avl_add(avl, box(892), box(545), nullptr);
+  avl = remove_int(avl, 924);
+  avl = grpc_avl_add(avl, box(708), box(547), nullptr);
+  avl = remove_int(avl, 135);
+  avl = remove_int(avl, 124);
+  avl = grpc_avl_add(avl, box(301), box(550), nullptr);
+  avl = grpc_avl_add(avl, box(939), box(551), nullptr);
+  avl = grpc_avl_add(avl, box(344), box(552), nullptr);
+  avl = remove_int(avl, 443);
+  avl = remove_int(avl, 122);
+  avl = grpc_avl_add(avl, box(636), box(555), nullptr);
+  avl = remove_int(avl, 558);
+  avl = grpc_avl_add(avl, box(923), box(557), nullptr);
+  avl = remove_int(avl, 827);
+  avl = grpc_avl_add(avl, box(649), box(559), nullptr);
+  avl = grpc_avl_add(avl, box(808), box(560), nullptr);
+  avl = remove_int(avl, 570);
+  avl = remove_int(avl, 434);
+  avl = grpc_avl_add(avl, box(40), box(563), nullptr);
+  avl = grpc_avl_add(avl, box(725), box(564), nullptr);
+  avl = remove_int(avl, 295);
+  avl = remove_int(avl, 615);
+  avl = remove_int(avl, 919);
+  avl = remove_int(avl, 170);
+  avl = remove_int(avl, 442);
+  avl = remove_int(avl, 971);
+  avl = grpc_avl_add(avl, box(483), box(571), nullptr);
+  avl = grpc_avl_add(avl, box(512), box(572), nullptr);
+  avl = remove_int(avl, 648);
+  avl = remove_int(avl, 78);
+  avl = remove_int(avl, 72);
+  avl = remove_int(avl, 790);
+  avl = remove_int(avl, 571);
+  avl = grpc_avl_add(avl, box(898), box(578), nullptr);
+  avl = remove_int(avl, 770);
+  avl = remove_int(avl, 776);
+  avl = grpc_avl_add(avl, box(602), box(581), nullptr);
+  avl = remove_int(avl, 251);
+  avl = grpc_avl_add(avl, box(303), box(583), nullptr);
+  avl = remove_int(avl, 837);
+  avl = grpc_avl_add(avl, box(714), box(585), nullptr);
+  avl = remove_int(avl, 800);
+  avl = grpc_avl_add(avl, box(266), box(587), nullptr);
+  avl = grpc_avl_add(avl, box(555), box(588), nullptr);
+  avl = remove_int(avl, 604);
+  avl = remove_int(avl, 163);
+  avl = remove_int(avl, 497);
+  avl = grpc_avl_add(avl, box(296), box(592), nullptr);
+  avl = remove_int(avl, 129);
+  avl = grpc_avl_add(avl, box(656), box(594), nullptr);
+  avl = remove_int(avl, 769);
+  avl = remove_int(avl, 941);
+  avl = grpc_avl_add(avl, box(775), box(597), nullptr);
+  avl = grpc_avl_add(avl, box(846), box(598), nullptr);
+  avl = remove_int(avl, 591);
+  avl = remove_int(avl, 801);
+  avl = remove_int(avl, 419);
+  avl = remove_int(avl, 455);
+  avl = grpc_avl_add(avl, box(866), box(603), nullptr);
+  avl = grpc_avl_add(avl, box(575), box(604), nullptr);
+  avl = grpc_avl_add(avl, box(620), box(605), nullptr);
+  avl = remove_int(avl, 100);
+  avl = remove_int(avl, 667);
+  avl = grpc_avl_add(avl, box(138), box(608), nullptr);
+  avl = grpc_avl_add(avl, box(566), box(609), nullptr);
+  avl = grpc_avl_add(avl, box(673), box(610), nullptr);
+  avl = grpc_avl_add(avl, box(178), box(611), nullptr);
+  avl = remove_int(avl, 659);
+  avl = grpc_avl_add(avl, box(759), box(613), nullptr);
+  avl = grpc_avl_add(avl, box(1008), box(614), nullptr);
+  avl = remove_int(avl, 116);
+  avl = grpc_avl_add(avl, box(608), box(616), nullptr);
+  avl = grpc_avl_add(avl, box(339), box(617), nullptr);
+  avl = grpc_avl_add(avl, box(197), box(618), nullptr);
+  avl = remove_int(avl, 25);
+  avl = remove_int(avl, 628);
+  avl = grpc_avl_add(avl, box(487), box(621), nullptr);
+  avl = remove_int(avl, 739);
+  avl = remove_int(avl, 100);
+  avl = remove_int(avl, 928);
+  avl = grpc_avl_add(avl, box(647), box(625), nullptr);
+  avl = remove_int(avl, 978);
+  avl = remove_int(avl, 143);
+  avl = remove_int(avl, 755);
+  avl = grpc_avl_add(avl, box(71), box(629), nullptr);
+  avl = remove_int(avl, 205);
+  avl = grpc_avl_add(avl, box(501), box(631), nullptr);
+  avl = remove_int(avl, 723);
+  avl = remove_int(avl, 852);
+  avl = remove_int(avl, 1021);
+  avl = remove_int(avl, 670);
+  avl = remove_int(avl, 500);
+  avl = grpc_avl_add(avl, box(330), box(637), nullptr);
+  avl = remove_int(avl, 264);
+  avl = grpc_avl_add(avl, box(69), box(639), nullptr);
+  avl = remove_int(avl, 73);
+  avl = grpc_avl_add(avl, box(745), box(641), nullptr);
+  avl = remove_int(avl, 518);
+  avl = remove_int(avl, 641);
+  avl = remove_int(avl, 768);
+  avl = grpc_avl_add(avl, box(988), box(645), nullptr);
+  avl = grpc_avl_add(avl, box(899), box(646), nullptr);
+  avl = remove_int(avl, 763);
+  avl = remove_int(avl, 281);
+  avl = remove_int(avl, 496);
+  avl = grpc_avl_add(avl, box(445), box(650), nullptr);
+  avl = remove_int(avl, 905);
+  avl = grpc_avl_add(avl, box(275), box(652), nullptr);
+  avl = grpc_avl_add(avl, box(137), box(653), nullptr);
+  avl = remove_int(avl, 642);
+  avl = grpc_avl_add(avl, box(708), box(655), nullptr);
+  avl = remove_int(avl, 922);
+  avl = grpc_avl_add(avl, box(743), box(657), nullptr);
+  avl = remove_int(avl, 295);
+  avl = remove_int(avl, 665);
+  avl = remove_int(avl, 48);
+  avl = grpc_avl_add(avl, box(1012), box(661), nullptr);
+  avl = remove_int(avl, 71);
+  avl = remove_int(avl, 523);
+  avl = grpc_avl_add(avl, box(319), box(664), nullptr);
+  avl = remove_int(avl, 632);
+  avl = grpc_avl_add(avl, box(137), box(666), nullptr);
+  avl = grpc_avl_add(avl, box(686), box(667), nullptr);
+  avl = grpc_avl_add(avl, box(724), box(668), nullptr);
+  avl = grpc_avl_add(avl, box(952), box(669), nullptr);
+  avl = grpc_avl_add(avl, box(5), box(670), nullptr);
+  avl = remove_int(avl, 35);
+  avl = grpc_avl_add(avl, box(43), box(672), nullptr);
+  avl = grpc_avl_add(avl, box(320), box(673), nullptr);
+  avl = grpc_avl_add(avl, box(115), box(674), nullptr);
+  avl = remove_int(avl, 377);
+  avl = remove_int(avl, 591);
+  avl = remove_int(avl, 87);
+  avl = remove_int(avl, 93);
+  avl = grpc_avl_add(avl, box(1016), box(679), nullptr);
+  avl = grpc_avl_add(avl, box(605), box(680), nullptr);
+  avl = grpc_avl_add(avl, box(152), box(681), nullptr);
+  avl = grpc_avl_add(avl, box(113), box(682), nullptr);
+  avl = remove_int(avl, 131);
+  avl = remove_int(avl, 637);
+  avl = grpc_avl_add(avl, box(156), box(685), nullptr);
+  avl = remove_int(avl, 696);
+  avl = grpc_avl_add(avl, box(546), box(687), nullptr);
+  avl = remove_int(avl, 970);
+  avl = remove_int(avl, 53);
+  avl = remove_int(avl, 827);
+  avl = remove_int(avl, 224);
+  avl = remove_int(avl, 796);
+  avl = remove_int(avl, 34);
+  avl = remove_int(avl, 922);
+  avl = remove_int(avl, 277);
+  avl = remove_int(avl, 650);
+  avl = remove_int(avl, 222);
+  avl = remove_int(avl, 244);
+  avl = remove_int(avl, 576);
+  avl = remove_int(avl, 413);
+  avl = grpc_avl_add(avl, box(500), box(701), nullptr);
+  avl = remove_int(avl, 924);
+  avl = grpc_avl_add(avl, box(825), box(703), nullptr);
+  avl = remove_int(avl, 888);
+  avl = remove_int(avl, 931);
+  avl = grpc_avl_add(avl, box(285), box(706), nullptr);
+  avl = remove_int(avl, 62);
+  avl = remove_int(avl, 444);
+  avl = remove_int(avl, 946);
+  avl = grpc_avl_add(avl, box(122), box(710), nullptr);
+  avl = grpc_avl_add(avl, box(846), box(711), nullptr);
+  avl = remove_int(avl, 628);
+  avl = grpc_avl_add(avl, box(511), box(713), nullptr);
+  avl = grpc_avl_add(avl, box(398), box(714), nullptr);
+  avl = remove_int(avl, 730);
+  avl = grpc_avl_add(avl, box(797), box(716), nullptr);
+  avl = remove_int(avl, 897);
+  avl = remove_int(avl, 228);
+  avl = remove_int(avl, 544);
+  avl = remove_int(avl, 552);
+  avl = remove_int(avl, 783);
+  avl = remove_int(avl, 583);
+  avl = remove_int(avl, 894);
+  avl = remove_int(avl, 942);
+  avl = grpc_avl_add(avl, box(346), box(725), nullptr);
+  avl = grpc_avl_add(avl, box(1015), box(726), nullptr);
+  avl = remove_int(avl, 813);
+  avl = grpc_avl_add(avl, box(213), box(728), nullptr);
+  avl = remove_int(avl, 468);
+  avl = remove_int(avl, 365);
+  avl = remove_int(avl, 399);
+  avl = grpc_avl_add(avl, box(380), box(732), nullptr);
+  avl = remove_int(avl, 835);
+  avl = remove_int(avl, 970);
+  avl = grpc_avl_add(avl, box(700), box(735), nullptr);
+  avl = grpc_avl_add(avl, box(807), box(736), nullptr);
+  avl = remove_int(avl, 312);
+  avl = remove_int(avl, 282);
+  avl = remove_int(avl, 370);
+  avl = remove_int(avl, 999);
+  avl = remove_int(avl, 241);
+  avl = remove_int(avl, 884);
+  avl = grpc_avl_add(avl, box(587), box(743), nullptr);
+  avl = grpc_avl_add(avl, box(332), box(744), nullptr);
+  avl = remove_int(avl, 686);
+  avl = remove_int(avl, 206);
+  avl = remove_int(avl, 835);
+  avl = grpc_avl_add(avl, box(334), box(748), nullptr);
+  avl = remove_int(avl, 171);
+  avl = grpc_avl_add(avl, box(1002), box(750), nullptr);
+  avl = grpc_avl_add(avl, box(779), box(751), nullptr);
+  avl = grpc_avl_add(avl, box(307), box(752), nullptr);
+  avl = grpc_avl_add(avl, box(127), box(753), nullptr);
+  avl = grpc_avl_add(avl, box(251), box(754), nullptr);
+  avl = remove_int(avl, 790);
+  avl = remove_int(avl, 189);
+  avl = remove_int(avl, 193);
+  avl = remove_int(avl, 38);
+  avl = remove_int(avl, 124);
+  avl = grpc_avl_add(avl, box(812), box(760), nullptr);
+  avl = remove_int(avl, 43);
+  avl = grpc_avl_add(avl, box(871), box(762), nullptr);
+  avl = grpc_avl_add(avl, box(580), box(763), nullptr);
+  avl = remove_int(avl, 501);
+  avl = remove_int(avl, 462);
+  avl = remove_int(avl, 599);
+  avl = grpc_avl_add(avl, box(240), box(767), nullptr);
+  avl = grpc_avl_add(avl, box(285), box(768), nullptr);
+  avl = grpc_avl_add(avl, box(472), box(769), nullptr);
+  avl = remove_int(avl, 865);
+  avl = remove_int(avl, 763);
+  avl = remove_int(avl, 245);
+  avl = remove_int(avl, 80);
+  avl = remove_int(avl, 713);
+  avl = remove_int(avl, 654);
+  avl = remove_int(avl, 1014);
+  avl = grpc_avl_add(avl, box(495), box(777), nullptr);
+  avl = grpc_avl_add(avl, box(552), box(778), nullptr);
+  avl = remove_int(avl, 19);
+  avl = remove_int(avl, 803);
+  avl = grpc_avl_add(avl, box(508), box(781), nullptr);
+  avl = remove_int(avl, 699);
+  avl = remove_int(avl, 260);
+  avl = remove_int(avl, 92);
+  avl = remove_int(avl, 497);
+  avl = grpc_avl_add(avl, box(970), box(786), nullptr);
+  avl = remove_int(avl, 987);
+  avl = remove_int(avl, 168);
+  avl = remove_int(avl, 476);
+  avl = remove_int(avl, 248);
+  avl = grpc_avl_add(avl, box(358), box(791), nullptr);
+  avl = remove_int(avl, 804);
+  avl = remove_int(avl, 77);
+  avl = remove_int(avl, 905);
+  avl = remove_int(avl, 362);
+  avl = grpc_avl_add(avl, box(578), box(796), nullptr);
+  avl = remove_int(avl, 38);
+  avl = remove_int(avl, 595);
+  avl = grpc_avl_add(avl, box(213), box(799), nullptr);
+  avl = remove_int(avl, 7);
+  avl = remove_int(avl, 620);
+  avl = grpc_avl_add(avl, box(946), box(802), nullptr);
+  avl = remove_int(avl, 145);
+  avl = grpc_avl_add(avl, box(628), box(804), nullptr);
+  avl = remove_int(avl, 972);
+  avl = grpc_avl_add(avl, box(728), box(806), nullptr);
+  avl = remove_int(avl, 91);
+  avl = grpc_avl_add(avl, box(136), box(808), nullptr);
+  avl = grpc_avl_add(avl, box(841), box(809), nullptr);
+  avl = grpc_avl_add(avl, box(265), box(810), nullptr);
+  avl = grpc_avl_add(avl, box(701), box(811), nullptr);
+  avl = grpc_avl_add(avl, box(27), box(812), nullptr);
+  avl = remove_int(avl, 72);
+  avl = remove_int(avl, 14);
+  avl = grpc_avl_add(avl, box(286), box(815), nullptr);
+  avl = remove_int(avl, 996);
+  avl = remove_int(avl, 998);
+  avl = grpc_avl_add(avl, box(466), box(818), nullptr);
+  avl = remove_int(avl, 1009);
+  avl = remove_int(avl, 741);
+  avl = remove_int(avl, 947);
+  avl = remove_int(avl, 241);
+  avl = remove_int(avl, 954);
+  avl = remove_int(avl, 183);
+  avl = remove_int(avl, 395);
+  avl = remove_int(avl, 951);
+  avl = grpc_avl_add(avl, box(267), box(827), nullptr);
+  avl = remove_int(avl, 812);
+  avl = grpc_avl_add(avl, box(577), box(829), nullptr);
+  avl = remove_int(avl, 624);
+  avl = remove_int(avl, 847);
+  avl = remove_int(avl, 745);
+  avl = grpc_avl_add(avl, box(491), box(833), nullptr);
+  avl = grpc_avl_add(avl, box(941), box(834), nullptr);
+  avl = remove_int(avl, 258);
+  avl = grpc_avl_add(avl, box(410), box(836), nullptr);
+  avl = grpc_avl_add(avl, box(80), box(837), nullptr);
+  avl = grpc_avl_add(avl, box(196), box(838), nullptr);
+  avl = grpc_avl_add(avl, box(5), box(839), nullptr);
+  avl = remove_int(avl, 782);
+  avl = grpc_avl_add(avl, box(827), box(841), nullptr);
+  avl = remove_int(avl, 472);
+  avl = remove_int(avl, 664);
+  avl = grpc_avl_add(avl, box(409), box(844), nullptr);
+  avl = grpc_avl_add(avl, box(62), box(845), nullptr);
+  avl = remove_int(avl, 56);
+  avl = remove_int(avl, 606);
+  avl = remove_int(avl, 707);
+  avl = remove_int(avl, 989);
+  avl = remove_int(avl, 549);
+  avl = remove_int(avl, 259);
+  avl = grpc_avl_add(avl, box(405), box(852), nullptr);
+  avl = remove_int(avl, 587);
+  avl = remove_int(avl, 350);
+  avl = grpc_avl_add(avl, box(980), box(855), nullptr);
+  avl = grpc_avl_add(avl, box(992), box(856), nullptr);
+  avl = grpc_avl_add(avl, box(818), box(857), nullptr);
+  avl = remove_int(avl, 853);
+  avl = remove_int(avl, 701);
+  avl = grpc_avl_add(avl, box(675), box(860), nullptr);
+  avl = remove_int(avl, 248);
+  avl = remove_int(avl, 649);
+  avl = grpc_avl_add(avl, box(508), box(863), nullptr);
+  avl = remove_int(avl, 927);
+  avl = grpc_avl_add(avl, box(957), box(865), nullptr);
+  avl = grpc_avl_add(avl, box(698), box(866), nullptr);
+  avl = grpc_avl_add(avl, box(388), box(867), nullptr);
+  avl = grpc_avl_add(avl, box(532), box(868), nullptr);
+  avl = grpc_avl_add(avl, box(681), box(869), nullptr);
+  avl = remove_int(avl, 544);
+  avl = remove_int(avl, 991);
+  avl = remove_int(avl, 397);
+  avl = grpc_avl_add(avl, box(954), box(873), nullptr);
+  avl = grpc_avl_add(avl, box(219), box(874), nullptr);
+  avl = grpc_avl_add(avl, box(465), box(875), nullptr);
+  avl = remove_int(avl, 371);
+  avl = grpc_avl_add(avl, box(601), box(877), nullptr);
+  avl = grpc_avl_add(avl, box(543), box(878), nullptr);
+  avl = remove_int(avl, 329);
+  avl = grpc_avl_add(avl, box(560), box(880), nullptr);
+  avl = remove_int(avl, 898);
+  avl = grpc_avl_add(avl, box(455), box(882), nullptr);
+  avl = remove_int(avl, 313);
+  avl = grpc_avl_add(avl, box(215), box(884), nullptr);
+  avl = remove_int(avl, 846);
+  avl = grpc_avl_add(avl, box(608), box(886), nullptr);
+  avl = remove_int(avl, 248);
+  avl = grpc_avl_add(avl, box(575), box(888), nullptr);
+  avl = remove_int(avl, 207);
+  avl = remove_int(avl, 810);
+  avl = remove_int(avl, 665);
+  avl = remove_int(avl, 361);
+  avl = grpc_avl_add(avl, box(154), box(893), nullptr);
+  avl = grpc_avl_add(avl, box(329), box(894), nullptr);
+  avl = grpc_avl_add(avl, box(326), box(895), nullptr);
+  avl = remove_int(avl, 746);
+  avl = remove_int(avl, 99);
+  avl = grpc_avl_add(avl, box(464), box(898), nullptr);
+  avl = grpc_avl_add(avl, box(141), box(899), nullptr);
+  avl = remove_int(avl, 383);
+  avl = grpc_avl_add(avl, box(414), box(901), nullptr);
+  avl = grpc_avl_add(avl, box(777), box(902), nullptr);
+  avl = remove_int(avl, 972);
+  avl = remove_int(avl, 841);
+  avl = remove_int(avl, 100);
+  avl = grpc_avl_add(avl, box(828), box(906), nullptr);
+  avl = remove_int(avl, 785);
+  avl = grpc_avl_add(avl, box(1008), box(908), nullptr);
+  avl = grpc_avl_add(avl, box(46), box(909), nullptr);
+  avl = remove_int(avl, 399);
+  avl = grpc_avl_add(avl, box(178), box(911), nullptr);
+  avl = grpc_avl_add(avl, box(573), box(912), nullptr);
+  avl = remove_int(avl, 299);
+  avl = grpc_avl_add(avl, box(690), box(914), nullptr);
+  avl = grpc_avl_add(avl, box(692), box(915), nullptr);
+  avl = remove_int(avl, 404);
+  avl = remove_int(avl, 16);
+  avl = remove_int(avl, 746);
+  avl = remove_int(avl, 486);
+  avl = remove_int(avl, 119);
+  avl = grpc_avl_add(avl, box(167), box(921), nullptr);
+  avl = remove_int(avl, 328);
+  avl = grpc_avl_add(avl, box(89), box(923), nullptr);
+  avl = remove_int(avl, 867);
+  avl = remove_int(avl, 626);
+  avl = remove_int(avl, 507);
+  avl = grpc_avl_add(avl, box(365), box(927), nullptr);
+  avl = grpc_avl_add(avl, box(58), box(928), nullptr);
+  avl = grpc_avl_add(avl, box(70), box(929), nullptr);
+  avl = remove_int(avl, 81);
+  avl = remove_int(avl, 797);
+  avl = grpc_avl_add(avl, box(846), box(932), nullptr);
+  avl = remove_int(avl, 642);
+  avl = grpc_avl_add(avl, box(777), box(934), nullptr);
+  avl = remove_int(avl, 107);
+  avl = grpc_avl_add(avl, box(691), box(936), nullptr);
+  avl = grpc_avl_add(avl, box(820), box(937), nullptr);
+  avl = grpc_avl_add(avl, box(202), box(938), nullptr);
+  avl = grpc_avl_add(avl, box(308), box(939), nullptr);
+  avl = grpc_avl_add(avl, box(20), box(940), nullptr);
+  avl = remove_int(avl, 289);
+  avl = grpc_avl_add(avl, box(714), box(942), nullptr);
+  avl = grpc_avl_add(avl, box(584), box(943), nullptr);
+  avl = remove_int(avl, 294);
+  avl = grpc_avl_add(avl, box(496), box(945), nullptr);
+  avl = grpc_avl_add(avl, box(394), box(946), nullptr);
+  avl = grpc_avl_add(avl, box(860), box(947), nullptr);
+  avl = grpc_avl_add(avl, box(58), box(948), nullptr);
+  avl = remove_int(avl, 784);
+  avl = remove_int(avl, 584);
+  avl = remove_int(avl, 708);
+  avl = grpc_avl_add(avl, box(142), box(952), nullptr);
+  avl = grpc_avl_add(avl, box(247), box(953), nullptr);
+  avl = grpc_avl_add(avl, box(389), box(954), nullptr);
+  avl = remove_int(avl, 390);
+  avl = grpc_avl_add(avl, box(465), box(956), nullptr);
+  avl = grpc_avl_add(avl, box(936), box(957), nullptr);
+  avl = grpc_avl_add(avl, box(309), box(958), nullptr);
+  avl = remove_int(avl, 928);
+  avl = remove_int(avl, 128);
+  avl = remove_int(avl, 979);
+  avl = remove_int(avl, 670);
+  avl = remove_int(avl, 738);
+  avl = remove_int(avl, 271);
+  avl = remove_int(avl, 540);
+  avl = grpc_avl_add(avl, box(365), box(966), nullptr);
+  avl = remove_int(avl, 82);
+  avl = grpc_avl_add(avl, box(728), box(968), nullptr);
+  avl = remove_int(avl, 852);
+  avl = grpc_avl_add(avl, box(884), box(970), nullptr);
+  avl = grpc_avl_add(avl, box(502), box(971), nullptr);
+  avl = remove_int(avl, 898);
+  avl = remove_int(avl, 481);
+  avl = grpc_avl_add(avl, box(911), box(974), nullptr);
+  avl = remove_int(avl, 787);
+  avl = remove_int(avl, 785);
+  avl = remove_int(avl, 537);
+  avl = remove_int(avl, 535);
+  avl = remove_int(avl, 136);
+  avl = remove_int(avl, 749);
+  avl = remove_int(avl, 637);
+  avl = remove_int(avl, 900);
+  avl = grpc_avl_add(avl, box(598), box(983), nullptr);
+  avl = remove_int(avl, 25);
+  avl = remove_int(avl, 697);
+  avl = grpc_avl_add(avl, box(645), box(986), nullptr);
+  avl = grpc_avl_add(avl, box(211), box(987), nullptr);
+  avl = grpc_avl_add(avl, box(589), box(988), nullptr);
+  avl = remove_int(avl, 702);
+  avl = grpc_avl_add(avl, box(53), box(990), nullptr);
+  avl = remove_int(avl, 492);
+  avl = remove_int(avl, 185);
+  avl = remove_int(avl, 246);
+  avl = remove_int(avl, 257);
+  avl = remove_int(avl, 502);
+  avl = remove_int(avl, 34);
+  avl = grpc_avl_add(avl, box(74), box(997), nullptr);
+  avl = grpc_avl_add(avl, box(834), box(998), nullptr);
+  avl = grpc_avl_add(avl, box(514), box(999), nullptr);
+  avl = grpc_avl_add(avl, box(75), box(1000), nullptr);
+  avl = remove_int(avl, 745);
+  avl = grpc_avl_add(avl, box(362), box(1002), nullptr);
+  avl = remove_int(avl, 215);
+  avl = grpc_avl_add(avl, box(624), box(1004), nullptr);
+  avl = remove_int(avl, 404);
+  avl = remove_int(avl, 359);
+  avl = remove_int(avl, 491);
+  avl = grpc_avl_add(avl, box(903), box(1008), nullptr);
+  avl = grpc_avl_add(avl, box(240), box(1009), nullptr);
+  avl = remove_int(avl, 95);
+  avl = grpc_avl_add(avl, box(119), box(1011), nullptr);
+  avl = grpc_avl_add(avl, box(857), box(1012), nullptr);
+  avl = remove_int(avl, 39);
+  avl = remove_int(avl, 866);
+  avl = grpc_avl_add(avl, box(503), box(1015), nullptr);
+  avl = grpc_avl_add(avl, box(740), box(1016), nullptr);
+  avl = remove_int(avl, 637);
+  avl = remove_int(avl, 156);
+  avl = remove_int(avl, 6);
+  avl = remove_int(avl, 745);
+  avl = remove_int(avl, 433);
+  avl = remove_int(avl, 283);
+  avl = grpc_avl_add(avl, box(625), box(1023), nullptr);
+  avl = remove_int(avl, 638);
+  avl = grpc_avl_add(avl, box(299), box(1025), nullptr);
+  avl = grpc_avl_add(avl, box(584), box(1026), nullptr);
+  avl = remove_int(avl, 863);
+  avl = grpc_avl_add(avl, box(612), box(1028), nullptr);
+  avl = grpc_avl_add(avl, box(62), box(1029), nullptr);
+  avl = grpc_avl_add(avl, box(432), box(1030), nullptr);
+  avl = remove_int(avl, 371);
+  avl = remove_int(avl, 790);
+  avl = remove_int(avl, 227);
+  avl = remove_int(avl, 836);
+  avl = grpc_avl_add(avl, box(703), box(1035), nullptr);
+  avl = grpc_avl_add(avl, box(644), box(1036), nullptr);
+  avl = remove_int(avl, 638);
+  avl = grpc_avl_add(avl, box(13), box(1038), nullptr);
+  avl = remove_int(avl, 66);
+  avl = remove_int(avl, 82);
+  avl = grpc_avl_add(avl, box(362), box(1041), nullptr);
+  avl = grpc_avl_add(avl, box(783), box(1042), nullptr);
+  avl = remove_int(avl, 60);
+  avl = grpc_avl_add(avl, box(80), box(1044), nullptr);
+  avl = grpc_avl_add(avl, box(825), box(1045), nullptr);
+  avl = grpc_avl_add(avl, box(688), box(1046), nullptr);
+  avl = grpc_avl_add(avl, box(662), box(1047), nullptr);
+  avl = remove_int(avl, 156);
+  avl = remove_int(avl, 376);
+  avl = remove_int(avl, 99);
+  avl = grpc_avl_add(avl, box(526), box(1051), nullptr);
+  avl = grpc_avl_add(avl, box(168), box(1052), nullptr);
+  avl = remove_int(avl, 646);
+  avl = remove_int(avl, 380);
+  avl = remove_int(avl, 833);
+  avl = grpc_avl_add(avl, box(53), box(1056), nullptr);
+  avl = remove_int(avl, 105);
+  avl = grpc_avl_add(avl, box(373), box(1058), nullptr);
+  avl = grpc_avl_add(avl, box(184), box(1059), nullptr);
+  avl = remove_int(avl, 288);
+  avl = grpc_avl_add(avl, box(966), box(1061), nullptr);
+  avl = remove_int(avl, 158);
+  avl = grpc_avl_add(avl, box(406), box(1063), nullptr);
+  avl = remove_int(avl, 470);
+  avl = grpc_avl_add(avl, box(283), box(1065), nullptr);
+  avl = grpc_avl_add(avl, box(838), box(1066), nullptr);
+  avl = grpc_avl_add(avl, box(288), box(1067), nullptr);
+  avl = grpc_avl_add(avl, box(950), box(1068), nullptr);
+  avl = grpc_avl_add(avl, box(163), box(1069), nullptr);
+  avl = remove_int(avl, 623);
+  avl = remove_int(avl, 769);
+  avl = grpc_avl_add(avl, box(144), box(1072), nullptr);
+  avl = grpc_avl_add(avl, box(489), box(1073), nullptr);
+  avl = remove_int(avl, 15);
+  avl = grpc_avl_add(avl, box(971), box(1075), nullptr);
+  avl = remove_int(avl, 660);
+  avl = grpc_avl_add(avl, box(255), box(1077), nullptr);
+  avl = remove_int(avl, 494);
+  avl = grpc_avl_add(avl, box(109), box(1079), nullptr);
+  avl = grpc_avl_add(avl, box(420), box(1080), nullptr);
+  avl = grpc_avl_add(avl, box(509), box(1081), nullptr);
+  avl = remove_int(avl, 178);
+  avl = grpc_avl_add(avl, box(216), box(1083), nullptr);
+  avl = grpc_avl_add(avl, box(707), box(1084), nullptr);
+  avl = grpc_avl_add(avl, box(411), box(1085), nullptr);
+  avl = grpc_avl_add(avl, box(352), box(1086), nullptr);
+  avl = remove_int(avl, 983);
+  avl = grpc_avl_add(avl, box(6), box(1088), nullptr);
+  avl = grpc_avl_add(avl, box(1014), box(1089), nullptr);
+  avl = remove_int(avl, 98);
+  avl = remove_int(avl, 325);
+  avl = grpc_avl_add(avl, box(851), box(1092), nullptr);
+  avl = remove_int(avl, 553);
+  avl = grpc_avl_add(avl, box(218), box(1094), nullptr);
+  avl = grpc_avl_add(avl, box(261), box(1095), nullptr);
+  avl = remove_int(avl, 31);
+  avl = grpc_avl_add(avl, box(872), box(1097), nullptr);
+  avl = remove_int(avl, 543);
+  avl = remove_int(avl, 314);
+  avl = remove_int(avl, 443);
+  avl = grpc_avl_add(avl, box(533), box(1101), nullptr);
+  avl = remove_int(avl, 881);
+  avl = remove_int(avl, 269);
+  avl = remove_int(avl, 940);
+  avl = remove_int(avl, 909);
+  avl = remove_int(avl, 197);
+  avl = remove_int(avl, 773);
+  avl = remove_int(avl, 790);
+  avl = remove_int(avl, 345);
+  avl = grpc_avl_add(avl, box(965), box(1110), nullptr);
+  avl = remove_int(avl, 622);
+  avl = grpc_avl_add(avl, box(352), box(1112), nullptr);
+  avl = remove_int(avl, 182);
+  avl = grpc_avl_add(avl, box(534), box(1114), nullptr);
+  avl = grpc_avl_add(avl, box(97), box(1115), nullptr);
+  avl = grpc_avl_add(avl, box(198), box(1116), nullptr);
+  avl = remove_int(avl, 750);
+  avl = grpc_avl_add(avl, box(98), box(1118), nullptr);
+  avl = remove_int(avl, 943);
+  avl = grpc_avl_add(avl, box(254), box(1120), nullptr);
+  avl = grpc_avl_add(avl, box(30), box(1121), nullptr);
+  avl = remove_int(avl, 14);
+  avl = remove_int(avl, 475);
+  avl = remove_int(avl, 82);
+  avl = grpc_avl_add(avl, box(789), box(1125), nullptr);
+  avl = grpc_avl_add(avl, box(402), box(1126), nullptr);
+  avl = remove_int(avl, 1019);
+  avl = grpc_avl_add(avl, box(858), box(1128), nullptr);
+  avl = grpc_avl_add(avl, box(625), box(1129), nullptr);
+  avl = remove_int(avl, 675);
+  avl = remove_int(avl, 323);
+  avl = grpc_avl_add(avl, box(329), box(1132), nullptr);
+  avl = remove_int(avl, 929);
+  avl = remove_int(avl, 44);
+  avl = grpc_avl_add(avl, box(443), box(1135), nullptr);
+  avl = grpc_avl_add(avl, box(653), box(1136), nullptr);
+  avl = grpc_avl_add(avl, box(750), box(1137), nullptr);
+  avl = grpc_avl_add(avl, box(252), box(1138), nullptr);
+  avl = grpc_avl_add(avl, box(449), box(1139), nullptr);
+  avl = remove_int(avl, 1022);
+  avl = remove_int(avl, 357);
+  avl = remove_int(avl, 602);
+  avl = remove_int(avl, 131);
+  avl = grpc_avl_add(avl, box(531), box(1144), nullptr);
+  avl = remove_int(avl, 806);
+  avl = grpc_avl_add(avl, box(455), box(1146), nullptr);
+  avl = remove_int(avl, 31);
+  avl = grpc_avl_add(avl, box(154), box(1148), nullptr);
+  avl = grpc_avl_add(avl, box(189), box(1149), nullptr);
+  avl = remove_int(avl, 786);
+  avl = grpc_avl_add(avl, box(496), box(1151), nullptr);
+  avl = grpc_avl_add(avl, box(81), box(1152), nullptr);
+  avl = grpc_avl_add(avl, box(59), box(1153), nullptr);
+  avl = remove_int(avl, 424);
+  avl = remove_int(avl, 668);
+  avl = grpc_avl_add(avl, box(723), box(1156), nullptr);
+  avl = grpc_avl_add(avl, box(822), box(1157), nullptr);
+  avl = grpc_avl_add(avl, box(354), box(1158), nullptr);
+  avl = remove_int(avl, 738);
+  avl = grpc_avl_add(avl, box(686), box(1160), nullptr);
+  avl = grpc_avl_add(avl, box(43), box(1161), nullptr);
+  avl = grpc_avl_add(avl, box(625), box(1162), nullptr);
+  avl = grpc_avl_add(avl, box(902), box(1163), nullptr);
+  avl = grpc_avl_add(avl, box(12), box(1164), nullptr);
+  avl = grpc_avl_add(avl, box(977), box(1165), nullptr);
+  avl = grpc_avl_add(avl, box(699), box(1166), nullptr);
+  avl = grpc_avl_add(avl, box(189), box(1167), nullptr);
+  avl = remove_int(avl, 672);
+  avl = remove_int(avl, 90);
+  avl = remove_int(avl, 757);
+  avl = remove_int(avl, 494);
+  avl = grpc_avl_add(avl, box(759), box(1172), nullptr);
+  avl = remove_int(avl, 758);
+  avl = remove_int(avl, 222);
+  avl = grpc_avl_add(avl, box(975), box(1175), nullptr);
+  avl = remove_int(avl, 993);
+  avl = grpc_avl_add(avl, box(2), box(1177), nullptr);
+  avl = grpc_avl_add(avl, box(70), box(1178), nullptr);
+  avl = remove_int(avl, 350);
+  avl = remove_int(avl, 972);
+  avl = remove_int(avl, 880);
+  avl = grpc_avl_add(avl, box(753), box(1182), nullptr);
+  avl = remove_int(avl, 404);
+  avl = grpc_avl_add(avl, box(294), box(1184), nullptr);
+  avl = remove_int(avl, 474);
+  avl = grpc_avl_add(avl, box(228), box(1186), nullptr);
+  avl = grpc_avl_add(avl, box(484), box(1187), nullptr);
+  avl = remove_int(avl, 238);
+  avl = remove_int(avl, 53);
+  avl = remove_int(avl, 691);
+  avl = grpc_avl_add(avl, box(345), box(1191), nullptr);
+  avl = remove_int(avl, 0);
+  avl = grpc_avl_add(avl, box(230), box(1193), nullptr);
+  avl = remove_int(avl, 227);
+  avl = remove_int(avl, 152);
+  avl = grpc_avl_add(avl, box(884), box(1196), nullptr);
+  avl = remove_int(avl, 823);
+  avl = remove_int(avl, 53);
+  avl = grpc_avl_add(avl, box(1015), box(1199), nullptr);
+  avl = grpc_avl_add(avl, box(697), box(1200), nullptr);
+  avl = grpc_avl_add(avl, box(376), box(1201), nullptr);
+  avl = remove_int(avl, 411);
+  avl = grpc_avl_add(avl, box(888), box(1203), nullptr);
+  avl = remove_int(avl, 55);
+  avl = grpc_avl_add(avl, box(85), box(1205), nullptr);
+  avl = remove_int(avl, 947);
+  avl = remove_int(avl, 382);
+  avl = remove_int(avl, 777);
+  avl = grpc_avl_add(avl, box(1017), box(1209), nullptr);
+  avl = grpc_avl_add(avl, box(169), box(1210), nullptr);
+  avl = grpc_avl_add(avl, box(156), box(1211), nullptr);
+  avl = remove_int(avl, 153);
+  avl = remove_int(avl, 642);
+  avl = remove_int(avl, 158);
+  avl = grpc_avl_add(avl, box(554), box(1215), nullptr);
+  avl = grpc_avl_add(avl, box(76), box(1216), nullptr);
+  avl = grpc_avl_add(avl, box(756), box(1217), nullptr);
+  avl = remove_int(avl, 767);
+  avl = remove_int(avl, 112);
+  avl = remove_int(avl, 539);
+  avl = remove_int(avl, 544);
+  avl = remove_int(avl, 628);
+  avl = remove_int(avl, 385);
+  avl = remove_int(avl, 514);
+  avl = remove_int(avl, 362);
+  avl = grpc_avl_add(avl, box(523), box(1226), nullptr);
+  avl = grpc_avl_add(avl, box(712), box(1227), nullptr);
+  avl = grpc_avl_add(avl, box(474), box(1228), nullptr);
+  avl = grpc_avl_add(avl, box(882), box(1229), nullptr);
+  avl = grpc_avl_add(avl, box(965), box(1230), nullptr);
+  avl = remove_int(avl, 464);
+  avl = grpc_avl_add(avl, box(319), box(1232), nullptr);
+  avl = grpc_avl_add(avl, box(504), box(1233), nullptr);
+  avl = remove_int(avl, 818);
+  avl = grpc_avl_add(avl, box(884), box(1235), nullptr);
+  avl = grpc_avl_add(avl, box(813), box(1236), nullptr);
+  avl = grpc_avl_add(avl, box(795), box(1237), nullptr);
+  avl = remove_int(avl, 306);
+  avl = grpc_avl_add(avl, box(799), box(1239), nullptr);
+  avl = remove_int(avl, 534);
+  avl = grpc_avl_add(avl, box(480), box(1241), nullptr);
+  avl = grpc_avl_add(avl, box(656), box(1242), nullptr);
+  avl = grpc_avl_add(avl, box(709), box(1243), nullptr);
+  avl = grpc_avl_add(avl, box(500), box(1244), nullptr);
+  avl = remove_int(avl, 740);
+  avl = grpc_avl_add(avl, box(980), box(1246), nullptr);
+  avl = grpc_avl_add(avl, box(458), box(1247), nullptr);
+  avl = remove_int(avl, 377);
+  avl = remove_int(avl, 338);
+  avl = grpc_avl_add(avl, box(554), box(1250), nullptr);
+  avl = grpc_avl_add(avl, box(504), box(1251), nullptr);
+  avl = grpc_avl_add(avl, box(603), box(1252), nullptr);
+  avl = grpc_avl_add(avl, box(761), box(1253), nullptr);
+  avl = remove_int(avl, 431);
+  avl = grpc_avl_add(avl, box(707), box(1255), nullptr);
+  avl = grpc_avl_add(avl, box(673), box(1256), nullptr);
+  avl = remove_int(avl, 998);
+  avl = remove_int(avl, 332);
+  avl = remove_int(avl, 413);
+  avl = remove_int(avl, 227);
+  avl = remove_int(avl, 249);
+  avl = remove_int(avl, 309);
+  avl = remove_int(avl, 459);
+  avl = grpc_avl_add(avl, box(645), box(1264), nullptr);
+  avl = remove_int(avl, 858);
+  avl = remove_int(avl, 997);
+  avl = grpc_avl_add(avl, box(519), box(1267), nullptr);
+  avl = remove_int(avl, 614);
+  avl = remove_int(avl, 462);
+  avl = remove_int(avl, 792);
+  avl = grpc_avl_add(avl, box(987), box(1271), nullptr);
+  avl = grpc_avl_add(avl, box(309), box(1272), nullptr);
+  avl = remove_int(avl, 747);
+  avl = grpc_avl_add(avl, box(621), box(1274), nullptr);
+  avl = grpc_avl_add(avl, box(450), box(1275), nullptr);
+  avl = remove_int(avl, 265);
+  avl = remove_int(avl, 8);
+  avl = remove_int(avl, 383);
+  avl = grpc_avl_add(avl, box(238), box(1279), nullptr);
+  avl = remove_int(avl, 241);
+  avl = grpc_avl_add(avl, box(180), box(1281), nullptr);
+  avl = grpc_avl_add(avl, box(411), box(1282), nullptr);
+  avl = grpc_avl_add(avl, box(791), box(1283), nullptr);
+  avl = grpc_avl_add(avl, box(955), box(1284), nullptr);
+  avl = remove_int(avl, 24);
+  avl = remove_int(avl, 375);
+  avl = grpc_avl_add(avl, box(140), box(1287), nullptr);
+  avl = remove_int(avl, 949);
+  avl = grpc_avl_add(avl, box(301), box(1289), nullptr);
+  avl = grpc_avl_add(avl, box(0), box(1290), nullptr);
+  avl = remove_int(avl, 371);
+  avl = remove_int(avl, 427);
+  avl = remove_int(avl, 841);
+  avl = remove_int(avl, 847);
+  avl = grpc_avl_add(avl, box(814), box(1295), nullptr);
+  avl = grpc_avl_add(avl, box(127), box(1296), nullptr);
+  avl = grpc_avl_add(avl, box(279), box(1297), nullptr);
+  avl = remove_int(avl, 669);
+  avl = remove_int(avl, 541);
+  avl = remove_int(avl, 275);
+  avl = remove_int(avl, 299);
+  avl = remove_int(avl, 552);
+  avl = grpc_avl_add(avl, box(310), box(1303), nullptr);
+  avl = grpc_avl_add(avl, box(304), box(1304), nullptr);
+  avl = grpc_avl_add(avl, box(1), box(1305), nullptr);
+  avl = grpc_avl_add(avl, box(339), box(1306), nullptr);
+  avl = remove_int(avl, 570);
+  avl = remove_int(avl, 752);
+  avl = remove_int(avl, 552);
+  avl = remove_int(avl, 442);
+  avl = remove_int(avl, 639);
+  avl = grpc_avl_add(avl, box(313), box(1312), nullptr);
+  avl = remove_int(avl, 85);
+  avl = grpc_avl_add(avl, box(964), box(1314), nullptr);
+  avl = grpc_avl_add(avl, box(559), box(1315), nullptr);
+  avl = remove_int(avl, 167);
+  avl = grpc_avl_add(avl, box(866), box(1317), nullptr);
+  avl = remove_int(avl, 275);
+  avl = grpc_avl_add(avl, box(173), box(1319), nullptr);
+  avl = grpc_avl_add(avl, box(765), box(1320), nullptr);
+  avl = remove_int(avl, 883);
+  avl = grpc_avl_add(avl, box(547), box(1322), nullptr);
+  avl = grpc_avl_add(avl, box(847), box(1323), nullptr);
+  avl = remove_int(avl, 817);
+  avl = remove_int(avl, 850);
+  avl = remove_int(avl, 718);
+  avl = grpc_avl_add(avl, box(806), box(1327), nullptr);
+  avl = grpc_avl_add(avl, box(360), box(1328), nullptr);
+  avl = remove_int(avl, 991);
+  avl = grpc_avl_add(avl, box(493), box(1330), nullptr);
+  avl = remove_int(avl, 516);
+  avl = grpc_avl_add(avl, box(361), box(1332), nullptr);
+  avl = remove_int(avl, 355);
+  avl = grpc_avl_add(avl, box(512), box(1334), nullptr);
+  avl = grpc_avl_add(avl, box(191), box(1335), nullptr);
+  avl = remove_int(avl, 703);
+  avl = grpc_avl_add(avl, box(333), box(1337), nullptr);
+  avl = remove_int(avl, 481);
+  avl = grpc_avl_add(avl, box(501), box(1339), nullptr);
+  avl = remove_int(avl, 532);
+  avl = remove_int(avl, 510);
+  avl = grpc_avl_add(avl, box(793), box(1342), nullptr);
+  avl = grpc_avl_add(avl, box(234), box(1343), nullptr);
+  avl = remove_int(avl, 159);
+  avl = remove_int(avl, 429);
+  avl = remove_int(avl, 728);
+  avl = remove_int(avl, 288);
+  avl = grpc_avl_add(avl, box(281), box(1348), nullptr);
+  avl = grpc_avl_add(avl, box(702), box(1349), nullptr);
+  avl = grpc_avl_add(avl, box(149), box(1350), nullptr);
+  avl = remove_int(avl, 22);
+  avl = remove_int(avl, 944);
+  avl = remove_int(avl, 55);
+  avl = remove_int(avl, 512);
+  avl = remove_int(avl, 676);
+  avl = remove_int(avl, 884);
+  avl = grpc_avl_add(avl, box(246), box(1357), nullptr);
+  avl = grpc_avl_add(avl, box(455), box(1358), nullptr);
+  avl = remove_int(avl, 782);
+  avl = remove_int(avl, 682);
+  avl = grpc_avl_add(avl, box(243), box(1361), nullptr);
+  avl = grpc_avl_add(avl, box(109), box(1362), nullptr);
+  avl = grpc_avl_add(avl, box(452), box(1363), nullptr);
+  avl = remove_int(avl, 151);
+  avl = grpc_avl_add(avl, box(159), box(1365), nullptr);
+  avl = remove_int(avl, 1023);
+  avl = grpc_avl_add(avl, box(129), box(1367), nullptr);
+  avl = grpc_avl_add(avl, box(537), box(1368), nullptr);
+  avl = remove_int(avl, 321);
+  avl = grpc_avl_add(avl, box(740), box(1370), nullptr);
+  avl = remove_int(avl, 45);
+  avl = remove_int(avl, 136);
+  avl = grpc_avl_add(avl, box(229), box(1373), nullptr);
+  avl = remove_int(avl, 772);
+  avl = grpc_avl_add(avl, box(181), box(1375), nullptr);
+  avl = remove_int(avl, 175);
+  avl = grpc_avl_add(avl, box(817), box(1377), nullptr);
+  avl = remove_int(avl, 956);
+  avl = grpc_avl_add(avl, box(675), box(1379), nullptr);
+  avl = grpc_avl_add(avl, box(375), box(1380), nullptr);
+  avl = remove_int(avl, 384);
+  avl = grpc_avl_add(avl, box(1016), box(1382), nullptr);
+  avl = remove_int(avl, 295);
+  avl = remove_int(avl, 697);
+  avl = remove_int(avl, 554);
+  avl = remove_int(avl, 590);
+  avl = remove_int(avl, 1014);
+  avl = grpc_avl_add(avl, box(890), box(1388), nullptr);
+  avl = grpc_avl_add(avl, box(293), box(1389), nullptr);
+  avl = remove_int(avl, 207);
+  avl = remove_int(avl, 46);
+  avl = grpc_avl_add(avl, box(899), box(1392), nullptr);
+  avl = grpc_avl_add(avl, box(666), box(1393), nullptr);
+  avl = grpc_avl_add(avl, box(85), box(1394), nullptr);
+  avl = grpc_avl_add(avl, box(914), box(1395), nullptr);
+  avl = grpc_avl_add(avl, box(128), box(1396), nullptr);
+  avl = grpc_avl_add(avl, box(835), box(1397), nullptr);
+  avl = grpc_avl_add(avl, box(787), box(1398), nullptr);
+  avl = grpc_avl_add(avl, box(649), box(1399), nullptr);
+  avl = grpc_avl_add(avl, box(723), box(1400), nullptr);
+  avl = remove_int(avl, 874);
+  avl = grpc_avl_add(avl, box(778), box(1402), nullptr);
+  avl = grpc_avl_add(avl, box(1015), box(1403), nullptr);
+  avl = grpc_avl_add(avl, box(59), box(1404), nullptr);
+  avl = grpc_avl_add(avl, box(259), box(1405), nullptr);
+  avl = grpc_avl_add(avl, box(758), box(1406), nullptr);
+  avl = remove_int(avl, 648);
+  avl = grpc_avl_add(avl, box(145), box(1408), nullptr);
+  avl = grpc_avl_add(avl, box(440), box(1409), nullptr);
+  avl = remove_int(avl, 608);
+  avl = remove_int(avl, 690);
+  avl = grpc_avl_add(avl, box(605), box(1412), nullptr);
+  avl = remove_int(avl, 856);
+  avl = remove_int(avl, 608);
+  avl = grpc_avl_add(avl, box(829), box(1415), nullptr);
+  avl = grpc_avl_add(avl, box(660), box(1416), nullptr);
+  avl = remove_int(avl, 596);
+  avl = grpc_avl_add(avl, box(519), box(1418), nullptr);
+  avl = grpc_avl_add(avl, box(35), box(1419), nullptr);
+  avl = grpc_avl_add(avl, box(871), box(1420), nullptr);
+  avl = remove_int(avl, 845);
+  avl = grpc_avl_add(avl, box(600), box(1422), nullptr);
+  avl = grpc_avl_add(avl, box(215), box(1423), nullptr);
+  avl = remove_int(avl, 761);
+  avl = grpc_avl_add(avl, box(975), box(1425), nullptr);
+  avl = remove_int(avl, 987);
+  avl = grpc_avl_add(avl, box(58), box(1427), nullptr);
+  avl = remove_int(avl, 119);
+  avl = grpc_avl_add(avl, box(937), box(1429), nullptr);
+  avl = grpc_avl_add(avl, box(372), box(1430), nullptr);
+  avl = grpc_avl_add(avl, box(11), box(1431), nullptr);
+  avl = grpc_avl_add(avl, box(398), box(1432), nullptr);
+  avl = grpc_avl_add(avl, box(423), box(1433), nullptr);
+  avl = remove_int(avl, 171);
+  avl = grpc_avl_add(avl, box(473), box(1435), nullptr);
+  avl = remove_int(avl, 752);
+  avl = remove_int(avl, 625);
+  avl = remove_int(avl, 764);
+  avl = remove_int(avl, 49);
+  avl = grpc_avl_add(avl, box(472), box(1440), nullptr);
+  avl = remove_int(avl, 847);
+  avl = remove_int(avl, 642);
+  avl = remove_int(avl, 1004);
+  avl = remove_int(avl, 795);
+  avl = remove_int(avl, 465);
+  avl = grpc_avl_add(avl, box(636), box(1446), nullptr);
+  avl = remove_int(avl, 152);
+  avl = grpc_avl_add(avl, box(61), box(1448), nullptr);
+  avl = remove_int(avl, 929);
+  avl = remove_int(avl, 9);
+  avl = grpc_avl_add(avl, box(251), box(1451), nullptr);
+  avl = grpc_avl_add(avl, box(672), box(1452), nullptr);
+  avl = grpc_avl_add(avl, box(66), box(1453), nullptr);
+  avl = remove_int(avl, 693);
+  avl = remove_int(avl, 914);
+  avl = remove_int(avl, 116);
+  avl = remove_int(avl, 577);
+  avl = grpc_avl_add(avl, box(618), box(1458), nullptr);
+  avl = grpc_avl_add(avl, box(495), box(1459), nullptr);
+  avl = remove_int(avl, 450);
+  avl = grpc_avl_add(avl, box(533), box(1461), nullptr);
+  avl = grpc_avl_add(avl, box(414), box(1462), nullptr);
+  avl = remove_int(avl, 74);
+  avl = remove_int(avl, 236);
+  avl = grpc_avl_add(avl, box(707), box(1465), nullptr);
+  avl = grpc_avl_add(avl, box(357), box(1466), nullptr);
+  avl = grpc_avl_add(avl, box(1007), box(1467), nullptr);
+  avl = grpc_avl_add(avl, box(811), box(1468), nullptr);
+  avl = grpc_avl_add(avl, box(418), box(1469), nullptr);
+  avl = grpc_avl_add(avl, box(164), box(1470), nullptr);
+  avl = grpc_avl_add(avl, box(622), box(1471), nullptr);
+  avl = remove_int(avl, 22);
+  avl = remove_int(avl, 14);
+  avl = remove_int(avl, 732);
+  avl = remove_int(avl, 7);
+  avl = remove_int(avl, 447);
+  avl = grpc_avl_add(avl, box(221), box(1477), nullptr);
+  avl = grpc_avl_add(avl, box(202), box(1478), nullptr);
+  avl = grpc_avl_add(avl, box(312), box(1479), nullptr);
+  avl = remove_int(avl, 274);
+  avl = grpc_avl_add(avl, box(684), box(1481), nullptr);
+  avl = grpc_avl_add(avl, box(954), box(1482), nullptr);
+  avl = grpc_avl_add(avl, box(637), box(1483), nullptr);
+  avl = remove_int(avl, 716);
+  avl = grpc_avl_add(avl, box(198), box(1485), nullptr);
+  avl = remove_int(avl, 340);
+  avl = remove_int(avl, 137);
+  avl = remove_int(avl, 995);
+  avl = remove_int(avl, 1004);
+  avl = grpc_avl_add(avl, box(661), box(1490), nullptr);
+  avl = grpc_avl_add(avl, box(862), box(1491), nullptr);
+  avl = remove_int(avl, 527);
+  avl = grpc_avl_add(avl, box(945), box(1493), nullptr);
+  avl = remove_int(avl, 355);
+  avl = remove_int(avl, 144);
+  avl = grpc_avl_add(avl, box(229), box(1496), nullptr);
+  avl = grpc_avl_add(avl, box(237), box(1497), nullptr);
+  avl = remove_int(avl, 471);
+  avl = remove_int(avl, 901);
+  avl = grpc_avl_add(avl, box(905), box(1500), nullptr);
+  avl = remove_int(avl, 19);
+  avl = remove_int(avl, 896);
+  avl = remove_int(avl, 585);
+  avl = remove_int(avl, 308);
+  avl = grpc_avl_add(avl, box(547), box(1505), nullptr);
+  avl = grpc_avl_add(avl, box(552), box(1506), nullptr);
+  avl = grpc_avl_add(avl, box(30), box(1507), nullptr);
+  avl = grpc_avl_add(avl, box(445), box(1508), nullptr);
+  avl = remove_int(avl, 785);
+  avl = remove_int(avl, 185);
+  avl = grpc_avl_add(avl, box(405), box(1511), nullptr);
+  avl = grpc_avl_add(avl, box(733), box(1512), nullptr);
+  avl = grpc_avl_add(avl, box(573), box(1513), nullptr);
+  avl = grpc_avl_add(avl, box(492), box(1514), nullptr);
+  avl = grpc_avl_add(avl, box(343), box(1515), nullptr);
+  avl = grpc_avl_add(avl, box(527), box(1516), nullptr);
+  avl = grpc_avl_add(avl, box(596), box(1517), nullptr);
+  avl = grpc_avl_add(avl, box(519), box(1518), nullptr);
+  avl = remove_int(avl, 243);
+  avl = remove_int(avl, 722);
+  avl = grpc_avl_add(avl, box(772), box(1521), nullptr);
+  avl = remove_int(avl, 152);
+  avl = remove_int(avl, 305);
+  avl = grpc_avl_add(avl, box(754), box(1524), nullptr);
+  avl = grpc_avl_add(avl, box(373), box(1525), nullptr);
+  avl = remove_int(avl, 995);
+  avl = grpc_avl_add(avl, box(329), box(1527), nullptr);
+  avl = remove_int(avl, 397);
+  avl = grpc_avl_add(avl, box(884), box(1529), nullptr);
+  avl = remove_int(avl, 329);
+  avl = remove_int(avl, 240);
+  avl = grpc_avl_add(avl, box(566), box(1532), nullptr);
+  avl = grpc_avl_add(avl, box(232), box(1533), nullptr);
+  avl = remove_int(avl, 993);
+  avl = grpc_avl_add(avl, box(888), box(1535), nullptr);
+  avl = remove_int(avl, 242);
+  avl = grpc_avl_add(avl, box(941), box(1537), nullptr);
+  avl = remove_int(avl, 415);
+  avl = grpc_avl_add(avl, box(992), box(1539), nullptr);
+  avl = remove_int(avl, 289);
+  avl = grpc_avl_add(avl, box(60), box(1541), nullptr);
+  avl = grpc_avl_add(avl, box(97), box(1542), nullptr);
+  avl = remove_int(avl, 965);
+  avl = remove_int(avl, 267);
+  avl = remove_int(avl, 360);
+  avl = grpc_avl_add(avl, box(5), box(1546), nullptr);
+  avl = remove_int(avl, 429);
+  avl = grpc_avl_add(avl, box(412), box(1548), nullptr);
+  avl = remove_int(avl, 632);
+  avl = remove_int(avl, 113);
+  avl = grpc_avl_add(avl, box(48), box(1551), nullptr);
+  avl = grpc_avl_add(avl, box(108), box(1552), nullptr);
+  avl = grpc_avl_add(avl, box(750), box(1553), nullptr);
+  avl = remove_int(avl, 188);
+  avl = grpc_avl_add(avl, box(668), box(1555), nullptr);
+  avl = remove_int(avl, 37);
+  avl = remove_int(avl, 737);
+  avl = grpc_avl_add(avl, box(93), box(1558), nullptr);
+  avl = grpc_avl_add(avl, box(628), box(1559), nullptr);
+  avl = grpc_avl_add(avl, box(480), box(1560), nullptr);
+  avl = remove_int(avl, 958);
+  avl = remove_int(avl, 565);
+  avl = remove_int(avl, 32);
+  avl = remove_int(avl, 1);
+  avl = remove_int(avl, 335);
+  avl = grpc_avl_add(avl, box(136), box(1566), nullptr);
+  avl = grpc_avl_add(avl, box(469), box(1567), nullptr);
+  avl = remove_int(avl, 349);
+  avl = grpc_avl_add(avl, box(768), box(1569), nullptr);
+  avl = grpc_avl_add(avl, box(915), box(1570), nullptr);
+  avl = remove_int(avl, 1014);
+  avl = grpc_avl_add(avl, box(117), box(1572), nullptr);
+  avl = remove_int(avl, 62);
+  avl = grpc_avl_add(avl, box(382), box(1574), nullptr);
+  avl = remove_int(avl, 571);
+  avl = grpc_avl_add(avl, box(655), box(1576), nullptr);
+  avl = grpc_avl_add(avl, box(323), box(1577), nullptr);
+  avl = remove_int(avl, 869);
+  avl = remove_int(avl, 151);
+  avl = grpc_avl_add(avl, box(1019), box(1580), nullptr);
+  avl = grpc_avl_add(avl, box(984), box(1581), nullptr);
+  avl = grpc_avl_add(avl, box(870), box(1582), nullptr);
+  avl = grpc_avl_add(avl, box(376), box(1583), nullptr);
+  avl = remove_int(avl, 625);
+  avl = grpc_avl_add(avl, box(733), box(1585), nullptr);
+  avl = remove_int(avl, 532);
+  avl = remove_int(avl, 444);
+  avl = grpc_avl_add(avl, box(428), box(1588), nullptr);
+  avl = grpc_avl_add(avl, box(860), box(1589), nullptr);
+  avl = grpc_avl_add(avl, box(173), box(1590), nullptr);
+  avl = remove_int(avl, 649);
+  avl = remove_int(avl, 913);
+  avl = remove_int(avl, 1);
+  avl = remove_int(avl, 304);
+  avl = grpc_avl_add(avl, box(604), box(1595), nullptr);
+  avl = grpc_avl_add(avl, box(639), box(1596), nullptr);
+  avl = remove_int(avl, 431);
+  avl = grpc_avl_add(avl, box(993), box(1598), nullptr);
+  avl = remove_int(avl, 681);
+  avl = remove_int(avl, 927);
+  avl = grpc_avl_add(avl, box(87), box(1601), nullptr);
+  avl = grpc_avl_add(avl, box(91), box(1602), nullptr);
+  avl = remove_int(avl, 61);
+  avl = remove_int(avl, 14);
+  avl = remove_int(avl, 305);
+  avl = remove_int(avl, 304);
+  avl = remove_int(avl, 1016);
+  avl = grpc_avl_add(avl, box(903), box(1608), nullptr);
+  avl = grpc_avl_add(avl, box(951), box(1609), nullptr);
+  avl = grpc_avl_add(avl, box(146), box(1610), nullptr);
+  avl = grpc_avl_add(avl, box(482), box(1611), nullptr);
+  avl = grpc_avl_add(avl, box(71), box(1612), nullptr);
+  avl = remove_int(avl, 246);
+  avl = remove_int(avl, 696);
+  avl = grpc_avl_add(avl, box(636), box(1615), nullptr);
+  avl = grpc_avl_add(avl, box(295), box(1616), nullptr);
+  avl = remove_int(avl, 11);
+  avl = remove_int(avl, 231);
+  avl = grpc_avl_add(avl, box(905), box(1619), nullptr);
+  avl = grpc_avl_add(avl, box(993), box(1620), nullptr);
+  avl = grpc_avl_add(avl, box(433), box(1621), nullptr);
+  avl = grpc_avl_add(avl, box(117), box(1622), nullptr);
+  avl = grpc_avl_add(avl, box(467), box(1623), nullptr);
+  avl = remove_int(avl, 419);
+  avl = grpc_avl_add(avl, box(179), box(1625), nullptr);
+  avl = remove_int(avl, 926);
+  avl = remove_int(avl, 326);
+  avl = grpc_avl_add(avl, box(551), box(1628), nullptr);
+  avl = remove_int(avl, 14);
+  avl = remove_int(avl, 476);
+  avl = remove_int(avl, 823);
+  avl = grpc_avl_add(avl, box(350), box(1632), nullptr);
+  avl = grpc_avl_add(avl, box(133), box(1633), nullptr);
+  avl = remove_int(avl, 906);
+  avl = grpc_avl_add(avl, box(827), box(1635), nullptr);
+  avl = grpc_avl_add(avl, box(201), box(1636), nullptr);
+  avl = remove_int(avl, 124);
+  avl = remove_int(avl, 662);
+  avl = grpc_avl_add(avl, box(314), box(1639), nullptr);
+  avl = grpc_avl_add(avl, box(986), box(1640), nullptr);
+  avl = grpc_avl_add(avl, box(622), box(1641), nullptr);
+  avl = remove_int(avl, 130);
+  avl = grpc_avl_add(avl, box(861), box(1643), nullptr);
+  avl = remove_int(avl, 497);
+  avl = remove_int(avl, 905);
+  avl = grpc_avl_add(avl, box(502), box(1646), nullptr);
+  avl = remove_int(avl, 721);
+  avl = grpc_avl_add(avl, box(514), box(1648), nullptr);
+  avl = grpc_avl_add(avl, box(410), box(1649), nullptr);
+  avl = remove_int(avl, 869);
+  avl = remove_int(avl, 247);
+  avl = grpc_avl_add(avl, box(450), box(1652), nullptr);
+  avl = remove_int(avl, 364);
+  avl = grpc_avl_add(avl, box(963), box(1654), nullptr);
+  avl = grpc_avl_add(avl, box(146), box(1655), nullptr);
+  avl = remove_int(avl, 147);
+  avl = remove_int(avl, 789);
+  avl = grpc_avl_add(avl, box(693), box(1658), nullptr);
+  avl = grpc_avl_add(avl, box(959), box(1659), nullptr);
+  avl = remove_int(avl, 478);
+  avl = grpc_avl_add(avl, box(116), box(1661), nullptr);
+  avl = grpc_avl_add(avl, box(520), box(1662), nullptr);
+  avl = grpc_avl_add(avl, box(809), box(1663), nullptr);
+  avl = grpc_avl_add(avl, box(667), box(1664), nullptr);
+  avl = grpc_avl_add(avl, box(406), box(1665), nullptr);
+  avl = remove_int(avl, 409);
+  avl = grpc_avl_add(avl, box(558), box(1667), nullptr);
+  avl = grpc_avl_add(avl, box(0), box(1668), nullptr);
+  avl = grpc_avl_add(avl, box(948), box(1669), nullptr);
+  avl = grpc_avl_add(avl, box(576), box(1670), nullptr);
+  avl = remove_int(avl, 864);
+  avl = remove_int(avl, 840);
+  avl = remove_int(avl, 1001);
+  avl = grpc_avl_add(avl, box(232), box(1674), nullptr);
+  avl = remove_int(avl, 676);
+  avl = remove_int(avl, 752);
+  avl = remove_int(avl, 667);
+  avl = remove_int(avl, 605);
+  avl = grpc_avl_add(avl, box(258), box(1679), nullptr);
+  avl = grpc_avl_add(avl, box(648), box(1680), nullptr);
+  avl = grpc_avl_add(avl, box(761), box(1681), nullptr);
+  avl = remove_int(avl, 293);
+  avl = remove_int(avl, 893);
+  avl = grpc_avl_add(avl, box(194), box(1684), nullptr);
+  avl = remove_int(avl, 233);
+  avl = grpc_avl_add(avl, box(888), box(1686), nullptr);
+  avl = remove_int(avl, 470);
+  avl = remove_int(avl, 703);
+  avl = remove_int(avl, 190);
+  avl = remove_int(avl, 359);
+  avl = grpc_avl_add(avl, box(621), box(1691), nullptr);
+  avl = remove_int(avl, 634);
+  avl = remove_int(avl, 335);
+  avl = grpc_avl_add(avl, box(718), box(1694), nullptr);
+  avl = grpc_avl_add(avl, box(463), box(1695), nullptr);
+  avl = grpc_avl_add(avl, box(233), box(1696), nullptr);
+  avl = remove_int(avl, 376);
+  avl = remove_int(avl, 496);
+  avl = remove_int(avl, 819);
+  avl = remove_int(avl, 38);
+  avl = remove_int(avl, 436);
+  avl = remove_int(avl, 102);
+  avl = grpc_avl_add(avl, box(607), box(1703), nullptr);
+  avl = remove_int(avl, 329);
+  avl = grpc_avl_add(avl, box(716), box(1705), nullptr);
+  avl = remove_int(avl, 639);
+  avl = remove_int(avl, 775);
+  avl = remove_int(avl, 578);
+  avl = remove_int(avl, 464);
+  avl = remove_int(avl, 679);
+  avl = remove_int(avl, 615);
+  avl = remove_int(avl, 104);
+  avl = grpc_avl_add(avl, box(414), box(1713), nullptr);
+  avl = grpc_avl_add(avl, box(212), box(1714), nullptr);
+  avl = grpc_avl_add(avl, box(266), box(1715), nullptr);
+  avl = grpc_avl_add(avl, box(238), box(1716), nullptr);
+  avl = remove_int(avl, 153);
+  avl = grpc_avl_add(avl, box(585), box(1718), nullptr);
+  avl = remove_int(avl, 121);
+  avl = grpc_avl_add(avl, box(534), box(1720), nullptr);
+  avl = remove_int(avl, 579);
+  avl = grpc_avl_add(avl, box(127), box(1722), nullptr);
+  avl = grpc_avl_add(avl, box(399), box(1723), nullptr);
+  avl = remove_int(avl, 417);
+  avl = grpc_avl_add(avl, box(978), box(1725), nullptr);
+  avl = grpc_avl_add(avl, box(768), box(1726), nullptr);
+  avl = remove_int(avl, 985);
+  avl = grpc_avl_add(avl, box(536), box(1728), nullptr);
+  avl = grpc_avl_add(avl, box(449), box(1729), nullptr);
+  avl = grpc_avl_add(avl, box(586), box(1730), nullptr);
+  avl = remove_int(avl, 998);
+  avl = remove_int(avl, 394);
+  avl = remove_int(avl, 141);
+  avl = grpc_avl_add(avl, box(889), box(1734), nullptr);
+  avl = grpc_avl_add(avl, box(871), box(1735), nullptr);
+  avl = grpc_avl_add(avl, box(76), box(1736), nullptr);
+  avl = grpc_avl_add(avl, box(549), box(1737), nullptr);
+  avl = grpc_avl_add(avl, box(757), box(1738), nullptr);
+  avl = remove_int(avl, 908);
+  avl = grpc_avl_add(avl, box(789), box(1740), nullptr);
+  avl = remove_int(avl, 224);
+  avl = grpc_avl_add(avl, box(407), box(1742), nullptr);
+  avl = grpc_avl_add(avl, box(381), box(1743), nullptr);
+  avl = grpc_avl_add(avl, box(561), box(1744), nullptr);
+  avl = grpc_avl_add(avl, box(667), box(1745), nullptr);
+  avl = grpc_avl_add(avl, box(522), box(1746), nullptr);
+  avl = grpc_avl_add(avl, box(948), box(1747), nullptr);
+  avl = remove_int(avl, 770);
+  avl = grpc_avl_add(avl, box(872), box(1749), nullptr);
+  avl = grpc_avl_add(avl, box(327), box(1750), nullptr);
+  avl = remove_int(avl, 10);
+  avl = grpc_avl_add(avl, box(122), box(1752), nullptr);
+  avl = remove_int(avl, 606);
+  avl = grpc_avl_add(avl, box(485), box(1754), nullptr);
+  avl = remove_int(avl, 6);
+  avl = grpc_avl_add(avl, box(329), box(1756), nullptr);
+  avl = grpc_avl_add(avl, box(783), box(1757), nullptr);
+  avl = remove_int(avl, 416);
+  avl = grpc_avl_add(avl, box(656), box(1759), nullptr);
+  avl = grpc_avl_add(avl, box(971), box(1760), nullptr);
+  avl = grpc_avl_add(avl, box(77), box(1761), nullptr);
+  avl = grpc_avl_add(avl, box(942), box(1762), nullptr);
+  avl = remove_int(avl, 361);
+  avl = grpc_avl_add(avl, box(66), box(1764), nullptr);
+  avl = grpc_avl_add(avl, box(299), box(1765), nullptr);
+  avl = grpc_avl_add(avl, box(929), box(1766), nullptr);
+  avl = grpc_avl_add(avl, box(797), box(1767), nullptr);
+  avl = remove_int(avl, 869);
+  avl = remove_int(avl, 907);
+  avl = grpc_avl_add(avl, box(870), box(1770), nullptr);
+  avl = remove_int(avl, 580);
+  avl = remove_int(avl, 120);
+  avl = grpc_avl_add(avl, box(913), box(1773), nullptr);
+  avl = remove_int(avl, 480);
+  avl = grpc_avl_add(avl, box(489), box(1775), nullptr);
+  avl = remove_int(avl, 845);
+  avl = grpc_avl_add(avl, box(896), box(1777), nullptr);
+  avl = remove_int(avl, 567);
+  avl = remove_int(avl, 427);
+  avl = grpc_avl_add(avl, box(443), box(1780), nullptr);
+  avl = grpc_avl_add(avl, box(3), box(1781), nullptr);
+  avl = remove_int(avl, 12);
+  avl = grpc_avl_add(avl, box(376), box(1783), nullptr);
+  avl = grpc_avl_add(avl, box(155), box(1784), nullptr);
+  avl = grpc_avl_add(avl, box(188), box(1785), nullptr);
+  avl = grpc_avl_add(avl, box(149), box(1786), nullptr);
+  avl = grpc_avl_add(avl, box(178), box(1787), nullptr);
+  avl = remove_int(avl, 84);
+  avl = grpc_avl_add(avl, box(805), box(1789), nullptr);
+  avl = grpc_avl_add(avl, box(612), box(1790), nullptr);
+  avl = remove_int(avl, 991);
+  avl = grpc_avl_add(avl, box(837), box(1792), nullptr);
+  avl = remove_int(avl, 173);
+  avl = remove_int(avl, 72);
+  avl = grpc_avl_add(avl, box(1014), box(1795), nullptr);
+  avl = remove_int(avl, 303);
+  avl = grpc_avl_add(avl, box(865), box(1797), nullptr);
+  avl = grpc_avl_add(avl, box(793), box(1798), nullptr);
+  avl = remove_int(avl, 173);
+  avl = remove_int(avl, 477);
+  avl = grpc_avl_add(avl, box(950), box(1801), nullptr);
+  avl = grpc_avl_add(avl, box(105), box(1802), nullptr);
+  avl = grpc_avl_add(avl, box(895), box(1803), nullptr);
+  avl = grpc_avl_add(avl, box(171), box(1804), nullptr);
+  avl = grpc_avl_add(avl, box(753), box(1805), nullptr);
+  avl = grpc_avl_add(avl, box(946), box(1806), nullptr);
+  avl = remove_int(avl, 194);
+  avl = remove_int(avl, 559);
+  avl = remove_int(avl, 116);
+  avl = grpc_avl_add(avl, box(968), box(1810), nullptr);
+  avl = remove_int(avl, 124);
+  avl = remove_int(avl, 99);
+  avl = grpc_avl_add(avl, box(563), box(1813), nullptr);
+  avl = remove_int(avl, 182);
+  avl = grpc_avl_add(avl, box(816), box(1815), nullptr);
+  avl = remove_int(avl, 73);
+  avl = remove_int(avl, 261);
+  avl = grpc_avl_add(avl, box(847), box(1818), nullptr);
+  avl = grpc_avl_add(avl, box(368), box(1819), nullptr);
+  avl = grpc_avl_add(avl, box(808), box(1820), nullptr);
+  avl = grpc_avl_add(avl, box(779), box(1821), nullptr);
+  avl = remove_int(avl, 818);
+  avl = grpc_avl_add(avl, box(466), box(1823), nullptr);
+  avl = remove_int(avl, 316);
+  avl = grpc_avl_add(avl, box(986), box(1825), nullptr);
+  avl = grpc_avl_add(avl, box(688), box(1826), nullptr);
+  avl = grpc_avl_add(avl, box(509), box(1827), nullptr);
+  avl = grpc_avl_add(avl, box(51), box(1828), nullptr);
+  avl = remove_int(avl, 655);
+  avl = remove_int(avl, 785);
+  avl = remove_int(avl, 893);
+  avl = grpc_avl_add(avl, box(167), box(1832), nullptr);
+  avl = remove_int(avl, 13);
+  avl = remove_int(avl, 263);
+  avl = grpc_avl_add(avl, box(1009), box(1835), nullptr);
+  avl = remove_int(avl, 480);
+  avl = remove_int(avl, 778);
+  avl = remove_int(avl, 713);
+  avl = remove_int(avl, 628);
+  avl = grpc_avl_add(avl, box(803), box(1840), nullptr);
+  avl = remove_int(avl, 267);
+  avl = grpc_avl_add(avl, box(676), box(1842), nullptr);
+  avl = grpc_avl_add(avl, box(231), box(1843), nullptr);
+  avl = grpc_avl_add(avl, box(824), box(1844), nullptr);
+  avl = remove_int(avl, 961);
+  avl = grpc_avl_add(avl, box(311), box(1846), nullptr);
+  avl = grpc_avl_add(avl, box(420), box(1847), nullptr);
+  avl = grpc_avl_add(avl, box(960), box(1848), nullptr);
+  avl = grpc_avl_add(avl, box(468), box(1849), nullptr);
+  avl = grpc_avl_add(avl, box(815), box(1850), nullptr);
+  avl = remove_int(avl, 247);
+  avl = remove_int(avl, 194);
+  avl = grpc_avl_add(avl, box(546), box(1853), nullptr);
+  avl = remove_int(avl, 222);
+  avl = remove_int(avl, 914);
+  avl = remove_int(avl, 741);
+  avl = grpc_avl_add(avl, box(470), box(1857), nullptr);
+  avl = grpc_avl_add(avl, box(933), box(1858), nullptr);
+  avl = grpc_avl_add(avl, box(97), box(1859), nullptr);
+  avl = remove_int(avl, 564);
+  avl = remove_int(avl, 295);
+  avl = grpc_avl_add(avl, box(864), box(1862), nullptr);
+  avl = remove_int(avl, 329);
+  avl = grpc_avl_add(avl, box(124), box(1864), nullptr);
+  avl = grpc_avl_add(avl, box(1000), box(1865), nullptr);
+  avl = grpc_avl_add(avl, box(228), box(1866), nullptr);
+  avl = grpc_avl_add(avl, box(187), box(1867), nullptr);
+  avl = remove_int(avl, 224);
+  avl = remove_int(avl, 306);
+  avl = remove_int(avl, 884);
+  avl = grpc_avl_add(avl, box(449), box(1871), nullptr);
+  avl = grpc_avl_add(avl, box(353), box(1872), nullptr);
+  avl = grpc_avl_add(avl, box(994), box(1873), nullptr);
+  avl = grpc_avl_add(avl, box(596), box(1874), nullptr);
+  avl = grpc_avl_add(avl, box(996), box(1875), nullptr);
+  avl = grpc_avl_add(avl, box(101), box(1876), nullptr);
+  avl = grpc_avl_add(avl, box(1012), box(1877), nullptr);
+  avl = grpc_avl_add(avl, box(982), box(1878), nullptr);
+  avl = grpc_avl_add(avl, box(742), box(1879), nullptr);
+  avl = remove_int(avl, 92);
+  avl = remove_int(avl, 1022);
+  avl = grpc_avl_add(avl, box(941), box(1882), nullptr);
+  avl = remove_int(avl, 742);
+  avl = remove_int(avl, 919);
+  avl = grpc_avl_add(avl, box(588), box(1885), nullptr);
+  avl = remove_int(avl, 221);
+  avl = grpc_avl_add(avl, box(356), box(1887), nullptr);
+  avl = grpc_avl_add(avl, box(932), box(1888), nullptr);
+  avl = remove_int(avl, 837);
+  avl = grpc_avl_add(avl, box(394), box(1890), nullptr);
+  avl = grpc_avl_add(avl, box(642), box(1891), nullptr);
+  avl = grpc_avl_add(avl, box(52), box(1892), nullptr);
+  avl = grpc_avl_add(avl, box(437), box(1893), nullptr);
+  avl = grpc_avl_add(avl, box(948), box(1894), nullptr);
+  avl = grpc_avl_add(avl, box(93), box(1895), nullptr);
+  avl = remove_int(avl, 873);
+  avl = remove_int(avl, 336);
+  avl = remove_int(avl, 277);
+  avl = remove_int(avl, 932);
+  avl = grpc_avl_add(avl, box(80), box(1900), nullptr);
+  avl = grpc_avl_add(avl, box(952), box(1901), nullptr);
+  avl = grpc_avl_add(avl, box(510), box(1902), nullptr);
+  avl = remove_int(avl, 876);
+  avl = remove_int(avl, 612);
+  avl = grpc_avl_add(avl, box(923), box(1905), nullptr);
+  avl = grpc_avl_add(avl, box(475), box(1906), nullptr);
+  avl = remove_int(avl, 478);
+  avl = remove_int(avl, 148);
+  avl = grpc_avl_add(avl, box(538), box(1909), nullptr);
+  avl = remove_int(avl, 47);
+  avl = grpc_avl_add(avl, box(89), box(1911), nullptr);
+  avl = remove_int(avl, 723);
+  avl = grpc_avl_add(avl, box(687), box(1913), nullptr);
+  avl = grpc_avl_add(avl, box(480), box(1914), nullptr);
+  avl = grpc_avl_add(avl, box(149), box(1915), nullptr);
+  avl = remove_int(avl, 68);
+  avl = remove_int(avl, 862);
+  avl = remove_int(avl, 363);
+  avl = grpc_avl_add(avl, box(996), box(1919), nullptr);
+  avl = remove_int(avl, 380);
+  avl = grpc_avl_add(avl, box(957), box(1921), nullptr);
+  avl = remove_int(avl, 413);
+  avl = grpc_avl_add(avl, box(360), box(1923), nullptr);
+  avl = grpc_avl_add(avl, box(304), box(1924), nullptr);
+  avl = grpc_avl_add(avl, box(634), box(1925), nullptr);
+  avl = grpc_avl_add(avl, box(506), box(1926), nullptr);
+  avl = remove_int(avl, 248);
+  avl = grpc_avl_add(avl, box(124), box(1928), nullptr);
+  avl = grpc_avl_add(avl, box(181), box(1929), nullptr);
+  avl = remove_int(avl, 507);
+  avl = grpc_avl_add(avl, box(141), box(1931), nullptr);
+  avl = remove_int(avl, 409);
+  avl = remove_int(avl, 129);
+  avl = remove_int(avl, 694);
+  avl = remove_int(avl, 723);
+  avl = grpc_avl_add(avl, box(998), box(1936), nullptr);
+  avl = grpc_avl_add(avl, box(906), box(1937), nullptr);
+  avl = grpc_avl_add(avl, box(44), box(1938), nullptr);
+  avl = remove_int(avl, 949);
+  avl = remove_int(avl, 117);
+  avl = grpc_avl_add(avl, box(700), box(1941), nullptr);
+  avl = grpc_avl_add(avl, box(258), box(1942), nullptr);
+  avl = remove_int(avl, 828);
+  avl = grpc_avl_add(avl, box(860), box(1944), nullptr);
+  avl = grpc_avl_add(avl, box(987), box(1945), nullptr);
+  avl = grpc_avl_add(avl, box(316), box(1946), nullptr);
+  avl = grpc_avl_add(avl, box(919), box(1947), nullptr);
+  avl = remove_int(avl, 84);
+  avl = grpc_avl_add(avl, box(473), box(1949), nullptr);
+  avl = remove_int(avl, 127);
+  avl = remove_int(avl, 829);
+  avl = remove_int(avl, 829);
+  avl = grpc_avl_add(avl, box(488), box(1953), nullptr);
+  avl = grpc_avl_add(avl, box(954), box(1954), nullptr);
+  avl = remove_int(avl, 198);
+  avl = remove_int(avl, 972);
+  avl = remove_int(avl, 670);
+  avl = grpc_avl_add(avl, box(822), box(1958), nullptr);
+  avl = remove_int(avl, 589);
+  avl = remove_int(avl, 459);
+  avl = grpc_avl_add(avl, box(1003), box(1961), nullptr);
+  avl = grpc_avl_add(avl, box(657), box(1962), nullptr);
+  avl = grpc_avl_add(avl, box(477), box(1963), nullptr);
+  avl = grpc_avl_add(avl, box(923), box(1964), nullptr);
+  avl = remove_int(avl, 496);
+  avl = remove_int(avl, 99);
+  avl = grpc_avl_add(avl, box(127), box(1967), nullptr);
+  avl = grpc_avl_add(avl, box(1013), box(1968), nullptr);
+  avl = grpc_avl_add(avl, box(778), box(1969), nullptr);
+  avl = remove_int(avl, 5);
+  avl = remove_int(avl, 990);
+  avl = remove_int(avl, 850);
+  avl = remove_int(avl, 160);
+  avl = remove_int(avl, 86);
+  avl = grpc_avl_add(avl, box(283), box(1975), nullptr);
+  avl = remove_int(avl, 278);
+  avl = remove_int(avl, 297);
+  avl = remove_int(avl, 137);
+  avl = remove_int(avl, 653);
+  avl = grpc_avl_add(avl, box(702), box(1980), nullptr);
+  avl = remove_int(avl, 63);
+  avl = remove_int(avl, 427);
+  avl = remove_int(avl, 706);
+  avl = remove_int(avl, 806);
+  avl = grpc_avl_add(avl, box(335), box(1985), nullptr);
+  avl = grpc_avl_add(avl, box(412), box(1986), nullptr);
+  avl = remove_int(avl, 766);
+  avl = remove_int(avl, 937);
+  avl = remove_int(avl, 886);
+  avl = remove_int(avl, 652);
+  avl = grpc_avl_add(avl, box(545), box(1991), nullptr);
+  avl = grpc_avl_add(avl, box(408), box(1992), nullptr);
+  avl = grpc_avl_add(avl, box(841), box(1993), nullptr);
+  avl = remove_int(avl, 593);
+  avl = grpc_avl_add(avl, box(582), box(1995), nullptr);
+  avl = grpc_avl_add(avl, box(597), box(1996), nullptr);
+  avl = remove_int(avl, 49);
+  avl = remove_int(avl, 835);
+  avl = grpc_avl_add(avl, box(417), box(1999), nullptr);
+  avl = grpc_avl_add(avl, box(191), box(2000), nullptr);
+  avl = remove_int(avl, 406);
+  avl = grpc_avl_add(avl, box(30), box(2002), nullptr);
+  avl = remove_int(avl, 841);
+  avl = remove_int(avl, 50);
+  avl = grpc_avl_add(avl, box(967), box(2005), nullptr);
+  avl = grpc_avl_add(avl, box(849), box(2006), nullptr);
+  avl = remove_int(avl, 608);
+  avl = grpc_avl_add(avl, box(306), box(2008), nullptr);
+  avl = remove_int(avl, 779);
+  avl = grpc_avl_add(avl, box(897), box(2010), nullptr);
+  avl = grpc_avl_add(avl, box(147), box(2011), nullptr);
+  avl = remove_int(avl, 982);
+  avl = grpc_avl_add(avl, box(470), box(2013), nullptr);
+  avl = remove_int(avl, 951);
+  avl = grpc_avl_add(avl, box(388), box(2015), nullptr);
+  avl = remove_int(avl, 616);
+  avl = remove_int(avl, 721);
+  avl = remove_int(avl, 942);
+  avl = remove_int(avl, 589);
+  avl = grpc_avl_add(avl, box(218), box(2020), nullptr);
+  avl = remove_int(avl, 671);
+  avl = grpc_avl_add(avl, box(1020), box(2022), nullptr);
+  avl = remove_int(avl, 277);
+  avl = grpc_avl_add(avl, box(681), box(2024), nullptr);
+  avl = grpc_avl_add(avl, box(179), box(2025), nullptr);
+  avl = grpc_avl_add(avl, box(370), box(2026), nullptr);
+  avl = grpc_avl_add(avl, box(0), box(2027), nullptr);
+  avl = remove_int(avl, 523);
+  avl = grpc_avl_add(avl, box(99), box(2029), nullptr);
+  avl = grpc_avl_add(avl, box(334), box(2030), nullptr);
+  avl = grpc_avl_add(avl, box(569), box(2031), nullptr);
+  avl = grpc_avl_add(avl, box(257), box(2032), nullptr);
+  avl = remove_int(avl, 572);
+  avl = grpc_avl_add(avl, box(805), box(2034), nullptr);
+  avl = grpc_avl_add(avl, box(143), box(2035), nullptr);
+  avl = grpc_avl_add(avl, box(670), box(2036), nullptr);
+  avl = remove_int(avl, 42);
+  avl = grpc_avl_add(avl, box(46), box(2038), nullptr);
+  avl = remove_int(avl, 970);
+  avl = grpc_avl_add(avl, box(353), box(2040), nullptr);
+  avl = remove_int(avl, 258);
+  avl = grpc_avl_add(avl, box(451), box(2042), nullptr);
+  avl = grpc_avl_add(avl, box(28), box(2043), nullptr);
+  avl = grpc_avl_add(avl, box(729), box(2044), nullptr);
+  avl = grpc_avl_add(avl, box(401), box(2045), nullptr);
+  avl = grpc_avl_add(avl, box(614), box(2046), nullptr);
+  avl = remove_int(avl, 990);
+  avl = remove_int(avl, 212);
+  avl = remove_int(avl, 22);
+  avl = remove_int(avl, 677);
+  avl = grpc_avl_add(avl, box(1016), box(2051), nullptr);
+  avl = grpc_avl_add(avl, box(980), box(2052), nullptr);
+  avl = grpc_avl_add(avl, box(990), box(2053), nullptr);
+  avl = grpc_avl_add(avl, box(355), box(2054), nullptr);
+  avl = remove_int(avl, 730);
+  avl = remove_int(avl, 37);
+  avl = grpc_avl_add(avl, box(407), box(2057), nullptr);
+  avl = grpc_avl_add(avl, box(222), box(2058), nullptr);
+  avl = grpc_avl_add(avl, box(439), box(2059), nullptr);
+  avl = grpc_avl_add(avl, box(563), box(2060), nullptr);
+  avl = remove_int(avl, 992);
+  avl = remove_int(avl, 786);
+  avl = grpc_avl_add(avl, box(1), box(2063), nullptr);
+  avl = grpc_avl_add(avl, box(473), box(2064), nullptr);
+  avl = grpc_avl_add(avl, box(992), box(2065), nullptr);
+  avl = remove_int(avl, 190);
+  avl = remove_int(avl, 450);
+  avl = remove_int(avl, 1020);
+  avl = remove_int(avl, 149);
+  avl = grpc_avl_add(avl, box(329), box(2070), nullptr);
+  avl = grpc_avl_add(avl, box(35), box(2071), nullptr);
+  avl = remove_int(avl, 843);
+  avl = grpc_avl_add(avl, box(855), box(2073), nullptr);
+  avl = remove_int(avl, 878);
+  avl = grpc_avl_add(avl, box(993), box(2075), nullptr);
+  avl = grpc_avl_add(avl, box(87), box(2076), nullptr);
+  avl = grpc_avl_add(avl, box(572), box(2077), nullptr);
+  avl = remove_int(avl, 896);
+  avl = grpc_avl_add(avl, box(849), box(2079), nullptr);
+  avl = remove_int(avl, 597);
+  avl = grpc_avl_add(avl, box(472), box(2081), nullptr);
+  avl = remove_int(avl, 778);
+  avl = remove_int(avl, 934);
+  avl = remove_int(avl, 314);
+  avl = grpc_avl_add(avl, box(101), box(2085), nullptr);
+  avl = remove_int(avl, 938);
+  avl = remove_int(avl, 1010);
+  avl = grpc_avl_add(avl, box(579), box(2088), nullptr);
+  avl = remove_int(avl, 798);
+  avl = remove_int(avl, 88);
+  avl = grpc_avl_add(avl, box(851), box(2091), nullptr);
+  avl = remove_int(avl, 705);
+  avl = grpc_avl_add(avl, box(26), box(2093), nullptr);
+  avl = remove_int(avl, 973);
+  avl = grpc_avl_add(avl, box(923), box(2095), nullptr);
+  avl = remove_int(avl, 668);
+  avl = grpc_avl_add(avl, box(310), box(2097), nullptr);
+  avl = grpc_avl_add(avl, box(269), box(2098), nullptr);
+  avl = remove_int(avl, 173);
+  avl = grpc_avl_add(avl, box(279), box(2100), nullptr);
+  avl = remove_int(avl, 203);
+  avl = grpc_avl_add(avl, box(411), box(2102), nullptr);
+  avl = remove_int(avl, 950);
+  avl = grpc_avl_add(avl, box(6), box(2104), nullptr);
+  avl = remove_int(avl, 400);
+  avl = remove_int(avl, 468);
+  avl = remove_int(avl, 271);
+  avl = grpc_avl_add(avl, box(627), box(2108), nullptr);
+  avl = remove_int(avl, 727);
+  avl = remove_int(avl, 148);
+  avl = remove_int(avl, 98);
+  avl = remove_int(avl, 997);
+  avl = remove_int(avl, 215);
+  avl = remove_int(avl, 628);
+  avl = remove_int(avl, 826);
+  avl = remove_int(avl, 664);
+  avl = grpc_avl_add(avl, box(76), box(2117), nullptr);
+  avl = remove_int(avl, 194);
+  avl = remove_int(avl, 18);
+  avl = grpc_avl_add(avl, box(727), box(2120), nullptr);
+  avl = remove_int(avl, 295);
+  avl = grpc_avl_add(avl, box(645), box(2122), nullptr);
+  avl = remove_int(avl, 321);
+  avl = remove_int(avl, 863);
+  avl = grpc_avl_add(avl, box(824), box(2125), nullptr);
+  avl = grpc_avl_add(avl, box(651), box(2126), nullptr);
+  avl = grpc_avl_add(avl, box(804), box(2127), nullptr);
+  avl = remove_int(avl, 307);
+  avl = grpc_avl_add(avl, box(867), box(2129), nullptr);
+  avl = remove_int(avl, 384);
+  avl = grpc_avl_add(avl, box(819), box(2131), nullptr);
+  avl = remove_int(avl, 674);
+  avl = grpc_avl_add(avl, box(76), box(2133), nullptr);
+  avl = remove_int(avl, 898);
+  avl = grpc_avl_add(avl, box(45), box(2135), nullptr);
+  avl = grpc_avl_add(avl, box(512), box(2136), nullptr);
+  avl = remove_int(avl, 773);
+  avl = remove_int(avl, 907);
+  avl = remove_int(avl, 382);
+  avl = remove_int(avl, 95);
+  avl = remove_int(avl, 734);
+  avl = remove_int(avl, 81);
+  avl = grpc_avl_add(avl, box(348), box(2143), nullptr);
+  avl = remove_int(avl, 509);
+  avl = remove_int(avl, 301);
+  avl = grpc_avl_add(avl, box(861), box(2146), nullptr);
+  avl = grpc_avl_add(avl, box(918), box(2147), nullptr);
+  avl = remove_int(avl, 992);
+  avl = grpc_avl_add(avl, box(356), box(2149), nullptr);
+  avl = remove_int(avl, 64);
+  avl = remove_int(avl, 444);
+  avl = remove_int(avl, 741);
+  avl = grpc_avl_add(avl, box(710), box(2153), nullptr);
+  avl = grpc_avl_add(avl, box(264), box(2154), nullptr);
+  avl = remove_int(avl, 347);
+  avl = remove_int(avl, 250);
+  avl = grpc_avl_add(avl, box(82), box(2157), nullptr);
+  avl = grpc_avl_add(avl, box(571), box(2158), nullptr);
+  avl = remove_int(avl, 721);
+  avl = remove_int(avl, 622);
+  avl = grpc_avl_add(avl, box(950), box(2161), nullptr);
+  avl = grpc_avl_add(avl, box(94), box(2162), nullptr);
+  avl = remove_int(avl, 970);
+  avl = grpc_avl_add(avl, box(815), box(2164), nullptr);
+  avl = remove_int(avl, 930);
+  avl = remove_int(avl, 703);
+  avl = grpc_avl_add(avl, box(432), box(2167), nullptr);
+  avl = remove_int(avl, 544);
+  avl = grpc_avl_add(avl, box(21), box(2169), nullptr);
+  avl = grpc_avl_add(avl, box(186), box(2170), nullptr);
+  avl = remove_int(avl, 143);
+  avl = grpc_avl_add(avl, box(425), box(2172), nullptr);
+  avl = remove_int(avl, 769);
+  avl = grpc_avl_add(avl, box(656), box(2174), nullptr);
+  avl = remove_int(avl, 29);
+  avl = grpc_avl_add(avl, box(464), box(2176), nullptr);
+  avl = remove_int(avl, 713);
+  avl = grpc_avl_add(avl, box(800), box(2178), nullptr);
+  avl = remove_int(avl, 621);
+  avl = grpc_avl_add(avl, box(962), box(2180), nullptr);
+  avl = remove_int(avl, 448);
+  avl = grpc_avl_add(avl, box(878), box(2182), nullptr);
+  avl = remove_int(avl, 39);
+  avl = remove_int(avl, 999);
+  avl = grpc_avl_add(avl, box(182), box(2185), nullptr);
+  avl = grpc_avl_add(avl, box(429), box(2186), nullptr);
+  avl = grpc_avl_add(avl, box(598), box(2187), nullptr);
+  avl = remove_int(avl, 551);
+  avl = grpc_avl_add(avl, box(827), box(2189), nullptr);
+  avl = grpc_avl_add(avl, box(809), box(2190), nullptr);
+  avl = remove_int(avl, 438);
+  avl = remove_int(avl, 811);
+  avl = grpc_avl_add(avl, box(808), box(2193), nullptr);
+  avl = grpc_avl_add(avl, box(788), box(2194), nullptr);
+  avl = remove_int(avl, 156);
+  avl = grpc_avl_add(avl, box(933), box(2196), nullptr);
+  avl = grpc_avl_add(avl, box(344), box(2197), nullptr);
+  avl = remove_int(avl, 460);
+  avl = grpc_avl_add(avl, box(161), box(2199), nullptr);
+  avl = grpc_avl_add(avl, box(444), box(2200), nullptr);
+  avl = remove_int(avl, 597);
+  avl = remove_int(avl, 668);
+  avl = grpc_avl_add(avl, box(703), box(2203), nullptr);
+  avl = remove_int(avl, 515);
+  avl = grpc_avl_add(avl, box(380), box(2205), nullptr);
+  avl = grpc_avl_add(avl, box(338), box(2206), nullptr);
+  avl = remove_int(avl, 550);
+  avl = remove_int(avl, 946);
+  avl = remove_int(avl, 714);
+  avl = remove_int(avl, 739);
+  avl = grpc_avl_add(avl, box(413), box(2211), nullptr);
+  avl = remove_int(avl, 450);
+  avl = grpc_avl_add(avl, box(411), box(2213), nullptr);
+  avl = grpc_avl_add(avl, box(117), box(2214), nullptr);
+  avl = grpc_avl_add(avl, box(322), box(2215), nullptr);
+  avl = grpc_avl_add(avl, box(915), box(2216), nullptr);
+  avl = grpc_avl_add(avl, box(410), box(2217), nullptr);
+  avl = grpc_avl_add(avl, box(66), box(2218), nullptr);
+  avl = remove_int(avl, 756);
+  avl = remove_int(avl, 596);
+  avl = grpc_avl_add(avl, box(882), box(2221), nullptr);
+  avl = grpc_avl_add(avl, box(930), box(2222), nullptr);
+  avl = grpc_avl_add(avl, box(36), box(2223), nullptr);
+  avl = remove_int(avl, 742);
+  avl = grpc_avl_add(avl, box(539), box(2225), nullptr);
+  avl = grpc_avl_add(avl, box(596), box(2226), nullptr);
+  avl = remove_int(avl, 82);
+  avl = remove_int(avl, 686);
+  avl = remove_int(avl, 933);
+  avl = remove_int(avl, 42);
+  avl = remove_int(avl, 340);
+  avl = grpc_avl_add(avl, box(126), box(2232), nullptr);
+  avl = grpc_avl_add(avl, box(493), box(2233), nullptr);
+  avl = grpc_avl_add(avl, box(839), box(2234), nullptr);
+  avl = remove_int(avl, 774);
+  avl = grpc_avl_add(avl, box(337), box(2236), nullptr);
+  avl = remove_int(avl, 322);
+  avl = grpc_avl_add(avl, box(16), box(2238), nullptr);
+  avl = remove_int(avl, 73);
+  avl = remove_int(avl, 85);
+  avl = remove_int(avl, 191);
+  avl = remove_int(avl, 541);
+  avl = grpc_avl_add(avl, box(704), box(2243), nullptr);
+  avl = remove_int(avl, 767);
+  avl = remove_int(avl, 1006);
+  avl = remove_int(avl, 844);
+  avl = remove_int(avl, 742);
+  avl = grpc_avl_add(avl, box(48), box(2248), nullptr);
+  avl = grpc_avl_add(avl, box(138), box(2249), nullptr);
+  avl = grpc_avl_add(avl, box(437), box(2250), nullptr);
+  avl = grpc_avl_add(avl, box(275), box(2251), nullptr);
+  avl = remove_int(avl, 520);
+  avl = grpc_avl_add(avl, box(1019), box(2253), nullptr);
+  avl = remove_int(avl, 955);
+  avl = grpc_avl_add(avl, box(270), box(2255), nullptr);
+  avl = remove_int(avl, 680);
+  avl = remove_int(avl, 698);
+  avl = grpc_avl_add(avl, box(735), box(2258), nullptr);
+  avl = grpc_avl_add(avl, box(400), box(2259), nullptr);
+  avl = remove_int(avl, 991);
+  avl = grpc_avl_add(avl, box(263), box(2261), nullptr);
+  avl = remove_int(avl, 704);
+  avl = grpc_avl_add(avl, box(757), box(2263), nullptr);
+  avl = remove_int(avl, 194);
+  avl = remove_int(avl, 616);
+  avl = remove_int(avl, 784);
+  avl = grpc_avl_add(avl, box(382), box(2267), nullptr);
+  avl = grpc_avl_add(avl, box(464), box(2268), nullptr);
+  avl = grpc_avl_add(avl, box(817), box(2269), nullptr);
+  avl = remove_int(avl, 445);
+  avl = grpc_avl_add(avl, box(412), box(2271), nullptr);
+  avl = remove_int(avl, 525);
+  avl = grpc_avl_add(avl, box(299), box(2273), nullptr);
+  avl = grpc_avl_add(avl, box(464), box(2274), nullptr);
+  avl = grpc_avl_add(avl, box(715), box(2275), nullptr);
+  avl = remove_int(avl, 58);
+  avl = remove_int(avl, 218);
+  avl = grpc_avl_add(avl, box(961), box(2278), nullptr);
+  avl = grpc_avl_add(avl, box(491), box(2279), nullptr);
+  avl = remove_int(avl, 846);
+  avl = grpc_avl_add(avl, box(762), box(2281), nullptr);
+  avl = remove_int(avl, 974);
+  avl = remove_int(avl, 887);
+  avl = grpc_avl_add(avl, box(498), box(2284), nullptr);
+  avl = remove_int(avl, 810);
+  avl = remove_int(avl, 743);
+  avl = remove_int(avl, 22);
+  avl = remove_int(avl, 284);
+  avl = grpc_avl_add(avl, box(482), box(2289), nullptr);
+  avl = grpc_avl_add(avl, box(1021), box(2290), nullptr);
+  avl = remove_int(avl, 155);
+  avl = remove_int(avl, 128);
+  avl = grpc_avl_add(avl, box(819), box(2293), nullptr);
+  avl = grpc_avl_add(avl, box(324), box(2294), nullptr);
+  avl = remove_int(avl, 196);
+  avl = remove_int(avl, 370);
+  avl = remove_int(avl, 753);
+  avl = remove_int(avl, 56);
+  avl = remove_int(avl, 735);
+  avl = grpc_avl_add(avl, box(272), box(2300), nullptr);
+  avl = grpc_avl_add(avl, box(474), box(2301), nullptr);
+  avl = grpc_avl_add(avl, box(719), box(2302), nullptr);
+  avl = grpc_avl_add(avl, box(236), box(2303), nullptr);
+  avl = remove_int(avl, 818);
+  avl = grpc_avl_add(avl, box(727), box(2305), nullptr);
+  avl = remove_int(avl, 892);
+  avl = remove_int(avl, 871);
+  avl = remove_int(avl, 231);
+  avl = grpc_avl_add(avl, box(62), box(2309), nullptr);
+  avl = grpc_avl_add(avl, box(953), box(2310), nullptr);
+  avl = remove_int(avl, 701);
+  avl = grpc_avl_add(avl, box(193), box(2312), nullptr);
+  avl = remove_int(avl, 619);
+  avl = remove_int(avl, 22);
+  avl = remove_int(avl, 804);
+  avl = remove_int(avl, 851);
+  avl = grpc_avl_add(avl, box(286), box(2317), nullptr);
+  avl = grpc_avl_add(avl, box(751), box(2318), nullptr);
+  avl = remove_int(avl, 525);
+  avl = grpc_avl_add(avl, box(217), box(2320), nullptr);
+  avl = remove_int(avl, 336);
+  avl = grpc_avl_add(avl, box(86), box(2322), nullptr);
+  avl = grpc_avl_add(avl, box(81), box(2323), nullptr);
+  avl = grpc_avl_add(avl, box(850), box(2324), nullptr);
+  avl = remove_int(avl, 872);
+  avl = grpc_avl_add(avl, box(402), box(2326), nullptr);
+  avl = grpc_avl_add(avl, box(54), box(2327), nullptr);
+  avl = grpc_avl_add(avl, box(980), box(2328), nullptr);
+  avl = grpc_avl_add(avl, box(845), box(2329), nullptr);
+  avl = remove_int(avl, 1004);
+  avl = remove_int(avl, 273);
+  avl = remove_int(avl, 879);
+  avl = grpc_avl_add(avl, box(354), box(2333), nullptr);
+  avl = grpc_avl_add(avl, box(58), box(2334), nullptr);
+  avl = grpc_avl_add(avl, box(127), box(2335), nullptr);
+  avl = remove_int(avl, 84);
+  avl = grpc_avl_add(avl, box(360), box(2337), nullptr);
+  avl = remove_int(avl, 648);
+  avl = remove_int(avl, 488);
+  avl = remove_int(avl, 585);
+  avl = remove_int(avl, 230);
+  avl = grpc_avl_add(avl, box(887), box(2342), nullptr);
+  avl = remove_int(avl, 558);
+  avl = remove_int(avl, 958);
+  avl = grpc_avl_add(avl, box(822), box(2345), nullptr);
+  avl = remove_int(avl, 1004);
+  avl = remove_int(avl, 747);
+  avl = grpc_avl_add(avl, box(631), box(2348), nullptr);
+  avl = grpc_avl_add(avl, box(442), box(2349), nullptr);
+  avl = remove_int(avl, 957);
+  avl = remove_int(avl, 964);
+  avl = grpc_avl_add(avl, box(10), box(2352), nullptr);
+  avl = remove_int(avl, 189);
+  avl = grpc_avl_add(avl, box(742), box(2354), nullptr);
+  avl = remove_int(avl, 108);
+  avl = grpc_avl_add(avl, box(1014), box(2356), nullptr);
+  avl = remove_int(avl, 266);
+  avl = remove_int(avl, 623);
+  avl = remove_int(avl, 697);
+  avl = grpc_avl_add(avl, box(180), box(2360), nullptr);
+  avl = remove_int(avl, 472);
+  avl = grpc_avl_add(avl, box(567), box(2362), nullptr);
+  avl = remove_int(avl, 1020);
+  avl = remove_int(avl, 273);
+  avl = grpc_avl_add(avl, box(864), box(2365), nullptr);
+  avl = grpc_avl_add(avl, box(1009), box(2366), nullptr);
+  avl = remove_int(avl, 224);
+  avl = remove_int(avl, 81);
+  avl = grpc_avl_add(avl, box(653), box(2369), nullptr);
+  avl = remove_int(avl, 67);
+  avl = remove_int(avl, 102);
+  avl = remove_int(avl, 76);
+  avl = remove_int(avl, 935);
+  avl = remove_int(avl, 169);
+  avl = remove_int(avl, 232);
+  avl = remove_int(avl, 79);
+  avl = grpc_avl_add(avl, box(509), box(2377), nullptr);
+  avl = remove_int(avl, 900);
+  avl = remove_int(avl, 822);
+  avl = remove_int(avl, 945);
+  avl = remove_int(avl, 356);
+  avl = grpc_avl_add(avl, box(443), box(2382), nullptr);
+  avl = grpc_avl_add(avl, box(925), box(2383), nullptr);
+  avl = remove_int(avl, 994);
+  avl = remove_int(avl, 324);
+  avl = grpc_avl_add(avl, box(291), box(2386), nullptr);
+  avl = remove_int(avl, 94);
+  avl = remove_int(avl, 795);
+  avl = remove_int(avl, 42);
+  avl = grpc_avl_add(avl, box(613), box(2390), nullptr);
+  avl = remove_int(avl, 289);
+  avl = grpc_avl_add(avl, box(980), box(2392), nullptr);
+  avl = remove_int(avl, 316);
+  avl = grpc_avl_add(avl, box(281), box(2394), nullptr);
+  avl = grpc_avl_add(avl, box(1006), box(2395), nullptr);
+  avl = remove_int(avl, 776);
+  avl = grpc_avl_add(avl, box(108), box(2397), nullptr);
+  avl = grpc_avl_add(avl, box(918), box(2398), nullptr);
+  avl = remove_int(avl, 721);
+  avl = remove_int(avl, 563);
+  avl = grpc_avl_add(avl, box(925), box(2401), nullptr);
+  avl = remove_int(avl, 448);
+  avl = remove_int(avl, 198);
+  avl = remove_int(avl, 1);
+  avl = grpc_avl_add(avl, box(160), box(2405), nullptr);
+  avl = remove_int(avl, 515);
+  avl = grpc_avl_add(avl, box(284), box(2407), nullptr);
+  avl = grpc_avl_add(avl, box(225), box(2408), nullptr);
+  avl = remove_int(avl, 304);
+  avl = grpc_avl_add(avl, box(714), box(2410), nullptr);
+  avl = grpc_avl_add(avl, box(708), box(2411), nullptr);
+  avl = grpc_avl_add(avl, box(624), box(2412), nullptr);
+  avl = remove_int(avl, 662);
+  avl = remove_int(avl, 825);
+  avl = remove_int(avl, 383);
+  avl = remove_int(avl, 381);
+  avl = grpc_avl_add(avl, box(194), box(2417), nullptr);
+  avl = remove_int(avl, 280);
+  avl = remove_int(avl, 25);
+  avl = remove_int(avl, 633);
+  avl = grpc_avl_add(avl, box(897), box(2421), nullptr);
+  avl = remove_int(avl, 636);
+  avl = remove_int(avl, 596);
+  avl = remove_int(avl, 757);
+  avl = remove_int(avl, 343);
+  avl = remove_int(avl, 162);
+  avl = remove_int(avl, 913);
+  avl = remove_int(avl, 843);
+  avl = remove_int(avl, 280);
+  avl = remove_int(avl, 911);
+  avl = grpc_avl_add(avl, box(1008), box(2431), nullptr);
+  avl = remove_int(avl, 948);
+  avl = remove_int(avl, 74);
+  avl = remove_int(avl, 571);
+  avl = grpc_avl_add(avl, box(486), box(2435), nullptr);
+  avl = grpc_avl_add(avl, box(285), box(2436), nullptr);
+  avl = remove_int(avl, 304);
+  avl = remove_int(avl, 516);
+  avl = grpc_avl_add(avl, box(758), box(2439), nullptr);
+  avl = grpc_avl_add(avl, box(776), box(2440), nullptr);
+  avl = remove_int(avl, 696);
+  avl = grpc_avl_add(avl, box(104), box(2442), nullptr);
+  avl = grpc_avl_add(avl, box(700), box(2443), nullptr);
+  avl = grpc_avl_add(avl, box(114), box(2444), nullptr);
+  avl = grpc_avl_add(avl, box(567), box(2445), nullptr);
+  avl = remove_int(avl, 620);
+  avl = grpc_avl_add(avl, box(270), box(2447), nullptr);
+  avl = remove_int(avl, 730);
+  avl = grpc_avl_add(avl, box(749), box(2449), nullptr);
+  avl = grpc_avl_add(avl, box(443), box(2450), nullptr);
+  avl = remove_int(avl, 457);
+  avl = grpc_avl_add(avl, box(571), box(2452), nullptr);
+  avl = grpc_avl_add(avl, box(626), box(2453), nullptr);
+  avl = remove_int(avl, 638);
+  avl = remove_int(avl, 313);
+
+  grpc_avl_unref(avl, nullptr);
+}
+
+static void test_stress(int amount_of_stress) {
+  int added[1024];
+  int i, j;
+  int deletions = 0;
+  grpc_avl avl;
+
+  unsigned seed = (unsigned)time(nullptr);
+
+  gpr_log(GPR_DEBUG, "test_stress amount=%d seed=%u", amount_of_stress, seed);
+
+  srand((unsigned)time(nullptr));
+  avl = grpc_avl_create(&int_int_vtable);
+
+  memset(added, 0, sizeof(added));
+
+  for (i = 1; deletions < amount_of_stress; i++) {
+    int idx = rand() % (int)GPR_ARRAY_SIZE(added);
+    GPR_ASSERT(i);
+    if (rand() < RAND_MAX / 2) {
+      added[idx] = i;
+      printf("avl = grpc_avl_add(avl, box(%d), box(%d), NULL); /* d=%d */\n",
+             idx, i, deletions);
+      avl = grpc_avl_add(avl, box(idx), box(i), nullptr);
+    } else {
+      deletions += (added[idx] != 0);
+      added[idx] = 0;
+      printf("avl = remove_int(avl, %d); /* d=%d */\n", idx, deletions);
+      avl = remove_int(avl, idx);
+    }
+    for (j = 0; j < (int)GPR_ARRAY_SIZE(added); j++) {
+      if (added[j] != 0) {
+        check_get(avl, j, added[j]);
+      } else {
+        check_negget(avl, j);
+      }
+    }
+  }
+
+  grpc_avl_unref(avl, nullptr);
+}
+
+int main(int argc, char* argv[]) {
+  grpc_test_init(argc, argv);
+
+  test_get();
+  test_ll();
+  test_lr();
+  test_rr();
+  test_rl();
+  test_unbalanced();
+  test_replace();
+  test_remove();
+  test_badcase1();
+  test_badcase2();
+  test_badcase3();
+  test_stress(10);
+
+  return 0;
+}
diff --git a/test/core/backoff/backoff_test.cc b/test/core/backoff/backoff_test.cc
index 2e61243..53e910e 100644
--- a/test/core/backoff/backoff_test.cc
+++ b/test/core/backoff/backoff_test.cc
@@ -21,7 +21,6 @@
 #include <algorithm>
 
 #include <grpc/support/log.h>
-#include <grpc/support/useful.h>
 
 #include <gtest/gtest.h>
 #include "test/core/util/test_config.h"
diff --git a/test/core/bad_ssl/bad_ssl_test.cc b/test/core/bad_ssl/bad_ssl_test.cc
index 8a7960b..e2ab22e 100644
--- a/test/core/bad_ssl/bad_ssl_test.cc
+++ b/test/core/bad_ssl/bad_ssl_test.cc
@@ -22,14 +22,15 @@
 #include <grpc/grpc.h>
 #include <grpc/grpc_security.h>
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/subprocess.h>
+
 #include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "test/core/end2end/cq_verifier.h"
 #include "test/core/util/port.h"
+#include "test/core/util/subprocess.h"
 #include "test/core/util/test_config.h"
 
 static void* tag(intptr_t t) { return (void*)t; }
diff --git a/test/core/bad_ssl/generate_tests.bzl b/test/core/bad_ssl/generate_tests.bzl
index f2eab54..3cf7fd7 100755
--- a/test/core/bad_ssl/generate_tests.bzl
+++ b/test/core/bad_ssl/generate_tests.bzl
@@ -39,9 +39,10 @@
     native.cc_test(
         name = 'bad_ssl_%s_test' % t,
         srcs = ['bad_ssl_test.cc'],
-        data = [':bad_ssl_%s_server' % t],
+        data = [':bad_ssl_%s_server' % t,
+                '//src/core/tsi/test_creds:badserver.key',
+                '//src/core/tsi/test_creds:badserver.pem',],
         deps = ['//test/core/util:grpc_test_util',
                 '//:gpr',
                 '//test/core/end2end:cq_verifier'],
     )
-
diff --git a/test/core/bad_ssl/server_common.cc b/test/core/bad_ssl/server_common.cc
index 08842b8..809539a 100644
--- a/test/core/bad_ssl/server_common.cc
+++ b/test/core/bad_ssl/server_common.cc
@@ -16,11 +16,11 @@
  *
  */
 
-#include <grpc/support/cmdline.h>
 #include <grpc/support/log.h>
 #include <signal.h>
 
 #include "test/core/bad_ssl/server_common.h"
+#include "test/core/util/cmdline.h"
 #include "test/core/util/test_config.h"
 
 /* Common server implementation details for all servers in servers/.
diff --git a/test/core/bad_ssl/servers/alpn.cc b/test/core/bad_ssl/servers/alpn.cc
index 23954d8..4a04178 100644
--- a/test/core/bad_ssl/servers/alpn.cc
+++ b/test/core/bad_ssl/servers/alpn.cc
@@ -21,9 +21,9 @@
 #include <grpc/grpc.h>
 #include <grpc/grpc_security.h>
 #include <grpc/support/log.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/ext/transport/chttp2/alpn/alpn.h"
+#include "src/core/lib/gpr/useful.h"
 #include "test/core/bad_ssl/server_common.h"
 #include "test/core/end2end/data/ssl_test_data.h"
 
diff --git a/test/core/bad_ssl/servers/cert.cc b/test/core/bad_ssl/servers/cert.cc
index a51dd34..3ed7d02 100644
--- a/test/core/bad_ssl/servers/cert.cc
+++ b/test/core/bad_ssl/servers/cert.cc
@@ -21,7 +21,6 @@
 #include <grpc/grpc.h>
 #include <grpc/grpc_security.h>
 #include <grpc/support/log.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/iomgr/load_file.h"
 
diff --git a/test/core/channel/channel_args_test.cc b/test/core/channel/channel_args_test.cc
index 24319ba..d232bc0 100644
--- a/test/core/channel/channel_args_test.cc
+++ b/test/core/channel/channel_args_test.cc
@@ -19,9 +19,9 @@
 #include <string.h>
 
 #include <grpc/support/log.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/exec_ctx.h"
 #include "test/core/util/test_config.h"
 
diff --git a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc
index 18a795f..8cafadf 100644
--- a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc
+++ b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc
@@ -79,17 +79,17 @@
   return nullptr;
 }
 
-static grpc_resolver* create_resolver(const char* name) {
-  grpc_resolver_factory* factory = grpc_resolver_factory_lookup("dns");
+static grpc_core::OrphanablePtr<grpc_core::Resolver> create_resolver(
+    const char* name) {
+  grpc_core::ResolverFactory* factory =
+      grpc_core::ResolverRegistry::LookupResolverFactory("dns");
   grpc_uri* uri = grpc_uri_parse(name, 0);
   GPR_ASSERT(uri);
-  grpc_resolver_args args;
-  memset(&args, 0, sizeof(args));
+  grpc_core::ResolverArgs args;
   args.uri = uri;
   args.combiner = g_combiner;
-  grpc_resolver* resolver =
-      grpc_resolver_factory_create_resolver(factory, &args);
-  grpc_resolver_factory_unref(factory);
+  grpc_core::OrphanablePtr<grpc_core::Resolver> resolver =
+      factory->CreateResolver(args);
   grpc_uri_destroy(uri);
   return resolver;
 }
@@ -112,7 +112,7 @@
 }
 
 typedef struct next_args {
-  grpc_resolver* resolver;
+  grpc_core::Resolver* resolver;
   grpc_channel_args** result;
   grpc_closure* on_complete;
 } next_args;
@@ -120,21 +120,21 @@
 static void call_resolver_next_now_lock_taken(void* arg,
                                               grpc_error* error_unused) {
   next_args* a = static_cast<next_args*>(arg);
-  grpc_resolver_next_locked(a->resolver, a->result, a->on_complete);
+  a->resolver->NextLocked(a->result, a->on_complete);
   gpr_free(a);
 }
 
-static void call_resolver_next_after_locking(grpc_resolver* resolver,
+static void call_resolver_next_after_locking(grpc_core::Resolver* resolver,
                                              grpc_channel_args** result,
-                                             grpc_closure* on_complete) {
+                                             grpc_closure* on_complete,
+                                             grpc_combiner* combiner) {
   next_args* a = static_cast<next_args*>(gpr_malloc(sizeof(*a)));
   a->resolver = resolver;
   a->result = result;
   a->on_complete = on_complete;
-  GRPC_CLOSURE_SCHED(
-      GRPC_CLOSURE_CREATE(call_resolver_next_now_lock_taken, a,
-                          grpc_combiner_scheduler(resolver->combiner)),
-      GRPC_ERROR_NONE);
+  GRPC_CLOSURE_SCHED(GRPC_CLOSURE_CREATE(call_resolver_next_now_lock_taken, a,
+                                         grpc_combiner_scheduler(combiner)),
+                     GRPC_ERROR_NONE);
 }
 
 int main(int argc, char** argv) {
@@ -149,12 +149,14 @@
 
   {
     grpc_core::ExecCtx exec_ctx;
-    grpc_resolver* resolver = create_resolver("dns:test");
+    grpc_core::OrphanablePtr<grpc_core::Resolver> resolver =
+        create_resolver("dns:test");
     gpr_event ev1;
     gpr_event_init(&ev1);
     call_resolver_next_after_locking(
-        resolver, &result,
-        GRPC_CLOSURE_CREATE(on_done, &ev1, grpc_schedule_on_exec_ctx));
+        resolver.get(), &result,
+        GRPC_CLOSURE_CREATE(on_done, &ev1, grpc_schedule_on_exec_ctx),
+        g_combiner);
     grpc_core::ExecCtx::Get()->Flush();
     GPR_ASSERT(wait_loop(5, &ev1));
     GPR_ASSERT(result == nullptr);
@@ -162,14 +164,14 @@
     gpr_event ev2;
     gpr_event_init(&ev2);
     call_resolver_next_after_locking(
-        resolver, &result,
-        GRPC_CLOSURE_CREATE(on_done, &ev2, grpc_schedule_on_exec_ctx));
+        resolver.get(), &result,
+        GRPC_CLOSURE_CREATE(on_done, &ev2, grpc_schedule_on_exec_ctx),
+        g_combiner);
     grpc_core::ExecCtx::Get()->Flush();
     GPR_ASSERT(wait_loop(30, &ev2));
     GPR_ASSERT(result != nullptr);
 
     grpc_channel_args_destroy(result);
-    GRPC_RESOLVER_UNREF(resolver, "test");
     GRPC_COMBINER_UNREF(g_combiner, "test");
   }
 
diff --git a/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc b/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc
index 64342b4..9402a605 100644
--- a/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc
+++ b/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc
@@ -23,6 +23,7 @@
 #include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h"
 #include "src/core/ext/filters/client_channel/resolver_registry.h"
 #include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gprpp/memory.h"
 #include "src/core/lib/iomgr/combiner.h"
 #include "src/core/lib/iomgr/sockaddr_utils.h"
 #include "test/core/util/test_config.h"
@@ -131,13 +132,13 @@
   gpr_event_set(&args->ev, (void*)1);
 }
 
-typedef struct on_resolution_cb_arg {
-  const char* uri_str;
-  grpc_resolver* resolver;
-  grpc_channel_args* result;
-  grpc_millis delay_before_second_resolution;
-  bool using_cares;
-} on_resolution_cb_arg;
+struct OnResolutionCallbackArg {
+  const char* uri_str = nullptr;
+  grpc_core::OrphanablePtr<grpc_core::Resolver> resolver;
+  grpc_channel_args* result = nullptr;
+  grpc_millis delay_before_second_resolution = 0;
+  bool using_cares = false;
+};
 
 // Counter for the number of times a resolution notification callback has been
 // invoked.
@@ -147,7 +148,7 @@
 bool g_all_callbacks_invoked;
 
 void on_third_resolution(void* arg, grpc_error* error) {
-  on_resolution_cb_arg* cb_arg = static_cast<on_resolution_cb_arg*>(arg);
+  OnResolutionCallbackArg* cb_arg = static_cast<OnResolutionCallbackArg*>(arg);
   GPR_ASSERT(error == GRPC_ERROR_NONE);
   ++g_on_resolution_invocations_count;
   grpc_channel_args_destroy(cb_arg->result);
@@ -159,8 +160,7 @@
   // period.
   GPR_ASSERT(g_on_resolution_invocations_count == 3);
   GPR_ASSERT(g_resolution_count == 2);
-  grpc_resolver_shutdown_locked(cb_arg->resolver);
-  GRPC_RESOLVER_UNREF(cb_arg->resolver, "on_third_resolution");
+  cb_arg->resolver.reset();
   if (cb_arg->using_cares) {
     gpr_atm_rel_store(&g_iomgr_args.done_atm, 1);
     gpr_mu_lock(g_iomgr_args.mu);
@@ -168,12 +168,12 @@
                       grpc_pollset_kick(g_iomgr_args.pollset, nullptr));
     gpr_mu_unlock(g_iomgr_args.mu);
   }
-  gpr_free(cb_arg);
+  grpc_core::Delete(cb_arg);
   g_all_callbacks_invoked = true;
 }
 
 void on_second_resolution(void* arg, grpc_error* error) {
-  on_resolution_cb_arg* cb_arg = static_cast<on_resolution_cb_arg*>(arg);
+  OnResolutionCallbackArg* cb_arg = static_cast<OnResolutionCallbackArg*>(arg);
   ++g_on_resolution_invocations_count;
   grpc_channel_args_destroy(cb_arg->result);
 
@@ -187,11 +187,11 @@
   GPR_ASSERT(g_resolution_count == 1);
   grpc_core::ExecCtx::Get()->TestOnlySetNow(
       cb_arg->delay_before_second_resolution * 2);
-  grpc_resolver_next_locked(
-      cb_arg->resolver, &cb_arg->result,
+  cb_arg->resolver->NextLocked(
+      &cb_arg->result,
       GRPC_CLOSURE_CREATE(on_third_resolution, arg,
                           grpc_combiner_scheduler(g_combiner)));
-  grpc_resolver_channel_saw_error_locked(cb_arg->resolver);
+  cb_arg->resolver->RequestReresolutionLocked();
   if (cb_arg->using_cares) {
     gpr_mu_lock(g_iomgr_args.mu);
     GRPC_LOG_IF_ERROR("pollset_kick",
@@ -201,14 +201,14 @@
 }
 
 void on_first_resolution(void* arg, grpc_error* error) {
-  on_resolution_cb_arg* cb_arg = static_cast<on_resolution_cb_arg*>(arg);
+  OnResolutionCallbackArg* cb_arg = static_cast<OnResolutionCallbackArg*>(arg);
   ++g_on_resolution_invocations_count;
   grpc_channel_args_destroy(cb_arg->result);
-  grpc_resolver_next_locked(
-      cb_arg->resolver, &cb_arg->result,
+  cb_arg->resolver->NextLocked(
+      &cb_arg->result,
       GRPC_CLOSURE_CREATE(on_second_resolution, arg,
                           grpc_combiner_scheduler(g_combiner)));
-  grpc_resolver_channel_saw_error_locked(cb_arg->resolver);
+  cb_arg->resolver->RequestReresolutionLocked();
   gpr_log(GPR_INFO,
           "1st: g_on_resolution_invocations_count: %d, g_resolution_count: %d",
           g_on_resolution_invocations_count, g_resolution_count);
@@ -225,15 +225,16 @@
 }
 
 static void start_test_under_combiner(void* arg, grpc_error* error) {
-  on_resolution_cb_arg* res_cb_arg = static_cast<on_resolution_cb_arg*>(arg);
-  grpc_resolver* resolver;
-  grpc_resolver_factory* factory = grpc_resolver_factory_lookup("dns");
+  OnResolutionCallbackArg* res_cb_arg =
+      static_cast<OnResolutionCallbackArg*>(arg);
+
+  grpc_core::ResolverFactory* factory =
+      grpc_core::ResolverRegistry::LookupResolverFactory("dns");
   grpc_uri* uri = grpc_uri_parse(res_cb_arg->uri_str, 0);
-  grpc_resolver_args args;
   gpr_log(GPR_DEBUG, "test: '%s' should be valid for '%s'", res_cb_arg->uri_str,
-          factory->vtable->scheme);
-  GPR_ASSERT(uri);
-  memset(&args, 0, sizeof(args));
+          factory->scheme());
+  GPR_ASSERT(uri != nullptr);
+  grpc_core::ResolverArgs args;
   args.uri = uri;
   args.combiner = g_combiner;
   g_on_resolution_invocations_count = 0;
@@ -248,25 +249,23 @@
   auto* cooldown_channel_args =
       grpc_channel_args_copy_and_add(nullptr, &cooldown_arg, 1);
   args.args = cooldown_channel_args;
-  resolver = grpc_resolver_factory_create_resolver(factory, &args);
+  res_cb_arg->resolver = factory->CreateResolver(args);
   grpc_channel_args_destroy(cooldown_channel_args);
-  GPR_ASSERT(resolver != nullptr);
-  res_cb_arg->resolver = resolver;
+  GPR_ASSERT(res_cb_arg->resolver != nullptr);
   res_cb_arg->delay_before_second_resolution = kMinResolutionPeriodMs;
   // First resolution, would incur in system-level resolution.
-  grpc_resolver_next_locked(
-      resolver, &res_cb_arg->result,
+  res_cb_arg->resolver->NextLocked(
+      &res_cb_arg->result,
       GRPC_CLOSURE_CREATE(on_first_resolution, res_cb_arg,
                           grpc_combiner_scheduler(g_combiner)));
   grpc_uri_destroy(uri);
-  grpc_resolver_factory_unref(factory);
 }
 
 static void test_cooldown(bool using_cares) {
   grpc_core::ExecCtx exec_ctx;
   if (using_cares) iomgr_args_init(&g_iomgr_args);
-  on_resolution_cb_arg* res_cb_arg =
-      static_cast<on_resolution_cb_arg*>(gpr_zalloc(sizeof(*res_cb_arg)));
+  OnResolutionCallbackArg* res_cb_arg =
+      grpc_core::New<OnResolutionCallbackArg>();
   res_cb_arg->uri_str = "dns:127.0.0.1";
   res_cb_arg->using_cares = using_cares;
 
diff --git a/test/core/client_channel/resolvers/dns_resolver_test.cc b/test/core/client_channel/resolvers/dns_resolver_test.cc
index 8066790..e3fba28 100644
--- a/test/core/client_channel/resolvers/dns_resolver_test.cc
+++ b/test/core/client_channel/resolvers/dns_resolver_test.cc
@@ -27,47 +27,46 @@
 
 static grpc_combiner* g_combiner;
 
-static void test_succeeds(grpc_resolver_factory* factory, const char* string) {
+static void test_succeeds(grpc_core::ResolverFactory* factory,
+                          const char* string) {
+  gpr_log(GPR_DEBUG, "test: '%s' should be valid for '%s'", string,
+          factory->scheme());
   grpc_core::ExecCtx exec_ctx;
   grpc_uri* uri = grpc_uri_parse(string, 0);
-  grpc_resolver_args args;
-  grpc_resolver* resolver;
-  gpr_log(GPR_DEBUG, "test: '%s' should be valid for '%s'", string,
-          factory->vtable->scheme);
   GPR_ASSERT(uri);
-  memset(&args, 0, sizeof(args));
+  grpc_core::ResolverArgs args;
   args.uri = uri;
   args.combiner = g_combiner;
-  resolver = grpc_resolver_factory_create_resolver(factory, &args);
+  grpc_core::OrphanablePtr<grpc_core::Resolver> resolver =
+      factory->CreateResolver(args);
   GPR_ASSERT(resolver != nullptr);
-  GRPC_RESOLVER_UNREF(resolver, "test_succeeds");
   grpc_uri_destroy(uri);
 }
 
-static void test_fails(grpc_resolver_factory* factory, const char* string) {
+static void test_fails(grpc_core::ResolverFactory* factory,
+                       const char* string) {
+  gpr_log(GPR_DEBUG, "test: '%s' should be invalid for '%s'", string,
+          factory->scheme());
   grpc_core::ExecCtx exec_ctx;
   grpc_uri* uri = grpc_uri_parse(string, 0);
-  grpc_resolver_args args;
-  grpc_resolver* resolver;
-  gpr_log(GPR_DEBUG, "test: '%s' should be invalid for '%s'", string,
-          factory->vtable->scheme);
   GPR_ASSERT(uri);
-  memset(&args, 0, sizeof(args));
+  grpc_core::ResolverArgs args;
   args.uri = uri;
   args.combiner = g_combiner;
-  resolver = grpc_resolver_factory_create_resolver(factory, &args);
+  grpc_core::OrphanablePtr<grpc_core::Resolver> resolver =
+      factory->CreateResolver(args);
   GPR_ASSERT(resolver == nullptr);
   grpc_uri_destroy(uri);
 }
 
 int main(int argc, char** argv) {
-  grpc_resolver_factory* dns;
   grpc_test_init(argc, argv);
   grpc_init();
 
   g_combiner = grpc_combiner_create();
 
-  dns = grpc_resolver_factory_lookup("dns");
+  grpc_core::ResolverFactory* dns =
+      grpc_core::ResolverRegistry::LookupResolverFactory("dns");
 
   test_succeeds(dns, "dns:10.2.1.1");
   test_succeeds(dns, "dns:10.2.1.1:1234");
@@ -78,7 +77,6 @@
     test_fails(dns, "ipv4://8.8.8.8/8.8.8.8:8888");
   }
 
-  grpc_resolver_factory_unref(dns);
   {
     grpc_core::ExecCtx exec_ctx;
     GRPC_COMBINER_UNREF(g_combiner, "test");
diff --git a/test/core/client_channel/resolvers/fake_resolver_test.cc b/test/core/client_channel/resolvers/fake_resolver_test.cc
index 9c11c01..03af895 100644
--- a/test/core/client_channel/resolvers/fake_resolver_test.cc
+++ b/test/core/client_channel/resolvers/fake_resolver_test.cc
@@ -27,25 +27,26 @@
 #include "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h"
 #include "src/core/ext/filters/client_channel/resolver_registry.h"
 #include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gprpp/ref_counted_ptr.h"
 #include "src/core/lib/iomgr/combiner.h"
 #include "src/core/lib/security/credentials/fake/fake_credentials.h"
 
 #include "test/core/util/test_config.h"
 
-static grpc_resolver* build_fake_resolver(
+static grpc_core::OrphanablePtr<grpc_core::Resolver> build_fake_resolver(
     grpc_combiner* combiner,
-    grpc_fake_resolver_response_generator* response_generator) {
-  grpc_resolver_factory* factory = grpc_resolver_factory_lookup("fake");
+    grpc_core::FakeResolverResponseGenerator* response_generator) {
+  grpc_core::ResolverFactory* factory =
+      grpc_core::ResolverRegistry::LookupResolverFactory("fake");
   grpc_arg generator_arg =
-      grpc_fake_resolver_response_generator_arg(response_generator);
-  grpc_resolver_args args;
-  memset(&args, 0, sizeof(args));
+      grpc_core::FakeResolverResponseGenerator::MakeChannelArg(
+          response_generator);
   grpc_channel_args channel_args = {1, &generator_arg};
+  grpc_core::ResolverArgs args;
   args.args = &channel_args;
   args.combiner = combiner;
-  grpc_resolver* resolver =
-      grpc_resolver_factory_create_resolver(factory, &args);
-  grpc_resolver_factory_unref(factory);
+  grpc_core::OrphanablePtr<grpc_core::Resolver> resolver =
+      factory->CreateResolver(args);
   return resolver;
 }
 
@@ -57,10 +58,11 @@
 
 // Callback to check the resolution result is as expected.
 void on_resolution_cb(void* arg, grpc_error* error) {
+  if (error != GRPC_ERROR_NONE) return;
   on_resolution_arg* res = static_cast<on_resolution_arg*>(arg);
   // We only check the addresses channel arg because that's the only one
   // explicitly set by the test via
-  // grpc_fake_resolver_response_generator_set_response.
+  // FakeResolverResponseGenerator::SetResponse().
   const grpc_lb_addresses* actual_lb_addresses =
       grpc_lb_addresses_find_channel_arg(res->resolver_result);
   const grpc_lb_addresses* expected_lb_addresses =
@@ -115,27 +117,27 @@
   grpc_core::ExecCtx exec_ctx;
   grpc_combiner* combiner = grpc_combiner_create();
   // Create resolver.
-  grpc_fake_resolver_response_generator* response_generator =
-      grpc_fake_resolver_response_generator_create();
-  grpc_resolver* resolver = build_fake_resolver(combiner, response_generator);
-  GPR_ASSERT(resolver != nullptr);
+  grpc_core::RefCountedPtr<grpc_core::FakeResolverResponseGenerator>
+      response_generator =
+          grpc_core::MakeRefCounted<grpc_core::FakeResolverResponseGenerator>();
+  grpc_core::OrphanablePtr<grpc_core::Resolver> resolver =
+      build_fake_resolver(combiner, response_generator.get());
+  GPR_ASSERT(resolver.get() != nullptr);
   // Test 1: normal resolution.
-  // next_results != NULL, results_upon_error == NULL, last_used_results ==
+  // next_results != NULL, reresolution_results == NULL, last_used_results ==
   // NULL. Expected response is next_results.
   grpc_channel_args* results = create_new_resolver_result();
   on_resolution_arg on_res_arg = create_on_resolution_arg(results);
   grpc_closure* on_resolution = GRPC_CLOSURE_CREATE(
       on_resolution_cb, &on_res_arg, grpc_combiner_scheduler(combiner));
   // Resolution won't be triggered until next_results is set.
-  grpc_resolver_next_locked(resolver, &on_res_arg.resolver_result,
-                            on_resolution);
-  grpc_fake_resolver_response_generator_set_response(response_generator,
-                                                     results);
+  resolver->NextLocked(&on_res_arg.resolver_result, on_resolution);
+  response_generator->SetResponse(results);
   grpc_core::ExecCtx::Get()->Flush();
   GPR_ASSERT(gpr_event_wait(&on_res_arg.ev,
                             grpc_timeout_seconds_to_deadline(5)) != nullptr);
   // Test 2: update resolution.
-  // next_results != NULL, results_upon_error == NULL, last_used_results !=
+  // next_results != NULL, reresolution_results == NULL, last_used_results !=
   // NULL. Expected response is next_results.
   results = create_new_resolver_result();
   grpc_channel_args* last_used_results = grpc_channel_args_copy(results);
@@ -143,61 +145,55 @@
   on_resolution = GRPC_CLOSURE_CREATE(on_resolution_cb, &on_res_arg,
                                       grpc_combiner_scheduler(combiner));
   // Resolution won't be triggered until next_results is set.
-  grpc_resolver_next_locked(resolver, &on_res_arg.resolver_result,
-                            on_resolution);
-  grpc_fake_resolver_response_generator_set_response(response_generator,
-                                                     results);
+  resolver->NextLocked(&on_res_arg.resolver_result, on_resolution);
+  response_generator->SetResponse(results);
   grpc_core::ExecCtx::Get()->Flush();
   GPR_ASSERT(gpr_event_wait(&on_res_arg.ev,
                             grpc_timeout_seconds_to_deadline(5)) != nullptr);
   // Test 3: fallback re-resolution.
-  // next_results == NULL, results_upon_error == NULL, last_used_results !=
+  // next_results == NULL, reresolution_results == NULL, last_used_results !=
   // NULL. Expected response is last_used_results.
   on_res_arg = create_on_resolution_arg(last_used_results);
   on_resolution = GRPC_CLOSURE_CREATE(on_resolution_cb, &on_res_arg,
                                       grpc_combiner_scheduler(combiner));
-  grpc_resolver_next_locked(resolver, &on_res_arg.resolver_result,
-                            on_resolution);
+  resolver->NextLocked(&on_res_arg.resolver_result, on_resolution);
   // Trigger a re-resolution.
-  grpc_resolver_channel_saw_error_locked(resolver);
+  resolver->RequestReresolutionLocked();
   grpc_core::ExecCtx::Get()->Flush();
   GPR_ASSERT(gpr_event_wait(&on_res_arg.ev,
                             grpc_timeout_seconds_to_deadline(5)) != nullptr);
   // Test 4: normal re-resolution.
-  // next_results == NULL, results_upon_error != NULL, last_used_results !=
-  // NULL. Expected response is results_upon_error.
-  grpc_channel_args* results_upon_error = create_new_resolver_result();
+  // next_results == NULL, reresolution_results != NULL, last_used_results !=
+  // NULL. Expected response is reresolution_results.
+  grpc_channel_args* reresolution_results = create_new_resolver_result();
   on_res_arg =
-      create_on_resolution_arg(grpc_channel_args_copy(results_upon_error));
+      create_on_resolution_arg(grpc_channel_args_copy(reresolution_results));
   on_resolution = GRPC_CLOSURE_CREATE(on_resolution_cb, &on_res_arg,
                                       grpc_combiner_scheduler(combiner));
-  grpc_resolver_next_locked(resolver, &on_res_arg.resolver_result,
-                            on_resolution);
-  // Set results_upon_error.
-  grpc_fake_resolver_response_generator_set_response_upon_error(
-      response_generator, results_upon_error);
+  resolver->NextLocked(&on_res_arg.resolver_result, on_resolution);
+  // Set reresolution_results.
+  response_generator->SetReresolutionResponse(reresolution_results);
   // Flush here to guarantee that the response has been set.
   grpc_core::ExecCtx::Get()->Flush();
   // Trigger a re-resolution.
-  grpc_resolver_channel_saw_error_locked(resolver);
+  resolver->RequestReresolutionLocked();
   grpc_core::ExecCtx::Get()->Flush();
   GPR_ASSERT(gpr_event_wait(&on_res_arg.ev,
                             grpc_timeout_seconds_to_deadline(5)) != nullptr);
   // Test 5: repeat re-resolution.
-  // next_results == NULL, results_upon_error != NULL, last_used_results !=
-  // NULL. Expected response is results_upon_error.
-  on_res_arg = create_on_resolution_arg(results_upon_error);
+  // next_results == NULL, reresolution_results != NULL, last_used_results !=
+  // NULL. Expected response is reresolution_results.
+  on_res_arg = create_on_resolution_arg(reresolution_results);
   on_resolution = GRPC_CLOSURE_CREATE(on_resolution_cb, &on_res_arg,
                                       grpc_combiner_scheduler(combiner));
-  grpc_resolver_next_locked(resolver, &on_res_arg.resolver_result,
-                            on_resolution);
+  resolver->NextLocked(&on_res_arg.resolver_result, on_resolution);
   // Trigger a re-resolution.
-  grpc_resolver_channel_saw_error_locked(resolver);
+  resolver->RequestReresolutionLocked();
   grpc_core::ExecCtx::Get()->Flush();
   GPR_ASSERT(gpr_event_wait(&on_res_arg.ev,
                             grpc_timeout_seconds_to_deadline(5)) != nullptr);
   // Test 6: normal resolution.
-  // next_results != NULL, results_upon_error != NULL, last_used_results !=
+  // next_results != NULL, reresolution_results != NULL, last_used_results !=
   // NULL. Expected response is next_results.
   results = create_new_resolver_result();
   last_used_results = grpc_channel_args_copy(results);
@@ -205,28 +201,24 @@
   on_resolution = GRPC_CLOSURE_CREATE(on_resolution_cb, &on_res_arg,
                                       grpc_combiner_scheduler(combiner));
   // Resolution won't be triggered until next_results is set.
-  grpc_resolver_next_locked(resolver, &on_res_arg.resolver_result,
-                            on_resolution);
-  grpc_fake_resolver_response_generator_set_response(response_generator,
-                                                     results);
+  resolver->NextLocked(&on_res_arg.resolver_result, on_resolution);
+  response_generator->SetResponse(results);
   grpc_core::ExecCtx::Get()->Flush();
   GPR_ASSERT(gpr_event_wait(&on_res_arg.ev,
                             grpc_timeout_seconds_to_deadline(5)) != nullptr);
   // Test 7: fallback re-resolution.
-  // next_results == NULL, results_upon_error == NULL, last_used_results !=
+  // next_results == NULL, reresolution_results == NULL, last_used_results !=
   // NULL. Expected response is last_used_results.
   on_res_arg = create_on_resolution_arg(last_used_results);
   on_resolution = GRPC_CLOSURE_CREATE(on_resolution_cb, &on_res_arg,
                                       grpc_combiner_scheduler(combiner));
-  grpc_resolver_next_locked(resolver, &on_res_arg.resolver_result,
-                            on_resolution);
-  // Reset results_upon_error.
-  grpc_fake_resolver_response_generator_set_response_upon_error(
-      response_generator, nullptr);
-  // Flush here to guarantee that results_upon_error has been reset.
+  resolver->NextLocked(&on_res_arg.resolver_result, on_resolution);
+  // Reset reresolution_results.
+  response_generator->SetReresolutionResponse(nullptr);
+  // Flush here to guarantee that reresolution_results has been reset.
   grpc_core::ExecCtx::Get()->Flush();
   // Trigger a re-resolution.
-  grpc_resolver_channel_saw_error_locked(resolver);
+  resolver->RequestReresolutionLocked();
   grpc_core::ExecCtx::Get()->Flush();
   GPR_ASSERT(gpr_event_wait(&on_res_arg.ev,
                             grpc_timeout_seconds_to_deadline(5)) != nullptr);
@@ -234,16 +226,15 @@
   // Requesting a new resolution without setting the response shouldn't trigger
   // the resolution callback.
   memset(&on_res_arg, 0, sizeof(on_res_arg));
-  grpc_resolver_next_locked(resolver, &on_res_arg.resolver_result,
-                            on_resolution);
+  on_resolution = GRPC_CLOSURE_CREATE(on_resolution_cb, &on_res_arg,
+                                      grpc_combiner_scheduler(combiner));
+  resolver->NextLocked(&on_res_arg.resolver_result, on_resolution);
   grpc_core::ExecCtx::Get()->Flush();
   GPR_ASSERT(gpr_event_wait(&on_res_arg.ev,
                             grpc_timeout_milliseconds_to_deadline(100)) ==
              nullptr);
   // Clean up.
   GRPC_COMBINER_UNREF(combiner, "test_fake_resolver");
-  GRPC_RESOLVER_UNREF(resolver, "test_fake_resolver");
-  grpc_fake_resolver_response_generator_unref(response_generator);
 }
 
 int main(int argc, char** argv) {
diff --git a/test/core/client_channel/resolvers/sockaddr_resolver_test.cc b/test/core/client_channel/resolvers/sockaddr_resolver_test.cc
index 07ee133..b9287c2 100644
--- a/test/core/client_channel/resolvers/sockaddr_resolver_test.cc
+++ b/test/core/client_channel/resolvers/sockaddr_resolver_test.cc
@@ -40,18 +40,18 @@
   grpc_channel_args_destroy(res->resolver_result);
 }
 
-static void test_succeeds(grpc_resolver_factory* factory, const char* string) {
+static void test_succeeds(grpc_core::ResolverFactory* factory,
+                          const char* string) {
+  gpr_log(GPR_DEBUG, "test: '%s' should be valid for '%s'", string,
+          factory->scheme());
   grpc_core::ExecCtx exec_ctx;
   grpc_uri* uri = grpc_uri_parse(string, 0);
-  grpc_resolver_args args;
-  grpc_resolver* resolver;
-  gpr_log(GPR_DEBUG, "test: '%s' should be valid for '%s'", string,
-          factory->vtable->scheme);
   GPR_ASSERT(uri);
-  memset(&args, 0, sizeof(args));
+  grpc_core::ResolverArgs args;
   args.uri = uri;
   args.combiner = g_combiner;
-  resolver = grpc_resolver_factory_create_resolver(factory, &args);
+  grpc_core::OrphanablePtr<grpc_core::Resolver> resolver =
+      factory->CreateResolver(args);
   GPR_ASSERT(resolver != nullptr);
 
   on_resolution_arg on_res_arg;
@@ -60,40 +60,39 @@
   grpc_closure* on_resolution = GRPC_CLOSURE_CREATE(
       on_resolution_cb, &on_res_arg, grpc_schedule_on_exec_ctx);
 
-  grpc_resolver_next_locked(resolver, &on_res_arg.resolver_result,
-                            on_resolution);
-  GRPC_RESOLVER_UNREF(resolver, "test_succeeds");
+  resolver->NextLocked(&on_res_arg.resolver_result, on_resolution);
   grpc_uri_destroy(uri);
   /* Flush ExecCtx to avoid stack-use-after-scope on on_res_arg which is
    * accessed in the closure on_resolution_cb */
   grpc_core::ExecCtx::Get()->Flush();
 }
 
-static void test_fails(grpc_resolver_factory* factory, const char* string) {
+static void test_fails(grpc_core::ResolverFactory* factory,
+                       const char* string) {
+  gpr_log(GPR_DEBUG, "test: '%s' should be invalid for '%s'", string,
+          factory->scheme());
   grpc_core::ExecCtx exec_ctx;
   grpc_uri* uri = grpc_uri_parse(string, 0);
-  grpc_resolver_args args;
-  grpc_resolver* resolver;
-  gpr_log(GPR_DEBUG, "test: '%s' should be invalid for '%s'", string,
-          factory->vtable->scheme);
   GPR_ASSERT(uri);
-  memset(&args, 0, sizeof(args));
+  grpc_core::ResolverArgs args;
   args.uri = uri;
   args.combiner = g_combiner;
-  resolver = grpc_resolver_factory_create_resolver(factory, &args);
+  grpc_core::OrphanablePtr<grpc_core::Resolver> resolver =
+      factory->CreateResolver(args);
   GPR_ASSERT(resolver == nullptr);
   grpc_uri_destroy(uri);
 }
 
 int main(int argc, char** argv) {
-  grpc_resolver_factory *ipv4, *ipv6;
   grpc_test_init(argc, argv);
   grpc_init();
 
   g_combiner = grpc_combiner_create();
 
-  ipv4 = grpc_resolver_factory_lookup("ipv4");
-  ipv6 = grpc_resolver_factory_lookup("ipv6");
+  grpc_core::ResolverFactory* ipv4 =
+      grpc_core::ResolverRegistry::LookupResolverFactory("ipv4");
+  grpc_core::ResolverFactory* ipv6 =
+      grpc_core::ResolverRegistry::LookupResolverFactory("ipv6");
 
   test_fails(ipv4, "ipv4:10.2.1.1");
   test_succeeds(ipv4, "ipv4:10.2.1.1:1234");
@@ -109,9 +108,6 @@
   test_fails(ipv6, "ipv6:[::]:123456");
   test_fails(ipv6, "ipv6:www.google.com");
 
-  grpc_resolver_factory_unref(ipv4);
-  grpc_resolver_factory_unref(ipv6);
-
   {
     grpc_core::ExecCtx exec_ctx;
     GRPC_COMBINER_UNREF(g_combiner, "test");
diff --git a/test/core/compression/algorithm_test.cc b/test/core/compression/algorithm_test.cc
index b053c39..3dcddf3 100644
--- a/test/core/compression/algorithm_test.cc
+++ b/test/core/compression/algorithm_test.cc
@@ -23,7 +23,6 @@
 
 #include <grpc/grpc.h>
 #include <grpc/support/log.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/slice/slice_internal.h"
 #include "src/core/lib/transport/static_metadata.h"
diff --git a/test/core/compression/compression_test.cc b/test/core/compression/compression_test.cc
index 589d91b..6522988 100644
--- a/test/core/compression/compression_test.cc
+++ b/test/core/compression/compression_test.cc
@@ -22,8 +22,8 @@
 #include <grpc/compression.h>
 #include <grpc/grpc.h>
 #include <grpc/support/log.h>
-#include <grpc/support/useful.h>
 
+#include "src/core/lib/gpr/useful.h"
 #include "test/core/util/test_config.h"
 
 static void test_compression_algorithm_parse(void) {
diff --git a/test/core/compression/message_compress_test.cc b/test/core/compression/message_compress_test.cc
index bab32e0..e3fe825 100644
--- a/test/core/compression/message_compress_test.cc
+++ b/test/core/compression/message_compress_test.cc
@@ -23,9 +23,9 @@
 
 #include <grpc/grpc.h>
 #include <grpc/support/log.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/gpr/murmur_hash.h"
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/exec_ctx.h"
 #include "test/core/util/slice_splitter.h"
 #include "test/core/util/test_config.h"
diff --git a/test/core/end2end/bad_server_response_test.cc b/test/core/end2end/bad_server_response_test.cc
index a8e5e29..2b98620 100644
--- a/test/core/end2end/bad_server_response_test.cc
+++ b/test/core/end2end/bad_server_response_test.cc
@@ -27,10 +27,10 @@
 #include <grpc/grpc.h>
 #include <grpc/slice.h>
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/thd.h>
 
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/iomgr/sockaddr.h"
 #include "src/core/lib/slice/slice_internal.h"
diff --git a/test/core/end2end/connection_refused_test.cc b/test/core/end2end/connection_refused_test.cc
index ca6d17e..ff830b4 100644
--- a/test/core/end2end/connection_refused_test.cc
+++ b/test/core/end2end/connection_refused_test.cc
@@ -20,11 +20,11 @@
 
 #include <grpc/grpc.h>
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 
 #include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/slice/slice_internal.h"
 #include "src/core/lib/transport/metadata.h"
 #include "src/core/lib/transport/service_config.h"
diff --git a/test/core/end2end/cq_verifier.cc b/test/core/end2end/cq_verifier.cc
index 7bf8ae0..a7b37f3 100644
--- a/test/core/end2end/cq_verifier.cc
+++ b/test/core/end2end/cq_verifier.cc
@@ -28,7 +28,6 @@
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/surface/event_string.h"
 
diff --git a/test/core/end2end/dualstack_socket_test.cc b/test/core/end2end/dualstack_socket_test.cc
index bb30547..2dc72b8 100644
--- a/test/core/end2end/dualstack_socket_test.cc
+++ b/test/core/end2end/dualstack_socket_test.cc
@@ -25,10 +25,10 @@
 
 #include <grpc/grpc.h>
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/iomgr/error.h"
 #include "src/core/lib/iomgr/resolve_address.h"
diff --git a/test/core/end2end/end2end_test.sh b/test/core/end2end/end2end_test.sh
index 3b18ae3..b1b9a65 100755
--- a/test/core/end2end/end2end_test.sh
+++ b/test/core/end2end/end2end_test.sh
@@ -15,4 +15,4 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-$1 $2
+"$1" "$2"
diff --git a/test/core/end2end/fixtures/h2_census.cc b/test/core/end2end/fixtures/h2_census.cc
index 75c80aa..423764a 100644
--- a/test/core/end2end/fixtures/h2_census.cc
+++ b/test/core/end2end/fixtures/h2_census.cc
@@ -21,16 +21,16 @@
 #include <string.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/useful.h>
+
 #include "src/core/ext/filters/client_channel/client_channel.h"
 #include "src/core/ext/filters/http/server/http_server_filter.h"
 #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/channel/connected_channel.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/surface/channel.h"
 #include "src/core/lib/surface/server.h"
 #include "test/core/util/port.h"
diff --git a/test/core/end2end/fixtures/h2_compress.cc b/test/core/end2end/fixtures/h2_compress.cc
index 5b91815..af7ddec 100644
--- a/test/core/end2end/fixtures/h2_compress.cc
+++ b/test/core/end2end/fixtures/h2_compress.cc
@@ -21,16 +21,16 @@
 #include <string.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/useful.h>
+
 #include "src/core/ext/filters/client_channel/client_channel.h"
 #include "src/core/ext/filters/http/server/http_server_filter.h"
 #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/channel/connected_channel.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/surface/channel.h"
 #include "src/core/lib/surface/server.h"
 #include "test/core/util/port.h"
diff --git a/test/core/end2end/fixtures/h2_fakesec.cc b/test/core/end2end/fixtures/h2_fakesec.cc
index 87d4668..bbf65fc 100644
--- a/test/core/end2end/fixtures/h2_fakesec.cc
+++ b/test/core/end2end/fixtures/h2_fakesec.cc
@@ -22,9 +22,10 @@
 #include <string.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
+
 #include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/security/credentials/fake/fake_credentials.h"
 #include "test/core/end2end/data/ssl_test_data.h"
 #include "test/core/util/port.h"
diff --git a/test/core/end2end/fixtures/h2_full+pipe.cc b/test/core/end2end/fixtures/h2_full+pipe.cc
index b080591..88f24b9 100644
--- a/test/core/end2end/fixtures/h2_full+pipe.cc
+++ b/test/core/end2end/fixtures/h2_full+pipe.cc
@@ -26,15 +26,15 @@
 #include <string.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/useful.h>
+
 #include "src/core/ext/filters/client_channel/client_channel.h"
 #include "src/core/ext/filters/http/server/http_server_filter.h"
 #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
 #include "src/core/lib/channel/connected_channel.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/iomgr/wakeup_fd_posix.h"
 #include "src/core/lib/surface/channel.h"
 #include "src/core/lib/surface/server.h"
diff --git a/test/core/end2end/fixtures/h2_full+trace.cc b/test/core/end2end/fixtures/h2_full+trace.cc
index 7104fbc..4e0d668 100644
--- a/test/core/end2end/fixtures/h2_full+trace.cc
+++ b/test/core/end2end/fixtures/h2_full+trace.cc
@@ -26,16 +26,16 @@
 #endif
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/useful.h>
+
 #include "src/core/ext/filters/client_channel/client_channel.h"
 #include "src/core/ext/filters/http/server/http_server_filter.h"
 #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
 #include "src/core/lib/channel/connected_channel.h"
 #include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/surface/channel.h"
 #include "src/core/lib/surface/server.h"
 #include "test/core/util/port.h"
diff --git a/test/core/end2end/fixtures/h2_full+workarounds.cc b/test/core/end2end/fixtures/h2_full+workarounds.cc
index 237841d..ce0fed6 100644
--- a/test/core/end2end/fixtures/h2_full+workarounds.cc
+++ b/test/core/end2end/fixtures/h2_full+workarounds.cc
@@ -21,16 +21,17 @@
 #include <string.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/useful.h>
+
 #include <grpc/support/workaround_list.h>
+
 #include "src/core/ext/filters/client_channel/client_channel.h"
 #include "src/core/ext/filters/http/server/http_server_filter.h"
 #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
 #include "src/core/lib/channel/connected_channel.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/surface/channel.h"
 #include "src/core/lib/surface/server.h"
 #include "test/core/util/port.h"
diff --git a/test/core/end2end/fixtures/h2_full.cc b/test/core/end2end/fixtures/h2_full.cc
index 6d15c28..4b96fa2 100644
--- a/test/core/end2end/fixtures/h2_full.cc
+++ b/test/core/end2end/fixtures/h2_full.cc
@@ -21,15 +21,15 @@
 #include <string.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/useful.h>
+
 #include "src/core/ext/filters/client_channel/client_channel.h"
 #include "src/core/ext/filters/http/server/http_server_filter.h"
 #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
 #include "src/core/lib/channel/connected_channel.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/surface/channel.h"
 #include "src/core/lib/surface/server.h"
 #include "test/core/util/port.h"
diff --git a/test/core/end2end/fixtures/h2_http_proxy.cc b/test/core/end2end/fixtures/h2_http_proxy.cc
index e8e81f0..da63f46 100644
--- a/test/core/end2end/fixtures/h2_http_proxy.cc
+++ b/test/core/end2end/fixtures/h2_http_proxy.cc
@@ -21,17 +21,17 @@
 #include <string.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/useful.h>
+
 #include "src/core/ext/filters/client_channel/client_channel.h"
 #include "src/core/ext/filters/http/server/http_server_filter.h"
 #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
 #include "src/core/lib/channel/connected_channel.h"
 #include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/surface/channel.h"
 #include "src/core/lib/surface/server.h"
 #include "test/core/end2end/fixtures/http_proxy_fixture.h"
diff --git a/test/core/end2end/fixtures/h2_load_reporting.cc b/test/core/end2end/fixtures/h2_load_reporting.cc
index fda5f4b..dddeef5 100644
--- a/test/core/end2end/fixtures/h2_load_reporting.cc
+++ b/test/core/end2end/fixtures/h2_load_reporting.cc
@@ -21,17 +21,17 @@
 #include <string.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/useful.h>
+
 #include "src/core/ext/filters/client_channel/client_channel.h"
 #include "src/core/ext/filters/http/server/http_server_filter.h"
 #include "src/core/ext/filters/load_reporting/server_load_reporting_plugin.h"
 #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/channel/connected_channel.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/surface/channel.h"
 #include "src/core/lib/surface/server.h"
 #include "test/core/util/port.h"
diff --git a/test/core/end2end/fixtures/h2_oauth2.cc b/test/core/end2end/fixtures/h2_oauth2.cc
index 5fed443..795e94a 100644
--- a/test/core/end2end/fixtures/h2_oauth2.cc
+++ b/test/core/end2end/fixtures/h2_oauth2.cc
@@ -22,9 +22,10 @@
 #include <string.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
+
 #include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/iomgr/iomgr.h"
 #include "src/core/lib/security/credentials/credentials.h"
 #include "test/core/end2end/data/ssl_test_data.h"
diff --git a/test/core/end2end/fixtures/h2_proxy.cc b/test/core/end2end/fixtures/h2_proxy.cc
index 295654c..4379cdd 100644
--- a/test/core/end2end/fixtures/h2_proxy.cc
+++ b/test/core/end2end/fixtures/h2_proxy.cc
@@ -21,15 +21,15 @@
 #include <string.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/useful.h>
+
 #include "src/core/ext/filters/client_channel/client_channel.h"
 #include "src/core/ext/filters/http/server/http_server_filter.h"
 #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
 #include "src/core/lib/channel/connected_channel.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/surface/channel.h"
 #include "src/core/lib/surface/server.h"
 #include "test/core/end2end/fixtures/proxy.h"
diff --git a/test/core/end2end/fixtures/h2_sockpair+trace.cc b/test/core/end2end/fixtures/h2_sockpair+trace.cc
index 236780b..92b9a46 100644
--- a/test/core/end2end/fixtures/h2_sockpair+trace.cc
+++ b/test/core/end2end/fixtures/h2_sockpair+trace.cc
@@ -29,7 +29,7 @@
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/useful.h>
+
 #include "src/core/ext/filters/client_channel/client_channel.h"
 #include "src/core/ext/filters/http/client/http_client_filter.h"
 #include "src/core/ext/filters/http/message_compress/message_compress_filter.h"
diff --git a/test/core/end2end/fixtures/h2_sockpair.cc b/test/core/end2end/fixtures/h2_sockpair.cc
index b68279f..46acf1f 100644
--- a/test/core/end2end/fixtures/h2_sockpair.cc
+++ b/test/core/end2end/fixtures/h2_sockpair.cc
@@ -24,7 +24,7 @@
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/useful.h>
+
 #include "src/core/ext/filters/client_channel/client_channel.h"
 #include "src/core/ext/filters/http/client/http_client_filter.h"
 #include "src/core/ext/filters/http/message_compress/message_compress_filter.h"
diff --git a/test/core/end2end/fixtures/h2_sockpair_1byte.cc b/test/core/end2end/fixtures/h2_sockpair_1byte.cc
index 350be13..6499c90 100644
--- a/test/core/end2end/fixtures/h2_sockpair_1byte.cc
+++ b/test/core/end2end/fixtures/h2_sockpair_1byte.cc
@@ -24,7 +24,7 @@
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/useful.h>
+
 #include "src/core/ext/filters/client_channel/client_channel.h"
 #include "src/core/ext/filters/http/client/http_client_filter.h"
 #include "src/core/ext/filters/http/message_compress/message_compress_filter.h"
diff --git a/test/core/end2end/fixtures/h2_ssl.cc b/test/core/end2end/fixtures/h2_ssl.cc
index 8c5c8a2..bbcc88e 100644
--- a/test/core/end2end/fixtures/h2_ssl.cc
+++ b/test/core/end2end/fixtures/h2_ssl.cc
@@ -22,11 +22,11 @@
 #include <string.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/gpr/tmpfile.h"
 #include "src/core/lib/security/credentials/credentials.h"
diff --git a/test/core/end2end/fixtures/h2_ssl_proxy.cc b/test/core/end2end/fixtures/h2_ssl_proxy.cc
index 3f0646c..6b0b891 100644
--- a/test/core/end2end/fixtures/h2_ssl_proxy.cc
+++ b/test/core/end2end/fixtures/h2_ssl_proxy.cc
@@ -22,11 +22,11 @@
 #include <string.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/gpr/tmpfile.h"
 #include "src/core/lib/security/credentials/credentials.h"
diff --git a/test/core/end2end/fixtures/h2_uds.cc b/test/core/end2end/fixtures/h2_uds.cc
index 1944dd8..41045c2 100644
--- a/test/core/end2end/fixtures/h2_uds.cc
+++ b/test/core/end2end/fixtures/h2_uds.cc
@@ -23,16 +23,16 @@
 #include <unistd.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/useful.h>
+
 #include "src/core/ext/filters/client_channel/client_channel.h"
 #include "src/core/ext/filters/http/server/http_server_filter.h"
 #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
 #include "src/core/lib/channel/connected_channel.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/surface/channel.h"
 #include "src/core/lib/surface/server.h"
diff --git a/test/core/end2end/fixtures/http_proxy_fixture.cc b/test/core/end2end/fixtures/http_proxy_fixture.cc
index 8ec97df..2d5e841 100644
--- a/test/core/end2end/fixtures/http_proxy_fixture.cc
+++ b/test/core/end2end/fixtures/http_proxy_fixture.cc
@@ -26,14 +26,13 @@
 #include <grpc/slice_buffer.h>
 #include <grpc/support/alloc.h>
 #include <grpc/support/atm.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/http/parser.h"
 #include "src/core/lib/iomgr/closure.h"
diff --git a/test/core/end2end/fixtures/inproc.cc b/test/core/end2end/fixtures/inproc.cc
index b748fbf..796ef67 100644
--- a/test/core/end2end/fixtures/inproc.cc
+++ b/test/core/end2end/fixtures/inproc.cc
@@ -21,15 +21,15 @@
 #include <string.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/useful.h>
+
 #include "src/core/ext/filters/client_channel/client_channel.h"
 #include "src/core/ext/filters/http/server/http_server_filter.h"
 #include "src/core/ext/transport/inproc/inproc_transport.h"
 #include "src/core/lib/channel/connected_channel.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/surface/channel.h"
 #include "src/core/lib/surface/server.h"
 #include "test/core/util/port.h"
diff --git a/test/core/end2end/fixtures/proxy.cc b/test/core/end2end/fixtures/proxy.cc
index b1698c8..7a35796 100644
--- a/test/core/end2end/fixtures/proxy.cc
+++ b/test/core/end2end/fixtures/proxy.cc
@@ -21,12 +21,12 @@
 #include <string.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/useful.h>
 
+#include "src/core/lib/gpr/host_port.h"
+#include "src/core/lib/gpr/useful.h"
 #include "test/core/util/port.h"
 
 struct grpc_end2end_proxy {
diff --git a/test/core/end2end/fuzzers/api_fuzzer_corpus/poc-2d730ebd78b3052e4367ad0d485208dcb205482cbcd6289f17907989b8de1fba b/test/core/end2end/fuzzers/api_fuzzer_corpus/poc-2d730ebd78b3052e4367ad0d485208dcb205482cbcd6289f17907989b8de1fba
new file mode 100644
index 0000000..89e28bb
--- /dev/null
+++ b/test/core/end2end/fuzzers/api_fuzzer_corpus/poc-2d730ebd78b3052e4367ad0d485208dcb205482cbcd6289f17907989b8de1fba
Binary files differ
diff --git a/test/core/end2end/h2_ssl_cert_test.cc b/test/core/end2end/h2_ssl_cert_test.cc
index 9adb96e..cd62c3f 100644
--- a/test/core/end2end/h2_ssl_cert_test.cc
+++ b/test/core/end2end/h2_ssl_cert_test.cc
@@ -22,11 +22,11 @@
 #include <string.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/gpr/tmpfile.h"
 #include "src/core/lib/security/credentials/credentials.h"
diff --git a/test/core/end2end/invalid_call_argument_test.cc b/test/core/end2end/invalid_call_argument_test.cc
index cb6b4c0..d2b26e7 100644
--- a/test/core/end2end/invalid_call_argument_test.cc
+++ b/test/core/end2end/invalid_call_argument_test.cc
@@ -23,9 +23,9 @@
 
 #include <grpc/grpc.h>
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 
+#include "src/core/lib/gpr/host_port.h"
 #include "test/core/end2end/cq_verifier.h"
 #include "test/core/util/port.h"
 #include "test/core/util/test_config.h"
diff --git a/test/core/end2end/tests/authority_not_supported.cc b/test/core/end2end/tests/authority_not_supported.cc
index 9c85450..f2852f7 100644
--- a/test/core/end2end/tests/authority_not_supported.cc
+++ b/test/core/end2end/tests/authority_not_supported.cc
@@ -25,7 +25,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "test/core/end2end/cq_verifier.h"
 
 static void* tag(intptr_t t) { return (void*)t; }
diff --git a/test/core/end2end/tests/bad_hostname.cc b/test/core/end2end/tests/bad_hostname.cc
index 85e9ba1..63bfd76 100644
--- a/test/core/end2end/tests/bad_hostname.cc
+++ b/test/core/end2end/tests/bad_hostname.cc
@@ -26,7 +26,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "src/core/lib/gpr/string.h"
 #include "test/core/end2end/cq_verifier.h"
 
diff --git a/test/core/end2end/tests/bad_ping.cc b/test/core/end2end/tests/bad_ping.cc
index 30a1b8d..672c2f4 100644
--- a/test/core/end2end/tests/bad_ping.cc
+++ b/test/core/end2end/tests/bad_ping.cc
@@ -25,8 +25,8 @@
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 
+#include "src/core/lib/gpr/useful.h"
 #include "test/core/end2end/cq_verifier.h"
 
 #define MAX_PING_STRIKES 1
diff --git a/test/core/end2end/tests/binary_metadata.cc b/test/core/end2end/tests/binary_metadata.cc
index 381671e..8a0d667 100644
--- a/test/core/end2end/tests/binary_metadata.cc
+++ b/test/core/end2end/tests/binary_metadata.cc
@@ -25,7 +25,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "test/core/end2end/cq_verifier.h"
 
 static void* tag(intptr_t t) { return (void*)t; }
diff --git a/test/core/end2end/tests/call_creds.cc b/test/core/end2end/tests/call_creds.cc
index c5ea101..968dab1 100644
--- a/test/core/end2end/tests/call_creds.cc
+++ b/test/core/end2end/tests/call_creds.cc
@@ -26,7 +26,7 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
+
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/security/credentials/credentials.h"
 #include "test/core/end2end/cq_verifier.h"
diff --git a/test/core/end2end/tests/cancel_after_accept.cc b/test/core/end2end/tests/cancel_after_accept.cc
index f59caf7..11bf4e7 100644
--- a/test/core/end2end/tests/cancel_after_accept.cc
+++ b/test/core/end2end/tests/cancel_after_accept.cc
@@ -25,7 +25,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/slice/slice_internal.h"
diff --git a/test/core/end2end/tests/cancel_after_client_done.cc b/test/core/end2end/tests/cancel_after_client_done.cc
index 9b832d4..b0702b7 100644
--- a/test/core/end2end/tests/cancel_after_client_done.cc
+++ b/test/core/end2end/tests/cancel_after_client_done.cc
@@ -25,7 +25,8 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
+
+#include "src/core/lib/gpr/useful.h"
 #include "test/core/end2end/cq_verifier.h"
 #include "test/core/end2end/tests/cancel_test_helpers.h"
 
diff --git a/test/core/end2end/tests/cancel_after_invoke.cc b/test/core/end2end/tests/cancel_after_invoke.cc
index d3891b1..a3e36e0 100644
--- a/test/core/end2end/tests/cancel_after_invoke.cc
+++ b/test/core/end2end/tests/cancel_after_invoke.cc
@@ -25,7 +25,8 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
+
+#include "src/core/lib/gpr/useful.h"
 #include "test/core/end2end/cq_verifier.h"
 #include "test/core/end2end/tests/cancel_test_helpers.h"
 
diff --git a/test/core/end2end/tests/cancel_after_round_trip.cc b/test/core/end2end/tests/cancel_after_round_trip.cc
index b10b939..63e6505 100644
--- a/test/core/end2end/tests/cancel_after_round_trip.cc
+++ b/test/core/end2end/tests/cancel_after_round_trip.cc
@@ -25,7 +25,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/slice/slice_internal.h"
diff --git a/test/core/end2end/tests/cancel_before_invoke.cc b/test/core/end2end/tests/cancel_before_invoke.cc
index 1112375..e9fa046 100644
--- a/test/core/end2end/tests/cancel_before_invoke.cc
+++ b/test/core/end2end/tests/cancel_before_invoke.cc
@@ -25,7 +25,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "test/core/end2end/cq_verifier.h"
 
 static void* tag(intptr_t t) { return (void*)t; }
diff --git a/test/core/end2end/tests/cancel_in_a_vacuum.cc b/test/core/end2end/tests/cancel_in_a_vacuum.cc
index a6c534e..6be2d69 100644
--- a/test/core/end2end/tests/cancel_in_a_vacuum.cc
+++ b/test/core/end2end/tests/cancel_in_a_vacuum.cc
@@ -25,7 +25,8 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
+
+#include "src/core/lib/gpr/useful.h"
 #include "test/core/end2end/cq_verifier.h"
 #include "test/core/end2end/tests/cancel_test_helpers.h"
 
diff --git a/test/core/end2end/tests/cancel_with_status.cc b/test/core/end2end/tests/cancel_with_status.cc
index 7937fd1..6820ba5 100644
--- a/test/core/end2end/tests/cancel_with_status.cc
+++ b/test/core/end2end/tests/cancel_with_status.cc
@@ -27,7 +27,6 @@
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "src/core/lib/gpr/string.h"
 #include "test/core/end2end/cq_verifier.h"
 
diff --git a/test/core/end2end/tests/compressed_payload.cc b/test/core/end2end/tests/compressed_payload.cc
index 944edc7..63bf472 100644
--- a/test/core/end2end/tests/compressed_payload.cc
+++ b/test/core/end2end/tests/compressed_payload.cc
@@ -28,7 +28,6 @@
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/surface/call.h"
diff --git a/test/core/end2end/tests/default_host.cc b/test/core/end2end/tests/default_host.cc
index 7c94420..33be5f1 100644
--- a/test/core/end2end/tests/default_host.cc
+++ b/test/core/end2end/tests/default_host.cc
@@ -26,7 +26,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "src/core/lib/gpr/string.h"
 #include "test/core/end2end/cq_verifier.h"
 
diff --git a/test/core/end2end/tests/disappearing_server.cc b/test/core/end2end/tests/disappearing_server.cc
index 29fb194..1b2f729 100644
--- a/test/core/end2end/tests/disappearing_server.cc
+++ b/test/core/end2end/tests/disappearing_server.cc
@@ -25,7 +25,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "test/core/end2end/cq_verifier.h"
 
 static void* tag(intptr_t t) { return (void*)t; }
diff --git a/test/core/end2end/tests/empty_batch.cc b/test/core/end2end/tests/empty_batch.cc
index c41e65d..1de4b8f 100644
--- a/test/core/end2end/tests/empty_batch.cc
+++ b/test/core/end2end/tests/empty_batch.cc
@@ -26,7 +26,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "src/core/lib/gpr/string.h"
 #include "test/core/end2end/cq_verifier.h"
 
diff --git a/test/core/end2end/tests/filter_call_init_fails.cc b/test/core/end2end/tests/filter_call_init_fails.cc
index 8f46f0b..f60a47f 100644
--- a/test/core/end2end/tests/filter_call_init_fails.cc
+++ b/test/core/end2end/tests/filter_call_init_fails.cc
@@ -27,7 +27,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "src/core/lib/channel/channel_stack_builder.h"
 #include "src/core/lib/surface/channel_init.h"
 #include "test/core/end2end/cq_verifier.h"
diff --git a/test/core/end2end/tests/filter_causes_close.cc b/test/core/end2end/tests/filter_causes_close.cc
index ec8f9db..43f20d7 100644
--- a/test/core/end2end/tests/filter_causes_close.cc
+++ b/test/core/end2end/tests/filter_causes_close.cc
@@ -26,7 +26,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "src/core/lib/channel/channel_stack_builder.h"
 #include "src/core/lib/surface/channel_init.h"
 #include "test/core/end2end/cq_verifier.h"
diff --git a/test/core/end2end/tests/filter_latency.cc b/test/core/end2end/tests/filter_latency.cc
index 845cbc0..d6cf3b0 100644
--- a/test/core/end2end/tests/filter_latency.cc
+++ b/test/core/end2end/tests/filter_latency.cc
@@ -27,7 +27,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/channel/channel_stack_builder.h"
 #include "src/core/lib/surface/channel_init.h"
diff --git a/test/core/end2end/tests/filter_status_code.cc b/test/core/end2end/tests/filter_status_code.cc
index 61c658b..ad80f23 100644
--- a/test/core/end2end/tests/filter_status_code.cc
+++ b/test/core/end2end/tests/filter_status_code.cc
@@ -27,7 +27,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/channel/channel_stack_builder.h"
 #include "src/core/lib/surface/call.h"
diff --git a/test/core/end2end/tests/graceful_server_shutdown.cc b/test/core/end2end/tests/graceful_server_shutdown.cc
index bf11b49..3b6872b 100644
--- a/test/core/end2end/tests/graceful_server_shutdown.cc
+++ b/test/core/end2end/tests/graceful_server_shutdown.cc
@@ -25,7 +25,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "test/core/end2end/cq_verifier.h"
 
 static void* tag(intptr_t t) { return (void*)t; }
diff --git a/test/core/end2end/tests/high_initial_seqno.cc b/test/core/end2end/tests/high_initial_seqno.cc
index d4d4f5a..989cd56 100644
--- a/test/core/end2end/tests/high_initial_seqno.cc
+++ b/test/core/end2end/tests/high_initial_seqno.cc
@@ -27,7 +27,6 @@
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/gpr/string.h"
 #include "test/core/end2end/cq_verifier.h"
diff --git a/test/core/end2end/tests/hpack_size.cc b/test/core/end2end/tests/hpack_size.cc
index 0d6ec01..66b3a40 100644
--- a/test/core/end2end/tests/hpack_size.cc
+++ b/test/core/end2end/tests/hpack_size.cc
@@ -27,9 +27,9 @@
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gpr/useful.h"
 #include "test/core/end2end/cq_verifier.h"
 
 static void* tag(intptr_t t) { return (void*)t; }
diff --git a/test/core/end2end/tests/idempotent_request.cc b/test/core/end2end/tests/idempotent_request.cc
index 7487e4d..578510d 100644
--- a/test/core/end2end/tests/idempotent_request.cc
+++ b/test/core/end2end/tests/idempotent_request.cc
@@ -26,7 +26,7 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
+
 #include "src/core/lib/gpr/string.h"
 #include "test/core/end2end/cq_verifier.h"
 
diff --git a/test/core/end2end/tests/invoke_large_request.cc b/test/core/end2end/tests/invoke_large_request.cc
index 8a67e3c..b7afa97 100644
--- a/test/core/end2end/tests/invoke_large_request.cc
+++ b/test/core/end2end/tests/invoke_large_request.cc
@@ -26,7 +26,8 @@
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
+
+#include "src/core/lib/gpr/useful.h"
 #include "test/core/end2end/cq_verifier.h"
 
 static void* tag(intptr_t t) { return (void*)t; }
diff --git a/test/core/end2end/tests/keepalive_timeout.cc b/test/core/end2end/tests/keepalive_timeout.cc
index 6482b86..0cdd12e 100644
--- a/test/core/end2end/tests/keepalive_timeout.cc
+++ b/test/core/end2end/tests/keepalive_timeout.cc
@@ -25,10 +25,11 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
+
 #include "src/core/ext/transport/chttp2/transport/frame_ping.h"
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/exec_ctx.h"
 #include "test/core/end2end/cq_verifier.h"
 
diff --git a/test/core/end2end/tests/large_metadata.cc b/test/core/end2end/tests/large_metadata.cc
index 8ddf433..c1343f9 100644
--- a/test/core/end2end/tests/large_metadata.cc
+++ b/test/core/end2end/tests/large_metadata.cc
@@ -25,7 +25,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "test/core/end2end/cq_verifier.h"
 
 static void* tag(intptr_t t) { return (void*)t; }
diff --git a/test/core/end2end/tests/load_reporting_hook.cc b/test/core/end2end/tests/load_reporting_hook.cc
index e056bd5..cfe5814 100644
--- a/test/core/end2end/tests/load_reporting_hook.cc
+++ b/test/core/end2end/tests/load_reporting_hook.cc
@@ -24,7 +24,6 @@
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/ext/filters/load_reporting/server_load_reporting_filter.h"
 #include "src/core/ext/filters/load_reporting/server_load_reporting_plugin.h"
diff --git a/test/core/end2end/tests/max_concurrent_streams.cc b/test/core/end2end/tests/max_concurrent_streams.cc
index c053973..642c0f7 100644
--- a/test/core/end2end/tests/max_concurrent_streams.cc
+++ b/test/core/end2end/tests/max_concurrent_streams.cc
@@ -25,7 +25,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "test/core/end2end/cq_verifier.h"
 
 static void* tag(intptr_t t) { return (void*)t; }
diff --git a/test/core/end2end/tests/max_connection_age.cc b/test/core/end2end/tests/max_connection_age.cc
index ddccfc3..df5fd5c 100644
--- a/test/core/end2end/tests/max_connection_age.cc
+++ b/test/core/end2end/tests/max_connection_age.cc
@@ -24,8 +24,8 @@
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 
+#include "src/core/lib/gpr/useful.h"
 #include "test/core/end2end/cq_verifier.h"
 
 #define MAX_CONNECTION_AGE_MS 500
diff --git a/test/core/end2end/tests/max_connection_idle.cc b/test/core/end2end/tests/max_connection_idle.cc
index 293ff7d..09b4a54 100644
--- a/test/core/end2end/tests/max_connection_idle.cc
+++ b/test/core/end2end/tests/max_connection_idle.cc
@@ -25,8 +25,8 @@
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 
+#include "src/core/lib/gpr/useful.h"
 #include "test/core/end2end/cq_verifier.h"
 
 #define MAX_CONNECTION_IDLE_MS 500
diff --git a/test/core/end2end/tests/max_message_length.cc b/test/core/end2end/tests/max_message_length.cc
index e581f1f..b1757a9 100644
--- a/test/core/end2end/tests/max_message_length.cc
+++ b/test/core/end2end/tests/max_message_length.cc
@@ -25,7 +25,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/slice/slice_internal.h"
diff --git a/test/core/end2end/tests/negative_deadline.cc b/test/core/end2end/tests/negative_deadline.cc
index b752bf9..b28bee0 100644
--- a/test/core/end2end/tests/negative_deadline.cc
+++ b/test/core/end2end/tests/negative_deadline.cc
@@ -26,7 +26,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "src/core/lib/gpr/string.h"
 #include "test/core/end2end/cq_verifier.h"
 
diff --git a/test/core/end2end/tests/network_status_change.cc b/test/core/end2end/tests/network_status_change.cc
index 7d0318f..809f8ff 100644
--- a/test/core/end2end/tests/network_status_change.cc
+++ b/test/core/end2end/tests/network_status_change.cc
@@ -25,7 +25,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "test/core/end2end/cq_verifier.h"
 
 /* this is a private API but exposed here for testing*/
diff --git a/test/core/end2end/tests/no_logging.cc b/test/core/end2end/tests/no_logging.cc
index d89918b..b4908d4 100644
--- a/test/core/end2end/tests/no_logging.cc
+++ b/test/core/end2end/tests/no_logging.cc
@@ -27,7 +27,6 @@
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/iomgr/error.h"
 #include "test/core/end2end/cq_verifier.h"
diff --git a/test/core/end2end/tests/no_op.cc b/test/core/end2end/tests/no_op.cc
index 18c2367..020f842 100644
--- a/test/core/end2end/tests/no_op.cc
+++ b/test/core/end2end/tests/no_op.cc
@@ -25,7 +25,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "test/core/end2end/cq_verifier.h"
 
 static void* tag(intptr_t t) { return (void*)t; }
diff --git a/test/core/end2end/tests/payload.cc b/test/core/end2end/tests/payload.cc
index 2e9513b..3535d80 100644
--- a/test/core/end2end/tests/payload.cc
+++ b/test/core/end2end/tests/payload.cc
@@ -25,7 +25,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "test/core/end2end/cq_verifier.h"
 
 static void* tag(intptr_t t) { return (void*)t; }
diff --git a/test/core/end2end/tests/ping.cc b/test/core/end2end/tests/ping.cc
index 725a425..c01dfa8 100644
--- a/test/core/end2end/tests/ping.cc
+++ b/test/core/end2end/tests/ping.cc
@@ -22,8 +22,8 @@
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 
+#include "src/core/lib/gpr/useful.h"
 #include "test/core/end2end/cq_verifier.h"
 
 #define PING_NUM 5
diff --git a/test/core/end2end/tests/ping_pong_streaming.cc b/test/core/end2end/tests/ping_pong_streaming.cc
index ec7981f..714a768 100644
--- a/test/core/end2end/tests/ping_pong_streaming.cc
+++ b/test/core/end2end/tests/ping_pong_streaming.cc
@@ -25,7 +25,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "test/core/end2end/cq_verifier.h"
 
 static void* tag(intptr_t t) { return (void*)t; }
diff --git a/test/core/end2end/tests/proxy_auth.cc b/test/core/end2end/tests/proxy_auth.cc
index 495151b..c34505c 100644
--- a/test/core/end2end/tests/proxy_auth.cc
+++ b/test/core/end2end/tests/proxy_auth.cc
@@ -31,7 +31,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "src/core/lib/gpr/string.h"
 #include "test/core/end2end/cq_verifier.h"
 
diff --git a/test/core/end2end/tests/registered_call.cc b/test/core/end2end/tests/registered_call.cc
index cefa89d..d1c37dc 100644
--- a/test/core/end2end/tests/registered_call.cc
+++ b/test/core/end2end/tests/registered_call.cc
@@ -26,7 +26,7 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
+
 #include "src/core/lib/gpr/string.h"
 #include "test/core/end2end/cq_verifier.h"
 
diff --git a/test/core/end2end/tests/request_with_flags.cc b/test/core/end2end/tests/request_with_flags.cc
index 984d8b1..4602313 100644
--- a/test/core/end2end/tests/request_with_flags.cc
+++ b/test/core/end2end/tests/request_with_flags.cc
@@ -25,7 +25,8 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
+
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/transport/byte_stream.h"
 #include "test/core/end2end/cq_verifier.h"
 
diff --git a/test/core/end2end/tests/request_with_payload.cc b/test/core/end2end/tests/request_with_payload.cc
index b3b9ee5..28818c8 100644
--- a/test/core/end2end/tests/request_with_payload.cc
+++ b/test/core/end2end/tests/request_with_payload.cc
@@ -25,7 +25,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "test/core/end2end/cq_verifier.h"
 
 static void* tag(intptr_t t) { return (void*)t; }
diff --git a/test/core/end2end/tests/resource_quota_server.cc b/test/core/end2end/tests/resource_quota_server.cc
index 0ee014f..6d35d08 100644
--- a/test/core/end2end/tests/resource_quota_server.cc
+++ b/test/core/end2end/tests/resource_quota_server.cc
@@ -25,7 +25,7 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
+
 #include "test/core/end2end/cq_verifier.h"
 
 static void* tag(intptr_t t) { return (void*)t; }
diff --git a/test/core/end2end/tests/server_finishes_request.cc b/test/core/end2end/tests/server_finishes_request.cc
index 743b3ae..f135851 100644
--- a/test/core/end2end/tests/server_finishes_request.cc
+++ b/test/core/end2end/tests/server_finishes_request.cc
@@ -26,7 +26,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "src/core/lib/gpr/string.h"
 #include "test/core/end2end/cq_verifier.h"
 
diff --git a/test/core/end2end/tests/shutdown_finishes_calls.cc b/test/core/end2end/tests/shutdown_finishes_calls.cc
index fce23f3..2e19e05 100644
--- a/test/core/end2end/tests/shutdown_finishes_calls.cc
+++ b/test/core/end2end/tests/shutdown_finishes_calls.cc
@@ -25,7 +25,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "test/core/end2end/cq_verifier.h"
 
 static void* tag(intptr_t t) { return (void*)t; }
diff --git a/test/core/end2end/tests/shutdown_finishes_tags.cc b/test/core/end2end/tests/shutdown_finishes_tags.cc
index de64eba..d160647 100644
--- a/test/core/end2end/tests/shutdown_finishes_tags.cc
+++ b/test/core/end2end/tests/shutdown_finishes_tags.cc
@@ -25,7 +25,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "test/core/end2end/cq_verifier.h"
 
 static void* tag(intptr_t t) { return (void*)t; }
diff --git a/test/core/end2end/tests/simple_cacheable_request.cc b/test/core/end2end/tests/simple_cacheable_request.cc
index d8034dc..b4732ae 100644
--- a/test/core/end2end/tests/simple_cacheable_request.cc
+++ b/test/core/end2end/tests/simple_cacheable_request.cc
@@ -25,7 +25,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "test/core/end2end/cq_verifier.h"
 
 enum { TIMEOUT = 200000 };
diff --git a/test/core/end2end/tests/simple_delayed_request.cc b/test/core/end2end/tests/simple_delayed_request.cc
index 0ad224f..54517fb 100644
--- a/test/core/end2end/tests/simple_delayed_request.cc
+++ b/test/core/end2end/tests/simple_delayed_request.cc
@@ -25,7 +25,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "test/core/end2end/cq_verifier.h"
 
 static void* tag(intptr_t t) { return (void*)t; }
diff --git a/test/core/end2end/tests/simple_metadata.cc b/test/core/end2end/tests/simple_metadata.cc
index 1a74116..5911834 100644
--- a/test/core/end2end/tests/simple_metadata.cc
+++ b/test/core/end2end/tests/simple_metadata.cc
@@ -25,7 +25,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "test/core/end2end/cq_verifier.h"
 
 static void* tag(intptr_t t) { return (void*)t; }
diff --git a/test/core/end2end/tests/simple_request.cc b/test/core/end2end/tests/simple_request.cc
index ae93f79..6ec4a14 100644
--- a/test/core/end2end/tests/simple_request.cc
+++ b/test/core/end2end/tests/simple_request.cc
@@ -26,7 +26,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "src/core/lib/debug/stats.h"
 #include "src/core/lib/gpr/string.h"
 #include "test/core/end2end/cq_verifier.h"
diff --git a/test/core/end2end/tests/stream_compression_compressed_payload.cc b/test/core/end2end/tests/stream_compression_compressed_payload.cc
index 7fdea52..637b7b2 100644
--- a/test/core/end2end/tests/stream_compression_compressed_payload.cc
+++ b/test/core/end2end/tests/stream_compression_compressed_payload.cc
@@ -28,7 +28,6 @@
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/surface/call.h"
diff --git a/test/core/end2end/tests/stream_compression_payload.cc b/test/core/end2end/tests/stream_compression_payload.cc
index 9a27957..6abb3bb 100644
--- a/test/core/end2end/tests/stream_compression_payload.cc
+++ b/test/core/end2end/tests/stream_compression_payload.cc
@@ -26,7 +26,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/surface/call.h"
 #include "test/core/end2end/cq_verifier.h"
diff --git a/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc b/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc
index 4dc306b..8242c2c 100644
--- a/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc
+++ b/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc
@@ -26,7 +26,7 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
+
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/surface/call.h"
 #include "test/core/end2end/cq_verifier.h"
diff --git a/test/core/end2end/tests/streaming_error_response.cc b/test/core/end2end/tests/streaming_error_response.cc
index 6ad1cec..167530a 100644
--- a/test/core/end2end/tests/streaming_error_response.cc
+++ b/test/core/end2end/tests/streaming_error_response.cc
@@ -28,7 +28,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "test/core/end2end/cq_verifier.h"
 
 static void* tag(intptr_t t) { return (void*)t; }
diff --git a/test/core/end2end/tests/trailing_metadata.cc b/test/core/end2end/tests/trailing_metadata.cc
index afc56c8..150c1cb 100644
--- a/test/core/end2end/tests/trailing_metadata.cc
+++ b/test/core/end2end/tests/trailing_metadata.cc
@@ -25,7 +25,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "test/core/end2end/cq_verifier.h"
 
 static void* tag(intptr_t t) { return (void*)t; }
diff --git a/test/core/end2end/tests/workaround_cronet_compression.cc b/test/core/end2end/tests/workaround_cronet_compression.cc
index d4decce..edf03d8 100644
--- a/test/core/end2end/tests/workaround_cronet_compression.cc
+++ b/test/core/end2end/tests/workaround_cronet_compression.cc
@@ -28,7 +28,6 @@
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/surface/call.h"
diff --git a/test/core/end2end/tests/write_buffering.cc b/test/core/end2end/tests/write_buffering.cc
index 40821dd..7f3d1ab 100644
--- a/test/core/end2end/tests/write_buffering.cc
+++ b/test/core/end2end/tests/write_buffering.cc
@@ -25,7 +25,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "test/core/end2end/cq_verifier.h"
 
 static void* tag(intptr_t t) { return (void*)t; }
diff --git a/test/core/end2end/tests/write_buffering_at_end.cc b/test/core/end2end/tests/write_buffering_at_end.cc
index 1b9dc96..a1fbfef 100644
--- a/test/core/end2end/tests/write_buffering_at_end.cc
+++ b/test/core/end2end/tests/write_buffering_at_end.cc
@@ -25,7 +25,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "test/core/end2end/cq_verifier.h"
 
 static void* tag(intptr_t t) { return (void*)t; }
diff --git a/test/core/fling/client.cc b/test/core/fling/client.cc
index c623d37..92f59b7 100644
--- a/test/core/fling/client.cc
+++ b/test/core/fling/client.cc
@@ -21,11 +21,12 @@
 #include <stdio.h>
 #include <string.h>
 
-#include <grpc/support/cmdline.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
+
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/profiling/timers.h"
+#include "test/core/util/cmdline.h"
 #include "test/core/util/grpc_profiler.h"
 #include "test/core/util/histogram.h"
 #include "test/core/util/test_config.h"
diff --git a/test/core/fling/fling_stream_test.cc b/test/core/fling/fling_stream_test.cc
index b5a5ce8..d5fd7a8 100644
--- a/test/core/fling/fling_stream_test.cc
+++ b/test/core/fling/fling_stream_test.cc
@@ -20,11 +20,12 @@
 #include <string.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/subprocess.h>
+
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "test/core/util/port.h"
+#include "test/core/util/subprocess.h"
 
 int main(int argc, char** argv) {
   char* me = argv[0];
diff --git a/test/core/fling/fling_test.cc b/test/core/fling/fling_test.cc
index 3792e45..d95317b 100644
--- a/test/core/fling/fling_test.cc
+++ b/test/core/fling/fling_test.cc
@@ -20,11 +20,12 @@
 #include <string.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/subprocess.h>
+
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "test/core/util/port.h"
+#include "test/core/util/subprocess.h"
 
 int main(int argc, const char** argv) {
   const char* me = argv[0];
diff --git a/test/core/fling/server.cc b/test/core/fling/server.cc
index f3a8a1c..b19a25a 100644
--- a/test/core/fling/server.cc
+++ b/test/core/fling/server.cc
@@ -30,12 +30,13 @@
 #endif
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/cmdline.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
+
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/profiling/timers.h"
 #include "test/core/end2end/data/ssl_test_data.h"
+#include "test/core/util/cmdline.h"
 #include "test/core/util/grpc_profiler.h"
 #include "test/core/util/port.h"
 #include "test/core/util/test_config.h"
diff --git a/test/core/gpr/BUILD b/test/core/gpr/BUILD
index 1be1036..9aa74cc 100644
--- a/test/core/gpr/BUILD
+++ b/test/core/gpr/BUILD
@@ -29,26 +29,6 @@
 )
 
 grpc_cc_test(
-    name = "avl_test",
-    srcs = ["avl_test.cc"],
-    language = "C++",
-    deps = [
-        "//:gpr",
-        "//test/core/util:gpr_test_util",
-    ],
-)
-
-grpc_cc_test(
-    name = "cmdline_test",
-    srcs = ["cmdline_test.cc"],
-    language = "C++",
-    deps = [
-        "//:gpr",
-        "//test/core/util:gpr_test_util",
-    ],
-)
-
-grpc_cc_test(
     name = "cpu_test",
     srcs = ["cpu_test.cc"],
     language = "C++",
diff --git a/test/core/gpr/arena_test.cc b/test/core/gpr/arena_test.cc
index 62a3f8b..087a800 100644
--- a/test/core/gpr/arena_test.cc
+++ b/test/core/gpr/arena_test.cc
@@ -23,11 +23,11 @@
 #include <grpc/support/string_util.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/useful.h>
 #include <inttypes.h>
 #include <string.h>
 
 #include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gpr/useful.h"
 #include "test/core/util/test_config.h"
 
 static void test_noop(void) { gpr_arena_destroy(gpr_arena_create(1)); }
diff --git a/test/core/gpr/avl_test.cc b/test/core/gpr/avl_test.cc
deleted file mode 100644
index 345db55..0000000
--- a/test/core/gpr/avl_test.cc
+++ /dev/null
@@ -1,3659 +0,0 @@
-/*
- *
- * Copyright 2015 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <grpc/support/avl.h>
-
-#include <stdio.h>
-#include <string.h>
-
-#include <grpc/support/alloc.h>
-#include <grpc/support/log.h>
-#include <grpc/support/useful.h>
-
-#include "test/core/util/test_config.h"
-
-static int* box(int x) {
-  int* b = static_cast<int*>(gpr_malloc(sizeof(*b)));
-  *b = x;
-  return b;
-}
-
-static long int_compare(void* int1, void* int2, void* unused) {
-  return (*(int*)int1) - (*(int*)int2);
-}
-static void* int_copy(void* p, void* unused) { return box(*(int*)p); }
-
-static void destroy(void* p, void* unused) { gpr_free(p); }
-
-static const gpr_avl_vtable int_int_vtable = {destroy, int_copy, int_compare,
-                                              destroy, int_copy};
-
-static void check_get(gpr_avl avl, int key, int value) {
-  int* k = box(key);
-  GPR_ASSERT(*(int*)gpr_avl_get(avl, k, nullptr) == value);
-  gpr_free(k);
-}
-
-static void check_negget(gpr_avl avl, int key) {
-  int* k = box(key);
-  GPR_ASSERT(gpr_avl_get(avl, k, nullptr) == nullptr);
-  gpr_free(k);
-}
-
-static gpr_avl remove_int(gpr_avl avl, int key) {
-  int* k = box(key);
-  avl = gpr_avl_remove(avl, k, nullptr);
-  gpr_free(k);
-  return avl;
-}
-
-static void test_get(void) {
-  gpr_avl avl;
-  gpr_log(GPR_DEBUG, "test_get");
-  avl = gpr_avl_create(&int_int_vtable);
-  avl = gpr_avl_add(avl, box(1), box(11), nullptr);
-  avl = gpr_avl_add(avl, box(2), box(22), nullptr);
-  avl = gpr_avl_add(avl, box(3), box(33), nullptr);
-  check_get(avl, 1, 11);
-  check_get(avl, 2, 22);
-  check_get(avl, 3, 33);
-  check_negget(avl, 4);
-  gpr_avl_unref(avl, nullptr);
-}
-
-static void test_ll(void) {
-  gpr_avl avl;
-  gpr_log(GPR_DEBUG, "test_ll");
-  avl = gpr_avl_create(&int_int_vtable);
-  avl = gpr_avl_add(avl, box(5), box(1), nullptr);
-  avl = gpr_avl_add(avl, box(4), box(2), nullptr);
-  avl = gpr_avl_add(avl, box(3), box(3), nullptr);
-  GPR_ASSERT(*(int*)avl.root->key == 4);
-  GPR_ASSERT(*(int*)avl.root->left->key == 3);
-  GPR_ASSERT(*(int*)avl.root->right->key == 5);
-  gpr_avl_unref(avl, nullptr);
-}
-
-static void test_lr(void) {
-  gpr_avl avl;
-  gpr_log(GPR_DEBUG, "test_lr");
-  avl = gpr_avl_create(&int_int_vtable);
-  avl = gpr_avl_add(avl, box(5), box(1), nullptr);
-  avl = gpr_avl_add(avl, box(3), box(2), nullptr);
-  avl = gpr_avl_add(avl, box(4), box(3), nullptr);
-  GPR_ASSERT(*(int*)avl.root->key == 4);
-  GPR_ASSERT(*(int*)avl.root->left->key == 3);
-  GPR_ASSERT(*(int*)avl.root->right->key == 5);
-  gpr_avl_unref(avl, nullptr);
-}
-
-static void test_rr(void) {
-  gpr_avl avl;
-  gpr_log(GPR_DEBUG, "test_rr");
-  avl = gpr_avl_create(&int_int_vtable);
-  avl = gpr_avl_add(avl, box(3), box(1), nullptr);
-  avl = gpr_avl_add(avl, box(4), box(2), nullptr);
-  avl = gpr_avl_add(avl, box(5), box(3), nullptr);
-  GPR_ASSERT(*(int*)avl.root->key == 4);
-  GPR_ASSERT(*(int*)avl.root->left->key == 3);
-  GPR_ASSERT(*(int*)avl.root->right->key == 5);
-  gpr_avl_unref(avl, nullptr);
-}
-
-static void test_rl(void) {
-  gpr_avl avl;
-  gpr_log(GPR_DEBUG, "test_rl");
-  avl = gpr_avl_create(&int_int_vtable);
-  avl = gpr_avl_add(avl, box(3), box(1), nullptr);
-  avl = gpr_avl_add(avl, box(5), box(2), nullptr);
-  avl = gpr_avl_add(avl, box(4), box(3), nullptr);
-  GPR_ASSERT(*(int*)avl.root->key == 4);
-  GPR_ASSERT(*(int*)avl.root->left->key == 3);
-  GPR_ASSERT(*(int*)avl.root->right->key == 5);
-  gpr_avl_unref(avl, nullptr);
-}
-
-static void test_unbalanced(void) {
-  gpr_avl avl;
-  gpr_log(GPR_DEBUG, "test_unbalanced");
-  avl = gpr_avl_create(&int_int_vtable);
-  avl = gpr_avl_add(avl, box(5), box(1), nullptr);
-  avl = gpr_avl_add(avl, box(4), box(2), nullptr);
-  avl = gpr_avl_add(avl, box(3), box(3), nullptr);
-  avl = gpr_avl_add(avl, box(2), box(4), nullptr);
-  avl = gpr_avl_add(avl, box(1), box(5), nullptr);
-  GPR_ASSERT(*(int*)avl.root->key == 4);
-  GPR_ASSERT(*(int*)avl.root->left->key == 2);
-  GPR_ASSERT(*(int*)avl.root->left->left->key == 1);
-  GPR_ASSERT(*(int*)avl.root->left->right->key == 3);
-  GPR_ASSERT(*(int*)avl.root->right->key == 5);
-  gpr_avl_unref(avl, nullptr);
-}
-
-static void test_replace(void) {
-  gpr_avl avl;
-  gpr_log(GPR_DEBUG, "test_replace");
-  avl = gpr_avl_create(&int_int_vtable);
-  avl = gpr_avl_add(avl, box(1), box(1), nullptr);
-  avl = gpr_avl_add(avl, box(1), box(2), nullptr);
-  check_get(avl, 1, 2);
-  check_negget(avl, 2);
-  gpr_avl_unref(avl, nullptr);
-}
-
-static void test_remove(void) {
-  gpr_avl avl;
-  gpr_avl avl3, avl4, avl5, avln;
-  gpr_log(GPR_DEBUG, "test_remove");
-  avl = gpr_avl_create(&int_int_vtable);
-  avl = gpr_avl_add(avl, box(3), box(1), nullptr);
-  avl = gpr_avl_add(avl, box(4), box(2), nullptr);
-  avl = gpr_avl_add(avl, box(5), box(3), nullptr);
-
-  avl3 = remove_int(gpr_avl_ref(avl, nullptr), 3);
-  avl4 = remove_int(gpr_avl_ref(avl, nullptr), 4);
-  avl5 = remove_int(gpr_avl_ref(avl, nullptr), 5);
-  avln = remove_int(gpr_avl_ref(avl, nullptr), 1);
-
-  gpr_avl_unref(avl, nullptr);
-
-  check_negget(avl3, 3);
-  check_get(avl3, 4, 2);
-  check_get(avl3, 5, 3);
-  gpr_avl_unref(avl3, nullptr);
-
-  check_get(avl4, 3, 1);
-  check_negget(avl4, 4);
-  check_get(avl4, 5, 3);
-  gpr_avl_unref(avl4, nullptr);
-
-  check_get(avl5, 3, 1);
-  check_get(avl5, 4, 2);
-  check_negget(avl5, 5);
-  gpr_avl_unref(avl5, nullptr);
-
-  check_get(avln, 3, 1);
-  check_get(avln, 4, 2);
-  check_get(avln, 5, 3);
-  gpr_avl_unref(avln, nullptr);
-}
-
-static void test_badcase1(void) {
-  gpr_avl avl;
-
-  gpr_log(GPR_DEBUG, "test_badcase1");
-
-  avl = gpr_avl_create(&int_int_vtable);
-  avl = gpr_avl_add(avl, box(88), box(1), nullptr);
-  avl = remove_int(avl, 643);
-  avl = remove_int(avl, 983);
-  avl = gpr_avl_add(avl, box(985), box(4), nullptr);
-  avl = gpr_avl_add(avl, box(640), box(5), nullptr);
-  avl = gpr_avl_add(avl, box(41), box(6), nullptr);
-  avl = gpr_avl_add(avl, box(112), box(7), nullptr);
-  avl = gpr_avl_add(avl, box(342), box(8), nullptr);
-  avl = remove_int(avl, 1013);
-  avl = gpr_avl_add(avl, box(434), box(10), nullptr);
-  avl = gpr_avl_add(avl, box(520), box(11), nullptr);
-  avl = gpr_avl_add(avl, box(231), box(12), nullptr);
-  avl = gpr_avl_add(avl, box(852), box(13), nullptr);
-  avl = remove_int(avl, 461);
-  avl = gpr_avl_add(avl, box(108), box(15), nullptr);
-  avl = gpr_avl_add(avl, box(806), box(16), nullptr);
-  avl = gpr_avl_add(avl, box(827), box(17), nullptr);
-  avl = remove_int(avl, 796);
-  avl = gpr_avl_add(avl, box(340), box(19), nullptr);
-  avl = gpr_avl_add(avl, box(498), box(20), nullptr);
-  avl = gpr_avl_add(avl, box(203), box(21), nullptr);
-  avl = gpr_avl_add(avl, box(751), box(22), nullptr);
-  avl = gpr_avl_add(avl, box(150), box(23), nullptr);
-  avl = remove_int(avl, 237);
-  avl = gpr_avl_add(avl, box(830), box(25), nullptr);
-  avl = remove_int(avl, 1007);
-  avl = remove_int(avl, 394);
-  avl = gpr_avl_add(avl, box(65), box(28), nullptr);
-  avl = remove_int(avl, 904);
-  avl = remove_int(avl, 123);
-  avl = gpr_avl_add(avl, box(238), box(31), nullptr);
-  avl = gpr_avl_add(avl, box(184), box(32), nullptr);
-  avl = remove_int(avl, 331);
-  avl = gpr_avl_add(avl, box(827), box(34), nullptr);
-
-  check_get(avl, 830, 25);
-
-  gpr_avl_unref(avl, nullptr);
-}
-
-static void test_badcase2(void) {
-  gpr_avl avl;
-
-  gpr_log(GPR_DEBUG, "test_badcase2");
-
-  avl = gpr_avl_create(&int_int_vtable);
-  avl = gpr_avl_add(avl, box(288), box(1), nullptr);
-  avl = remove_int(avl, 415);
-  avl = gpr_avl_add(avl, box(953), box(3), nullptr);
-  avl = gpr_avl_add(avl, box(101), box(4), nullptr);
-  avl = gpr_avl_add(avl, box(516), box(5), nullptr);
-  avl = gpr_avl_add(avl, box(547), box(6), nullptr);
-  avl = gpr_avl_add(avl, box(467), box(7), nullptr);
-  avl = gpr_avl_add(avl, box(793), box(8), nullptr);
-  avl = remove_int(avl, 190);
-  avl = gpr_avl_add(avl, box(687), box(10), nullptr);
-  avl = gpr_avl_add(avl, box(242), box(11), nullptr);
-  avl = gpr_avl_add(avl, box(142), box(12), nullptr);
-  avl = remove_int(avl, 705);
-  avl = remove_int(avl, 578);
-  avl = remove_int(avl, 767);
-  avl = remove_int(avl, 183);
-  avl = gpr_avl_add(avl, box(950), box(17), nullptr);
-  avl = gpr_avl_add(avl, box(622), box(18), nullptr);
-  avl = remove_int(avl, 513);
-  avl = remove_int(avl, 429);
-  avl = gpr_avl_add(avl, box(205), box(21), nullptr);
-  avl = remove_int(avl, 663);
-  avl = remove_int(avl, 953);
-  avl = remove_int(avl, 892);
-  avl = gpr_avl_add(avl, box(236), box(25), nullptr);
-  avl = remove_int(avl, 982);
-  avl = remove_int(avl, 201);
-  avl = remove_int(avl, 684);
-  avl = gpr_avl_add(avl, box(572), box(29), nullptr);
-  avl = remove_int(avl, 817);
-  avl = gpr_avl_add(avl, box(970), box(31), nullptr);
-  avl = remove_int(avl, 347);
-  avl = remove_int(avl, 574);
-  avl = gpr_avl_add(avl, box(752), box(34), nullptr);
-  avl = gpr_avl_add(avl, box(670), box(35), nullptr);
-  avl = gpr_avl_add(avl, box(69), box(36), nullptr);
-  avl = remove_int(avl, 111);
-  avl = remove_int(avl, 523);
-  avl = gpr_avl_add(avl, box(141), box(39), nullptr);
-  avl = remove_int(avl, 159);
-  avl = gpr_avl_add(avl, box(947), box(41), nullptr);
-  avl = gpr_avl_add(avl, box(855), box(42), nullptr);
-  avl = remove_int(avl, 218);
-  avl = remove_int(avl, 6);
-  avl = gpr_avl_add(avl, box(753), box(45), nullptr);
-  avl = remove_int(avl, 82);
-  avl = remove_int(avl, 799);
-  avl = gpr_avl_add(avl, box(572), box(48), nullptr);
-  avl = remove_int(avl, 376);
-  avl = remove_int(avl, 413);
-  avl = gpr_avl_add(avl, box(458), box(51), nullptr);
-  avl = remove_int(avl, 897);
-  avl = gpr_avl_add(avl, box(191), box(53), nullptr);
-  avl = gpr_avl_add(avl, box(609), box(54), nullptr);
-  avl = remove_int(avl, 787);
-  avl = remove_int(avl, 710);
-  avl = remove_int(avl, 886);
-  avl = remove_int(avl, 835);
-  avl = remove_int(avl, 33);
-  avl = gpr_avl_add(avl, box(871), box(60), nullptr);
-  avl = remove_int(avl, 641);
-  avl = gpr_avl_add(avl, box(462), box(62), nullptr);
-  avl = remove_int(avl, 359);
-  avl = remove_int(avl, 767);
-  avl = gpr_avl_add(avl, box(310), box(65), nullptr);
-  avl = remove_int(avl, 757);
-  avl = remove_int(avl, 639);
-  avl = remove_int(avl, 314);
-  avl = gpr_avl_add(avl, box(2), box(69), nullptr);
-  avl = remove_int(avl, 138);
-  avl = gpr_avl_add(avl, box(669), box(71), nullptr);
-  avl = remove_int(avl, 477);
-  avl = gpr_avl_add(avl, box(366), box(73), nullptr);
-  avl = gpr_avl_add(avl, box(612), box(74), nullptr);
-  avl = gpr_avl_add(avl, box(106), box(75), nullptr);
-  avl = remove_int(avl, 161);
-  avl = gpr_avl_add(avl, box(388), box(77), nullptr);
-  avl = gpr_avl_add(avl, box(141), box(78), nullptr);
-  avl = remove_int(avl, 633);
-  avl = remove_int(avl, 459);
-  avl = gpr_avl_add(avl, box(40), box(81), nullptr);
-  avl = remove_int(avl, 689);
-  avl = gpr_avl_add(avl, box(823), box(83), nullptr);
-  avl = remove_int(avl, 485);
-  avl = gpr_avl_add(avl, box(903), box(85), nullptr);
-  avl = gpr_avl_add(avl, box(592), box(86), nullptr);
-  avl = remove_int(avl, 448);
-  avl = gpr_avl_add(avl, box(56), box(88), nullptr);
-  avl = remove_int(avl, 333);
-  avl = gpr_avl_add(avl, box(189), box(90), nullptr);
-  avl = gpr_avl_add(avl, box(103), box(91), nullptr);
-  avl = remove_int(avl, 164);
-  avl = remove_int(avl, 974);
-  avl = gpr_avl_add(avl, box(215), box(94), nullptr);
-  avl = remove_int(avl, 189);
-  avl = remove_int(avl, 504);
-  avl = gpr_avl_add(avl, box(868), box(97), nullptr);
-  avl = remove_int(avl, 909);
-  avl = remove_int(avl, 148);
-  avl = remove_int(avl, 469);
-  avl = gpr_avl_add(avl, box(994), box(101), nullptr);
-  avl = gpr_avl_add(avl, box(576), box(102), nullptr);
-  avl = remove_int(avl, 82);
-  avl = remove_int(avl, 209);
-  avl = gpr_avl_add(avl, box(276), box(105), nullptr);
-  avl = remove_int(avl, 856);
-  avl = gpr_avl_add(avl, box(750), box(107), nullptr);
-  avl = remove_int(avl, 871);
-  avl = gpr_avl_add(avl, box(301), box(109), nullptr);
-  avl = remove_int(avl, 260);
-  avl = remove_int(avl, 737);
-  avl = remove_int(avl, 719);
-  avl = gpr_avl_add(avl, box(933), box(113), nullptr);
-  avl = gpr_avl_add(avl, box(225), box(114), nullptr);
-  avl = gpr_avl_add(avl, box(975), box(115), nullptr);
-  avl = gpr_avl_add(avl, box(86), box(116), nullptr);
-  avl = remove_int(avl, 732);
-  avl = gpr_avl_add(avl, box(340), box(118), nullptr);
-  avl = gpr_avl_add(avl, box(271), box(119), nullptr);
-  avl = remove_int(avl, 206);
-  avl = gpr_avl_add(avl, box(949), box(121), nullptr);
-  avl = gpr_avl_add(avl, box(927), box(122), nullptr);
-  avl = gpr_avl_add(avl, box(34), box(123), nullptr);
-  avl = gpr_avl_add(avl, box(351), box(124), nullptr);
-  avl = remove_int(avl, 836);
-  avl = gpr_avl_add(avl, box(825), box(126), nullptr);
-  avl = gpr_avl_add(avl, box(352), box(127), nullptr);
-  avl = remove_int(avl, 107);
-  avl = remove_int(avl, 101);
-  avl = gpr_avl_add(avl, box(320), box(130), nullptr);
-  avl = gpr_avl_add(avl, box(3), box(131), nullptr);
-  avl = remove_int(avl, 998);
-  avl = remove_int(avl, 44);
-  avl = gpr_avl_add(avl, box(525), box(134), nullptr);
-  avl = gpr_avl_add(avl, box(864), box(135), nullptr);
-  avl = gpr_avl_add(avl, box(863), box(136), nullptr);
-  avl = remove_int(avl, 770);
-  avl = gpr_avl_add(avl, box(440), box(138), nullptr);
-  avl = remove_int(avl, 516);
-  avl = gpr_avl_add(avl, box(116), box(140), nullptr);
-  avl = remove_int(avl, 380);
-  avl = gpr_avl_add(avl, box(878), box(142), nullptr);
-  avl = remove_int(avl, 439);
-  avl = gpr_avl_add(avl, box(994), box(144), nullptr);
-  avl = remove_int(avl, 294);
-  avl = remove_int(avl, 593);
-  avl = gpr_avl_add(avl, box(696), box(147), nullptr);
-  avl = remove_int(avl, 8);
-  avl = gpr_avl_add(avl, box(881), box(149), nullptr);
-  avl = remove_int(avl, 32);
-  avl = remove_int(avl, 242);
-  avl = gpr_avl_add(avl, box(487), box(152), nullptr);
-  avl = gpr_avl_add(avl, box(637), box(153), nullptr);
-  avl = gpr_avl_add(avl, box(793), box(154), nullptr);
-  avl = gpr_avl_add(avl, box(696), box(155), nullptr);
-  avl = remove_int(avl, 458);
-  avl = gpr_avl_add(avl, box(828), box(157), nullptr);
-  avl = remove_int(avl, 784);
-  avl = remove_int(avl, 274);
-  avl = gpr_avl_add(avl, box(783), box(160), nullptr);
-  avl = remove_int(avl, 21);
-  avl = gpr_avl_add(avl, box(866), box(162), nullptr);
-  avl = remove_int(avl, 919);
-  avl = gpr_avl_add(avl, box(435), box(164), nullptr);
-  avl = remove_int(avl, 385);
-  avl = gpr_avl_add(avl, box(475), box(166), nullptr);
-  avl = remove_int(avl, 339);
-  avl = gpr_avl_add(avl, box(615), box(168), nullptr);
-  avl = remove_int(avl, 866);
-  avl = remove_int(avl, 82);
-  avl = remove_int(avl, 271);
-  avl = gpr_avl_add(avl, box(590), box(172), nullptr);
-  avl = gpr_avl_add(avl, box(852), box(173), nullptr);
-  avl = remove_int(avl, 318);
-  avl = remove_int(avl, 82);
-  avl = gpr_avl_add(avl, box(672), box(176), nullptr);
-  avl = remove_int(avl, 430);
-  avl = gpr_avl_add(avl, box(821), box(178), nullptr);
-  avl = gpr_avl_add(avl, box(365), box(179), nullptr);
-  avl = remove_int(avl, 78);
-  avl = gpr_avl_add(avl, box(700), box(181), nullptr);
-  avl = gpr_avl_add(avl, box(353), box(182), nullptr);
-  avl = remove_int(avl, 492);
-  avl = gpr_avl_add(avl, box(991), box(184), nullptr);
-  avl = remove_int(avl, 330);
-  avl = gpr_avl_add(avl, box(873), box(186), nullptr);
-  avl = remove_int(avl, 589);
-  avl = gpr_avl_add(avl, box(676), box(188), nullptr);
-  avl = gpr_avl_add(avl, box(790), box(189), nullptr);
-  avl = remove_int(avl, 521);
-  avl = remove_int(avl, 47);
-  avl = gpr_avl_add(avl, box(976), box(192), nullptr);
-  avl = gpr_avl_add(avl, box(683), box(193), nullptr);
-  avl = remove_int(avl, 803);
-  avl = remove_int(avl, 1006);
-  avl = gpr_avl_add(avl, box(775), box(196), nullptr);
-  avl = gpr_avl_add(avl, box(411), box(197), nullptr);
-  avl = gpr_avl_add(avl, box(697), box(198), nullptr);
-  avl = remove_int(avl, 50);
-  avl = gpr_avl_add(avl, box(213), box(200), nullptr);
-  avl = remove_int(avl, 714);
-  avl = gpr_avl_add(avl, box(981), box(202), nullptr);
-  avl = gpr_avl_add(avl, box(502), box(203), nullptr);
-  avl = gpr_avl_add(avl, box(697), box(204), nullptr);
-  avl = gpr_avl_add(avl, box(603), box(205), nullptr);
-  avl = gpr_avl_add(avl, box(117), box(206), nullptr);
-  avl = remove_int(avl, 363);
-  avl = gpr_avl_add(avl, box(104), box(208), nullptr);
-  avl = remove_int(avl, 842);
-  avl = gpr_avl_add(avl, box(48), box(210), nullptr);
-  avl = remove_int(avl, 764);
-  avl = gpr_avl_add(avl, box(482), box(212), nullptr);
-  avl = gpr_avl_add(avl, box(928), box(213), nullptr);
-  avl = gpr_avl_add(avl, box(30), box(214), nullptr);
-  avl = gpr_avl_add(avl, box(820), box(215), nullptr);
-  avl = gpr_avl_add(avl, box(334), box(216), nullptr);
-  avl = remove_int(avl, 306);
-  avl = gpr_avl_add(avl, box(789), box(218), nullptr);
-  avl = remove_int(avl, 924);
-  avl = gpr_avl_add(avl, box(53), box(220), nullptr);
-  avl = remove_int(avl, 657);
-  avl = gpr_avl_add(avl, box(130), box(222), nullptr);
-  avl = gpr_avl_add(avl, box(239), box(223), nullptr);
-  avl = remove_int(avl, 20);
-  avl = gpr_avl_add(avl, box(117), box(225), nullptr);
-  avl = remove_int(avl, 882);
-  avl = remove_int(avl, 891);
-  avl = gpr_avl_add(avl, box(9), box(228), nullptr);
-  avl = gpr_avl_add(avl, box(496), box(229), nullptr);
-  avl = gpr_avl_add(avl, box(750), box(230), nullptr);
-  avl = gpr_avl_add(avl, box(283), box(231), nullptr);
-  avl = gpr_avl_add(avl, box(802), box(232), nullptr);
-  avl = remove_int(avl, 352);
-  avl = gpr_avl_add(avl, box(374), box(234), nullptr);
-  avl = gpr_avl_add(avl, box(6), box(235), nullptr);
-  avl = gpr_avl_add(avl, box(756), box(236), nullptr);
-  avl = gpr_avl_add(avl, box(597), box(237), nullptr);
-  avl = gpr_avl_add(avl, box(661), box(238), nullptr);
-  avl = remove_int(avl, 96);
-  avl = gpr_avl_add(avl, box(894), box(240), nullptr);
-  avl = remove_int(avl, 749);
-  avl = gpr_avl_add(avl, box(71), box(242), nullptr);
-  avl = remove_int(avl, 68);
-  avl = gpr_avl_add(avl, box(388), box(244), nullptr);
-  avl = remove_int(avl, 119);
-  avl = remove_int(avl, 856);
-  avl = gpr_avl_add(avl, box(176), box(247), nullptr);
-  avl = gpr_avl_add(avl, box(993), box(248), nullptr);
-  avl = remove_int(avl, 178);
-  avl = remove_int(avl, 781);
-  avl = remove_int(avl, 771);
-  avl = remove_int(avl, 848);
-  avl = remove_int(avl, 376);
-  avl = remove_int(avl, 157);
-  avl = remove_int(avl, 142);
-  avl = remove_int(avl, 686);
-  avl = gpr_avl_add(avl, box(779), box(257), nullptr);
-  avl = gpr_avl_add(avl, box(484), box(258), nullptr);
-  avl = remove_int(avl, 837);
-  avl = gpr_avl_add(avl, box(388), box(260), nullptr);
-  avl = remove_int(avl, 987);
-  avl = gpr_avl_add(avl, box(336), box(262), nullptr);
-  avl = remove_int(avl, 855);
-  avl = gpr_avl_add(avl, box(668), box(264), nullptr);
-  avl = remove_int(avl, 648);
-  avl = gpr_avl_add(avl, box(193), box(266), nullptr);
-  avl = remove_int(avl, 939);
-  avl = gpr_avl_add(avl, box(740), box(268), nullptr);
-  avl = gpr_avl_add(avl, box(503), box(269), nullptr);
-  avl = gpr_avl_add(avl, box(765), box(270), nullptr);
-  avl = remove_int(avl, 924);
-  avl = remove_int(avl, 513);
-  avl = gpr_avl_add(avl, box(161), box(273), nullptr);
-  avl = gpr_avl_add(avl, box(502), box(274), nullptr);
-  avl = gpr_avl_add(avl, box(846), box(275), nullptr);
-  avl = remove_int(avl, 931);
-  avl = gpr_avl_add(avl, box(87), box(277), nullptr);
-  avl = gpr_avl_add(avl, box(949), box(278), nullptr);
-  avl = gpr_avl_add(avl, box(548), box(279), nullptr);
-  avl = gpr_avl_add(avl, box(951), box(280), nullptr);
-  avl = remove_int(avl, 1018);
-  avl = remove_int(avl, 568);
-  avl = gpr_avl_add(avl, box(138), box(283), nullptr);
-  avl = gpr_avl_add(avl, box(202), box(284), nullptr);
-  avl = gpr_avl_add(avl, box(157), box(285), nullptr);
-  avl = gpr_avl_add(avl, box(264), box(286), nullptr);
-  avl = gpr_avl_add(avl, box(370), box(287), nullptr);
-  avl = remove_int(avl, 736);
-  avl = remove_int(avl, 751);
-  avl = remove_int(avl, 506);
-  avl = remove_int(avl, 81);
-  avl = remove_int(avl, 358);
-  avl = remove_int(avl, 657);
-  avl = remove_int(avl, 86);
-  avl = gpr_avl_add(avl, box(876), box(295), nullptr);
-  avl = remove_int(avl, 354);
-  avl = gpr_avl_add(avl, box(134), box(297), nullptr);
-  avl = remove_int(avl, 781);
-  avl = remove_int(avl, 183);
-  avl = gpr_avl_add(avl, box(914), box(300), nullptr);
-  avl = remove_int(avl, 926);
-  avl = remove_int(avl, 398);
-  avl = remove_int(avl, 932);
-  avl = remove_int(avl, 804);
-  avl = remove_int(avl, 326);
-  avl = gpr_avl_add(avl, box(208), box(306), nullptr);
-  avl = gpr_avl_add(avl, box(699), box(307), nullptr);
-  avl = remove_int(avl, 576);
-  avl = remove_int(avl, 850);
-  avl = remove_int(avl, 514);
-  avl = remove_int(avl, 676);
-  avl = remove_int(avl, 549);
-  avl = remove_int(avl, 767);
-  avl = gpr_avl_add(avl, box(58), box(314), nullptr);
-  avl = gpr_avl_add(avl, box(265), box(315), nullptr);
-  avl = gpr_avl_add(avl, box(268), box(316), nullptr);
-  avl = gpr_avl_add(avl, box(103), box(317), nullptr);
-  avl = gpr_avl_add(avl, box(440), box(318), nullptr);
-  avl = remove_int(avl, 777);
-  avl = gpr_avl_add(avl, box(670), box(320), nullptr);
-  avl = remove_int(avl, 506);
-  avl = remove_int(avl, 487);
-  avl = gpr_avl_add(avl, box(421), box(323), nullptr);
-  avl = remove_int(avl, 514);
-  avl = gpr_avl_add(avl, box(701), box(325), nullptr);
-  avl = remove_int(avl, 949);
-  avl = remove_int(avl, 872);
-  avl = remove_int(avl, 139);
-  avl = gpr_avl_add(avl, box(781), box(329), nullptr);
-  avl = gpr_avl_add(avl, box(543), box(330), nullptr);
-  avl = gpr_avl_add(avl, box(147), box(331), nullptr);
-  avl = remove_int(avl, 190);
-  avl = gpr_avl_add(avl, box(453), box(333), nullptr);
-  avl = remove_int(avl, 262);
-  avl = remove_int(avl, 850);
-  avl = remove_int(avl, 286);
-  avl = remove_int(avl, 787);
-  avl = gpr_avl_add(avl, box(514), box(338), nullptr);
-  avl = remove_int(avl, 812);
-  avl = gpr_avl_add(avl, box(431), box(340), nullptr);
-  avl = gpr_avl_add(avl, box(8), box(341), nullptr);
-  avl = remove_int(avl, 843);
-  avl = gpr_avl_add(avl, box(831), box(343), nullptr);
-  avl = remove_int(avl, 472);
-  avl = remove_int(avl, 157);
-  avl = gpr_avl_add(avl, box(612), box(346), nullptr);
-  avl = gpr_avl_add(avl, box(802), box(347), nullptr);
-  avl = remove_int(avl, 554);
-  avl = gpr_avl_add(avl, box(409), box(349), nullptr);
-  avl = gpr_avl_add(avl, box(439), box(350), nullptr);
-  avl = gpr_avl_add(avl, box(725), box(351), nullptr);
-  avl = gpr_avl_add(avl, box(568), box(352), nullptr);
-  avl = remove_int(avl, 475);
-  avl = remove_int(avl, 672);
-  avl = remove_int(avl, 62);
-  avl = remove_int(avl, 753);
-  avl = gpr_avl_add(avl, box(435), box(357), nullptr);
-  avl = gpr_avl_add(avl, box(950), box(358), nullptr);
-  avl = gpr_avl_add(avl, box(532), box(359), nullptr);
-  avl = gpr_avl_add(avl, box(832), box(360), nullptr);
-  avl = remove_int(avl, 390);
-  avl = gpr_avl_add(avl, box(993), box(362), nullptr);
-  avl = remove_int(avl, 198);
-  avl = remove_int(avl, 401);
-  avl = gpr_avl_add(avl, box(316), box(365), nullptr);
-  avl = remove_int(avl, 843);
-  avl = gpr_avl_add(avl, box(541), box(367), nullptr);
-  avl = gpr_avl_add(avl, box(505), box(368), nullptr);
-  avl = remove_int(avl, 445);
-  avl = remove_int(avl, 256);
-  avl = gpr_avl_add(avl, box(232), box(371), nullptr);
-  avl = remove_int(avl, 577);
-  avl = remove_int(avl, 558);
-  avl = gpr_avl_add(avl, box(910), box(374), nullptr);
-  avl = remove_int(avl, 902);
-  avl = remove_int(avl, 755);
-  avl = remove_int(avl, 114);
-  avl = remove_int(avl, 438);
-  avl = remove_int(avl, 224);
-  avl = gpr_avl_add(avl, box(920), box(380), nullptr);
-  avl = gpr_avl_add(avl, box(655), box(381), nullptr);
-  avl = remove_int(avl, 557);
-  avl = remove_int(avl, 102);
-  avl = remove_int(avl, 165);
-  avl = gpr_avl_add(avl, box(191), box(385), nullptr);
-  avl = remove_int(avl, 30);
-  avl = gpr_avl_add(avl, box(406), box(387), nullptr);
-  avl = gpr_avl_add(avl, box(66), box(388), nullptr);
-  avl = gpr_avl_add(avl, box(87), box(389), nullptr);
-  avl = remove_int(avl, 7);
-  avl = remove_int(avl, 671);
-  avl = gpr_avl_add(avl, box(234), box(392), nullptr);
-  avl = remove_int(avl, 463);
-  avl = gpr_avl_add(avl, box(75), box(394), nullptr);
-  avl = gpr_avl_add(avl, box(487), box(395), nullptr);
-  avl = remove_int(avl, 203);
-  avl = gpr_avl_add(avl, box(711), box(397), nullptr);
-  avl = remove_int(avl, 291);
-  avl = remove_int(avl, 798);
-  avl = remove_int(avl, 337);
-  avl = gpr_avl_add(avl, box(877), box(401), nullptr);
-  avl = gpr_avl_add(avl, box(388), box(402), nullptr);
-  avl = remove_int(avl, 975);
-  avl = gpr_avl_add(avl, box(200), box(404), nullptr);
-  avl = gpr_avl_add(avl, box(408), box(405), nullptr);
-  avl = gpr_avl_add(avl, box(3), box(406), nullptr);
-  avl = gpr_avl_add(avl, box(971), box(407), nullptr);
-  avl = remove_int(avl, 841);
-  avl = remove_int(avl, 910);
-  avl = remove_int(avl, 74);
-  avl = remove_int(avl, 888);
-  avl = gpr_avl_add(avl, box(492), box(412), nullptr);
-  avl = remove_int(avl, 14);
-  avl = remove_int(avl, 364);
-  avl = gpr_avl_add(avl, box(215), box(415), nullptr);
-  avl = remove_int(avl, 778);
-  avl = remove_int(avl, 45);
-  avl = gpr_avl_add(avl, box(328), box(418), nullptr);
-  avl = gpr_avl_add(avl, box(597), box(419), nullptr);
-  avl = remove_int(avl, 34);
-  avl = gpr_avl_add(avl, box(736), box(421), nullptr);
-  avl = remove_int(avl, 37);
-  avl = gpr_avl_add(avl, box(275), box(423), nullptr);
-  avl = gpr_avl_add(avl, box(70), box(424), nullptr);
-  avl = gpr_avl_add(avl, box(771), box(425), nullptr);
-  avl = remove_int(avl, 536);
-  avl = remove_int(avl, 421);
-  avl = gpr_avl_add(avl, box(186), box(428), nullptr);
-  avl = gpr_avl_add(avl, box(788), box(429), nullptr);
-  avl = gpr_avl_add(avl, box(224), box(430), nullptr);
-  avl = remove_int(avl, 228);
-  avl = gpr_avl_add(avl, box(48), box(432), nullptr);
-  avl = gpr_avl_add(avl, box(120), box(433), nullptr);
-  avl = gpr_avl_add(avl, box(269), box(434), nullptr);
-  avl = gpr_avl_add(avl, box(904), box(435), nullptr);
-  avl = remove_int(avl, 699);
-  avl = gpr_avl_add(avl, box(340), box(437), nullptr);
-  avl = remove_int(avl, 276);
-  avl = gpr_avl_add(avl, box(591), box(439), nullptr);
-  avl = gpr_avl_add(avl, box(778), box(440), nullptr);
-  avl = remove_int(avl, 490);
-  avl = remove_int(avl, 973);
-  avl = gpr_avl_add(avl, box(294), box(443), nullptr);
-  avl = gpr_avl_add(avl, box(323), box(444), nullptr);
-  avl = remove_int(avl, 685);
-  avl = gpr_avl_add(avl, box(38), box(446), nullptr);
-  avl = gpr_avl_add(avl, box(525), box(447), nullptr);
-  avl = remove_int(avl, 162);
-  avl = gpr_avl_add(avl, box(462), box(449), nullptr);
-  avl = gpr_avl_add(avl, box(340), box(450), nullptr);
-  avl = remove_int(avl, 734);
-  avl = remove_int(avl, 959);
-  avl = gpr_avl_add(avl, box(752), box(453), nullptr);
-  avl = gpr_avl_add(avl, box(667), box(454), nullptr);
-  avl = remove_int(avl, 558);
-  avl = remove_int(avl, 657);
-  avl = gpr_avl_add(avl, box(711), box(457), nullptr);
-  avl = remove_int(avl, 937);
-  avl = gpr_avl_add(avl, box(741), box(459), nullptr);
-  avl = gpr_avl_add(avl, box(40), box(460), nullptr);
-  avl = remove_int(avl, 784);
-  avl = gpr_avl_add(avl, box(292), box(462), nullptr);
-  avl = remove_int(avl, 164);
-  avl = remove_int(avl, 931);
-  avl = remove_int(avl, 886);
-  avl = gpr_avl_add(avl, box(968), box(466), nullptr);
-  avl = remove_int(avl, 263);
-  avl = gpr_avl_add(avl, box(647), box(468), nullptr);
-  avl = gpr_avl_add(avl, box(92), box(469), nullptr);
-  avl = remove_int(avl, 310);
-  avl = gpr_avl_add(avl, box(711), box(471), nullptr);
-  avl = gpr_avl_add(avl, box(675), box(472), nullptr);
-  avl = remove_int(avl, 549);
-  avl = gpr_avl_add(avl, box(380), box(474), nullptr);
-  avl = remove_int(avl, 825);
-  avl = gpr_avl_add(avl, box(668), box(476), nullptr);
-  avl = remove_int(avl, 498);
-  avl = gpr_avl_add(avl, box(870), box(478), nullptr);
-  avl = gpr_avl_add(avl, box(391), box(479), nullptr);
-  avl = gpr_avl_add(avl, box(264), box(480), nullptr);
-  avl = remove_int(avl, 1);
-  avl = remove_int(avl, 849);
-  avl = remove_int(avl, 88);
-  avl = remove_int(avl, 255);
-  avl = remove_int(avl, 763);
-  avl = remove_int(avl, 831);
-  avl = gpr_avl_add(avl, box(508), box(487), nullptr);
-  avl = remove_int(avl, 849);
-  avl = remove_int(avl, 47);
-  avl = gpr_avl_add(avl, box(299), box(490), nullptr);
-  avl = remove_int(avl, 625);
-  avl = remove_int(avl, 433);
-  avl = remove_int(avl, 904);
-  avl = remove_int(avl, 761);
-  avl = gpr_avl_add(avl, box(33), box(495), nullptr);
-  avl = gpr_avl_add(avl, box(524), box(496), nullptr);
-  avl = remove_int(avl, 210);
-  avl = remove_int(avl, 299);
-  avl = gpr_avl_add(avl, box(823), box(499), nullptr);
-  avl = remove_int(avl, 479);
-  avl = remove_int(avl, 96);
-  avl = remove_int(avl, 1013);
-  avl = gpr_avl_add(avl, box(768), box(503), nullptr);
-  avl = remove_int(avl, 638);
-  avl = remove_int(avl, 20);
-  avl = gpr_avl_add(avl, box(663), box(506), nullptr);
-  avl = remove_int(avl, 882);
-  avl = gpr_avl_add(avl, box(745), box(508), nullptr);
-  avl = remove_int(avl, 352);
-  avl = gpr_avl_add(avl, box(10), box(510), nullptr);
-  avl = remove_int(avl, 484);
-  avl = gpr_avl_add(avl, box(420), box(512), nullptr);
-  avl = gpr_avl_add(avl, box(884), box(513), nullptr);
-  avl = gpr_avl_add(avl, box(993), box(514), nullptr);
-  avl = gpr_avl_add(avl, box(251), box(515), nullptr);
-  avl = remove_int(avl, 222);
-  avl = gpr_avl_add(avl, box(734), box(517), nullptr);
-  avl = gpr_avl_add(avl, box(952), box(518), nullptr);
-  avl = remove_int(avl, 26);
-  avl = remove_int(avl, 270);
-  avl = remove_int(avl, 481);
-  avl = remove_int(avl, 693);
-  avl = remove_int(avl, 1006);
-  avl = gpr_avl_add(avl, box(77), box(524), nullptr);
-  avl = remove_int(avl, 897);
-  avl = gpr_avl_add(avl, box(719), box(526), nullptr);
-  avl = gpr_avl_add(avl, box(622), box(527), nullptr);
-  avl = remove_int(avl, 28);
-  avl = remove_int(avl, 836);
-  avl = remove_int(avl, 142);
-  avl = gpr_avl_add(avl, box(445), box(531), nullptr);
-  avl = gpr_avl_add(avl, box(410), box(532), nullptr);
-  avl = remove_int(avl, 575);
-  avl = gpr_avl_add(avl, box(634), box(534), nullptr);
-  avl = gpr_avl_add(avl, box(906), box(535), nullptr);
-  avl = remove_int(avl, 649);
-  avl = gpr_avl_add(avl, box(813), box(537), nullptr);
-  avl = remove_int(avl, 702);
-  avl = remove_int(avl, 732);
-  avl = gpr_avl_add(avl, box(105), box(540), nullptr);
-  avl = gpr_avl_add(avl, box(867), box(541), nullptr);
-  avl = remove_int(avl, 964);
-  avl = remove_int(avl, 941);
-  avl = gpr_avl_add(avl, box(947), box(544), nullptr);
-  avl = remove_int(avl, 990);
-  avl = gpr_avl_add(avl, box(816), box(546), nullptr);
-  avl = remove_int(avl, 429);
-  avl = remove_int(avl, 567);
-  avl = remove_int(avl, 541);
-  avl = remove_int(avl, 583);
-  avl = gpr_avl_add(avl, box(57), box(551), nullptr);
-  avl = gpr_avl_add(avl, box(786), box(552), nullptr);
-  avl = gpr_avl_add(avl, box(526), box(553), nullptr);
-  avl = remove_int(avl, 642);
-  avl = remove_int(avl, 220);
-  avl = remove_int(avl, 840);
-  avl = remove_int(avl, 548);
-  avl = gpr_avl_add(avl, box(528), box(558), nullptr);
-  avl = gpr_avl_add(avl, box(749), box(559), nullptr);
-  avl = gpr_avl_add(avl, box(194), box(560), nullptr);
-  avl = remove_int(avl, 517);
-  avl = gpr_avl_add(avl, box(102), box(562), nullptr);
-  avl = remove_int(avl, 189);
-  avl = gpr_avl_add(avl, box(927), box(564), nullptr);
-  avl = remove_int(avl, 846);
-  avl = remove_int(avl, 130);
-  avl = gpr_avl_add(avl, box(694), box(567), nullptr);
-  avl = remove_int(avl, 750);
-  avl = gpr_avl_add(avl, box(357), box(569), nullptr);
-  avl = remove_int(avl, 431);
-  avl = remove_int(avl, 91);
-  avl = gpr_avl_add(avl, box(640), box(572), nullptr);
-  avl = remove_int(avl, 4);
-  avl = gpr_avl_add(avl, box(81), box(574), nullptr);
-  avl = gpr_avl_add(avl, box(595), box(575), nullptr);
-  avl = remove_int(avl, 444);
-  avl = remove_int(avl, 262);
-  avl = remove_int(avl, 11);
-  avl = gpr_avl_add(avl, box(192), box(579), nullptr);
-  avl = gpr_avl_add(avl, box(158), box(580), nullptr);
-  avl = remove_int(avl, 401);
-  avl = remove_int(avl, 918);
-  avl = gpr_avl_add(avl, box(180), box(583), nullptr);
-  avl = remove_int(avl, 268);
-  avl = gpr_avl_add(avl, box(1012), box(585), nullptr);
-  avl = gpr_avl_add(avl, box(90), box(586), nullptr);
-  avl = gpr_avl_add(avl, box(946), box(587), nullptr);
-  avl = remove_int(avl, 719);
-  avl = gpr_avl_add(avl, box(874), box(589), nullptr);
-  avl = gpr_avl_add(avl, box(679), box(590), nullptr);
-  avl = remove_int(avl, 53);
-  avl = remove_int(avl, 534);
-  avl = gpr_avl_add(avl, box(646), box(593), nullptr);
-  avl = gpr_avl_add(avl, box(767), box(594), nullptr);
-  avl = gpr_avl_add(avl, box(460), box(595), nullptr);
-  avl = gpr_avl_add(avl, box(852), box(596), nullptr);
-  avl = gpr_avl_add(avl, box(189), box(597), nullptr);
-  avl = remove_int(avl, 932);
-  avl = remove_int(avl, 366);
-  avl = remove_int(avl, 907);
-  avl = gpr_avl_add(avl, box(875), box(601), nullptr);
-  avl = gpr_avl_add(avl, box(434), box(602), nullptr);
-  avl = gpr_avl_add(avl, box(704), box(603), nullptr);
-  avl = gpr_avl_add(avl, box(724), box(604), nullptr);
-  avl = gpr_avl_add(avl, box(930), box(605), nullptr);
-  avl = gpr_avl_add(avl, box(1000), box(606), nullptr);
-  avl = remove_int(avl, 479);
-  avl = gpr_avl_add(avl, box(275), box(608), nullptr);
-  avl = remove_int(avl, 32);
-  avl = gpr_avl_add(avl, box(939), box(610), nullptr);
-  avl = remove_int(avl, 943);
-  avl = remove_int(avl, 329);
-  avl = gpr_avl_add(avl, box(490), box(613), nullptr);
-  avl = remove_int(avl, 477);
-  avl = remove_int(avl, 414);
-  avl = remove_int(avl, 187);
-  avl = remove_int(avl, 334);
-  avl = gpr_avl_add(avl, box(40), box(618), nullptr);
-  avl = remove_int(avl, 751);
-  avl = gpr_avl_add(avl, box(568), box(620), nullptr);
-  avl = gpr_avl_add(avl, box(120), box(621), nullptr);
-  avl = gpr_avl_add(avl, box(617), box(622), nullptr);
-  avl = gpr_avl_add(avl, box(32), box(623), nullptr);
-  avl = remove_int(avl, 701);
-  avl = gpr_avl_add(avl, box(910), box(625), nullptr);
-  avl = remove_int(avl, 557);
-  avl = remove_int(avl, 361);
-  avl = remove_int(avl, 937);
-  avl = remove_int(avl, 100);
-  avl = remove_int(avl, 684);
-  avl = gpr_avl_add(avl, box(751), box(631), nullptr);
-  avl = remove_int(avl, 781);
-  avl = remove_int(avl, 469);
-  avl = remove_int(avl, 75);
-  avl = remove_int(avl, 561);
-  avl = gpr_avl_add(avl, box(854), box(636), nullptr);
-  avl = remove_int(avl, 164);
-  avl = remove_int(avl, 258);
-  avl = remove_int(avl, 315);
-  avl = remove_int(avl, 261);
-  avl = gpr_avl_add(avl, box(552), box(641), nullptr);
-  avl = gpr_avl_add(avl, box(6), box(642), nullptr);
-  avl = gpr_avl_add(avl, box(680), box(643), nullptr);
-  avl = remove_int(avl, 741);
-  avl = remove_int(avl, 309);
-  avl = remove_int(avl, 272);
-  avl = gpr_avl_add(avl, box(249), box(647), nullptr);
-  avl = remove_int(avl, 97);
-  avl = remove_int(avl, 850);
-  avl = gpr_avl_add(avl, box(915), box(650), nullptr);
-  avl = gpr_avl_add(avl, box(816), box(651), nullptr);
-  avl = gpr_avl_add(avl, box(45), box(652), nullptr);
-  avl = gpr_avl_add(avl, box(168), box(653), nullptr);
-  avl = remove_int(avl, 153);
-  avl = remove_int(avl, 239);
-  avl = gpr_avl_add(avl, box(684), box(656), nullptr);
-  avl = gpr_avl_add(avl, box(208), box(657), nullptr);
-  avl = gpr_avl_add(avl, box(681), box(658), nullptr);
-  avl = gpr_avl_add(avl, box(609), box(659), nullptr);
-  avl = gpr_avl_add(avl, box(645), box(660), nullptr);
-  avl = remove_int(avl, 799);
-  avl = gpr_avl_add(avl, box(955), box(662), nullptr);
-  avl = gpr_avl_add(avl, box(946), box(663), nullptr);
-  avl = gpr_avl_add(avl, box(744), box(664), nullptr);
-  avl = gpr_avl_add(avl, box(201), box(665), nullptr);
-  avl = gpr_avl_add(avl, box(136), box(666), nullptr);
-  avl = remove_int(avl, 357);
-  avl = gpr_avl_add(avl, box(974), box(668), nullptr);
-  avl = remove_int(avl, 485);
-  avl = gpr_avl_add(avl, box(1009), box(670), nullptr);
-  avl = gpr_avl_add(avl, box(517), box(671), nullptr);
-  avl = remove_int(avl, 491);
-  avl = gpr_avl_add(avl, box(336), box(673), nullptr);
-  avl = gpr_avl_add(avl, box(589), box(674), nullptr);
-  avl = remove_int(avl, 546);
-  avl = remove_int(avl, 840);
-  avl = remove_int(avl, 104);
-  avl = remove_int(avl, 347);
-  avl = gpr_avl_add(avl, box(801), box(679), nullptr);
-  avl = remove_int(avl, 799);
-  avl = remove_int(avl, 702);
-  avl = remove_int(avl, 996);
-  avl = remove_int(avl, 93);
-  avl = gpr_avl_add(avl, box(561), box(684), nullptr);
-  avl = gpr_avl_add(avl, box(25), box(685), nullptr);
-  avl = remove_int(avl, 278);
-  avl = gpr_avl_add(avl, box(191), box(687), nullptr);
-  avl = remove_int(avl, 243);
-  avl = remove_int(avl, 918);
-  avl = remove_int(avl, 449);
-  avl = gpr_avl_add(avl, box(19), box(691), nullptr);
-  avl = gpr_avl_add(avl, box(762), box(692), nullptr);
-  avl = gpr_avl_add(avl, box(13), box(693), nullptr);
-  avl = gpr_avl_add(avl, box(151), box(694), nullptr);
-  avl = gpr_avl_add(avl, box(152), box(695), nullptr);
-  avl = gpr_avl_add(avl, box(793), box(696), nullptr);
-  avl = remove_int(avl, 862);
-  avl = remove_int(avl, 890);
-  avl = gpr_avl_add(avl, box(687), box(699), nullptr);
-  avl = gpr_avl_add(avl, box(509), box(700), nullptr);
-  avl = gpr_avl_add(avl, box(973), box(701), nullptr);
-  avl = remove_int(avl, 230);
-  avl = gpr_avl_add(avl, box(532), box(703), nullptr);
-  avl = remove_int(avl, 668);
-  avl = gpr_avl_add(avl, box(281), box(705), nullptr);
-  avl = gpr_avl_add(avl, box(867), box(706), nullptr);
-  avl = gpr_avl_add(avl, box(359), box(707), nullptr);
-  avl = remove_int(avl, 425);
-  avl = gpr_avl_add(avl, box(691), box(709), nullptr);
-  avl = gpr_avl_add(avl, box(163), box(710), nullptr);
-  avl = gpr_avl_add(avl, box(502), box(711), nullptr);
-  avl = remove_int(avl, 674);
-  avl = gpr_avl_add(avl, box(697), box(713), nullptr);
-  avl = remove_int(avl, 271);
-  avl = gpr_avl_add(avl, box(968), box(715), nullptr);
-  avl = gpr_avl_add(avl, box(48), box(716), nullptr);
-  avl = remove_int(avl, 543);
-  avl = gpr_avl_add(avl, box(35), box(718), nullptr);
-  avl = gpr_avl_add(avl, box(751), box(719), nullptr);
-  avl = gpr_avl_add(avl, box(478), box(720), nullptr);
-  avl = remove_int(avl, 797);
-  avl = remove_int(avl, 309);
-  avl = gpr_avl_add(avl, box(927), box(723), nullptr);
-  avl = remove_int(avl, 504);
-  avl = gpr_avl_add(avl, box(286), box(725), nullptr);
-  avl = gpr_avl_add(avl, box(413), box(726), nullptr);
-  avl = gpr_avl_add(avl, box(599), box(727), nullptr);
-  avl = remove_int(avl, 105);
-  avl = remove_int(avl, 605);
-  avl = gpr_avl_add(avl, box(632), box(730), nullptr);
-  avl = gpr_avl_add(avl, box(133), box(731), nullptr);
-  avl = remove_int(avl, 443);
-  avl = gpr_avl_add(avl, box(958), box(733), nullptr);
-  avl = gpr_avl_add(avl, box(729), box(734), nullptr);
-  avl = remove_int(avl, 158);
-  avl = gpr_avl_add(avl, box(694), box(736), nullptr);
-  avl = gpr_avl_add(avl, box(505), box(737), nullptr);
-  avl = remove_int(avl, 63);
-  avl = remove_int(avl, 714);
-  avl = gpr_avl_add(avl, box(1002), box(740), nullptr);
-  avl = remove_int(avl, 211);
-  avl = gpr_avl_add(avl, box(765), box(742), nullptr);
-  avl = gpr_avl_add(avl, box(455), box(743), nullptr);
-  avl = remove_int(avl, 59);
-  avl = remove_int(avl, 224);
-  avl = gpr_avl_add(avl, box(586), box(746), nullptr);
-  avl = gpr_avl_add(avl, box(348), box(747), nullptr);
-  avl = remove_int(avl, 10);
-  avl = remove_int(avl, 484);
-  avl = gpr_avl_add(avl, box(968), box(750), nullptr);
-  avl = gpr_avl_add(avl, box(923), box(751), nullptr);
-  avl = remove_int(avl, 573);
-  avl = remove_int(avl, 617);
-  avl = gpr_avl_add(avl, box(812), box(754), nullptr);
-  avl = gpr_avl_add(avl, box(179), box(755), nullptr);
-  avl = remove_int(avl, 284);
-  avl = remove_int(avl, 157);
-  avl = remove_int(avl, 177);
-  avl = remove_int(avl, 896);
-  avl = gpr_avl_add(avl, box(649), box(760), nullptr);
-  avl = gpr_avl_add(avl, box(927), box(761), nullptr);
-  avl = gpr_avl_add(avl, box(454), box(762), nullptr);
-  avl = gpr_avl_add(avl, box(217), box(763), nullptr);
-  avl = remove_int(avl, 534);
-  avl = gpr_avl_add(avl, box(180), box(765), nullptr);
-  avl = gpr_avl_add(avl, box(319), box(766), nullptr);
-  avl = remove_int(avl, 92);
-  avl = gpr_avl_add(avl, box(483), box(768), nullptr);
-  avl = remove_int(avl, 504);
-  avl = remove_int(avl, 1017);
-  avl = remove_int(avl, 37);
-  avl = remove_int(avl, 50);
-  avl = gpr_avl_add(avl, box(302), box(773), nullptr);
-  avl = remove_int(avl, 807);
-  avl = gpr_avl_add(avl, box(463), box(775), nullptr);
-  avl = gpr_avl_add(avl, box(271), box(776), nullptr);
-  avl = gpr_avl_add(avl, box(644), box(777), nullptr);
-  avl = remove_int(avl, 618);
-  avl = gpr_avl_add(avl, box(166), box(779), nullptr);
-  avl = gpr_avl_add(avl, box(538), box(780), nullptr);
-  avl = remove_int(avl, 606);
-  avl = gpr_avl_add(avl, box(425), box(782), nullptr);
-  avl = remove_int(avl, 725);
-  avl = remove_int(avl, 383);
-  avl = gpr_avl_add(avl, box(155), box(785), nullptr);
-  avl = remove_int(avl, 889);
-  avl = gpr_avl_add(avl, box(653), box(787), nullptr);
-  avl = remove_int(avl, 386);
-  avl = gpr_avl_add(avl, box(142), box(789), nullptr);
-  avl = remove_int(avl, 107);
-  avl = remove_int(avl, 603);
-  avl = remove_int(avl, 971);
-  avl = gpr_avl_add(avl, box(80), box(793), nullptr);
-  avl = gpr_avl_add(avl, box(61), box(794), nullptr);
-  avl = gpr_avl_add(avl, box(693), box(795), nullptr);
-  avl = gpr_avl_add(avl, box(592), box(796), nullptr);
-  avl = gpr_avl_add(avl, box(433), box(797), nullptr);
-  avl = gpr_avl_add(avl, box(973), box(798), nullptr);
-  avl = remove_int(avl, 901);
-  avl = remove_int(avl, 340);
-  avl = remove_int(avl, 709);
-  avl = gpr_avl_add(avl, box(224), box(802), nullptr);
-  avl = remove_int(avl, 120);
-  avl = remove_int(avl, 271);
-  avl = gpr_avl_add(avl, box(780), box(805), nullptr);
-  avl = gpr_avl_add(avl, box(867), box(806), nullptr);
-  avl = gpr_avl_add(avl, box(756), box(807), nullptr);
-  avl = gpr_avl_add(avl, box(583), box(808), nullptr);
-  avl = gpr_avl_add(avl, box(356), box(809), nullptr);
-  avl = gpr_avl_add(avl, box(58), box(810), nullptr);
-  avl = remove_int(avl, 219);
-  avl = gpr_avl_add(avl, box(301), box(812), nullptr);
-  avl = remove_int(avl, 643);
-  avl = remove_int(avl, 787);
-  avl = remove_int(avl, 583);
-  avl = remove_int(avl, 552);
-  avl = remove_int(avl, 308);
-  avl = remove_int(avl, 608);
-  avl = remove_int(avl, 363);
-  avl = remove_int(avl, 690);
-  avl = gpr_avl_add(avl, box(233), box(821), nullptr);
-  avl = gpr_avl_add(avl, box(479), box(822), nullptr);
-  avl = gpr_avl_add(avl, box(323), box(823), nullptr);
-  avl = gpr_avl_add(avl, box(802), box(824), nullptr);
-  avl = remove_int(avl, 682);
-  avl = remove_int(avl, 705);
-  avl = remove_int(avl, 487);
-  avl = gpr_avl_add(avl, box(530), box(828), nullptr);
-  avl = gpr_avl_add(avl, box(232), box(829), nullptr);
-  avl = remove_int(avl, 627);
-  avl = gpr_avl_add(avl, box(396), box(831), nullptr);
-  avl = gpr_avl_add(avl, box(61), box(832), nullptr);
-  avl = gpr_avl_add(avl, box(932), box(833), nullptr);
-  avl = gpr_avl_add(avl, box(108), box(834), nullptr);
-  avl = gpr_avl_add(avl, box(524), box(835), nullptr);
-  avl = remove_int(avl, 390);
-  avl = remove_int(avl, 307);
-  avl = gpr_avl_add(avl, box(722), box(838), nullptr);
-  avl = gpr_avl_add(avl, box(907), box(839), nullptr);
-  avl = remove_int(avl, 286);
-  avl = remove_int(avl, 337);
-  avl = remove_int(avl, 443);
-  avl = gpr_avl_add(avl, box(973), box(843), nullptr);
-  avl = remove_int(avl, 930);
-  avl = remove_int(avl, 242);
-  avl = gpr_avl_add(avl, box(997), box(846), nullptr);
-  avl = gpr_avl_add(avl, box(689), box(847), nullptr);
-  avl = remove_int(avl, 318);
-  avl = gpr_avl_add(avl, box(703), box(849), nullptr);
-  avl = gpr_avl_add(avl, box(868), box(850), nullptr);
-  avl = gpr_avl_add(avl, box(200), box(851), nullptr);
-  avl = gpr_avl_add(avl, box(960), box(852), nullptr);
-  avl = gpr_avl_add(avl, box(80), box(853), nullptr);
-  avl = remove_int(avl, 113);
-  avl = gpr_avl_add(avl, box(135), box(855), nullptr);
-  avl = remove_int(avl, 529);
-  avl = gpr_avl_add(avl, box(366), box(857), nullptr);
-  avl = remove_int(avl, 272);
-  avl = gpr_avl_add(avl, box(921), box(859), nullptr);
-  avl = remove_int(avl, 497);
-  avl = gpr_avl_add(avl, box(712), box(861), nullptr);
-  avl = remove_int(avl, 777);
-  avl = remove_int(avl, 505);
-  avl = remove_int(avl, 974);
-  avl = remove_int(avl, 497);
-  avl = gpr_avl_add(avl, box(388), box(866), nullptr);
-  avl = gpr_avl_add(avl, box(29), box(867), nullptr);
-  avl = gpr_avl_add(avl, box(180), box(868), nullptr);
-  avl = gpr_avl_add(avl, box(983), box(869), nullptr);
-  avl = gpr_avl_add(avl, box(72), box(870), nullptr);
-  avl = gpr_avl_add(avl, box(693), box(871), nullptr);
-  avl = gpr_avl_add(avl, box(567), box(872), nullptr);
-  avl = remove_int(avl, 549);
-  avl = remove_int(avl, 351);
-  avl = gpr_avl_add(avl, box(1019), box(875), nullptr);
-  avl = remove_int(avl, 585);
-  avl = remove_int(avl, 294);
-  avl = remove_int(avl, 61);
-  avl = gpr_avl_add(avl, box(409), box(879), nullptr);
-  avl = gpr_avl_add(avl, box(984), box(880), nullptr);
-  avl = gpr_avl_add(avl, box(830), box(881), nullptr);
-  avl = remove_int(avl, 579);
-  avl = gpr_avl_add(avl, box(672), box(883), nullptr);
-  avl = remove_int(avl, 968);
-
-  gpr_avl_unref(avl, nullptr);
-}
-
-static void test_badcase3(void) {
-  gpr_avl avl;
-
-  gpr_log(GPR_DEBUG, "test_badcase3");
-
-  avl = gpr_avl_create(&int_int_vtable);
-  avl = remove_int(avl, 624);
-  avl = gpr_avl_add(avl, box(59), box(2), nullptr);
-  avl = gpr_avl_add(avl, box(494), box(3), nullptr);
-  avl = gpr_avl_add(avl, box(226), box(4), nullptr);
-  avl = remove_int(avl, 524);
-  avl = gpr_avl_add(avl, box(540), box(6), nullptr);
-  avl = remove_int(avl, 1008);
-  avl = gpr_avl_add(avl, box(502), box(8), nullptr);
-  avl = remove_int(avl, 267);
-  avl = remove_int(avl, 764);
-  avl = remove_int(avl, 443);
-  avl = gpr_avl_add(avl, box(8), box(12), nullptr);
-  avl = remove_int(avl, 291);
-  avl = remove_int(avl, 796);
-  avl = remove_int(avl, 1002);
-  avl = gpr_avl_add(avl, box(778), box(16), nullptr);
-  avl = remove_int(avl, 621);
-  avl = remove_int(avl, 891);
-  avl = remove_int(avl, 880);
-  avl = gpr_avl_add(avl, box(197), box(20), nullptr);
-  avl = gpr_avl_add(avl, box(441), box(21), nullptr);
-  avl = gpr_avl_add(avl, box(719), box(22), nullptr);
-  avl = remove_int(avl, 109);
-  avl = gpr_avl_add(avl, box(458), box(24), nullptr);
-  avl = remove_int(avl, 86);
-  avl = gpr_avl_add(avl, box(897), box(26), nullptr);
-  avl = gpr_avl_add(avl, box(997), box(27), nullptr);
-  avl = remove_int(avl, 235);
-  avl = remove_int(avl, 425);
-  avl = remove_int(avl, 186);
-  avl = gpr_avl_add(avl, box(887), box(31), nullptr);
-  avl = gpr_avl_add(avl, box(1005), box(32), nullptr);
-  avl = gpr_avl_add(avl, box(778), box(33), nullptr);
-  avl = gpr_avl_add(avl, box(575), box(34), nullptr);
-  avl = remove_int(avl, 966);
-  avl = remove_int(avl, 1015);
-  avl = gpr_avl_add(avl, box(486), box(37), nullptr);
-  avl = gpr_avl_add(avl, box(809), box(38), nullptr);
-  avl = gpr_avl_add(avl, box(907), box(39), nullptr);
-  avl = gpr_avl_add(avl, box(971), box(40), nullptr);
-  avl = remove_int(avl, 441);
-  avl = remove_int(avl, 498);
-  avl = gpr_avl_add(avl, box(727), box(43), nullptr);
-  avl = remove_int(avl, 679);
-  avl = remove_int(avl, 740);
-  avl = remove_int(avl, 532);
-  avl = gpr_avl_add(avl, box(805), box(47), nullptr);
-  avl = remove_int(avl, 64);
-  avl = gpr_avl_add(avl, box(362), box(49), nullptr);
-  avl = gpr_avl_add(avl, box(170), box(50), nullptr);
-  avl = gpr_avl_add(avl, box(389), box(51), nullptr);
-  avl = gpr_avl_add(avl, box(689), box(52), nullptr);
-  avl = remove_int(avl, 871);
-  avl = gpr_avl_add(avl, box(447), box(54), nullptr);
-  avl = remove_int(avl, 718);
-  avl = gpr_avl_add(avl, box(724), box(56), nullptr);
-  avl = remove_int(avl, 215);
-  avl = gpr_avl_add(avl, box(550), box(58), nullptr);
-  avl = remove_int(avl, 932);
-  avl = gpr_avl_add(avl, box(47), box(60), nullptr);
-  avl = remove_int(avl, 46);
-  avl = remove_int(avl, 229);
-  avl = gpr_avl_add(avl, box(68), box(63), nullptr);
-  avl = gpr_avl_add(avl, box(387), box(64), nullptr);
-  avl = remove_int(avl, 933);
-  avl = remove_int(avl, 736);
-  avl = remove_int(avl, 719);
-  avl = gpr_avl_add(avl, box(150), box(68), nullptr);
-  avl = remove_int(avl, 875);
-  avl = remove_int(avl, 298);
-  avl = gpr_avl_add(avl, box(991), box(71), nullptr);
-  avl = remove_int(avl, 705);
-  avl = gpr_avl_add(avl, box(197), box(73), nullptr);
-  avl = gpr_avl_add(avl, box(101), box(74), nullptr);
-  avl = remove_int(avl, 436);
-  avl = gpr_avl_add(avl, box(755), box(76), nullptr);
-  avl = gpr_avl_add(avl, box(727), box(77), nullptr);
-  avl = remove_int(avl, 309);
-  avl = remove_int(avl, 253);
-  avl = gpr_avl_add(avl, box(203), box(80), nullptr);
-  avl = remove_int(avl, 231);
-  avl = gpr_avl_add(avl, box(461), box(82), nullptr);
-  avl = remove_int(avl, 316);
-  avl = remove_int(avl, 493);
-  avl = gpr_avl_add(avl, box(184), box(85), nullptr);
-  avl = remove_int(avl, 737);
-  avl = gpr_avl_add(avl, box(790), box(87), nullptr);
-  avl = gpr_avl_add(avl, box(335), box(88), nullptr);
-  avl = remove_int(avl, 649);
-  avl = gpr_avl_add(avl, box(69), box(90), nullptr);
-  avl = remove_int(avl, 585);
-  avl = remove_int(avl, 543);
-  avl = gpr_avl_add(avl, box(784), box(93), nullptr);
-  avl = gpr_avl_add(avl, box(60), box(94), nullptr);
-  avl = gpr_avl_add(avl, box(525), box(95), nullptr);
-  avl = gpr_avl_add(avl, box(177), box(96), nullptr);
-  avl = gpr_avl_add(avl, box(178), box(97), nullptr);
-  avl = gpr_avl_add(avl, box(683), box(98), nullptr);
-  avl = gpr_avl_add(avl, box(226), box(99), nullptr);
-  avl = gpr_avl_add(avl, box(662), box(100), nullptr);
-  avl = remove_int(avl, 944);
-  avl = gpr_avl_add(avl, box(562), box(102), nullptr);
-  avl = gpr_avl_add(avl, box(793), box(103), nullptr);
-  avl = remove_int(avl, 673);
-  avl = gpr_avl_add(avl, box(310), box(105), nullptr);
-  avl = remove_int(avl, 479);
-  avl = remove_int(avl, 543);
-  avl = remove_int(avl, 159);
-  avl = remove_int(avl, 850);
-  avl = gpr_avl_add(avl, box(318), box(110), nullptr);
-  avl = gpr_avl_add(avl, box(483), box(111), nullptr);
-  avl = gpr_avl_add(avl, box(84), box(112), nullptr);
-  avl = remove_int(avl, 109);
-  avl = gpr_avl_add(avl, box(132), box(114), nullptr);
-  avl = gpr_avl_add(avl, box(920), box(115), nullptr);
-  avl = remove_int(avl, 746);
-  avl = gpr_avl_add(avl, box(145), box(117), nullptr);
-  avl = gpr_avl_add(avl, box(526), box(118), nullptr);
-  avl = remove_int(avl, 158);
-  avl = gpr_avl_add(avl, box(332), box(120), nullptr);
-  avl = gpr_avl_add(avl, box(918), box(121), nullptr);
-  avl = remove_int(avl, 339);
-  avl = gpr_avl_add(avl, box(809), box(123), nullptr);
-  avl = gpr_avl_add(avl, box(742), box(124), nullptr);
-  avl = gpr_avl_add(avl, box(718), box(125), nullptr);
-  avl = remove_int(avl, 988);
-  avl = remove_int(avl, 531);
-  avl = remove_int(avl, 840);
-  avl = gpr_avl_add(avl, box(816), box(129), nullptr);
-  avl = gpr_avl_add(avl, box(976), box(130), nullptr);
-  avl = remove_int(avl, 743);
-  avl = remove_int(avl, 528);
-  avl = remove_int(avl, 982);
-  avl = gpr_avl_add(avl, box(803), box(134), nullptr);
-  avl = gpr_avl_add(avl, box(205), box(135), nullptr);
-  avl = gpr_avl_add(avl, box(584), box(136), nullptr);
-  avl = remove_int(avl, 923);
-  avl = remove_int(avl, 538);
-  avl = remove_int(avl, 398);
-  avl = remove_int(avl, 320);
-  avl = remove_int(avl, 292);
-  avl = gpr_avl_add(avl, box(270), box(142), nullptr);
-  avl = gpr_avl_add(avl, box(333), box(143), nullptr);
-  avl = remove_int(avl, 439);
-  avl = gpr_avl_add(avl, box(35), box(145), nullptr);
-  avl = gpr_avl_add(avl, box(837), box(146), nullptr);
-  avl = remove_int(avl, 65);
-  avl = remove_int(avl, 642);
-  avl = remove_int(avl, 371);
-  avl = remove_int(avl, 140);
-  avl = remove_int(avl, 533);
-  avl = remove_int(avl, 676);
-  avl = gpr_avl_add(avl, box(624), box(153), nullptr);
-  avl = gpr_avl_add(avl, box(116), box(154), nullptr);
-  avl = gpr_avl_add(avl, box(446), box(155), nullptr);
-  avl = remove_int(avl, 91);
-  avl = remove_int(avl, 721);
-  avl = remove_int(avl, 537);
-  avl = gpr_avl_add(avl, box(448), box(159), nullptr);
-  avl = remove_int(avl, 155);
-  avl = remove_int(avl, 344);
-  avl = remove_int(avl, 237);
-  avl = gpr_avl_add(avl, box(309), box(163), nullptr);
-  avl = gpr_avl_add(avl, box(434), box(164), nullptr);
-  avl = gpr_avl_add(avl, box(277), box(165), nullptr);
-  avl = remove_int(avl, 233);
-  avl = gpr_avl_add(avl, box(275), box(167), nullptr);
-  avl = gpr_avl_add(avl, box(218), box(168), nullptr);
-  avl = gpr_avl_add(avl, box(76), box(169), nullptr);
-  avl = gpr_avl_add(avl, box(898), box(170), nullptr);
-  avl = remove_int(avl, 771);
-  avl = gpr_avl_add(avl, box(237), box(172), nullptr);
-  avl = remove_int(avl, 327);
-  avl = gpr_avl_add(avl, box(499), box(174), nullptr);
-  avl = remove_int(avl, 727);
-  avl = remove_int(avl, 234);
-  avl = remove_int(avl, 623);
-  avl = remove_int(avl, 458);
-  avl = remove_int(avl, 326);
-  avl = remove_int(avl, 589);
-  avl = gpr_avl_add(avl, box(442), box(181), nullptr);
-  avl = remove_int(avl, 389);
-  avl = gpr_avl_add(avl, box(708), box(183), nullptr);
-  avl = gpr_avl_add(avl, box(594), box(184), nullptr);
-  avl = gpr_avl_add(avl, box(942), box(185), nullptr);
-  avl = gpr_avl_add(avl, box(282), box(186), nullptr);
-  avl = remove_int(avl, 434);
-  avl = remove_int(avl, 134);
-  avl = remove_int(avl, 270);
-  avl = remove_int(avl, 512);
-  avl = remove_int(avl, 265);
-  avl = remove_int(avl, 21);
-  avl = remove_int(avl, 193);
-  avl = remove_int(avl, 797);
-  avl = remove_int(avl, 347);
-  avl = gpr_avl_add(avl, box(99), box(196), nullptr);
-  avl = gpr_avl_add(avl, box(161), box(197), nullptr);
-  avl = remove_int(avl, 484);
-  avl = gpr_avl_add(avl, box(72), box(199), nullptr);
-  avl = remove_int(avl, 629);
-  avl = gpr_avl_add(avl, box(522), box(201), nullptr);
-  avl = remove_int(avl, 679);
-  avl = gpr_avl_add(avl, box(407), box(203), nullptr);
-  avl = remove_int(avl, 693);
-  avl = gpr_avl_add(avl, box(424), box(205), nullptr);
-  avl = gpr_avl_add(avl, box(651), box(206), nullptr);
-  avl = gpr_avl_add(avl, box(927), box(207), nullptr);
-  avl = remove_int(avl, 553);
-  avl = gpr_avl_add(avl, box(128), box(209), nullptr);
-  avl = gpr_avl_add(avl, box(616), box(210), nullptr);
-  avl = gpr_avl_add(avl, box(690), box(211), nullptr);
-  avl = remove_int(avl, 241);
-  avl = remove_int(avl, 179);
-  avl = gpr_avl_add(avl, box(697), box(214), nullptr);
-  avl = remove_int(avl, 779);
-  avl = gpr_avl_add(avl, box(241), box(216), nullptr);
-  avl = remove_int(avl, 190);
-  avl = remove_int(avl, 210);
-  avl = gpr_avl_add(avl, box(711), box(219), nullptr);
-  avl = remove_int(avl, 251);
-  avl = remove_int(avl, 61);
-  avl = gpr_avl_add(avl, box(800), box(222), nullptr);
-  avl = remove_int(avl, 551);
-  avl = gpr_avl_add(avl, box(61), box(224), nullptr);
-  avl = gpr_avl_add(avl, box(656), box(225), nullptr);
-  avl = remove_int(avl, 130);
-  avl = remove_int(avl, 368);
-  avl = remove_int(avl, 150);
-  avl = remove_int(avl, 73);
-  avl = gpr_avl_add(avl, box(799), box(230), nullptr);
-  avl = gpr_avl_add(avl, box(125), box(231), nullptr);
-  avl = remove_int(avl, 107);
-  avl = gpr_avl_add(avl, box(938), box(233), nullptr);
-  avl = gpr_avl_add(avl, box(914), box(234), nullptr);
-  avl = gpr_avl_add(avl, box(197), box(235), nullptr);
-  avl = remove_int(avl, 736);
-  avl = gpr_avl_add(avl, box(20), box(237), nullptr);
-  avl = remove_int(avl, 224);
-  avl = remove_int(avl, 841);
-  avl = gpr_avl_add(avl, box(226), box(240), nullptr);
-  avl = remove_int(avl, 963);
-  avl = remove_int(avl, 796);
-  avl = remove_int(avl, 728);
-  avl = gpr_avl_add(avl, box(855), box(244), nullptr);
-  avl = gpr_avl_add(avl, box(769), box(245), nullptr);
-  avl = gpr_avl_add(avl, box(631), box(246), nullptr);
-  avl = remove_int(avl, 648);
-  avl = gpr_avl_add(avl, box(187), box(248), nullptr);
-  avl = gpr_avl_add(avl, box(31), box(249), nullptr);
-  avl = remove_int(avl, 163);
-  avl = gpr_avl_add(avl, box(218), box(251), nullptr);
-  avl = gpr_avl_add(avl, box(488), box(252), nullptr);
-  avl = gpr_avl_add(avl, box(387), box(253), nullptr);
-  avl = gpr_avl_add(avl, box(809), box(254), nullptr);
-  avl = gpr_avl_add(avl, box(997), box(255), nullptr);
-  avl = remove_int(avl, 678);
-  avl = gpr_avl_add(avl, box(368), box(257), nullptr);
-  avl = gpr_avl_add(avl, box(220), box(258), nullptr);
-  avl = gpr_avl_add(avl, box(373), box(259), nullptr);
-  avl = remove_int(avl, 874);
-  avl = remove_int(avl, 682);
-  avl = remove_int(avl, 1014);
-  avl = remove_int(avl, 195);
-  avl = gpr_avl_add(avl, box(868), box(264), nullptr);
-  avl = remove_int(avl, 254);
-  avl = remove_int(avl, 456);
-  avl = gpr_avl_add(avl, box(906), box(267), nullptr);
-  avl = remove_int(avl, 711);
-  avl = gpr_avl_add(avl, box(632), box(269), nullptr);
-  avl = remove_int(avl, 474);
-  avl = gpr_avl_add(avl, box(508), box(271), nullptr);
-  avl = gpr_avl_add(avl, box(518), box(272), nullptr);
-  avl = remove_int(avl, 579);
-  avl = remove_int(avl, 948);
-  avl = gpr_avl_add(avl, box(789), box(275), nullptr);
-  avl = gpr_avl_add(avl, box(48), box(276), nullptr);
-  avl = gpr_avl_add(avl, box(256), box(277), nullptr);
-  avl = gpr_avl_add(avl, box(754), box(278), nullptr);
-  avl = remove_int(avl, 215);
-  avl = gpr_avl_add(avl, box(679), box(280), nullptr);
-  avl = gpr_avl_add(avl, box(606), box(281), nullptr);
-  avl = remove_int(avl, 941);
-  avl = remove_int(avl, 31);
-  avl = gpr_avl_add(avl, box(758), box(284), nullptr);
-  avl = remove_int(avl, 101);
-  avl = gpr_avl_add(avl, box(244), box(286), nullptr);
-  avl = gpr_avl_add(avl, box(337), box(287), nullptr);
-  avl = gpr_avl_add(avl, box(461), box(288), nullptr);
-  avl = remove_int(avl, 476);
-  avl = gpr_avl_add(avl, box(845), box(290), nullptr);
-  avl = remove_int(avl, 160);
-  avl = gpr_avl_add(avl, box(690), box(292), nullptr);
-  avl = remove_int(avl, 931);
-  avl = gpr_avl_add(avl, box(869), box(294), nullptr);
-  avl = gpr_avl_add(avl, box(1019), box(295), nullptr);
-  avl = remove_int(avl, 591);
-  avl = remove_int(avl, 635);
-  avl = remove_int(avl, 67);
-  avl = gpr_avl_add(avl, box(113), box(299), nullptr);
-  avl = remove_int(avl, 305);
-  avl = gpr_avl_add(avl, box(10), box(301), nullptr);
-  avl = remove_int(avl, 823);
-  avl = remove_int(avl, 288);
-  avl = remove_int(avl, 239);
-  avl = gpr_avl_add(avl, box(646), box(305), nullptr);
-  avl = gpr_avl_add(avl, box(1006), box(306), nullptr);
-  avl = gpr_avl_add(avl, box(954), box(307), nullptr);
-  avl = gpr_avl_add(avl, box(199), box(308), nullptr);
-  avl = gpr_avl_add(avl, box(69), box(309), nullptr);
-  avl = gpr_avl_add(avl, box(984), box(310), nullptr);
-  avl = remove_int(avl, 568);
-  avl = remove_int(avl, 666);
-  avl = remove_int(avl, 37);
-  avl = gpr_avl_add(avl, box(845), box(314), nullptr);
-  avl = remove_int(avl, 535);
-  avl = remove_int(avl, 365);
-  avl = remove_int(avl, 676);
-  avl = remove_int(avl, 892);
-  avl = remove_int(avl, 425);
-  avl = remove_int(avl, 704);
-  avl = remove_int(avl, 168);
-  avl = gpr_avl_add(avl, box(853), box(322), nullptr);
-  avl = gpr_avl_add(avl, box(335), box(323), nullptr);
-  avl = gpr_avl_add(avl, box(961), box(324), nullptr);
-  avl = gpr_avl_add(avl, box(73), box(325), nullptr);
-  avl = remove_int(avl, 469);
-  avl = gpr_avl_add(avl, box(449), box(327), nullptr);
-  avl = remove_int(avl, 821);
-  avl = gpr_avl_add(avl, box(845), box(329), nullptr);
-  avl = remove_int(avl, 637);
-  avl = gpr_avl_add(avl, box(769), box(331), nullptr);
-  avl = gpr_avl_add(avl, box(901), box(332), nullptr);
-  avl = remove_int(avl, 142);
-  avl = remove_int(avl, 361);
-  avl = remove_int(avl, 876);
-  avl = gpr_avl_add(avl, box(614), box(336), nullptr);
-  avl = gpr_avl_add(avl, box(729), box(337), nullptr);
-  avl = remove_int(avl, 120);
-  avl = remove_int(avl, 473);
-  avl = remove_int(avl, 445);
-  avl = gpr_avl_add(avl, box(978), box(341), nullptr);
-  avl = gpr_avl_add(avl, box(164), box(342), nullptr);
-  avl = gpr_avl_add(avl, box(1), box(343), nullptr);
-  avl = remove_int(avl, 890);
-  avl = gpr_avl_add(avl, box(605), box(345), nullptr);
-  avl = gpr_avl_add(avl, box(178), box(346), nullptr);
-  avl = gpr_avl_add(avl, box(481), box(347), nullptr);
-  avl = gpr_avl_add(avl, box(772), box(348), nullptr);
-  avl = remove_int(avl, 824);
-  avl = remove_int(avl, 167);
-  avl = remove_int(avl, 151);
-  avl = gpr_avl_add(avl, box(698), box(352), nullptr);
-  avl = gpr_avl_add(avl, box(202), box(353), nullptr);
-  avl = gpr_avl_add(avl, box(921), box(354), nullptr);
-  avl = gpr_avl_add(avl, box(875), box(355), nullptr);
-  avl = remove_int(avl, 197);
-  avl = remove_int(avl, 232);
-  avl = gpr_avl_add(avl, box(209), box(358), nullptr);
-  avl = remove_int(avl, 324);
-  avl = remove_int(avl, 56);
-  avl = remove_int(avl, 579);
-  avl = remove_int(avl, 255);
-  avl = remove_int(avl, 290);
-  avl = gpr_avl_add(avl, box(661), box(364), nullptr);
-  avl = gpr_avl_add(avl, box(113), box(365), nullptr);
-  avl = remove_int(avl, 767);
-  avl = gpr_avl_add(avl, box(586), box(367), nullptr);
-  avl = gpr_avl_add(avl, box(121), box(368), nullptr);
-  avl = remove_int(avl, 235);
-  avl = remove_int(avl, 439);
-  avl = remove_int(avl, 360);
-  avl = gpr_avl_add(avl, box(916), box(372), nullptr);
-  avl = remove_int(avl, 999);
-  avl = gpr_avl_add(avl, box(825), box(374), nullptr);
-  avl = gpr_avl_add(avl, box(177), box(375), nullptr);
-  avl = remove_int(avl, 204);
-  avl = remove_int(avl, 92);
-  avl = gpr_avl_add(avl, box(794), box(378), nullptr);
-  avl = gpr_avl_add(avl, box(463), box(379), nullptr);
-  avl = gpr_avl_add(avl, box(472), box(380), nullptr);
-  avl = remove_int(avl, 235);
-  avl = gpr_avl_add(avl, box(840), box(382), nullptr);
-  avl = remove_int(avl, 657);
-  avl = gpr_avl_add(avl, box(586), box(384), nullptr);
-  avl = gpr_avl_add(avl, box(979), box(385), nullptr);
-  avl = remove_int(avl, 979);
-  avl = gpr_avl_add(avl, box(639), box(387), nullptr);
-  avl = remove_int(avl, 907);
-  avl = remove_int(avl, 973);
-  avl = gpr_avl_add(avl, box(913), box(390), nullptr);
-  avl = gpr_avl_add(avl, box(566), box(391), nullptr);
-  avl = gpr_avl_add(avl, box(883), box(392), nullptr);
-  avl = gpr_avl_add(avl, box(552), box(393), nullptr);
-  avl = gpr_avl_add(avl, box(16), box(394), nullptr);
-  avl = remove_int(avl, 60);
-  avl = gpr_avl_add(avl, box(567), box(396), nullptr);
-  avl = gpr_avl_add(avl, box(705), box(397), nullptr);
-  avl = gpr_avl_add(avl, box(94), box(398), nullptr);
-  avl = remove_int(avl, 321);
-  avl = gpr_avl_add(avl, box(207), box(400), nullptr);
-  avl = gpr_avl_add(avl, box(682), box(401), nullptr);
-  avl = gpr_avl_add(avl, box(592), box(402), nullptr);
-  avl = gpr_avl_add(avl, box(10), box(403), nullptr);
-  avl = remove_int(avl, 911);
-  avl = remove_int(avl, 161);
-  avl = gpr_avl_add(avl, box(86), box(406), nullptr);
-  avl = remove_int(avl, 893);
-  avl = remove_int(avl, 362);
-  avl = gpr_avl_add(avl, box(599), box(409), nullptr);
-  avl = remove_int(avl, 413);
-  avl = gpr_avl_add(avl, box(867), box(411), nullptr);
-  avl = remove_int(avl, 955);
-  avl = gpr_avl_add(avl, box(341), box(413), nullptr);
-  avl = gpr_avl_add(avl, box(887), box(414), nullptr);
-  avl = remove_int(avl, 706);
-  avl = gpr_avl_add(avl, box(939), box(416), nullptr);
-  avl = remove_int(avl, 233);
-  avl = remove_int(avl, 662);
-  avl = remove_int(avl, 984);
-  avl = remove_int(avl, 203);
-  avl = gpr_avl_add(avl, box(326), box(421), nullptr);
-  avl = remove_int(avl, 848);
-  avl = gpr_avl_add(avl, box(235), box(423), nullptr);
-  avl = remove_int(avl, 617);
-  avl = gpr_avl_add(avl, box(565), box(425), nullptr);
-  avl = remove_int(avl, 469);
-  avl = gpr_avl_add(avl, box(988), box(427), nullptr);
-  avl = remove_int(avl, 957);
-  avl = gpr_avl_add(avl, box(426), box(429), nullptr);
-  avl = remove_int(avl, 967);
-  avl = gpr_avl_add(avl, box(890), box(431), nullptr);
-  avl = gpr_avl_add(avl, box(473), box(432), nullptr);
-  avl = remove_int(avl, 367);
-  avl = remove_int(avl, 344);
-  avl = remove_int(avl, 660);
-  avl = remove_int(avl, 448);
-  avl = remove_int(avl, 837);
-  avl = remove_int(avl, 158);
-  avl = gpr_avl_add(avl, box(459), box(439), nullptr);
-  avl = remove_int(avl, 882);
-  avl = remove_int(avl, 782);
-  avl = gpr_avl_add(avl, box(408), box(442), nullptr);
-  avl = gpr_avl_add(avl, box(728), box(443), nullptr);
-  avl = remove_int(avl, 27);
-  avl = gpr_avl_add(avl, box(137), box(445), nullptr);
-  avl = gpr_avl_add(avl, box(239), box(446), nullptr);
-  avl = remove_int(avl, 854);
-  avl = gpr_avl_add(avl, box(104), box(448), nullptr);
-  avl = gpr_avl_add(avl, box(823), box(449), nullptr);
-  avl = gpr_avl_add(avl, box(524), box(450), nullptr);
-  avl = gpr_avl_add(avl, box(995), box(451), nullptr);
-  avl = remove_int(avl, 422);
-  avl = remove_int(avl, 220);
-  avl = gpr_avl_add(avl, box(856), box(454), nullptr);
-  avl = remove_int(avl, 332);
-  avl = gpr_avl_add(avl, box(679), box(456), nullptr);
-  avl = remove_int(avl, 18);
-  avl = gpr_avl_add(avl, box(837), box(458), nullptr);
-  avl = remove_int(avl, 405);
-  avl = remove_int(avl, 877);
-  avl = remove_int(avl, 835);
-  avl = gpr_avl_add(avl, box(547), box(462), nullptr);
-  avl = remove_int(avl, 805);
-  avl = remove_int(avl, 862);
-  avl = gpr_avl_add(avl, box(75), box(465), nullptr);
-  avl = remove_int(avl, 41);
-  avl = gpr_avl_add(avl, box(310), box(467), nullptr);
-  avl = remove_int(avl, 855);
-  avl = gpr_avl_add(avl, box(20), box(469), nullptr);
-  avl = remove_int(avl, 186);
-  avl = remove_int(avl, 378);
-  avl = remove_int(avl, 442);
-  avl = remove_int(avl, 930);
-  avl = gpr_avl_add(avl, box(118), box(474), nullptr);
-  avl = gpr_avl_add(avl, box(96), box(475), nullptr);
-  avl = remove_int(avl, 854);
-  avl = gpr_avl_add(avl, box(65), box(477), nullptr);
-  avl = gpr_avl_add(avl, box(573), box(478), nullptr);
-  avl = gpr_avl_add(avl, box(4), box(479), nullptr);
-  avl = gpr_avl_add(avl, box(451), box(480), nullptr);
-  avl = gpr_avl_add(avl, box(774), box(481), nullptr);
-  avl = gpr_avl_add(avl, box(126), box(482), nullptr);
-  avl = remove_int(avl, 956);
-  avl = remove_int(avl, 591);
-  avl = remove_int(avl, 644);
-  avl = gpr_avl_add(avl, box(304), box(486), nullptr);
-  avl = remove_int(avl, 620);
-  avl = remove_int(avl, 394);
-  avl = gpr_avl_add(avl, box(1002), box(489), nullptr);
-  avl = gpr_avl_add(avl, box(837), box(490), nullptr);
-  avl = remove_int(avl, 485);
-  avl = gpr_avl_add(avl, box(1005), box(492), nullptr);
-  avl = remove_int(avl, 21);
-  avl = gpr_avl_add(avl, box(396), box(494), nullptr);
-  avl = remove_int(avl, 966);
-  avl = gpr_avl_add(avl, box(105), box(496), nullptr);
-  avl = gpr_avl_add(avl, box(316), box(497), nullptr);
-  avl = remove_int(avl, 776);
-  avl = gpr_avl_add(avl, box(188), box(499), nullptr);
-  avl = remove_int(avl, 200);
-  avl = gpr_avl_add(avl, box(98), box(501), nullptr);
-  avl = gpr_avl_add(avl, box(831), box(502), nullptr);
-  avl = gpr_avl_add(avl, box(227), box(503), nullptr);
-  avl = gpr_avl_add(avl, box(220), box(504), nullptr);
-  avl = remove_int(avl, 715);
-  avl = remove_int(avl, 279);
-  avl = gpr_avl_add(avl, box(701), box(507), nullptr);
-  avl = gpr_avl_add(avl, box(726), box(508), nullptr);
-  avl = gpr_avl_add(avl, box(815), box(509), nullptr);
-  avl = gpr_avl_add(avl, box(749), box(510), nullptr);
-  avl = remove_int(avl, 946);
-  avl = remove_int(avl, 449);
-  avl = remove_int(avl, 62);
-  avl = remove_int(avl, 487);
-  avl = gpr_avl_add(avl, box(545), box(515), nullptr);
-  avl = remove_int(avl, 59);
-  avl = gpr_avl_add(avl, box(168), box(517), nullptr);
-  avl = remove_int(avl, 337);
-  avl = gpr_avl_add(avl, box(69), box(519), nullptr);
-  avl = remove_int(avl, 600);
-  avl = gpr_avl_add(avl, box(591), box(521), nullptr);
-  avl = gpr_avl_add(avl, box(960), box(522), nullptr);
-  avl = gpr_avl_add(avl, box(116), box(523), nullptr);
-  avl = remove_int(avl, 991);
-  avl = gpr_avl_add(avl, box(760), box(525), nullptr);
-  avl = gpr_avl_add(avl, box(664), box(526), nullptr);
-  avl = gpr_avl_add(avl, box(547), box(527), nullptr);
-  avl = remove_int(avl, 922);
-  avl = gpr_avl_add(avl, box(290), box(529), nullptr);
-  avl = gpr_avl_add(avl, box(859), box(530), nullptr);
-  avl = gpr_avl_add(avl, box(49), box(531), nullptr);
-  avl = remove_int(avl, 455);
-  avl = remove_int(avl, 786);
-  avl = gpr_avl_add(avl, box(613), box(534), nullptr);
-  avl = gpr_avl_add(avl, box(326), box(535), nullptr);
-  avl = remove_int(avl, 615);
-  avl = gpr_avl_add(avl, box(45), box(537), nullptr);
-  avl = gpr_avl_add(avl, box(162), box(538), nullptr);
-  avl = gpr_avl_add(avl, box(189), box(539), nullptr);
-  avl = remove_int(avl, 68);
-  avl = remove_int(avl, 846);
-  avl = gpr_avl_add(avl, box(608), box(542), nullptr);
-  avl = remove_int(avl, 821);
-  avl = gpr_avl_add(avl, box(978), box(544), nullptr);
-  avl = gpr_avl_add(avl, box(892), box(545), nullptr);
-  avl = remove_int(avl, 924);
-  avl = gpr_avl_add(avl, box(708), box(547), nullptr);
-  avl = remove_int(avl, 135);
-  avl = remove_int(avl, 124);
-  avl = gpr_avl_add(avl, box(301), box(550), nullptr);
-  avl = gpr_avl_add(avl, box(939), box(551), nullptr);
-  avl = gpr_avl_add(avl, box(344), box(552), nullptr);
-  avl = remove_int(avl, 443);
-  avl = remove_int(avl, 122);
-  avl = gpr_avl_add(avl, box(636), box(555), nullptr);
-  avl = remove_int(avl, 558);
-  avl = gpr_avl_add(avl, box(923), box(557), nullptr);
-  avl = remove_int(avl, 827);
-  avl = gpr_avl_add(avl, box(649), box(559), nullptr);
-  avl = gpr_avl_add(avl, box(808), box(560), nullptr);
-  avl = remove_int(avl, 570);
-  avl = remove_int(avl, 434);
-  avl = gpr_avl_add(avl, box(40), box(563), nullptr);
-  avl = gpr_avl_add(avl, box(725), box(564), nullptr);
-  avl = remove_int(avl, 295);
-  avl = remove_int(avl, 615);
-  avl = remove_int(avl, 919);
-  avl = remove_int(avl, 170);
-  avl = remove_int(avl, 442);
-  avl = remove_int(avl, 971);
-  avl = gpr_avl_add(avl, box(483), box(571), nullptr);
-  avl = gpr_avl_add(avl, box(512), box(572), nullptr);
-  avl = remove_int(avl, 648);
-  avl = remove_int(avl, 78);
-  avl = remove_int(avl, 72);
-  avl = remove_int(avl, 790);
-  avl = remove_int(avl, 571);
-  avl = gpr_avl_add(avl, box(898), box(578), nullptr);
-  avl = remove_int(avl, 770);
-  avl = remove_int(avl, 776);
-  avl = gpr_avl_add(avl, box(602), box(581), nullptr);
-  avl = remove_int(avl, 251);
-  avl = gpr_avl_add(avl, box(303), box(583), nullptr);
-  avl = remove_int(avl, 837);
-  avl = gpr_avl_add(avl, box(714), box(585), nullptr);
-  avl = remove_int(avl, 800);
-  avl = gpr_avl_add(avl, box(266), box(587), nullptr);
-  avl = gpr_avl_add(avl, box(555), box(588), nullptr);
-  avl = remove_int(avl, 604);
-  avl = remove_int(avl, 163);
-  avl = remove_int(avl, 497);
-  avl = gpr_avl_add(avl, box(296), box(592), nullptr);
-  avl = remove_int(avl, 129);
-  avl = gpr_avl_add(avl, box(656), box(594), nullptr);
-  avl = remove_int(avl, 769);
-  avl = remove_int(avl, 941);
-  avl = gpr_avl_add(avl, box(775), box(597), nullptr);
-  avl = gpr_avl_add(avl, box(846), box(598), nullptr);
-  avl = remove_int(avl, 591);
-  avl = remove_int(avl, 801);
-  avl = remove_int(avl, 419);
-  avl = remove_int(avl, 455);
-  avl = gpr_avl_add(avl, box(866), box(603), nullptr);
-  avl = gpr_avl_add(avl, box(575), box(604), nullptr);
-  avl = gpr_avl_add(avl, box(620), box(605), nullptr);
-  avl = remove_int(avl, 100);
-  avl = remove_int(avl, 667);
-  avl = gpr_avl_add(avl, box(138), box(608), nullptr);
-  avl = gpr_avl_add(avl, box(566), box(609), nullptr);
-  avl = gpr_avl_add(avl, box(673), box(610), nullptr);
-  avl = gpr_avl_add(avl, box(178), box(611), nullptr);
-  avl = remove_int(avl, 659);
-  avl = gpr_avl_add(avl, box(759), box(613), nullptr);
-  avl = gpr_avl_add(avl, box(1008), box(614), nullptr);
-  avl = remove_int(avl, 116);
-  avl = gpr_avl_add(avl, box(608), box(616), nullptr);
-  avl = gpr_avl_add(avl, box(339), box(617), nullptr);
-  avl = gpr_avl_add(avl, box(197), box(618), nullptr);
-  avl = remove_int(avl, 25);
-  avl = remove_int(avl, 628);
-  avl = gpr_avl_add(avl, box(487), box(621), nullptr);
-  avl = remove_int(avl, 739);
-  avl = remove_int(avl, 100);
-  avl = remove_int(avl, 928);
-  avl = gpr_avl_add(avl, box(647), box(625), nullptr);
-  avl = remove_int(avl, 978);
-  avl = remove_int(avl, 143);
-  avl = remove_int(avl, 755);
-  avl = gpr_avl_add(avl, box(71), box(629), nullptr);
-  avl = remove_int(avl, 205);
-  avl = gpr_avl_add(avl, box(501), box(631), nullptr);
-  avl = remove_int(avl, 723);
-  avl = remove_int(avl, 852);
-  avl = remove_int(avl, 1021);
-  avl = remove_int(avl, 670);
-  avl = remove_int(avl, 500);
-  avl = gpr_avl_add(avl, box(330), box(637), nullptr);
-  avl = remove_int(avl, 264);
-  avl = gpr_avl_add(avl, box(69), box(639), nullptr);
-  avl = remove_int(avl, 73);
-  avl = gpr_avl_add(avl, box(745), box(641), nullptr);
-  avl = remove_int(avl, 518);
-  avl = remove_int(avl, 641);
-  avl = remove_int(avl, 768);
-  avl = gpr_avl_add(avl, box(988), box(645), nullptr);
-  avl = gpr_avl_add(avl, box(899), box(646), nullptr);
-  avl = remove_int(avl, 763);
-  avl = remove_int(avl, 281);
-  avl = remove_int(avl, 496);
-  avl = gpr_avl_add(avl, box(445), box(650), nullptr);
-  avl = remove_int(avl, 905);
-  avl = gpr_avl_add(avl, box(275), box(652), nullptr);
-  avl = gpr_avl_add(avl, box(137), box(653), nullptr);
-  avl = remove_int(avl, 642);
-  avl = gpr_avl_add(avl, box(708), box(655), nullptr);
-  avl = remove_int(avl, 922);
-  avl = gpr_avl_add(avl, box(743), box(657), nullptr);
-  avl = remove_int(avl, 295);
-  avl = remove_int(avl, 665);
-  avl = remove_int(avl, 48);
-  avl = gpr_avl_add(avl, box(1012), box(661), nullptr);
-  avl = remove_int(avl, 71);
-  avl = remove_int(avl, 523);
-  avl = gpr_avl_add(avl, box(319), box(664), nullptr);
-  avl = remove_int(avl, 632);
-  avl = gpr_avl_add(avl, box(137), box(666), nullptr);
-  avl = gpr_avl_add(avl, box(686), box(667), nullptr);
-  avl = gpr_avl_add(avl, box(724), box(668), nullptr);
-  avl = gpr_avl_add(avl, box(952), box(669), nullptr);
-  avl = gpr_avl_add(avl, box(5), box(670), nullptr);
-  avl = remove_int(avl, 35);
-  avl = gpr_avl_add(avl, box(43), box(672), nullptr);
-  avl = gpr_avl_add(avl, box(320), box(673), nullptr);
-  avl = gpr_avl_add(avl, box(115), box(674), nullptr);
-  avl = remove_int(avl, 377);
-  avl = remove_int(avl, 591);
-  avl = remove_int(avl, 87);
-  avl = remove_int(avl, 93);
-  avl = gpr_avl_add(avl, box(1016), box(679), nullptr);
-  avl = gpr_avl_add(avl, box(605), box(680), nullptr);
-  avl = gpr_avl_add(avl, box(152), box(681), nullptr);
-  avl = gpr_avl_add(avl, box(113), box(682), nullptr);
-  avl = remove_int(avl, 131);
-  avl = remove_int(avl, 637);
-  avl = gpr_avl_add(avl, box(156), box(685), nullptr);
-  avl = remove_int(avl, 696);
-  avl = gpr_avl_add(avl, box(546), box(687), nullptr);
-  avl = remove_int(avl, 970);
-  avl = remove_int(avl, 53);
-  avl = remove_int(avl, 827);
-  avl = remove_int(avl, 224);
-  avl = remove_int(avl, 796);
-  avl = remove_int(avl, 34);
-  avl = remove_int(avl, 922);
-  avl = remove_int(avl, 277);
-  avl = remove_int(avl, 650);
-  avl = remove_int(avl, 222);
-  avl = remove_int(avl, 244);
-  avl = remove_int(avl, 576);
-  avl = remove_int(avl, 413);
-  avl = gpr_avl_add(avl, box(500), box(701), nullptr);
-  avl = remove_int(avl, 924);
-  avl = gpr_avl_add(avl, box(825), box(703), nullptr);
-  avl = remove_int(avl, 888);
-  avl = remove_int(avl, 931);
-  avl = gpr_avl_add(avl, box(285), box(706), nullptr);
-  avl = remove_int(avl, 62);
-  avl = remove_int(avl, 444);
-  avl = remove_int(avl, 946);
-  avl = gpr_avl_add(avl, box(122), box(710), nullptr);
-  avl = gpr_avl_add(avl, box(846), box(711), nullptr);
-  avl = remove_int(avl, 628);
-  avl = gpr_avl_add(avl, box(511), box(713), nullptr);
-  avl = gpr_avl_add(avl, box(398), box(714), nullptr);
-  avl = remove_int(avl, 730);
-  avl = gpr_avl_add(avl, box(797), box(716), nullptr);
-  avl = remove_int(avl, 897);
-  avl = remove_int(avl, 228);
-  avl = remove_int(avl, 544);
-  avl = remove_int(avl, 552);
-  avl = remove_int(avl, 783);
-  avl = remove_int(avl, 583);
-  avl = remove_int(avl, 894);
-  avl = remove_int(avl, 942);
-  avl = gpr_avl_add(avl, box(346), box(725), nullptr);
-  avl = gpr_avl_add(avl, box(1015), box(726), nullptr);
-  avl = remove_int(avl, 813);
-  avl = gpr_avl_add(avl, box(213), box(728), nullptr);
-  avl = remove_int(avl, 468);
-  avl = remove_int(avl, 365);
-  avl = remove_int(avl, 399);
-  avl = gpr_avl_add(avl, box(380), box(732), nullptr);
-  avl = remove_int(avl, 835);
-  avl = remove_int(avl, 970);
-  avl = gpr_avl_add(avl, box(700), box(735), nullptr);
-  avl = gpr_avl_add(avl, box(807), box(736), nullptr);
-  avl = remove_int(avl, 312);
-  avl = remove_int(avl, 282);
-  avl = remove_int(avl, 370);
-  avl = remove_int(avl, 999);
-  avl = remove_int(avl, 241);
-  avl = remove_int(avl, 884);
-  avl = gpr_avl_add(avl, box(587), box(743), nullptr);
-  avl = gpr_avl_add(avl, box(332), box(744), nullptr);
-  avl = remove_int(avl, 686);
-  avl = remove_int(avl, 206);
-  avl = remove_int(avl, 835);
-  avl = gpr_avl_add(avl, box(334), box(748), nullptr);
-  avl = remove_int(avl, 171);
-  avl = gpr_avl_add(avl, box(1002), box(750), nullptr);
-  avl = gpr_avl_add(avl, box(779), box(751), nullptr);
-  avl = gpr_avl_add(avl, box(307), box(752), nullptr);
-  avl = gpr_avl_add(avl, box(127), box(753), nullptr);
-  avl = gpr_avl_add(avl, box(251), box(754), nullptr);
-  avl = remove_int(avl, 790);
-  avl = remove_int(avl, 189);
-  avl = remove_int(avl, 193);
-  avl = remove_int(avl, 38);
-  avl = remove_int(avl, 124);
-  avl = gpr_avl_add(avl, box(812), box(760), nullptr);
-  avl = remove_int(avl, 43);
-  avl = gpr_avl_add(avl, box(871), box(762), nullptr);
-  avl = gpr_avl_add(avl, box(580), box(763), nullptr);
-  avl = remove_int(avl, 501);
-  avl = remove_int(avl, 462);
-  avl = remove_int(avl, 599);
-  avl = gpr_avl_add(avl, box(240), box(767), nullptr);
-  avl = gpr_avl_add(avl, box(285), box(768), nullptr);
-  avl = gpr_avl_add(avl, box(472), box(769), nullptr);
-  avl = remove_int(avl, 865);
-  avl = remove_int(avl, 763);
-  avl = remove_int(avl, 245);
-  avl = remove_int(avl, 80);
-  avl = remove_int(avl, 713);
-  avl = remove_int(avl, 654);
-  avl = remove_int(avl, 1014);
-  avl = gpr_avl_add(avl, box(495), box(777), nullptr);
-  avl = gpr_avl_add(avl, box(552), box(778), nullptr);
-  avl = remove_int(avl, 19);
-  avl = remove_int(avl, 803);
-  avl = gpr_avl_add(avl, box(508), box(781), nullptr);
-  avl = remove_int(avl, 699);
-  avl = remove_int(avl, 260);
-  avl = remove_int(avl, 92);
-  avl = remove_int(avl, 497);
-  avl = gpr_avl_add(avl, box(970), box(786), nullptr);
-  avl = remove_int(avl, 987);
-  avl = remove_int(avl, 168);
-  avl = remove_int(avl, 476);
-  avl = remove_int(avl, 248);
-  avl = gpr_avl_add(avl, box(358), box(791), nullptr);
-  avl = remove_int(avl, 804);
-  avl = remove_int(avl, 77);
-  avl = remove_int(avl, 905);
-  avl = remove_int(avl, 362);
-  avl = gpr_avl_add(avl, box(578), box(796), nullptr);
-  avl = remove_int(avl, 38);
-  avl = remove_int(avl, 595);
-  avl = gpr_avl_add(avl, box(213), box(799), nullptr);
-  avl = remove_int(avl, 7);
-  avl = remove_int(avl, 620);
-  avl = gpr_avl_add(avl, box(946), box(802), nullptr);
-  avl = remove_int(avl, 145);
-  avl = gpr_avl_add(avl, box(628), box(804), nullptr);
-  avl = remove_int(avl, 972);
-  avl = gpr_avl_add(avl, box(728), box(806), nullptr);
-  avl = remove_int(avl, 91);
-  avl = gpr_avl_add(avl, box(136), box(808), nullptr);
-  avl = gpr_avl_add(avl, box(841), box(809), nullptr);
-  avl = gpr_avl_add(avl, box(265), box(810), nullptr);
-  avl = gpr_avl_add(avl, box(701), box(811), nullptr);
-  avl = gpr_avl_add(avl, box(27), box(812), nullptr);
-  avl = remove_int(avl, 72);
-  avl = remove_int(avl, 14);
-  avl = gpr_avl_add(avl, box(286), box(815), nullptr);
-  avl = remove_int(avl, 996);
-  avl = remove_int(avl, 998);
-  avl = gpr_avl_add(avl, box(466), box(818), nullptr);
-  avl = remove_int(avl, 1009);
-  avl = remove_int(avl, 741);
-  avl = remove_int(avl, 947);
-  avl = remove_int(avl, 241);
-  avl = remove_int(avl, 954);
-  avl = remove_int(avl, 183);
-  avl = remove_int(avl, 395);
-  avl = remove_int(avl, 951);
-  avl = gpr_avl_add(avl, box(267), box(827), nullptr);
-  avl = remove_int(avl, 812);
-  avl = gpr_avl_add(avl, box(577), box(829), nullptr);
-  avl = remove_int(avl, 624);
-  avl = remove_int(avl, 847);
-  avl = remove_int(avl, 745);
-  avl = gpr_avl_add(avl, box(491), box(833), nullptr);
-  avl = gpr_avl_add(avl, box(941), box(834), nullptr);
-  avl = remove_int(avl, 258);
-  avl = gpr_avl_add(avl, box(410), box(836), nullptr);
-  avl = gpr_avl_add(avl, box(80), box(837), nullptr);
-  avl = gpr_avl_add(avl, box(196), box(838), nullptr);
-  avl = gpr_avl_add(avl, box(5), box(839), nullptr);
-  avl = remove_int(avl, 782);
-  avl = gpr_avl_add(avl, box(827), box(841), nullptr);
-  avl = remove_int(avl, 472);
-  avl = remove_int(avl, 664);
-  avl = gpr_avl_add(avl, box(409), box(844), nullptr);
-  avl = gpr_avl_add(avl, box(62), box(845), nullptr);
-  avl = remove_int(avl, 56);
-  avl = remove_int(avl, 606);
-  avl = remove_int(avl, 707);
-  avl = remove_int(avl, 989);
-  avl = remove_int(avl, 549);
-  avl = remove_int(avl, 259);
-  avl = gpr_avl_add(avl, box(405), box(852), nullptr);
-  avl = remove_int(avl, 587);
-  avl = remove_int(avl, 350);
-  avl = gpr_avl_add(avl, box(980), box(855), nullptr);
-  avl = gpr_avl_add(avl, box(992), box(856), nullptr);
-  avl = gpr_avl_add(avl, box(818), box(857), nullptr);
-  avl = remove_int(avl, 853);
-  avl = remove_int(avl, 701);
-  avl = gpr_avl_add(avl, box(675), box(860), nullptr);
-  avl = remove_int(avl, 248);
-  avl = remove_int(avl, 649);
-  avl = gpr_avl_add(avl, box(508), box(863), nullptr);
-  avl = remove_int(avl, 927);
-  avl = gpr_avl_add(avl, box(957), box(865), nullptr);
-  avl = gpr_avl_add(avl, box(698), box(866), nullptr);
-  avl = gpr_avl_add(avl, box(388), box(867), nullptr);
-  avl = gpr_avl_add(avl, box(532), box(868), nullptr);
-  avl = gpr_avl_add(avl, box(681), box(869), nullptr);
-  avl = remove_int(avl, 544);
-  avl = remove_int(avl, 991);
-  avl = remove_int(avl, 397);
-  avl = gpr_avl_add(avl, box(954), box(873), nullptr);
-  avl = gpr_avl_add(avl, box(219), box(874), nullptr);
-  avl = gpr_avl_add(avl, box(465), box(875), nullptr);
-  avl = remove_int(avl, 371);
-  avl = gpr_avl_add(avl, box(601), box(877), nullptr);
-  avl = gpr_avl_add(avl, box(543), box(878), nullptr);
-  avl = remove_int(avl, 329);
-  avl = gpr_avl_add(avl, box(560), box(880), nullptr);
-  avl = remove_int(avl, 898);
-  avl = gpr_avl_add(avl, box(455), box(882), nullptr);
-  avl = remove_int(avl, 313);
-  avl = gpr_avl_add(avl, box(215), box(884), nullptr);
-  avl = remove_int(avl, 846);
-  avl = gpr_avl_add(avl, box(608), box(886), nullptr);
-  avl = remove_int(avl, 248);
-  avl = gpr_avl_add(avl, box(575), box(888), nullptr);
-  avl = remove_int(avl, 207);
-  avl = remove_int(avl, 810);
-  avl = remove_int(avl, 665);
-  avl = remove_int(avl, 361);
-  avl = gpr_avl_add(avl, box(154), box(893), nullptr);
-  avl = gpr_avl_add(avl, box(329), box(894), nullptr);
-  avl = gpr_avl_add(avl, box(326), box(895), nullptr);
-  avl = remove_int(avl, 746);
-  avl = remove_int(avl, 99);
-  avl = gpr_avl_add(avl, box(464), box(898), nullptr);
-  avl = gpr_avl_add(avl, box(141), box(899), nullptr);
-  avl = remove_int(avl, 383);
-  avl = gpr_avl_add(avl, box(414), box(901), nullptr);
-  avl = gpr_avl_add(avl, box(777), box(902), nullptr);
-  avl = remove_int(avl, 972);
-  avl = remove_int(avl, 841);
-  avl = remove_int(avl, 100);
-  avl = gpr_avl_add(avl, box(828), box(906), nullptr);
-  avl = remove_int(avl, 785);
-  avl = gpr_avl_add(avl, box(1008), box(908), nullptr);
-  avl = gpr_avl_add(avl, box(46), box(909), nullptr);
-  avl = remove_int(avl, 399);
-  avl = gpr_avl_add(avl, box(178), box(911), nullptr);
-  avl = gpr_avl_add(avl, box(573), box(912), nullptr);
-  avl = remove_int(avl, 299);
-  avl = gpr_avl_add(avl, box(690), box(914), nullptr);
-  avl = gpr_avl_add(avl, box(692), box(915), nullptr);
-  avl = remove_int(avl, 404);
-  avl = remove_int(avl, 16);
-  avl = remove_int(avl, 746);
-  avl = remove_int(avl, 486);
-  avl = remove_int(avl, 119);
-  avl = gpr_avl_add(avl, box(167), box(921), nullptr);
-  avl = remove_int(avl, 328);
-  avl = gpr_avl_add(avl, box(89), box(923), nullptr);
-  avl = remove_int(avl, 867);
-  avl = remove_int(avl, 626);
-  avl = remove_int(avl, 507);
-  avl = gpr_avl_add(avl, box(365), box(927), nullptr);
-  avl = gpr_avl_add(avl, box(58), box(928), nullptr);
-  avl = gpr_avl_add(avl, box(70), box(929), nullptr);
-  avl = remove_int(avl, 81);
-  avl = remove_int(avl, 797);
-  avl = gpr_avl_add(avl, box(846), box(932), nullptr);
-  avl = remove_int(avl, 642);
-  avl = gpr_avl_add(avl, box(777), box(934), nullptr);
-  avl = remove_int(avl, 107);
-  avl = gpr_avl_add(avl, box(691), box(936), nullptr);
-  avl = gpr_avl_add(avl, box(820), box(937), nullptr);
-  avl = gpr_avl_add(avl, box(202), box(938), nullptr);
-  avl = gpr_avl_add(avl, box(308), box(939), nullptr);
-  avl = gpr_avl_add(avl, box(20), box(940), nullptr);
-  avl = remove_int(avl, 289);
-  avl = gpr_avl_add(avl, box(714), box(942), nullptr);
-  avl = gpr_avl_add(avl, box(584), box(943), nullptr);
-  avl = remove_int(avl, 294);
-  avl = gpr_avl_add(avl, box(496), box(945), nullptr);
-  avl = gpr_avl_add(avl, box(394), box(946), nullptr);
-  avl = gpr_avl_add(avl, box(860), box(947), nullptr);
-  avl = gpr_avl_add(avl, box(58), box(948), nullptr);
-  avl = remove_int(avl, 784);
-  avl = remove_int(avl, 584);
-  avl = remove_int(avl, 708);
-  avl = gpr_avl_add(avl, box(142), box(952), nullptr);
-  avl = gpr_avl_add(avl, box(247), box(953), nullptr);
-  avl = gpr_avl_add(avl, box(389), box(954), nullptr);
-  avl = remove_int(avl, 390);
-  avl = gpr_avl_add(avl, box(465), box(956), nullptr);
-  avl = gpr_avl_add(avl, box(936), box(957), nullptr);
-  avl = gpr_avl_add(avl, box(309), box(958), nullptr);
-  avl = remove_int(avl, 928);
-  avl = remove_int(avl, 128);
-  avl = remove_int(avl, 979);
-  avl = remove_int(avl, 670);
-  avl = remove_int(avl, 738);
-  avl = remove_int(avl, 271);
-  avl = remove_int(avl, 540);
-  avl = gpr_avl_add(avl, box(365), box(966), nullptr);
-  avl = remove_int(avl, 82);
-  avl = gpr_avl_add(avl, box(728), box(968), nullptr);
-  avl = remove_int(avl, 852);
-  avl = gpr_avl_add(avl, box(884), box(970), nullptr);
-  avl = gpr_avl_add(avl, box(502), box(971), nullptr);
-  avl = remove_int(avl, 898);
-  avl = remove_int(avl, 481);
-  avl = gpr_avl_add(avl, box(911), box(974), nullptr);
-  avl = remove_int(avl, 787);
-  avl = remove_int(avl, 785);
-  avl = remove_int(avl, 537);
-  avl = remove_int(avl, 535);
-  avl = remove_int(avl, 136);
-  avl = remove_int(avl, 749);
-  avl = remove_int(avl, 637);
-  avl = remove_int(avl, 900);
-  avl = gpr_avl_add(avl, box(598), box(983), nullptr);
-  avl = remove_int(avl, 25);
-  avl = remove_int(avl, 697);
-  avl = gpr_avl_add(avl, box(645), box(986), nullptr);
-  avl = gpr_avl_add(avl, box(211), box(987), nullptr);
-  avl = gpr_avl_add(avl, box(589), box(988), nullptr);
-  avl = remove_int(avl, 702);
-  avl = gpr_avl_add(avl, box(53), box(990), nullptr);
-  avl = remove_int(avl, 492);
-  avl = remove_int(avl, 185);
-  avl = remove_int(avl, 246);
-  avl = remove_int(avl, 257);
-  avl = remove_int(avl, 502);
-  avl = remove_int(avl, 34);
-  avl = gpr_avl_add(avl, box(74), box(997), nullptr);
-  avl = gpr_avl_add(avl, box(834), box(998), nullptr);
-  avl = gpr_avl_add(avl, box(514), box(999), nullptr);
-  avl = gpr_avl_add(avl, box(75), box(1000), nullptr);
-  avl = remove_int(avl, 745);
-  avl = gpr_avl_add(avl, box(362), box(1002), nullptr);
-  avl = remove_int(avl, 215);
-  avl = gpr_avl_add(avl, box(624), box(1004), nullptr);
-  avl = remove_int(avl, 404);
-  avl = remove_int(avl, 359);
-  avl = remove_int(avl, 491);
-  avl = gpr_avl_add(avl, box(903), box(1008), nullptr);
-  avl = gpr_avl_add(avl, box(240), box(1009), nullptr);
-  avl = remove_int(avl, 95);
-  avl = gpr_avl_add(avl, box(119), box(1011), nullptr);
-  avl = gpr_avl_add(avl, box(857), box(1012), nullptr);
-  avl = remove_int(avl, 39);
-  avl = remove_int(avl, 866);
-  avl = gpr_avl_add(avl, box(503), box(1015), nullptr);
-  avl = gpr_avl_add(avl, box(740), box(1016), nullptr);
-  avl = remove_int(avl, 637);
-  avl = remove_int(avl, 156);
-  avl = remove_int(avl, 6);
-  avl = remove_int(avl, 745);
-  avl = remove_int(avl, 433);
-  avl = remove_int(avl, 283);
-  avl = gpr_avl_add(avl, box(625), box(1023), nullptr);
-  avl = remove_int(avl, 638);
-  avl = gpr_avl_add(avl, box(299), box(1025), nullptr);
-  avl = gpr_avl_add(avl, box(584), box(1026), nullptr);
-  avl = remove_int(avl, 863);
-  avl = gpr_avl_add(avl, box(612), box(1028), nullptr);
-  avl = gpr_avl_add(avl, box(62), box(1029), nullptr);
-  avl = gpr_avl_add(avl, box(432), box(1030), nullptr);
-  avl = remove_int(avl, 371);
-  avl = remove_int(avl, 790);
-  avl = remove_int(avl, 227);
-  avl = remove_int(avl, 836);
-  avl = gpr_avl_add(avl, box(703), box(1035), nullptr);
-  avl = gpr_avl_add(avl, box(644), box(1036), nullptr);
-  avl = remove_int(avl, 638);
-  avl = gpr_avl_add(avl, box(13), box(1038), nullptr);
-  avl = remove_int(avl, 66);
-  avl = remove_int(avl, 82);
-  avl = gpr_avl_add(avl, box(362), box(1041), nullptr);
-  avl = gpr_avl_add(avl, box(783), box(1042), nullptr);
-  avl = remove_int(avl, 60);
-  avl = gpr_avl_add(avl, box(80), box(1044), nullptr);
-  avl = gpr_avl_add(avl, box(825), box(1045), nullptr);
-  avl = gpr_avl_add(avl, box(688), box(1046), nullptr);
-  avl = gpr_avl_add(avl, box(662), box(1047), nullptr);
-  avl = remove_int(avl, 156);
-  avl = remove_int(avl, 376);
-  avl = remove_int(avl, 99);
-  avl = gpr_avl_add(avl, box(526), box(1051), nullptr);
-  avl = gpr_avl_add(avl, box(168), box(1052), nullptr);
-  avl = remove_int(avl, 646);
-  avl = remove_int(avl, 380);
-  avl = remove_int(avl, 833);
-  avl = gpr_avl_add(avl, box(53), box(1056), nullptr);
-  avl = remove_int(avl, 105);
-  avl = gpr_avl_add(avl, box(373), box(1058), nullptr);
-  avl = gpr_avl_add(avl, box(184), box(1059), nullptr);
-  avl = remove_int(avl, 288);
-  avl = gpr_avl_add(avl, box(966), box(1061), nullptr);
-  avl = remove_int(avl, 158);
-  avl = gpr_avl_add(avl, box(406), box(1063), nullptr);
-  avl = remove_int(avl, 470);
-  avl = gpr_avl_add(avl, box(283), box(1065), nullptr);
-  avl = gpr_avl_add(avl, box(838), box(1066), nullptr);
-  avl = gpr_avl_add(avl, box(288), box(1067), nullptr);
-  avl = gpr_avl_add(avl, box(950), box(1068), nullptr);
-  avl = gpr_avl_add(avl, box(163), box(1069), nullptr);
-  avl = remove_int(avl, 623);
-  avl = remove_int(avl, 769);
-  avl = gpr_avl_add(avl, box(144), box(1072), nullptr);
-  avl = gpr_avl_add(avl, box(489), box(1073), nullptr);
-  avl = remove_int(avl, 15);
-  avl = gpr_avl_add(avl, box(971), box(1075), nullptr);
-  avl = remove_int(avl, 660);
-  avl = gpr_avl_add(avl, box(255), box(1077), nullptr);
-  avl = remove_int(avl, 494);
-  avl = gpr_avl_add(avl, box(109), box(1079), nullptr);
-  avl = gpr_avl_add(avl, box(420), box(1080), nullptr);
-  avl = gpr_avl_add(avl, box(509), box(1081), nullptr);
-  avl = remove_int(avl, 178);
-  avl = gpr_avl_add(avl, box(216), box(1083), nullptr);
-  avl = gpr_avl_add(avl, box(707), box(1084), nullptr);
-  avl = gpr_avl_add(avl, box(411), box(1085), nullptr);
-  avl = gpr_avl_add(avl, box(352), box(1086), nullptr);
-  avl = remove_int(avl, 983);
-  avl = gpr_avl_add(avl, box(6), box(1088), nullptr);
-  avl = gpr_avl_add(avl, box(1014), box(1089), nullptr);
-  avl = remove_int(avl, 98);
-  avl = remove_int(avl, 325);
-  avl = gpr_avl_add(avl, box(851), box(1092), nullptr);
-  avl = remove_int(avl, 553);
-  avl = gpr_avl_add(avl, box(218), box(1094), nullptr);
-  avl = gpr_avl_add(avl, box(261), box(1095), nullptr);
-  avl = remove_int(avl, 31);
-  avl = gpr_avl_add(avl, box(872), box(1097), nullptr);
-  avl = remove_int(avl, 543);
-  avl = remove_int(avl, 314);
-  avl = remove_int(avl, 443);
-  avl = gpr_avl_add(avl, box(533), box(1101), nullptr);
-  avl = remove_int(avl, 881);
-  avl = remove_int(avl, 269);
-  avl = remove_int(avl, 940);
-  avl = remove_int(avl, 909);
-  avl = remove_int(avl, 197);
-  avl = remove_int(avl, 773);
-  avl = remove_int(avl, 790);
-  avl = remove_int(avl, 345);
-  avl = gpr_avl_add(avl, box(965), box(1110), nullptr);
-  avl = remove_int(avl, 622);
-  avl = gpr_avl_add(avl, box(352), box(1112), nullptr);
-  avl = remove_int(avl, 182);
-  avl = gpr_avl_add(avl, box(534), box(1114), nullptr);
-  avl = gpr_avl_add(avl, box(97), box(1115), nullptr);
-  avl = gpr_avl_add(avl, box(198), box(1116), nullptr);
-  avl = remove_int(avl, 750);
-  avl = gpr_avl_add(avl, box(98), box(1118), nullptr);
-  avl = remove_int(avl, 943);
-  avl = gpr_avl_add(avl, box(254), box(1120), nullptr);
-  avl = gpr_avl_add(avl, box(30), box(1121), nullptr);
-  avl = remove_int(avl, 14);
-  avl = remove_int(avl, 475);
-  avl = remove_int(avl, 82);
-  avl = gpr_avl_add(avl, box(789), box(1125), nullptr);
-  avl = gpr_avl_add(avl, box(402), box(1126), nullptr);
-  avl = remove_int(avl, 1019);
-  avl = gpr_avl_add(avl, box(858), box(1128), nullptr);
-  avl = gpr_avl_add(avl, box(625), box(1129), nullptr);
-  avl = remove_int(avl, 675);
-  avl = remove_int(avl, 323);
-  avl = gpr_avl_add(avl, box(329), box(1132), nullptr);
-  avl = remove_int(avl, 929);
-  avl = remove_int(avl, 44);
-  avl = gpr_avl_add(avl, box(443), box(1135), nullptr);
-  avl = gpr_avl_add(avl, box(653), box(1136), nullptr);
-  avl = gpr_avl_add(avl, box(750), box(1137), nullptr);
-  avl = gpr_avl_add(avl, box(252), box(1138), nullptr);
-  avl = gpr_avl_add(avl, box(449), box(1139), nullptr);
-  avl = remove_int(avl, 1022);
-  avl = remove_int(avl, 357);
-  avl = remove_int(avl, 602);
-  avl = remove_int(avl, 131);
-  avl = gpr_avl_add(avl, box(531), box(1144), nullptr);
-  avl = remove_int(avl, 806);
-  avl = gpr_avl_add(avl, box(455), box(1146), nullptr);
-  avl = remove_int(avl, 31);
-  avl = gpr_avl_add(avl, box(154), box(1148), nullptr);
-  avl = gpr_avl_add(avl, box(189), box(1149), nullptr);
-  avl = remove_int(avl, 786);
-  avl = gpr_avl_add(avl, box(496), box(1151), nullptr);
-  avl = gpr_avl_add(avl, box(81), box(1152), nullptr);
-  avl = gpr_avl_add(avl, box(59), box(1153), nullptr);
-  avl = remove_int(avl, 424);
-  avl = remove_int(avl, 668);
-  avl = gpr_avl_add(avl, box(723), box(1156), nullptr);
-  avl = gpr_avl_add(avl, box(822), box(1157), nullptr);
-  avl = gpr_avl_add(avl, box(354), box(1158), nullptr);
-  avl = remove_int(avl, 738);
-  avl = gpr_avl_add(avl, box(686), box(1160), nullptr);
-  avl = gpr_avl_add(avl, box(43), box(1161), nullptr);
-  avl = gpr_avl_add(avl, box(625), box(1162), nullptr);
-  avl = gpr_avl_add(avl, box(902), box(1163), nullptr);
-  avl = gpr_avl_add(avl, box(12), box(1164), nullptr);
-  avl = gpr_avl_add(avl, box(977), box(1165), nullptr);
-  avl = gpr_avl_add(avl, box(699), box(1166), nullptr);
-  avl = gpr_avl_add(avl, box(189), box(1167), nullptr);
-  avl = remove_int(avl, 672);
-  avl = remove_int(avl, 90);
-  avl = remove_int(avl, 757);
-  avl = remove_int(avl, 494);
-  avl = gpr_avl_add(avl, box(759), box(1172), nullptr);
-  avl = remove_int(avl, 758);
-  avl = remove_int(avl, 222);
-  avl = gpr_avl_add(avl, box(975), box(1175), nullptr);
-  avl = remove_int(avl, 993);
-  avl = gpr_avl_add(avl, box(2), box(1177), nullptr);
-  avl = gpr_avl_add(avl, box(70), box(1178), nullptr);
-  avl = remove_int(avl, 350);
-  avl = remove_int(avl, 972);
-  avl = remove_int(avl, 880);
-  avl = gpr_avl_add(avl, box(753), box(1182), nullptr);
-  avl = remove_int(avl, 404);
-  avl = gpr_avl_add(avl, box(294), box(1184), nullptr);
-  avl = remove_int(avl, 474);
-  avl = gpr_avl_add(avl, box(228), box(1186), nullptr);
-  avl = gpr_avl_add(avl, box(484), box(1187), nullptr);
-  avl = remove_int(avl, 238);
-  avl = remove_int(avl, 53);
-  avl = remove_int(avl, 691);
-  avl = gpr_avl_add(avl, box(345), box(1191), nullptr);
-  avl = remove_int(avl, 0);
-  avl = gpr_avl_add(avl, box(230), box(1193), nullptr);
-  avl = remove_int(avl, 227);
-  avl = remove_int(avl, 152);
-  avl = gpr_avl_add(avl, box(884), box(1196), nullptr);
-  avl = remove_int(avl, 823);
-  avl = remove_int(avl, 53);
-  avl = gpr_avl_add(avl, box(1015), box(1199), nullptr);
-  avl = gpr_avl_add(avl, box(697), box(1200), nullptr);
-  avl = gpr_avl_add(avl, box(376), box(1201), nullptr);
-  avl = remove_int(avl, 411);
-  avl = gpr_avl_add(avl, box(888), box(1203), nullptr);
-  avl = remove_int(avl, 55);
-  avl = gpr_avl_add(avl, box(85), box(1205), nullptr);
-  avl = remove_int(avl, 947);
-  avl = remove_int(avl, 382);
-  avl = remove_int(avl, 777);
-  avl = gpr_avl_add(avl, box(1017), box(1209), nullptr);
-  avl = gpr_avl_add(avl, box(169), box(1210), nullptr);
-  avl = gpr_avl_add(avl, box(156), box(1211), nullptr);
-  avl = remove_int(avl, 153);
-  avl = remove_int(avl, 642);
-  avl = remove_int(avl, 158);
-  avl = gpr_avl_add(avl, box(554), box(1215), nullptr);
-  avl = gpr_avl_add(avl, box(76), box(1216), nullptr);
-  avl = gpr_avl_add(avl, box(756), box(1217), nullptr);
-  avl = remove_int(avl, 767);
-  avl = remove_int(avl, 112);
-  avl = remove_int(avl, 539);
-  avl = remove_int(avl, 544);
-  avl = remove_int(avl, 628);
-  avl = remove_int(avl, 385);
-  avl = remove_int(avl, 514);
-  avl = remove_int(avl, 362);
-  avl = gpr_avl_add(avl, box(523), box(1226), nullptr);
-  avl = gpr_avl_add(avl, box(712), box(1227), nullptr);
-  avl = gpr_avl_add(avl, box(474), box(1228), nullptr);
-  avl = gpr_avl_add(avl, box(882), box(1229), nullptr);
-  avl = gpr_avl_add(avl, box(965), box(1230), nullptr);
-  avl = remove_int(avl, 464);
-  avl = gpr_avl_add(avl, box(319), box(1232), nullptr);
-  avl = gpr_avl_add(avl, box(504), box(1233), nullptr);
-  avl = remove_int(avl, 818);
-  avl = gpr_avl_add(avl, box(884), box(1235), nullptr);
-  avl = gpr_avl_add(avl, box(813), box(1236), nullptr);
-  avl = gpr_avl_add(avl, box(795), box(1237), nullptr);
-  avl = remove_int(avl, 306);
-  avl = gpr_avl_add(avl, box(799), box(1239), nullptr);
-  avl = remove_int(avl, 534);
-  avl = gpr_avl_add(avl, box(480), box(1241), nullptr);
-  avl = gpr_avl_add(avl, box(656), box(1242), nullptr);
-  avl = gpr_avl_add(avl, box(709), box(1243), nullptr);
-  avl = gpr_avl_add(avl, box(500), box(1244), nullptr);
-  avl = remove_int(avl, 740);
-  avl = gpr_avl_add(avl, box(980), box(1246), nullptr);
-  avl = gpr_avl_add(avl, box(458), box(1247), nullptr);
-  avl = remove_int(avl, 377);
-  avl = remove_int(avl, 338);
-  avl = gpr_avl_add(avl, box(554), box(1250), nullptr);
-  avl = gpr_avl_add(avl, box(504), box(1251), nullptr);
-  avl = gpr_avl_add(avl, box(603), box(1252), nullptr);
-  avl = gpr_avl_add(avl, box(761), box(1253), nullptr);
-  avl = remove_int(avl, 431);
-  avl = gpr_avl_add(avl, box(707), box(1255), nullptr);
-  avl = gpr_avl_add(avl, box(673), box(1256), nullptr);
-  avl = remove_int(avl, 998);
-  avl = remove_int(avl, 332);
-  avl = remove_int(avl, 413);
-  avl = remove_int(avl, 227);
-  avl = remove_int(avl, 249);
-  avl = remove_int(avl, 309);
-  avl = remove_int(avl, 459);
-  avl = gpr_avl_add(avl, box(645), box(1264), nullptr);
-  avl = remove_int(avl, 858);
-  avl = remove_int(avl, 997);
-  avl = gpr_avl_add(avl, box(519), box(1267), nullptr);
-  avl = remove_int(avl, 614);
-  avl = remove_int(avl, 462);
-  avl = remove_int(avl, 792);
-  avl = gpr_avl_add(avl, box(987), box(1271), nullptr);
-  avl = gpr_avl_add(avl, box(309), box(1272), nullptr);
-  avl = remove_int(avl, 747);
-  avl = gpr_avl_add(avl, box(621), box(1274), nullptr);
-  avl = gpr_avl_add(avl, box(450), box(1275), nullptr);
-  avl = remove_int(avl, 265);
-  avl = remove_int(avl, 8);
-  avl = remove_int(avl, 383);
-  avl = gpr_avl_add(avl, box(238), box(1279), nullptr);
-  avl = remove_int(avl, 241);
-  avl = gpr_avl_add(avl, box(180), box(1281), nullptr);
-  avl = gpr_avl_add(avl, box(411), box(1282), nullptr);
-  avl = gpr_avl_add(avl, box(791), box(1283), nullptr);
-  avl = gpr_avl_add(avl, box(955), box(1284), nullptr);
-  avl = remove_int(avl, 24);
-  avl = remove_int(avl, 375);
-  avl = gpr_avl_add(avl, box(140), box(1287), nullptr);
-  avl = remove_int(avl, 949);
-  avl = gpr_avl_add(avl, box(301), box(1289), nullptr);
-  avl = gpr_avl_add(avl, box(0), box(1290), nullptr);
-  avl = remove_int(avl, 371);
-  avl = remove_int(avl, 427);
-  avl = remove_int(avl, 841);
-  avl = remove_int(avl, 847);
-  avl = gpr_avl_add(avl, box(814), box(1295), nullptr);
-  avl = gpr_avl_add(avl, box(127), box(1296), nullptr);
-  avl = gpr_avl_add(avl, box(279), box(1297), nullptr);
-  avl = remove_int(avl, 669);
-  avl = remove_int(avl, 541);
-  avl = remove_int(avl, 275);
-  avl = remove_int(avl, 299);
-  avl = remove_int(avl, 552);
-  avl = gpr_avl_add(avl, box(310), box(1303), nullptr);
-  avl = gpr_avl_add(avl, box(304), box(1304), nullptr);
-  avl = gpr_avl_add(avl, box(1), box(1305), nullptr);
-  avl = gpr_avl_add(avl, box(339), box(1306), nullptr);
-  avl = remove_int(avl, 570);
-  avl = remove_int(avl, 752);
-  avl = remove_int(avl, 552);
-  avl = remove_int(avl, 442);
-  avl = remove_int(avl, 639);
-  avl = gpr_avl_add(avl, box(313), box(1312), nullptr);
-  avl = remove_int(avl, 85);
-  avl = gpr_avl_add(avl, box(964), box(1314), nullptr);
-  avl = gpr_avl_add(avl, box(559), box(1315), nullptr);
-  avl = remove_int(avl, 167);
-  avl = gpr_avl_add(avl, box(866), box(1317), nullptr);
-  avl = remove_int(avl, 275);
-  avl = gpr_avl_add(avl, box(173), box(1319), nullptr);
-  avl = gpr_avl_add(avl, box(765), box(1320), nullptr);
-  avl = remove_int(avl, 883);
-  avl = gpr_avl_add(avl, box(547), box(1322), nullptr);
-  avl = gpr_avl_add(avl, box(847), box(1323), nullptr);
-  avl = remove_int(avl, 817);
-  avl = remove_int(avl, 850);
-  avl = remove_int(avl, 718);
-  avl = gpr_avl_add(avl, box(806), box(1327), nullptr);
-  avl = gpr_avl_add(avl, box(360), box(1328), nullptr);
-  avl = remove_int(avl, 991);
-  avl = gpr_avl_add(avl, box(493), box(1330), nullptr);
-  avl = remove_int(avl, 516);
-  avl = gpr_avl_add(avl, box(361), box(1332), nullptr);
-  avl = remove_int(avl, 355);
-  avl = gpr_avl_add(avl, box(512), box(1334), nullptr);
-  avl = gpr_avl_add(avl, box(191), box(1335), nullptr);
-  avl = remove_int(avl, 703);
-  avl = gpr_avl_add(avl, box(333), box(1337), nullptr);
-  avl = remove_int(avl, 481);
-  avl = gpr_avl_add(avl, box(501), box(1339), nullptr);
-  avl = remove_int(avl, 532);
-  avl = remove_int(avl, 510);
-  avl = gpr_avl_add(avl, box(793), box(1342), nullptr);
-  avl = gpr_avl_add(avl, box(234), box(1343), nullptr);
-  avl = remove_int(avl, 159);
-  avl = remove_int(avl, 429);
-  avl = remove_int(avl, 728);
-  avl = remove_int(avl, 288);
-  avl = gpr_avl_add(avl, box(281), box(1348), nullptr);
-  avl = gpr_avl_add(avl, box(702), box(1349), nullptr);
-  avl = gpr_avl_add(avl, box(149), box(1350), nullptr);
-  avl = remove_int(avl, 22);
-  avl = remove_int(avl, 944);
-  avl = remove_int(avl, 55);
-  avl = remove_int(avl, 512);
-  avl = remove_int(avl, 676);
-  avl = remove_int(avl, 884);
-  avl = gpr_avl_add(avl, box(246), box(1357), nullptr);
-  avl = gpr_avl_add(avl, box(455), box(1358), nullptr);
-  avl = remove_int(avl, 782);
-  avl = remove_int(avl, 682);
-  avl = gpr_avl_add(avl, box(243), box(1361), nullptr);
-  avl = gpr_avl_add(avl, box(109), box(1362), nullptr);
-  avl = gpr_avl_add(avl, box(452), box(1363), nullptr);
-  avl = remove_int(avl, 151);
-  avl = gpr_avl_add(avl, box(159), box(1365), nullptr);
-  avl = remove_int(avl, 1023);
-  avl = gpr_avl_add(avl, box(129), box(1367), nullptr);
-  avl = gpr_avl_add(avl, box(537), box(1368), nullptr);
-  avl = remove_int(avl, 321);
-  avl = gpr_avl_add(avl, box(740), box(1370), nullptr);
-  avl = remove_int(avl, 45);
-  avl = remove_int(avl, 136);
-  avl = gpr_avl_add(avl, box(229), box(1373), nullptr);
-  avl = remove_int(avl, 772);
-  avl = gpr_avl_add(avl, box(181), box(1375), nullptr);
-  avl = remove_int(avl, 175);
-  avl = gpr_avl_add(avl, box(817), box(1377), nullptr);
-  avl = remove_int(avl, 956);
-  avl = gpr_avl_add(avl, box(675), box(1379), nullptr);
-  avl = gpr_avl_add(avl, box(375), box(1380), nullptr);
-  avl = remove_int(avl, 384);
-  avl = gpr_avl_add(avl, box(1016), box(1382), nullptr);
-  avl = remove_int(avl, 295);
-  avl = remove_int(avl, 697);
-  avl = remove_int(avl, 554);
-  avl = remove_int(avl, 590);
-  avl = remove_int(avl, 1014);
-  avl = gpr_avl_add(avl, box(890), box(1388), nullptr);
-  avl = gpr_avl_add(avl, box(293), box(1389), nullptr);
-  avl = remove_int(avl, 207);
-  avl = remove_int(avl, 46);
-  avl = gpr_avl_add(avl, box(899), box(1392), nullptr);
-  avl = gpr_avl_add(avl, box(666), box(1393), nullptr);
-  avl = gpr_avl_add(avl, box(85), box(1394), nullptr);
-  avl = gpr_avl_add(avl, box(914), box(1395), nullptr);
-  avl = gpr_avl_add(avl, box(128), box(1396), nullptr);
-  avl = gpr_avl_add(avl, box(835), box(1397), nullptr);
-  avl = gpr_avl_add(avl, box(787), box(1398), nullptr);
-  avl = gpr_avl_add(avl, box(649), box(1399), nullptr);
-  avl = gpr_avl_add(avl, box(723), box(1400), nullptr);
-  avl = remove_int(avl, 874);
-  avl = gpr_avl_add(avl, box(778), box(1402), nullptr);
-  avl = gpr_avl_add(avl, box(1015), box(1403), nullptr);
-  avl = gpr_avl_add(avl, box(59), box(1404), nullptr);
-  avl = gpr_avl_add(avl, box(259), box(1405), nullptr);
-  avl = gpr_avl_add(avl, box(758), box(1406), nullptr);
-  avl = remove_int(avl, 648);
-  avl = gpr_avl_add(avl, box(145), box(1408), nullptr);
-  avl = gpr_avl_add(avl, box(440), box(1409), nullptr);
-  avl = remove_int(avl, 608);
-  avl = remove_int(avl, 690);
-  avl = gpr_avl_add(avl, box(605), box(1412), nullptr);
-  avl = remove_int(avl, 856);
-  avl = remove_int(avl, 608);
-  avl = gpr_avl_add(avl, box(829), box(1415), nullptr);
-  avl = gpr_avl_add(avl, box(660), box(1416), nullptr);
-  avl = remove_int(avl, 596);
-  avl = gpr_avl_add(avl, box(519), box(1418), nullptr);
-  avl = gpr_avl_add(avl, box(35), box(1419), nullptr);
-  avl = gpr_avl_add(avl, box(871), box(1420), nullptr);
-  avl = remove_int(avl, 845);
-  avl = gpr_avl_add(avl, box(600), box(1422), nullptr);
-  avl = gpr_avl_add(avl, box(215), box(1423), nullptr);
-  avl = remove_int(avl, 761);
-  avl = gpr_avl_add(avl, box(975), box(1425), nullptr);
-  avl = remove_int(avl, 987);
-  avl = gpr_avl_add(avl, box(58), box(1427), nullptr);
-  avl = remove_int(avl, 119);
-  avl = gpr_avl_add(avl, box(937), box(1429), nullptr);
-  avl = gpr_avl_add(avl, box(372), box(1430), nullptr);
-  avl = gpr_avl_add(avl, box(11), box(1431), nullptr);
-  avl = gpr_avl_add(avl, box(398), box(1432), nullptr);
-  avl = gpr_avl_add(avl, box(423), box(1433), nullptr);
-  avl = remove_int(avl, 171);
-  avl = gpr_avl_add(avl, box(473), box(1435), nullptr);
-  avl = remove_int(avl, 752);
-  avl = remove_int(avl, 625);
-  avl = remove_int(avl, 764);
-  avl = remove_int(avl, 49);
-  avl = gpr_avl_add(avl, box(472), box(1440), nullptr);
-  avl = remove_int(avl, 847);
-  avl = remove_int(avl, 642);
-  avl = remove_int(avl, 1004);
-  avl = remove_int(avl, 795);
-  avl = remove_int(avl, 465);
-  avl = gpr_avl_add(avl, box(636), box(1446), nullptr);
-  avl = remove_int(avl, 152);
-  avl = gpr_avl_add(avl, box(61), box(1448), nullptr);
-  avl = remove_int(avl, 929);
-  avl = remove_int(avl, 9);
-  avl = gpr_avl_add(avl, box(251), box(1451), nullptr);
-  avl = gpr_avl_add(avl, box(672), box(1452), nullptr);
-  avl = gpr_avl_add(avl, box(66), box(1453), nullptr);
-  avl = remove_int(avl, 693);
-  avl = remove_int(avl, 914);
-  avl = remove_int(avl, 116);
-  avl = remove_int(avl, 577);
-  avl = gpr_avl_add(avl, box(618), box(1458), nullptr);
-  avl = gpr_avl_add(avl, box(495), box(1459), nullptr);
-  avl = remove_int(avl, 450);
-  avl = gpr_avl_add(avl, box(533), box(1461), nullptr);
-  avl = gpr_avl_add(avl, box(414), box(1462), nullptr);
-  avl = remove_int(avl, 74);
-  avl = remove_int(avl, 236);
-  avl = gpr_avl_add(avl, box(707), box(1465), nullptr);
-  avl = gpr_avl_add(avl, box(357), box(1466), nullptr);
-  avl = gpr_avl_add(avl, box(1007), box(1467), nullptr);
-  avl = gpr_avl_add(avl, box(811), box(1468), nullptr);
-  avl = gpr_avl_add(avl, box(418), box(1469), nullptr);
-  avl = gpr_avl_add(avl, box(164), box(1470), nullptr);
-  avl = gpr_avl_add(avl, box(622), box(1471), nullptr);
-  avl = remove_int(avl, 22);
-  avl = remove_int(avl, 14);
-  avl = remove_int(avl, 732);
-  avl = remove_int(avl, 7);
-  avl = remove_int(avl, 447);
-  avl = gpr_avl_add(avl, box(221), box(1477), nullptr);
-  avl = gpr_avl_add(avl, box(202), box(1478), nullptr);
-  avl = gpr_avl_add(avl, box(312), box(1479), nullptr);
-  avl = remove_int(avl, 274);
-  avl = gpr_avl_add(avl, box(684), box(1481), nullptr);
-  avl = gpr_avl_add(avl, box(954), box(1482), nullptr);
-  avl = gpr_avl_add(avl, box(637), box(1483), nullptr);
-  avl = remove_int(avl, 716);
-  avl = gpr_avl_add(avl, box(198), box(1485), nullptr);
-  avl = remove_int(avl, 340);
-  avl = remove_int(avl, 137);
-  avl = remove_int(avl, 995);
-  avl = remove_int(avl, 1004);
-  avl = gpr_avl_add(avl, box(661), box(1490), nullptr);
-  avl = gpr_avl_add(avl, box(862), box(1491), nullptr);
-  avl = remove_int(avl, 527);
-  avl = gpr_avl_add(avl, box(945), box(1493), nullptr);
-  avl = remove_int(avl, 355);
-  avl = remove_int(avl, 144);
-  avl = gpr_avl_add(avl, box(229), box(1496), nullptr);
-  avl = gpr_avl_add(avl, box(237), box(1497), nullptr);
-  avl = remove_int(avl, 471);
-  avl = remove_int(avl, 901);
-  avl = gpr_avl_add(avl, box(905), box(1500), nullptr);
-  avl = remove_int(avl, 19);
-  avl = remove_int(avl, 896);
-  avl = remove_int(avl, 585);
-  avl = remove_int(avl, 308);
-  avl = gpr_avl_add(avl, box(547), box(1505), nullptr);
-  avl = gpr_avl_add(avl, box(552), box(1506), nullptr);
-  avl = gpr_avl_add(avl, box(30), box(1507), nullptr);
-  avl = gpr_avl_add(avl, box(445), box(1508), nullptr);
-  avl = remove_int(avl, 785);
-  avl = remove_int(avl, 185);
-  avl = gpr_avl_add(avl, box(405), box(1511), nullptr);
-  avl = gpr_avl_add(avl, box(733), box(1512), nullptr);
-  avl = gpr_avl_add(avl, box(573), box(1513), nullptr);
-  avl = gpr_avl_add(avl, box(492), box(1514), nullptr);
-  avl = gpr_avl_add(avl, box(343), box(1515), nullptr);
-  avl = gpr_avl_add(avl, box(527), box(1516), nullptr);
-  avl = gpr_avl_add(avl, box(596), box(1517), nullptr);
-  avl = gpr_avl_add(avl, box(519), box(1518), nullptr);
-  avl = remove_int(avl, 243);
-  avl = remove_int(avl, 722);
-  avl = gpr_avl_add(avl, box(772), box(1521), nullptr);
-  avl = remove_int(avl, 152);
-  avl = remove_int(avl, 305);
-  avl = gpr_avl_add(avl, box(754), box(1524), nullptr);
-  avl = gpr_avl_add(avl, box(373), box(1525), nullptr);
-  avl = remove_int(avl, 995);
-  avl = gpr_avl_add(avl, box(329), box(1527), nullptr);
-  avl = remove_int(avl, 397);
-  avl = gpr_avl_add(avl, box(884), box(1529), nullptr);
-  avl = remove_int(avl, 329);
-  avl = remove_int(avl, 240);
-  avl = gpr_avl_add(avl, box(566), box(1532), nullptr);
-  avl = gpr_avl_add(avl, box(232), box(1533), nullptr);
-  avl = remove_int(avl, 993);
-  avl = gpr_avl_add(avl, box(888), box(1535), nullptr);
-  avl = remove_int(avl, 242);
-  avl = gpr_avl_add(avl, box(941), box(1537), nullptr);
-  avl = remove_int(avl, 415);
-  avl = gpr_avl_add(avl, box(992), box(1539), nullptr);
-  avl = remove_int(avl, 289);
-  avl = gpr_avl_add(avl, box(60), box(1541), nullptr);
-  avl = gpr_avl_add(avl, box(97), box(1542), nullptr);
-  avl = remove_int(avl, 965);
-  avl = remove_int(avl, 267);
-  avl = remove_int(avl, 360);
-  avl = gpr_avl_add(avl, box(5), box(1546), nullptr);
-  avl = remove_int(avl, 429);
-  avl = gpr_avl_add(avl, box(412), box(1548), nullptr);
-  avl = remove_int(avl, 632);
-  avl = remove_int(avl, 113);
-  avl = gpr_avl_add(avl, box(48), box(1551), nullptr);
-  avl = gpr_avl_add(avl, box(108), box(1552), nullptr);
-  avl = gpr_avl_add(avl, box(750), box(1553), nullptr);
-  avl = remove_int(avl, 188);
-  avl = gpr_avl_add(avl, box(668), box(1555), nullptr);
-  avl = remove_int(avl, 37);
-  avl = remove_int(avl, 737);
-  avl = gpr_avl_add(avl, box(93), box(1558), nullptr);
-  avl = gpr_avl_add(avl, box(628), box(1559), nullptr);
-  avl = gpr_avl_add(avl, box(480), box(1560), nullptr);
-  avl = remove_int(avl, 958);
-  avl = remove_int(avl, 565);
-  avl = remove_int(avl, 32);
-  avl = remove_int(avl, 1);
-  avl = remove_int(avl, 335);
-  avl = gpr_avl_add(avl, box(136), box(1566), nullptr);
-  avl = gpr_avl_add(avl, box(469), box(1567), nullptr);
-  avl = remove_int(avl, 349);
-  avl = gpr_avl_add(avl, box(768), box(1569), nullptr);
-  avl = gpr_avl_add(avl, box(915), box(1570), nullptr);
-  avl = remove_int(avl, 1014);
-  avl = gpr_avl_add(avl, box(117), box(1572), nullptr);
-  avl = remove_int(avl, 62);
-  avl = gpr_avl_add(avl, box(382), box(1574), nullptr);
-  avl = remove_int(avl, 571);
-  avl = gpr_avl_add(avl, box(655), box(1576), nullptr);
-  avl = gpr_avl_add(avl, box(323), box(1577), nullptr);
-  avl = remove_int(avl, 869);
-  avl = remove_int(avl, 151);
-  avl = gpr_avl_add(avl, box(1019), box(1580), nullptr);
-  avl = gpr_avl_add(avl, box(984), box(1581), nullptr);
-  avl = gpr_avl_add(avl, box(870), box(1582), nullptr);
-  avl = gpr_avl_add(avl, box(376), box(1583), nullptr);
-  avl = remove_int(avl, 625);
-  avl = gpr_avl_add(avl, box(733), box(1585), nullptr);
-  avl = remove_int(avl, 532);
-  avl = remove_int(avl, 444);
-  avl = gpr_avl_add(avl, box(428), box(1588), nullptr);
-  avl = gpr_avl_add(avl, box(860), box(1589), nullptr);
-  avl = gpr_avl_add(avl, box(173), box(1590), nullptr);
-  avl = remove_int(avl, 649);
-  avl = remove_int(avl, 913);
-  avl = remove_int(avl, 1);
-  avl = remove_int(avl, 304);
-  avl = gpr_avl_add(avl, box(604), box(1595), nullptr);
-  avl = gpr_avl_add(avl, box(639), box(1596), nullptr);
-  avl = remove_int(avl, 431);
-  avl = gpr_avl_add(avl, box(993), box(1598), nullptr);
-  avl = remove_int(avl, 681);
-  avl = remove_int(avl, 927);
-  avl = gpr_avl_add(avl, box(87), box(1601), nullptr);
-  avl = gpr_avl_add(avl, box(91), box(1602), nullptr);
-  avl = remove_int(avl, 61);
-  avl = remove_int(avl, 14);
-  avl = remove_int(avl, 305);
-  avl = remove_int(avl, 304);
-  avl = remove_int(avl, 1016);
-  avl = gpr_avl_add(avl, box(903), box(1608), nullptr);
-  avl = gpr_avl_add(avl, box(951), box(1609), nullptr);
-  avl = gpr_avl_add(avl, box(146), box(1610), nullptr);
-  avl = gpr_avl_add(avl, box(482), box(1611), nullptr);
-  avl = gpr_avl_add(avl, box(71), box(1612), nullptr);
-  avl = remove_int(avl, 246);
-  avl = remove_int(avl, 696);
-  avl = gpr_avl_add(avl, box(636), box(1615), nullptr);
-  avl = gpr_avl_add(avl, box(295), box(1616), nullptr);
-  avl = remove_int(avl, 11);
-  avl = remove_int(avl, 231);
-  avl = gpr_avl_add(avl, box(905), box(1619), nullptr);
-  avl = gpr_avl_add(avl, box(993), box(1620), nullptr);
-  avl = gpr_avl_add(avl, box(433), box(1621), nullptr);
-  avl = gpr_avl_add(avl, box(117), box(1622), nullptr);
-  avl = gpr_avl_add(avl, box(467), box(1623), nullptr);
-  avl = remove_int(avl, 419);
-  avl = gpr_avl_add(avl, box(179), box(1625), nullptr);
-  avl = remove_int(avl, 926);
-  avl = remove_int(avl, 326);
-  avl = gpr_avl_add(avl, box(551), box(1628), nullptr);
-  avl = remove_int(avl, 14);
-  avl = remove_int(avl, 476);
-  avl = remove_int(avl, 823);
-  avl = gpr_avl_add(avl, box(350), box(1632), nullptr);
-  avl = gpr_avl_add(avl, box(133), box(1633), nullptr);
-  avl = remove_int(avl, 906);
-  avl = gpr_avl_add(avl, box(827), box(1635), nullptr);
-  avl = gpr_avl_add(avl, box(201), box(1636), nullptr);
-  avl = remove_int(avl, 124);
-  avl = remove_int(avl, 662);
-  avl = gpr_avl_add(avl, box(314), box(1639), nullptr);
-  avl = gpr_avl_add(avl, box(986), box(1640), nullptr);
-  avl = gpr_avl_add(avl, box(622), box(1641), nullptr);
-  avl = remove_int(avl, 130);
-  avl = gpr_avl_add(avl, box(861), box(1643), nullptr);
-  avl = remove_int(avl, 497);
-  avl = remove_int(avl, 905);
-  avl = gpr_avl_add(avl, box(502), box(1646), nullptr);
-  avl = remove_int(avl, 721);
-  avl = gpr_avl_add(avl, box(514), box(1648), nullptr);
-  avl = gpr_avl_add(avl, box(410), box(1649), nullptr);
-  avl = remove_int(avl, 869);
-  avl = remove_int(avl, 247);
-  avl = gpr_avl_add(avl, box(450), box(1652), nullptr);
-  avl = remove_int(avl, 364);
-  avl = gpr_avl_add(avl, box(963), box(1654), nullptr);
-  avl = gpr_avl_add(avl, box(146), box(1655), nullptr);
-  avl = remove_int(avl, 147);
-  avl = remove_int(avl, 789);
-  avl = gpr_avl_add(avl, box(693), box(1658), nullptr);
-  avl = gpr_avl_add(avl, box(959), box(1659), nullptr);
-  avl = remove_int(avl, 478);
-  avl = gpr_avl_add(avl, box(116), box(1661), nullptr);
-  avl = gpr_avl_add(avl, box(520), box(1662), nullptr);
-  avl = gpr_avl_add(avl, box(809), box(1663), nullptr);
-  avl = gpr_avl_add(avl, box(667), box(1664), nullptr);
-  avl = gpr_avl_add(avl, box(406), box(1665), nullptr);
-  avl = remove_int(avl, 409);
-  avl = gpr_avl_add(avl, box(558), box(1667), nullptr);
-  avl = gpr_avl_add(avl, box(0), box(1668), nullptr);
-  avl = gpr_avl_add(avl, box(948), box(1669), nullptr);
-  avl = gpr_avl_add(avl, box(576), box(1670), nullptr);
-  avl = remove_int(avl, 864);
-  avl = remove_int(avl, 840);
-  avl = remove_int(avl, 1001);
-  avl = gpr_avl_add(avl, box(232), box(1674), nullptr);
-  avl = remove_int(avl, 676);
-  avl = remove_int(avl, 752);
-  avl = remove_int(avl, 667);
-  avl = remove_int(avl, 605);
-  avl = gpr_avl_add(avl, box(258), box(1679), nullptr);
-  avl = gpr_avl_add(avl, box(648), box(1680), nullptr);
-  avl = gpr_avl_add(avl, box(761), box(1681), nullptr);
-  avl = remove_int(avl, 293);
-  avl = remove_int(avl, 893);
-  avl = gpr_avl_add(avl, box(194), box(1684), nullptr);
-  avl = remove_int(avl, 233);
-  avl = gpr_avl_add(avl, box(888), box(1686), nullptr);
-  avl = remove_int(avl, 470);
-  avl = remove_int(avl, 703);
-  avl = remove_int(avl, 190);
-  avl = remove_int(avl, 359);
-  avl = gpr_avl_add(avl, box(621), box(1691), nullptr);
-  avl = remove_int(avl, 634);
-  avl = remove_int(avl, 335);
-  avl = gpr_avl_add(avl, box(718), box(1694), nullptr);
-  avl = gpr_avl_add(avl, box(463), box(1695), nullptr);
-  avl = gpr_avl_add(avl, box(233), box(1696), nullptr);
-  avl = remove_int(avl, 376);
-  avl = remove_int(avl, 496);
-  avl = remove_int(avl, 819);
-  avl = remove_int(avl, 38);
-  avl = remove_int(avl, 436);
-  avl = remove_int(avl, 102);
-  avl = gpr_avl_add(avl, box(607), box(1703), nullptr);
-  avl = remove_int(avl, 329);
-  avl = gpr_avl_add(avl, box(716), box(1705), nullptr);
-  avl = remove_int(avl, 639);
-  avl = remove_int(avl, 775);
-  avl = remove_int(avl, 578);
-  avl = remove_int(avl, 464);
-  avl = remove_int(avl, 679);
-  avl = remove_int(avl, 615);
-  avl = remove_int(avl, 104);
-  avl = gpr_avl_add(avl, box(414), box(1713), nullptr);
-  avl = gpr_avl_add(avl, box(212), box(1714), nullptr);
-  avl = gpr_avl_add(avl, box(266), box(1715), nullptr);
-  avl = gpr_avl_add(avl, box(238), box(1716), nullptr);
-  avl = remove_int(avl, 153);
-  avl = gpr_avl_add(avl, box(585), box(1718), nullptr);
-  avl = remove_int(avl, 121);
-  avl = gpr_avl_add(avl, box(534), box(1720), nullptr);
-  avl = remove_int(avl, 579);
-  avl = gpr_avl_add(avl, box(127), box(1722), nullptr);
-  avl = gpr_avl_add(avl, box(399), box(1723), nullptr);
-  avl = remove_int(avl, 417);
-  avl = gpr_avl_add(avl, box(978), box(1725), nullptr);
-  avl = gpr_avl_add(avl, box(768), box(1726), nullptr);
-  avl = remove_int(avl, 985);
-  avl = gpr_avl_add(avl, box(536), box(1728), nullptr);
-  avl = gpr_avl_add(avl, box(449), box(1729), nullptr);
-  avl = gpr_avl_add(avl, box(586), box(1730), nullptr);
-  avl = remove_int(avl, 998);
-  avl = remove_int(avl, 394);
-  avl = remove_int(avl, 141);
-  avl = gpr_avl_add(avl, box(889), box(1734), nullptr);
-  avl = gpr_avl_add(avl, box(871), box(1735), nullptr);
-  avl = gpr_avl_add(avl, box(76), box(1736), nullptr);
-  avl = gpr_avl_add(avl, box(549), box(1737), nullptr);
-  avl = gpr_avl_add(avl, box(757), box(1738), nullptr);
-  avl = remove_int(avl, 908);
-  avl = gpr_avl_add(avl, box(789), box(1740), nullptr);
-  avl = remove_int(avl, 224);
-  avl = gpr_avl_add(avl, box(407), box(1742), nullptr);
-  avl = gpr_avl_add(avl, box(381), box(1743), nullptr);
-  avl = gpr_avl_add(avl, box(561), box(1744), nullptr);
-  avl = gpr_avl_add(avl, box(667), box(1745), nullptr);
-  avl = gpr_avl_add(avl, box(522), box(1746), nullptr);
-  avl = gpr_avl_add(avl, box(948), box(1747), nullptr);
-  avl = remove_int(avl, 770);
-  avl = gpr_avl_add(avl, box(872), box(1749), nullptr);
-  avl = gpr_avl_add(avl, box(327), box(1750), nullptr);
-  avl = remove_int(avl, 10);
-  avl = gpr_avl_add(avl, box(122), box(1752), nullptr);
-  avl = remove_int(avl, 606);
-  avl = gpr_avl_add(avl, box(485), box(1754), nullptr);
-  avl = remove_int(avl, 6);
-  avl = gpr_avl_add(avl, box(329), box(1756), nullptr);
-  avl = gpr_avl_add(avl, box(783), box(1757), nullptr);
-  avl = remove_int(avl, 416);
-  avl = gpr_avl_add(avl, box(656), box(1759), nullptr);
-  avl = gpr_avl_add(avl, box(971), box(1760), nullptr);
-  avl = gpr_avl_add(avl, box(77), box(1761), nullptr);
-  avl = gpr_avl_add(avl, box(942), box(1762), nullptr);
-  avl = remove_int(avl, 361);
-  avl = gpr_avl_add(avl, box(66), box(1764), nullptr);
-  avl = gpr_avl_add(avl, box(299), box(1765), nullptr);
-  avl = gpr_avl_add(avl, box(929), box(1766), nullptr);
-  avl = gpr_avl_add(avl, box(797), box(1767), nullptr);
-  avl = remove_int(avl, 869);
-  avl = remove_int(avl, 907);
-  avl = gpr_avl_add(avl, box(870), box(1770), nullptr);
-  avl = remove_int(avl, 580);
-  avl = remove_int(avl, 120);
-  avl = gpr_avl_add(avl, box(913), box(1773), nullptr);
-  avl = remove_int(avl, 480);
-  avl = gpr_avl_add(avl, box(489), box(1775), nullptr);
-  avl = remove_int(avl, 845);
-  avl = gpr_avl_add(avl, box(896), box(1777), nullptr);
-  avl = remove_int(avl, 567);
-  avl = remove_int(avl, 427);
-  avl = gpr_avl_add(avl, box(443), box(1780), nullptr);
-  avl = gpr_avl_add(avl, box(3), box(1781), nullptr);
-  avl = remove_int(avl, 12);
-  avl = gpr_avl_add(avl, box(376), box(1783), nullptr);
-  avl = gpr_avl_add(avl, box(155), box(1784), nullptr);
-  avl = gpr_avl_add(avl, box(188), box(1785), nullptr);
-  avl = gpr_avl_add(avl, box(149), box(1786), nullptr);
-  avl = gpr_avl_add(avl, box(178), box(1787), nullptr);
-  avl = remove_int(avl, 84);
-  avl = gpr_avl_add(avl, box(805), box(1789), nullptr);
-  avl = gpr_avl_add(avl, box(612), box(1790), nullptr);
-  avl = remove_int(avl, 991);
-  avl = gpr_avl_add(avl, box(837), box(1792), nullptr);
-  avl = remove_int(avl, 173);
-  avl = remove_int(avl, 72);
-  avl = gpr_avl_add(avl, box(1014), box(1795), nullptr);
-  avl = remove_int(avl, 303);
-  avl = gpr_avl_add(avl, box(865), box(1797), nullptr);
-  avl = gpr_avl_add(avl, box(793), box(1798), nullptr);
-  avl = remove_int(avl, 173);
-  avl = remove_int(avl, 477);
-  avl = gpr_avl_add(avl, box(950), box(1801), nullptr);
-  avl = gpr_avl_add(avl, box(105), box(1802), nullptr);
-  avl = gpr_avl_add(avl, box(895), box(1803), nullptr);
-  avl = gpr_avl_add(avl, box(171), box(1804), nullptr);
-  avl = gpr_avl_add(avl, box(753), box(1805), nullptr);
-  avl = gpr_avl_add(avl, box(946), box(1806), nullptr);
-  avl = remove_int(avl, 194);
-  avl = remove_int(avl, 559);
-  avl = remove_int(avl, 116);
-  avl = gpr_avl_add(avl, box(968), box(1810), nullptr);
-  avl = remove_int(avl, 124);
-  avl = remove_int(avl, 99);
-  avl = gpr_avl_add(avl, box(563), box(1813), nullptr);
-  avl = remove_int(avl, 182);
-  avl = gpr_avl_add(avl, box(816), box(1815), nullptr);
-  avl = remove_int(avl, 73);
-  avl = remove_int(avl, 261);
-  avl = gpr_avl_add(avl, box(847), box(1818), nullptr);
-  avl = gpr_avl_add(avl, box(368), box(1819), nullptr);
-  avl = gpr_avl_add(avl, box(808), box(1820), nullptr);
-  avl = gpr_avl_add(avl, box(779), box(1821), nullptr);
-  avl = remove_int(avl, 818);
-  avl = gpr_avl_add(avl, box(466), box(1823), nullptr);
-  avl = remove_int(avl, 316);
-  avl = gpr_avl_add(avl, box(986), box(1825), nullptr);
-  avl = gpr_avl_add(avl, box(688), box(1826), nullptr);
-  avl = gpr_avl_add(avl, box(509), box(1827), nullptr);
-  avl = gpr_avl_add(avl, box(51), box(1828), nullptr);
-  avl = remove_int(avl, 655);
-  avl = remove_int(avl, 785);
-  avl = remove_int(avl, 893);
-  avl = gpr_avl_add(avl, box(167), box(1832), nullptr);
-  avl = remove_int(avl, 13);
-  avl = remove_int(avl, 263);
-  avl = gpr_avl_add(avl, box(1009), box(1835), nullptr);
-  avl = remove_int(avl, 480);
-  avl = remove_int(avl, 778);
-  avl = remove_int(avl, 713);
-  avl = remove_int(avl, 628);
-  avl = gpr_avl_add(avl, box(803), box(1840), nullptr);
-  avl = remove_int(avl, 267);
-  avl = gpr_avl_add(avl, box(676), box(1842), nullptr);
-  avl = gpr_avl_add(avl, box(231), box(1843), nullptr);
-  avl = gpr_avl_add(avl, box(824), box(1844), nullptr);
-  avl = remove_int(avl, 961);
-  avl = gpr_avl_add(avl, box(311), box(1846), nullptr);
-  avl = gpr_avl_add(avl, box(420), box(1847), nullptr);
-  avl = gpr_avl_add(avl, box(960), box(1848), nullptr);
-  avl = gpr_avl_add(avl, box(468), box(1849), nullptr);
-  avl = gpr_avl_add(avl, box(815), box(1850), nullptr);
-  avl = remove_int(avl, 247);
-  avl = remove_int(avl, 194);
-  avl = gpr_avl_add(avl, box(546), box(1853), nullptr);
-  avl = remove_int(avl, 222);
-  avl = remove_int(avl, 914);
-  avl = remove_int(avl, 741);
-  avl = gpr_avl_add(avl, box(470), box(1857), nullptr);
-  avl = gpr_avl_add(avl, box(933), box(1858), nullptr);
-  avl = gpr_avl_add(avl, box(97), box(1859), nullptr);
-  avl = remove_int(avl, 564);
-  avl = remove_int(avl, 295);
-  avl = gpr_avl_add(avl, box(864), box(1862), nullptr);
-  avl = remove_int(avl, 329);
-  avl = gpr_avl_add(avl, box(124), box(1864), nullptr);
-  avl = gpr_avl_add(avl, box(1000), box(1865), nullptr);
-  avl = gpr_avl_add(avl, box(228), box(1866), nullptr);
-  avl = gpr_avl_add(avl, box(187), box(1867), nullptr);
-  avl = remove_int(avl, 224);
-  avl = remove_int(avl, 306);
-  avl = remove_int(avl, 884);
-  avl = gpr_avl_add(avl, box(449), box(1871), nullptr);
-  avl = gpr_avl_add(avl, box(353), box(1872), nullptr);
-  avl = gpr_avl_add(avl, box(994), box(1873), nullptr);
-  avl = gpr_avl_add(avl, box(596), box(1874), nullptr);
-  avl = gpr_avl_add(avl, box(996), box(1875), nullptr);
-  avl = gpr_avl_add(avl, box(101), box(1876), nullptr);
-  avl = gpr_avl_add(avl, box(1012), box(1877), nullptr);
-  avl = gpr_avl_add(avl, box(982), box(1878), nullptr);
-  avl = gpr_avl_add(avl, box(742), box(1879), nullptr);
-  avl = remove_int(avl, 92);
-  avl = remove_int(avl, 1022);
-  avl = gpr_avl_add(avl, box(941), box(1882), nullptr);
-  avl = remove_int(avl, 742);
-  avl = remove_int(avl, 919);
-  avl = gpr_avl_add(avl, box(588), box(1885), nullptr);
-  avl = remove_int(avl, 221);
-  avl = gpr_avl_add(avl, box(356), box(1887), nullptr);
-  avl = gpr_avl_add(avl, box(932), box(1888), nullptr);
-  avl = remove_int(avl, 837);
-  avl = gpr_avl_add(avl, box(394), box(1890), nullptr);
-  avl = gpr_avl_add(avl, box(642), box(1891), nullptr);
-  avl = gpr_avl_add(avl, box(52), box(1892), nullptr);
-  avl = gpr_avl_add(avl, box(437), box(1893), nullptr);
-  avl = gpr_avl_add(avl, box(948), box(1894), nullptr);
-  avl = gpr_avl_add(avl, box(93), box(1895), nullptr);
-  avl = remove_int(avl, 873);
-  avl = remove_int(avl, 336);
-  avl = remove_int(avl, 277);
-  avl = remove_int(avl, 932);
-  avl = gpr_avl_add(avl, box(80), box(1900), nullptr);
-  avl = gpr_avl_add(avl, box(952), box(1901), nullptr);
-  avl = gpr_avl_add(avl, box(510), box(1902), nullptr);
-  avl = remove_int(avl, 876);
-  avl = remove_int(avl, 612);
-  avl = gpr_avl_add(avl, box(923), box(1905), nullptr);
-  avl = gpr_avl_add(avl, box(475), box(1906), nullptr);
-  avl = remove_int(avl, 478);
-  avl = remove_int(avl, 148);
-  avl = gpr_avl_add(avl, box(538), box(1909), nullptr);
-  avl = remove_int(avl, 47);
-  avl = gpr_avl_add(avl, box(89), box(1911), nullptr);
-  avl = remove_int(avl, 723);
-  avl = gpr_avl_add(avl, box(687), box(1913), nullptr);
-  avl = gpr_avl_add(avl, box(480), box(1914), nullptr);
-  avl = gpr_avl_add(avl, box(149), box(1915), nullptr);
-  avl = remove_int(avl, 68);
-  avl = remove_int(avl, 862);
-  avl = remove_int(avl, 363);
-  avl = gpr_avl_add(avl, box(996), box(1919), nullptr);
-  avl = remove_int(avl, 380);
-  avl = gpr_avl_add(avl, box(957), box(1921), nullptr);
-  avl = remove_int(avl, 413);
-  avl = gpr_avl_add(avl, box(360), box(1923), nullptr);
-  avl = gpr_avl_add(avl, box(304), box(1924), nullptr);
-  avl = gpr_avl_add(avl, box(634), box(1925), nullptr);
-  avl = gpr_avl_add(avl, box(506), box(1926), nullptr);
-  avl = remove_int(avl, 248);
-  avl = gpr_avl_add(avl, box(124), box(1928), nullptr);
-  avl = gpr_avl_add(avl, box(181), box(1929), nullptr);
-  avl = remove_int(avl, 507);
-  avl = gpr_avl_add(avl, box(141), box(1931), nullptr);
-  avl = remove_int(avl, 409);
-  avl = remove_int(avl, 129);
-  avl = remove_int(avl, 694);
-  avl = remove_int(avl, 723);
-  avl = gpr_avl_add(avl, box(998), box(1936), nullptr);
-  avl = gpr_avl_add(avl, box(906), box(1937), nullptr);
-  avl = gpr_avl_add(avl, box(44), box(1938), nullptr);
-  avl = remove_int(avl, 949);
-  avl = remove_int(avl, 117);
-  avl = gpr_avl_add(avl, box(700), box(1941), nullptr);
-  avl = gpr_avl_add(avl, box(258), box(1942), nullptr);
-  avl = remove_int(avl, 828);
-  avl = gpr_avl_add(avl, box(860), box(1944), nullptr);
-  avl = gpr_avl_add(avl, box(987), box(1945), nullptr);
-  avl = gpr_avl_add(avl, box(316), box(1946), nullptr);
-  avl = gpr_avl_add(avl, box(919), box(1947), nullptr);
-  avl = remove_int(avl, 84);
-  avl = gpr_avl_add(avl, box(473), box(1949), nullptr);
-  avl = remove_int(avl, 127);
-  avl = remove_int(avl, 829);
-  avl = remove_int(avl, 829);
-  avl = gpr_avl_add(avl, box(488), box(1953), nullptr);
-  avl = gpr_avl_add(avl, box(954), box(1954), nullptr);
-  avl = remove_int(avl, 198);
-  avl = remove_int(avl, 972);
-  avl = remove_int(avl, 670);
-  avl = gpr_avl_add(avl, box(822), box(1958), nullptr);
-  avl = remove_int(avl, 589);
-  avl = remove_int(avl, 459);
-  avl = gpr_avl_add(avl, box(1003), box(1961), nullptr);
-  avl = gpr_avl_add(avl, box(657), box(1962), nullptr);
-  avl = gpr_avl_add(avl, box(477), box(1963), nullptr);
-  avl = gpr_avl_add(avl, box(923), box(1964), nullptr);
-  avl = remove_int(avl, 496);
-  avl = remove_int(avl, 99);
-  avl = gpr_avl_add(avl, box(127), box(1967), nullptr);
-  avl = gpr_avl_add(avl, box(1013), box(1968), nullptr);
-  avl = gpr_avl_add(avl, box(778), box(1969), nullptr);
-  avl = remove_int(avl, 5);
-  avl = remove_int(avl, 990);
-  avl = remove_int(avl, 850);
-  avl = remove_int(avl, 160);
-  avl = remove_int(avl, 86);
-  avl = gpr_avl_add(avl, box(283), box(1975), nullptr);
-  avl = remove_int(avl, 278);
-  avl = remove_int(avl, 297);
-  avl = remove_int(avl, 137);
-  avl = remove_int(avl, 653);
-  avl = gpr_avl_add(avl, box(702), box(1980), nullptr);
-  avl = remove_int(avl, 63);
-  avl = remove_int(avl, 427);
-  avl = remove_int(avl, 706);
-  avl = remove_int(avl, 806);
-  avl = gpr_avl_add(avl, box(335), box(1985), nullptr);
-  avl = gpr_avl_add(avl, box(412), box(1986), nullptr);
-  avl = remove_int(avl, 766);
-  avl = remove_int(avl, 937);
-  avl = remove_int(avl, 886);
-  avl = remove_int(avl, 652);
-  avl = gpr_avl_add(avl, box(545), box(1991), nullptr);
-  avl = gpr_avl_add(avl, box(408), box(1992), nullptr);
-  avl = gpr_avl_add(avl, box(841), box(1993), nullptr);
-  avl = remove_int(avl, 593);
-  avl = gpr_avl_add(avl, box(582), box(1995), nullptr);
-  avl = gpr_avl_add(avl, box(597), box(1996), nullptr);
-  avl = remove_int(avl, 49);
-  avl = remove_int(avl, 835);
-  avl = gpr_avl_add(avl, box(417), box(1999), nullptr);
-  avl = gpr_avl_add(avl, box(191), box(2000), nullptr);
-  avl = remove_int(avl, 406);
-  avl = gpr_avl_add(avl, box(30), box(2002), nullptr);
-  avl = remove_int(avl, 841);
-  avl = remove_int(avl, 50);
-  avl = gpr_avl_add(avl, box(967), box(2005), nullptr);
-  avl = gpr_avl_add(avl, box(849), box(2006), nullptr);
-  avl = remove_int(avl, 608);
-  avl = gpr_avl_add(avl, box(306), box(2008), nullptr);
-  avl = remove_int(avl, 779);
-  avl = gpr_avl_add(avl, box(897), box(2010), nullptr);
-  avl = gpr_avl_add(avl, box(147), box(2011), nullptr);
-  avl = remove_int(avl, 982);
-  avl = gpr_avl_add(avl, box(470), box(2013), nullptr);
-  avl = remove_int(avl, 951);
-  avl = gpr_avl_add(avl, box(388), box(2015), nullptr);
-  avl = remove_int(avl, 616);
-  avl = remove_int(avl, 721);
-  avl = remove_int(avl, 942);
-  avl = remove_int(avl, 589);
-  avl = gpr_avl_add(avl, box(218), box(2020), nullptr);
-  avl = remove_int(avl, 671);
-  avl = gpr_avl_add(avl, box(1020), box(2022), nullptr);
-  avl = remove_int(avl, 277);
-  avl = gpr_avl_add(avl, box(681), box(2024), nullptr);
-  avl = gpr_avl_add(avl, box(179), box(2025), nullptr);
-  avl = gpr_avl_add(avl, box(370), box(2026), nullptr);
-  avl = gpr_avl_add(avl, box(0), box(2027), nullptr);
-  avl = remove_int(avl, 523);
-  avl = gpr_avl_add(avl, box(99), box(2029), nullptr);
-  avl = gpr_avl_add(avl, box(334), box(2030), nullptr);
-  avl = gpr_avl_add(avl, box(569), box(2031), nullptr);
-  avl = gpr_avl_add(avl, box(257), box(2032), nullptr);
-  avl = remove_int(avl, 572);
-  avl = gpr_avl_add(avl, box(805), box(2034), nullptr);
-  avl = gpr_avl_add(avl, box(143), box(2035), nullptr);
-  avl = gpr_avl_add(avl, box(670), box(2036), nullptr);
-  avl = remove_int(avl, 42);
-  avl = gpr_avl_add(avl, box(46), box(2038), nullptr);
-  avl = remove_int(avl, 970);
-  avl = gpr_avl_add(avl, box(353), box(2040), nullptr);
-  avl = remove_int(avl, 258);
-  avl = gpr_avl_add(avl, box(451), box(2042), nullptr);
-  avl = gpr_avl_add(avl, box(28), box(2043), nullptr);
-  avl = gpr_avl_add(avl, box(729), box(2044), nullptr);
-  avl = gpr_avl_add(avl, box(401), box(2045), nullptr);
-  avl = gpr_avl_add(avl, box(614), box(2046), nullptr);
-  avl = remove_int(avl, 990);
-  avl = remove_int(avl, 212);
-  avl = remove_int(avl, 22);
-  avl = remove_int(avl, 677);
-  avl = gpr_avl_add(avl, box(1016), box(2051), nullptr);
-  avl = gpr_avl_add(avl, box(980), box(2052), nullptr);
-  avl = gpr_avl_add(avl, box(990), box(2053), nullptr);
-  avl = gpr_avl_add(avl, box(355), box(2054), nullptr);
-  avl = remove_int(avl, 730);
-  avl = remove_int(avl, 37);
-  avl = gpr_avl_add(avl, box(407), box(2057), nullptr);
-  avl = gpr_avl_add(avl, box(222), box(2058), nullptr);
-  avl = gpr_avl_add(avl, box(439), box(2059), nullptr);
-  avl = gpr_avl_add(avl, box(563), box(2060), nullptr);
-  avl = remove_int(avl, 992);
-  avl = remove_int(avl, 786);
-  avl = gpr_avl_add(avl, box(1), box(2063), nullptr);
-  avl = gpr_avl_add(avl, box(473), box(2064), nullptr);
-  avl = gpr_avl_add(avl, box(992), box(2065), nullptr);
-  avl = remove_int(avl, 190);
-  avl = remove_int(avl, 450);
-  avl = remove_int(avl, 1020);
-  avl = remove_int(avl, 149);
-  avl = gpr_avl_add(avl, box(329), box(2070), nullptr);
-  avl = gpr_avl_add(avl, box(35), box(2071), nullptr);
-  avl = remove_int(avl, 843);
-  avl = gpr_avl_add(avl, box(855), box(2073), nullptr);
-  avl = remove_int(avl, 878);
-  avl = gpr_avl_add(avl, box(993), box(2075), nullptr);
-  avl = gpr_avl_add(avl, box(87), box(2076), nullptr);
-  avl = gpr_avl_add(avl, box(572), box(2077), nullptr);
-  avl = remove_int(avl, 896);
-  avl = gpr_avl_add(avl, box(849), box(2079), nullptr);
-  avl = remove_int(avl, 597);
-  avl = gpr_avl_add(avl, box(472), box(2081), nullptr);
-  avl = remove_int(avl, 778);
-  avl = remove_int(avl, 934);
-  avl = remove_int(avl, 314);
-  avl = gpr_avl_add(avl, box(101), box(2085), nullptr);
-  avl = remove_int(avl, 938);
-  avl = remove_int(avl, 1010);
-  avl = gpr_avl_add(avl, box(579), box(2088), nullptr);
-  avl = remove_int(avl, 798);
-  avl = remove_int(avl, 88);
-  avl = gpr_avl_add(avl, box(851), box(2091), nullptr);
-  avl = remove_int(avl, 705);
-  avl = gpr_avl_add(avl, box(26), box(2093), nullptr);
-  avl = remove_int(avl, 973);
-  avl = gpr_avl_add(avl, box(923), box(2095), nullptr);
-  avl = remove_int(avl, 668);
-  avl = gpr_avl_add(avl, box(310), box(2097), nullptr);
-  avl = gpr_avl_add(avl, box(269), box(2098), nullptr);
-  avl = remove_int(avl, 173);
-  avl = gpr_avl_add(avl, box(279), box(2100), nullptr);
-  avl = remove_int(avl, 203);
-  avl = gpr_avl_add(avl, box(411), box(2102), nullptr);
-  avl = remove_int(avl, 950);
-  avl = gpr_avl_add(avl, box(6), box(2104), nullptr);
-  avl = remove_int(avl, 400);
-  avl = remove_int(avl, 468);
-  avl = remove_int(avl, 271);
-  avl = gpr_avl_add(avl, box(627), box(2108), nullptr);
-  avl = remove_int(avl, 727);
-  avl = remove_int(avl, 148);
-  avl = remove_int(avl, 98);
-  avl = remove_int(avl, 997);
-  avl = remove_int(avl, 215);
-  avl = remove_int(avl, 628);
-  avl = remove_int(avl, 826);
-  avl = remove_int(avl, 664);
-  avl = gpr_avl_add(avl, box(76), box(2117), nullptr);
-  avl = remove_int(avl, 194);
-  avl = remove_int(avl, 18);
-  avl = gpr_avl_add(avl, box(727), box(2120), nullptr);
-  avl = remove_int(avl, 295);
-  avl = gpr_avl_add(avl, box(645), box(2122), nullptr);
-  avl = remove_int(avl, 321);
-  avl = remove_int(avl, 863);
-  avl = gpr_avl_add(avl, box(824), box(2125), nullptr);
-  avl = gpr_avl_add(avl, box(651), box(2126), nullptr);
-  avl = gpr_avl_add(avl, box(804), box(2127), nullptr);
-  avl = remove_int(avl, 307);
-  avl = gpr_avl_add(avl, box(867), box(2129), nullptr);
-  avl = remove_int(avl, 384);
-  avl = gpr_avl_add(avl, box(819), box(2131), nullptr);
-  avl = remove_int(avl, 674);
-  avl = gpr_avl_add(avl, box(76), box(2133), nullptr);
-  avl = remove_int(avl, 898);
-  avl = gpr_avl_add(avl, box(45), box(2135), nullptr);
-  avl = gpr_avl_add(avl, box(512), box(2136), nullptr);
-  avl = remove_int(avl, 773);
-  avl = remove_int(avl, 907);
-  avl = remove_int(avl, 382);
-  avl = remove_int(avl, 95);
-  avl = remove_int(avl, 734);
-  avl = remove_int(avl, 81);
-  avl = gpr_avl_add(avl, box(348), box(2143), nullptr);
-  avl = remove_int(avl, 509);
-  avl = remove_int(avl, 301);
-  avl = gpr_avl_add(avl, box(861), box(2146), nullptr);
-  avl = gpr_avl_add(avl, box(918), box(2147), nullptr);
-  avl = remove_int(avl, 992);
-  avl = gpr_avl_add(avl, box(356), box(2149), nullptr);
-  avl = remove_int(avl, 64);
-  avl = remove_int(avl, 444);
-  avl = remove_int(avl, 741);
-  avl = gpr_avl_add(avl, box(710), box(2153), nullptr);
-  avl = gpr_avl_add(avl, box(264), box(2154), nullptr);
-  avl = remove_int(avl, 347);
-  avl = remove_int(avl, 250);
-  avl = gpr_avl_add(avl, box(82), box(2157), nullptr);
-  avl = gpr_avl_add(avl, box(571), box(2158), nullptr);
-  avl = remove_int(avl, 721);
-  avl = remove_int(avl, 622);
-  avl = gpr_avl_add(avl, box(950), box(2161), nullptr);
-  avl = gpr_avl_add(avl, box(94), box(2162), nullptr);
-  avl = remove_int(avl, 970);
-  avl = gpr_avl_add(avl, box(815), box(2164), nullptr);
-  avl = remove_int(avl, 930);
-  avl = remove_int(avl, 703);
-  avl = gpr_avl_add(avl, box(432), box(2167), nullptr);
-  avl = remove_int(avl, 544);
-  avl = gpr_avl_add(avl, box(21), box(2169), nullptr);
-  avl = gpr_avl_add(avl, box(186), box(2170), nullptr);
-  avl = remove_int(avl, 143);
-  avl = gpr_avl_add(avl, box(425), box(2172), nullptr);
-  avl = remove_int(avl, 769);
-  avl = gpr_avl_add(avl, box(656), box(2174), nullptr);
-  avl = remove_int(avl, 29);
-  avl = gpr_avl_add(avl, box(464), box(2176), nullptr);
-  avl = remove_int(avl, 713);
-  avl = gpr_avl_add(avl, box(800), box(2178), nullptr);
-  avl = remove_int(avl, 621);
-  avl = gpr_avl_add(avl, box(962), box(2180), nullptr);
-  avl = remove_int(avl, 448);
-  avl = gpr_avl_add(avl, box(878), box(2182), nullptr);
-  avl = remove_int(avl, 39);
-  avl = remove_int(avl, 999);
-  avl = gpr_avl_add(avl, box(182), box(2185), nullptr);
-  avl = gpr_avl_add(avl, box(429), box(2186), nullptr);
-  avl = gpr_avl_add(avl, box(598), box(2187), nullptr);
-  avl = remove_int(avl, 551);
-  avl = gpr_avl_add(avl, box(827), box(2189), nullptr);
-  avl = gpr_avl_add(avl, box(809), box(2190), nullptr);
-  avl = remove_int(avl, 438);
-  avl = remove_int(avl, 811);
-  avl = gpr_avl_add(avl, box(808), box(2193), nullptr);
-  avl = gpr_avl_add(avl, box(788), box(2194), nullptr);
-  avl = remove_int(avl, 156);
-  avl = gpr_avl_add(avl, box(933), box(2196), nullptr);
-  avl = gpr_avl_add(avl, box(344), box(2197), nullptr);
-  avl = remove_int(avl, 460);
-  avl = gpr_avl_add(avl, box(161), box(2199), nullptr);
-  avl = gpr_avl_add(avl, box(444), box(2200), nullptr);
-  avl = remove_int(avl, 597);
-  avl = remove_int(avl, 668);
-  avl = gpr_avl_add(avl, box(703), box(2203), nullptr);
-  avl = remove_int(avl, 515);
-  avl = gpr_avl_add(avl, box(380), box(2205), nullptr);
-  avl = gpr_avl_add(avl, box(338), box(2206), nullptr);
-  avl = remove_int(avl, 550);
-  avl = remove_int(avl, 946);
-  avl = remove_int(avl, 714);
-  avl = remove_int(avl, 739);
-  avl = gpr_avl_add(avl, box(413), box(2211), nullptr);
-  avl = remove_int(avl, 450);
-  avl = gpr_avl_add(avl, box(411), box(2213), nullptr);
-  avl = gpr_avl_add(avl, box(117), box(2214), nullptr);
-  avl = gpr_avl_add(avl, box(322), box(2215), nullptr);
-  avl = gpr_avl_add(avl, box(915), box(2216), nullptr);
-  avl = gpr_avl_add(avl, box(410), box(2217), nullptr);
-  avl = gpr_avl_add(avl, box(66), box(2218), nullptr);
-  avl = remove_int(avl, 756);
-  avl = remove_int(avl, 596);
-  avl = gpr_avl_add(avl, box(882), box(2221), nullptr);
-  avl = gpr_avl_add(avl, box(930), box(2222), nullptr);
-  avl = gpr_avl_add(avl, box(36), box(2223), nullptr);
-  avl = remove_int(avl, 742);
-  avl = gpr_avl_add(avl, box(539), box(2225), nullptr);
-  avl = gpr_avl_add(avl, box(596), box(2226), nullptr);
-  avl = remove_int(avl, 82);
-  avl = remove_int(avl, 686);
-  avl = remove_int(avl, 933);
-  avl = remove_int(avl, 42);
-  avl = remove_int(avl, 340);
-  avl = gpr_avl_add(avl, box(126), box(2232), nullptr);
-  avl = gpr_avl_add(avl, box(493), box(2233), nullptr);
-  avl = gpr_avl_add(avl, box(839), box(2234), nullptr);
-  avl = remove_int(avl, 774);
-  avl = gpr_avl_add(avl, box(337), box(2236), nullptr);
-  avl = remove_int(avl, 322);
-  avl = gpr_avl_add(avl, box(16), box(2238), nullptr);
-  avl = remove_int(avl, 73);
-  avl = remove_int(avl, 85);
-  avl = remove_int(avl, 191);
-  avl = remove_int(avl, 541);
-  avl = gpr_avl_add(avl, box(704), box(2243), nullptr);
-  avl = remove_int(avl, 767);
-  avl = remove_int(avl, 1006);
-  avl = remove_int(avl, 844);
-  avl = remove_int(avl, 742);
-  avl = gpr_avl_add(avl, box(48), box(2248), nullptr);
-  avl = gpr_avl_add(avl, box(138), box(2249), nullptr);
-  avl = gpr_avl_add(avl, box(437), box(2250), nullptr);
-  avl = gpr_avl_add(avl, box(275), box(2251), nullptr);
-  avl = remove_int(avl, 520);
-  avl = gpr_avl_add(avl, box(1019), box(2253), nullptr);
-  avl = remove_int(avl, 955);
-  avl = gpr_avl_add(avl, box(270), box(2255), nullptr);
-  avl = remove_int(avl, 680);
-  avl = remove_int(avl, 698);
-  avl = gpr_avl_add(avl, box(735), box(2258), nullptr);
-  avl = gpr_avl_add(avl, box(400), box(2259), nullptr);
-  avl = remove_int(avl, 991);
-  avl = gpr_avl_add(avl, box(263), box(2261), nullptr);
-  avl = remove_int(avl, 704);
-  avl = gpr_avl_add(avl, box(757), box(2263), nullptr);
-  avl = remove_int(avl, 194);
-  avl = remove_int(avl, 616);
-  avl = remove_int(avl, 784);
-  avl = gpr_avl_add(avl, box(382), box(2267), nullptr);
-  avl = gpr_avl_add(avl, box(464), box(2268), nullptr);
-  avl = gpr_avl_add(avl, box(817), box(2269), nullptr);
-  avl = remove_int(avl, 445);
-  avl = gpr_avl_add(avl, box(412), box(2271), nullptr);
-  avl = remove_int(avl, 525);
-  avl = gpr_avl_add(avl, box(299), box(2273), nullptr);
-  avl = gpr_avl_add(avl, box(464), box(2274), nullptr);
-  avl = gpr_avl_add(avl, box(715), box(2275), nullptr);
-  avl = remove_int(avl, 58);
-  avl = remove_int(avl, 218);
-  avl = gpr_avl_add(avl, box(961), box(2278), nullptr);
-  avl = gpr_avl_add(avl, box(491), box(2279), nullptr);
-  avl = remove_int(avl, 846);
-  avl = gpr_avl_add(avl, box(762), box(2281), nullptr);
-  avl = remove_int(avl, 974);
-  avl = remove_int(avl, 887);
-  avl = gpr_avl_add(avl, box(498), box(2284), nullptr);
-  avl = remove_int(avl, 810);
-  avl = remove_int(avl, 743);
-  avl = remove_int(avl, 22);
-  avl = remove_int(avl, 284);
-  avl = gpr_avl_add(avl, box(482), box(2289), nullptr);
-  avl = gpr_avl_add(avl, box(1021), box(2290), nullptr);
-  avl = remove_int(avl, 155);
-  avl = remove_int(avl, 128);
-  avl = gpr_avl_add(avl, box(819), box(2293), nullptr);
-  avl = gpr_avl_add(avl, box(324), box(2294), nullptr);
-  avl = remove_int(avl, 196);
-  avl = remove_int(avl, 370);
-  avl = remove_int(avl, 753);
-  avl = remove_int(avl, 56);
-  avl = remove_int(avl, 735);
-  avl = gpr_avl_add(avl, box(272), box(2300), nullptr);
-  avl = gpr_avl_add(avl, box(474), box(2301), nullptr);
-  avl = gpr_avl_add(avl, box(719), box(2302), nullptr);
-  avl = gpr_avl_add(avl, box(236), box(2303), nullptr);
-  avl = remove_int(avl, 818);
-  avl = gpr_avl_add(avl, box(727), box(2305), nullptr);
-  avl = remove_int(avl, 892);
-  avl = remove_int(avl, 871);
-  avl = remove_int(avl, 231);
-  avl = gpr_avl_add(avl, box(62), box(2309), nullptr);
-  avl = gpr_avl_add(avl, box(953), box(2310), nullptr);
-  avl = remove_int(avl, 701);
-  avl = gpr_avl_add(avl, box(193), box(2312), nullptr);
-  avl = remove_int(avl, 619);
-  avl = remove_int(avl, 22);
-  avl = remove_int(avl, 804);
-  avl = remove_int(avl, 851);
-  avl = gpr_avl_add(avl, box(286), box(2317), nullptr);
-  avl = gpr_avl_add(avl, box(751), box(2318), nullptr);
-  avl = remove_int(avl, 525);
-  avl = gpr_avl_add(avl, box(217), box(2320), nullptr);
-  avl = remove_int(avl, 336);
-  avl = gpr_avl_add(avl, box(86), box(2322), nullptr);
-  avl = gpr_avl_add(avl, box(81), box(2323), nullptr);
-  avl = gpr_avl_add(avl, box(850), box(2324), nullptr);
-  avl = remove_int(avl, 872);
-  avl = gpr_avl_add(avl, box(402), box(2326), nullptr);
-  avl = gpr_avl_add(avl, box(54), box(2327), nullptr);
-  avl = gpr_avl_add(avl, box(980), box(2328), nullptr);
-  avl = gpr_avl_add(avl, box(845), box(2329), nullptr);
-  avl = remove_int(avl, 1004);
-  avl = remove_int(avl, 273);
-  avl = remove_int(avl, 879);
-  avl = gpr_avl_add(avl, box(354), box(2333), nullptr);
-  avl = gpr_avl_add(avl, box(58), box(2334), nullptr);
-  avl = gpr_avl_add(avl, box(127), box(2335), nullptr);
-  avl = remove_int(avl, 84);
-  avl = gpr_avl_add(avl, box(360), box(2337), nullptr);
-  avl = remove_int(avl, 648);
-  avl = remove_int(avl, 488);
-  avl = remove_int(avl, 585);
-  avl = remove_int(avl, 230);
-  avl = gpr_avl_add(avl, box(887), box(2342), nullptr);
-  avl = remove_int(avl, 558);
-  avl = remove_int(avl, 958);
-  avl = gpr_avl_add(avl, box(822), box(2345), nullptr);
-  avl = remove_int(avl, 1004);
-  avl = remove_int(avl, 747);
-  avl = gpr_avl_add(avl, box(631), box(2348), nullptr);
-  avl = gpr_avl_add(avl, box(442), box(2349), nullptr);
-  avl = remove_int(avl, 957);
-  avl = remove_int(avl, 964);
-  avl = gpr_avl_add(avl, box(10), box(2352), nullptr);
-  avl = remove_int(avl, 189);
-  avl = gpr_avl_add(avl, box(742), box(2354), nullptr);
-  avl = remove_int(avl, 108);
-  avl = gpr_avl_add(avl, box(1014), box(2356), nullptr);
-  avl = remove_int(avl, 266);
-  avl = remove_int(avl, 623);
-  avl = remove_int(avl, 697);
-  avl = gpr_avl_add(avl, box(180), box(2360), nullptr);
-  avl = remove_int(avl, 472);
-  avl = gpr_avl_add(avl, box(567), box(2362), nullptr);
-  avl = remove_int(avl, 1020);
-  avl = remove_int(avl, 273);
-  avl = gpr_avl_add(avl, box(864), box(2365), nullptr);
-  avl = gpr_avl_add(avl, box(1009), box(2366), nullptr);
-  avl = remove_int(avl, 224);
-  avl = remove_int(avl, 81);
-  avl = gpr_avl_add(avl, box(653), box(2369), nullptr);
-  avl = remove_int(avl, 67);
-  avl = remove_int(avl, 102);
-  avl = remove_int(avl, 76);
-  avl = remove_int(avl, 935);
-  avl = remove_int(avl, 169);
-  avl = remove_int(avl, 232);
-  avl = remove_int(avl, 79);
-  avl = gpr_avl_add(avl, box(509), box(2377), nullptr);
-  avl = remove_int(avl, 900);
-  avl = remove_int(avl, 822);
-  avl = remove_int(avl, 945);
-  avl = remove_int(avl, 356);
-  avl = gpr_avl_add(avl, box(443), box(2382), nullptr);
-  avl = gpr_avl_add(avl, box(925), box(2383), nullptr);
-  avl = remove_int(avl, 994);
-  avl = remove_int(avl, 324);
-  avl = gpr_avl_add(avl, box(291), box(2386), nullptr);
-  avl = remove_int(avl, 94);
-  avl = remove_int(avl, 795);
-  avl = remove_int(avl, 42);
-  avl = gpr_avl_add(avl, box(613), box(2390), nullptr);
-  avl = remove_int(avl, 289);
-  avl = gpr_avl_add(avl, box(980), box(2392), nullptr);
-  avl = remove_int(avl, 316);
-  avl = gpr_avl_add(avl, box(281), box(2394), nullptr);
-  avl = gpr_avl_add(avl, box(1006), box(2395), nullptr);
-  avl = remove_int(avl, 776);
-  avl = gpr_avl_add(avl, box(108), box(2397), nullptr);
-  avl = gpr_avl_add(avl, box(918), box(2398), nullptr);
-  avl = remove_int(avl, 721);
-  avl = remove_int(avl, 563);
-  avl = gpr_avl_add(avl, box(925), box(2401), nullptr);
-  avl = remove_int(avl, 448);
-  avl = remove_int(avl, 198);
-  avl = remove_int(avl, 1);
-  avl = gpr_avl_add(avl, box(160), box(2405), nullptr);
-  avl = remove_int(avl, 515);
-  avl = gpr_avl_add(avl, box(284), box(2407), nullptr);
-  avl = gpr_avl_add(avl, box(225), box(2408), nullptr);
-  avl = remove_int(avl, 304);
-  avl = gpr_avl_add(avl, box(714), box(2410), nullptr);
-  avl = gpr_avl_add(avl, box(708), box(2411), nullptr);
-  avl = gpr_avl_add(avl, box(624), box(2412), nullptr);
-  avl = remove_int(avl, 662);
-  avl = remove_int(avl, 825);
-  avl = remove_int(avl, 383);
-  avl = remove_int(avl, 381);
-  avl = gpr_avl_add(avl, box(194), box(2417), nullptr);
-  avl = remove_int(avl, 280);
-  avl = remove_int(avl, 25);
-  avl = remove_int(avl, 633);
-  avl = gpr_avl_add(avl, box(897), box(2421), nullptr);
-  avl = remove_int(avl, 636);
-  avl = remove_int(avl, 596);
-  avl = remove_int(avl, 757);
-  avl = remove_int(avl, 343);
-  avl = remove_int(avl, 162);
-  avl = remove_int(avl, 913);
-  avl = remove_int(avl, 843);
-  avl = remove_int(avl, 280);
-  avl = remove_int(avl, 911);
-  avl = gpr_avl_add(avl, box(1008), box(2431), nullptr);
-  avl = remove_int(avl, 948);
-  avl = remove_int(avl, 74);
-  avl = remove_int(avl, 571);
-  avl = gpr_avl_add(avl, box(486), box(2435), nullptr);
-  avl = gpr_avl_add(avl, box(285), box(2436), nullptr);
-  avl = remove_int(avl, 304);
-  avl = remove_int(avl, 516);
-  avl = gpr_avl_add(avl, box(758), box(2439), nullptr);
-  avl = gpr_avl_add(avl, box(776), box(2440), nullptr);
-  avl = remove_int(avl, 696);
-  avl = gpr_avl_add(avl, box(104), box(2442), nullptr);
-  avl = gpr_avl_add(avl, box(700), box(2443), nullptr);
-  avl = gpr_avl_add(avl, box(114), box(2444), nullptr);
-  avl = gpr_avl_add(avl, box(567), box(2445), nullptr);
-  avl = remove_int(avl, 620);
-  avl = gpr_avl_add(avl, box(270), box(2447), nullptr);
-  avl = remove_int(avl, 730);
-  avl = gpr_avl_add(avl, box(749), box(2449), nullptr);
-  avl = gpr_avl_add(avl, box(443), box(2450), nullptr);
-  avl = remove_int(avl, 457);
-  avl = gpr_avl_add(avl, box(571), box(2452), nullptr);
-  avl = gpr_avl_add(avl, box(626), box(2453), nullptr);
-  avl = remove_int(avl, 638);
-  avl = remove_int(avl, 313);
-
-  gpr_avl_unref(avl, nullptr);
-}
-
-static void test_stress(int amount_of_stress) {
-  int added[1024];
-  int i, j;
-  int deletions = 0;
-  gpr_avl avl;
-
-  unsigned seed = (unsigned)time(nullptr);
-
-  gpr_log(GPR_DEBUG, "test_stress amount=%d seed=%u", amount_of_stress, seed);
-
-  srand((unsigned)time(nullptr));
-  avl = gpr_avl_create(&int_int_vtable);
-
-  memset(added, 0, sizeof(added));
-
-  for (i = 1; deletions < amount_of_stress; i++) {
-    int idx = rand() % (int)GPR_ARRAY_SIZE(added);
-    GPR_ASSERT(i);
-    if (rand() < RAND_MAX / 2) {
-      added[idx] = i;
-      printf("avl = gpr_avl_add(avl, box(%d), box(%d), NULL); /* d=%d */\n",
-             idx, i, deletions);
-      avl = gpr_avl_add(avl, box(idx), box(i), nullptr);
-    } else {
-      deletions += (added[idx] != 0);
-      added[idx] = 0;
-      printf("avl = remove_int(avl, %d); /* d=%d */\n", idx, deletions);
-      avl = remove_int(avl, idx);
-    }
-    for (j = 0; j < (int)GPR_ARRAY_SIZE(added); j++) {
-      if (added[j] != 0) {
-        check_get(avl, j, added[j]);
-      } else {
-        check_negget(avl, j);
-      }
-    }
-  }
-
-  gpr_avl_unref(avl, nullptr);
-}
-
-int main(int argc, char* argv[]) {
-  grpc_test_init(argc, argv);
-
-  test_get();
-  test_ll();
-  test_lr();
-  test_rr();
-  test_rl();
-  test_unbalanced();
-  test_replace();
-  test_remove();
-  test_badcase1();
-  test_badcase2();
-  test_badcase3();
-  test_stress(10);
-
-  return 0;
-}
diff --git a/test/core/gpr/host_port_test.cc b/test/core/gpr/host_port_test.cc
index 42dd565..b5d88b2 100644
--- a/test/core/gpr/host_port_test.cc
+++ b/test/core/gpr/host_port_test.cc
@@ -19,8 +19,9 @@
 #include <string.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
+
+#include "src/core/lib/gpr/host_port.h"
 #include "test/core/util/test_config.h"
 
 static void join_host_port_expect(const char* host, int port,
diff --git a/test/core/gpr/mpscq_test.cc b/test/core/gpr/mpscq_test.cc
index 5a81775..58df2f1 100644
--- a/test/core/gpr/mpscq_test.cc
+++ b/test/core/gpr/mpscq_test.cc
@@ -24,7 +24,8 @@
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/useful.h>
+
+#include "src/core/lib/gpr/useful.h"
 #include "test/core/util/test_config.h"
 
 typedef struct test_node {
diff --git a/test/core/gpr/string_test.cc b/test/core/gpr/string_test.cc
index 57068eb..9f3b312 100644
--- a/test/core/gpr/string_test.cc
+++ b/test/core/gpr/string_test.cc
@@ -26,7 +26,7 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
+
 #include "test/core/util/test_config.h"
 
 #define LOG_TEST_NAME(x) gpr_log(GPR_INFO, "%s", x)
diff --git a/test/core/gpr/tls_test.cc b/test/core/gpr/tls_test.cc
index 743b10f..1ef253e 100644
--- a/test/core/gpr/tls_test.cc
+++ b/test/core/gpr/tls_test.cc
@@ -21,9 +21,10 @@
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/tls.h>
 #include <stdio.h>
 #include <stdlib.h>
+
+#include "src/core/lib/gpr/tls.h"
 #include "test/core/util/test_config.h"
 
 #define NUM_THREADS 100
diff --git a/test/core/gpr/useful_test.cc b/test/core/gpr/useful_test.cc
index 2f86010..619c800 100644
--- a/test/core/gpr/useful_test.cc
+++ b/test/core/gpr/useful_test.cc
@@ -18,7 +18,8 @@
 
 #include <grpc/support/log.h>
 #include <grpc/support/port_platform.h>
-#include <grpc/support/useful.h>
+
+#include "src/core/lib/gpr/useful.h"
 #include "test/core/util/test_config.h"
 
 int main(int argc, char** argv) {
diff --git a/test/core/http/httpcli_test.cc b/test/core/http/httpcli_test.cc
index 6ad0753..3d892b9 100644
--- a/test/core/http/httpcli_test.cc
+++ b/test/core/http/httpcli_test.cc
@@ -24,10 +24,11 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/subprocess.h>
 #include <grpc/support/sync.h>
+
 #include "src/core/lib/iomgr/iomgr.h"
 #include "test/core/util/port.h"
+#include "test/core/util/subprocess.h"
 #include "test/core/util/test_config.h"
 
 static int g_done = 0;
diff --git a/test/core/http/httpscli_test.cc b/test/core/http/httpscli_test.cc
index 92193bb..7e99ad4 100644
--- a/test/core/http/httpscli_test.cc
+++ b/test/core/http/httpscli_test.cc
@@ -25,11 +25,12 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/subprocess.h>
 #include <grpc/support/sync.h>
+
 #include "src/core/lib/gpr/env.h"
 #include "src/core/lib/iomgr/iomgr.h"
 #include "test/core/util/port.h"
+#include "test/core/util/subprocess.h"
 #include "test/core/util/test_config.h"
 
 static int g_done = 0;
diff --git a/test/core/http/parser_test.cc b/test/core/http/parser_test.cc
index 18f1985..fe824f5 100644
--- a/test/core/http/parser_test.cc
+++ b/test/core/http/parser_test.cc
@@ -25,7 +25,8 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
+
+#include "src/core/lib/gpr/useful.h"
 #include "test/core/util/slice_splitter.h"
 #include "test/core/util/test_config.h"
 
diff --git a/test/core/iomgr/combiner_test.cc b/test/core/iomgr/combiner_test.cc
index 891008c..eb926cc 100644
--- a/test/core/iomgr/combiner_test.cc
+++ b/test/core/iomgr/combiner_test.cc
@@ -22,8 +22,8 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/useful.h>
 
+#include "src/core/lib/gpr/useful.h"
 #include "test/core/util/test_config.h"
 
 static void test_no_op(void) {
diff --git a/test/core/iomgr/endpoint_pair_test.cc b/test/core/iomgr/endpoint_pair_test.cc
index 90dd40d..4251f27 100644
--- a/test/core/iomgr/endpoint_pair_test.cc
+++ b/test/core/iomgr/endpoint_pair_test.cc
@@ -21,7 +21,8 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
+
+#include "src/core/lib/gpr/useful.h"
 #include "test/core/iomgr/endpoint_tests.h"
 #include "test/core/util/test_config.h"
 
diff --git a/test/core/iomgr/endpoint_tests.cc b/test/core/iomgr/endpoint_tests.cc
index 8ccae52..842be8f 100644
--- a/test/core/iomgr/endpoint_tests.cc
+++ b/test/core/iomgr/endpoint_tests.cc
@@ -25,8 +25,8 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/slice/slice_internal.h"
 #include "test/core/util/test_config.h"
 
diff --git a/test/core/iomgr/error_test.cc b/test/core/iomgr/error_test.cc
index 51f8af1..064ce0a 100644
--- a/test/core/iomgr/error_test.cc
+++ b/test/core/iomgr/error_test.cc
@@ -22,7 +22,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/useful.h>
 
 #include <string.h>
 
diff --git a/test/core/iomgr/ev_epollsig_linux_test.cc b/test/core/iomgr/ev_epollsig_linux_test.cc
index 2624703..07a69a2 100644
--- a/test/core/iomgr/ev_epollsig_linux_test.cc
+++ b/test/core/iomgr/ev_epollsig_linux_test.cc
@@ -30,8 +30,8 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/thd.h>
-#include <grpc/support/useful.h>
 
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/iomgr.h"
 #include "test/core/util/test_config.h"
 
diff --git a/test/core/iomgr/pollset_set_test.cc b/test/core/iomgr/pollset_set_test.cc
index 7d2f59b..114f397 100644
--- a/test/core/iomgr/pollset_set_test.cc
+++ b/test/core/iomgr/pollset_set_test.cc
@@ -27,8 +27,8 @@
 #include <grpc/grpc.h>
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
-#include <grpc/support/useful.h>
 
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/ev_posix.h"
 #include "src/core/lib/iomgr/iomgr.h"
 #include "test/core/util/test_config.h"
diff --git a/test/core/iomgr/resolve_address_posix_test.cc b/test/core/iomgr/resolve_address_posix_test.cc
index e363153..92d2338 100644
--- a/test/core/iomgr/resolve_address_posix_test.cc
+++ b/test/core/iomgr/resolve_address_posix_test.cc
@@ -27,8 +27,8 @@
 #include <grpc/support/sync.h>
 #include <grpc/support/thd.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/executor.h"
 #include "src/core/lib/iomgr/iomgr.h"
 #include "test/core/util/test_config.h"
diff --git a/test/core/iomgr/socket_utils_test.cc b/test/core/iomgr/socket_utils_test.cc
index 49c6f79..67391a5 100644
--- a/test/core/iomgr/socket_utils_test.cc
+++ b/test/core/iomgr/socket_utils_test.cc
@@ -30,7 +30,8 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
-#include <grpc/support/useful.h>
+
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/socket_mutator.h"
 #include "test/core/util/test_config.h"
 
diff --git a/test/core/iomgr/tcp_posix_test.cc b/test/core/iomgr/tcp_posix_test.cc
index f4acba8..3a79b9b 100644
--- a/test/core/iomgr/tcp_posix_test.cc
+++ b/test/core/iomgr/tcp_posix_test.cc
@@ -34,8 +34,8 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/slice/slice_internal.h"
 #include "test/core/iomgr/endpoint_tests.h"
 #include "test/core/util/test_config.h"
diff --git a/test/core/iomgr/timer_heap_test.cc b/test/core/iomgr/timer_heap_test.cc
index f0ab434..ed66b7d 100644
--- a/test/core/iomgr/timer_heap_test.cc
+++ b/test/core/iomgr/timer_heap_test.cc
@@ -28,8 +28,8 @@
 
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
-#include <grpc/support/useful.h>
 
+#include "src/core/lib/gpr/useful.h"
 #include "test/core/util/test_config.h"
 
 static gpr_atm random_deadline(void) { return rand(); }
diff --git a/test/core/iomgr/udp_server_test.cc b/test/core/iomgr/udp_server_test.cc
index 09f0283..4c92a6b 100644
--- a/test/core/iomgr/udp_server_test.cc
+++ b/test/core/iomgr/udp_server_test.cc
@@ -33,9 +33,9 @@
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/ev_posix.h"
 #include "src/core/lib/iomgr/iomgr.h"
 #include "src/core/lib/iomgr/socket_factory_posix.h"
diff --git a/test/core/iomgr/wakeup_fd_cv_test.cc b/test/core/iomgr/wakeup_fd_cv_test.cc
index c092a8f..2d64520 100644
--- a/test/core/iomgr/wakeup_fd_cv_test.cc
+++ b/test/core/iomgr/wakeup_fd_cv_test.cc
@@ -25,7 +25,6 @@
 #include <grpc/support/log.h>
 #include <grpc/support/thd.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/gpr/env.h"
 #include "src/core/lib/iomgr/ev_posix.h"
diff --git a/test/core/json/json_rewrite.cc b/test/core/json/json_rewrite.cc
index 6891a57..0319d15 100644
--- a/test/core/json/json_rewrite.cc
+++ b/test/core/json/json_rewrite.cc
@@ -20,11 +20,11 @@
 #include <stdlib.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/cmdline.h>
 #include <grpc/support/log.h>
 
 #include "src/core/lib/json/json_reader.h"
 #include "src/core/lib/json/json_writer.h"
+#include "test/core/util/cmdline.h"
 
 typedef struct json_writer_userdata {
   FILE* out;
diff --git a/test/core/json/json_rewrite_test.cc b/test/core/json/json_rewrite_test.cc
index 3104afc..8846d46 100644
--- a/test/core/json/json_rewrite_test.cc
+++ b/test/core/json/json_rewrite_test.cc
@@ -21,9 +21,9 @@
 
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
-#include <grpc/support/useful.h>
 #include "test/core/util/test_config.h"
 
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/json/json_reader.h"
 #include "src/core/lib/json/json_writer.h"
 
diff --git a/test/core/json/json_stream_error_test.cc b/test/core/json/json_stream_error_test.cc
index b367d3f..00288d6 100644
--- a/test/core/json/json_stream_error_test.cc
+++ b/test/core/json/json_stream_error_test.cc
@@ -21,7 +21,6 @@
 
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
-#include <grpc/support/useful.h>
 #include "test/core/util/test_config.h"
 
 #include "src/core/lib/json/json_reader.h"
diff --git a/test/core/json/json_test.cc b/test/core/json/json_test.cc
index 902f1cd..7f1dbb7 100644
--- a/test/core/json/json_test.cc
+++ b/test/core/json/json_test.cc
@@ -21,8 +21,8 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
 #include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/json/json.h"
 
 #include "test/core/util/test_config.h"
diff --git a/test/core/memory_usage/client.cc b/test/core/memory_usage/client.cc
index ca84143..4f2ca9e 100644
--- a/test/core/memory_usage/client.cc
+++ b/test/core/memory_usage/client.cc
@@ -24,12 +24,13 @@
 #include <grpc/byte_buffer.h>
 #include <grpc/byte_buffer_reader.h>
 #include <grpc/support/alloc.h>
-#include <grpc/support/cmdline.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 #include "src/core/lib/gpr/env.h"
 #include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gpr/useful.h"
+
+#include "test/core/util/cmdline.h"
 #include "test/core/util/memory_counters.h"
 #include "test/core/util/test_config.h"
 
diff --git a/test/core/memory_usage/memory_usage_test.cc b/test/core/memory_usage/memory_usage_test.cc
index fb6d290..cc3528b 100644
--- a/test/core/memory_usage/memory_usage_test.cc
+++ b/test/core/memory_usage/memory_usage_test.cc
@@ -20,11 +20,12 @@
 #include <string.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/subprocess.h>
+
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "test/core/util/port.h"
+#include "test/core/util/subprocess.h"
 
 int main(int argc, char** argv) {
   char* me = argv[0];
diff --git a/test/core/memory_usage/server.cc b/test/core/memory_usage/server.cc
index 45aeaea..a276102 100644
--- a/test/core/memory_usage/server.cc
+++ b/test/core/memory_usage/server.cc
@@ -30,11 +30,12 @@
 #endif
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/cmdline.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
+
+#include "src/core/lib/gpr/host_port.h"
 #include "test/core/end2end/data/ssl_test_data.h"
+#include "test/core/util/cmdline.h"
 #include "test/core/util/memory_counters.h"
 #include "test/core/util/port.h"
 #include "test/core/util/test_config.h"
diff --git a/test/core/network_benchmarks/low_level_ping_pong.cc b/test/core/network_benchmarks/low_level_ping_pong.cc
index fb982a1..8fd2c75 100644
--- a/test/core/network_benchmarks/low_level_ping_pong.cc
+++ b/test/core/network_benchmarks/low_level_ping_pong.cc
@@ -35,13 +35,14 @@
 #include <sys/socket.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/cmdline.h>
 #include <grpc/support/log.h>
 #include <grpc/support/thd.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
+
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/error.h"
 #include "src/core/lib/iomgr/socket_utils_posix.h"
+#include "test/core/util/cmdline.h"
 #include "test/core/util/histogram.h"
 
 typedef struct fd_pair {
diff --git a/test/core/security/BUILD b/test/core/security/BUILD
index 7cd3ae5..425c617 100644
--- a/test/core/security/BUILD
+++ b/test/core/security/BUILD
@@ -110,6 +110,7 @@
     deps = [
         "//:gpr",
         "//:grpc",
+        "//test/core/util:grpc_test_util",
     ],
 )
 
@@ -121,6 +122,7 @@
         ":oauth2_utils",
         "//:gpr",
         "//:grpc",
+        "//test/core/util:grpc_test_util",
     ],
 )
 
@@ -131,5 +133,6 @@
     deps = [
         "//:gpr",
         "//:grpc",
+        "//test/core/util:grpc_test_util",
     ],
 )
diff --git a/test/core/security/create_jwt.cc b/test/core/security/create_jwt.cc
index 56ae9c8..bb8227f 100644
--- a/test/core/security/create_jwt.cc
+++ b/test/core/security/create_jwt.cc
@@ -24,9 +24,10 @@
 
 #include <grpc/slice.h>
 #include <grpc/support/alloc.h>
-#include <grpc/support/cmdline.h>
 #include <grpc/support/log.h>
 
+#include "test/core/util/cmdline.h"
+
 void create_jwt(const char* json_key_file_path, const char* service_url,
                 const char* scope) {
   grpc_auth_json_key key;
diff --git a/test/core/security/fetch_oauth2.cc b/test/core/security/fetch_oauth2.cc
index cb28a04..b0fa514 100644
--- a/test/core/security/fetch_oauth2.cc
+++ b/test/core/security/fetch_oauth2.cc
@@ -23,13 +23,13 @@
 #include <grpc/grpc_security.h>
 #include <grpc/slice.h>
 #include <grpc/support/alloc.h>
-#include <grpc/support/cmdline.h>
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
 
 #include "src/core/lib/iomgr/load_file.h"
 #include "src/core/lib/security/credentials/credentials.h"
 #include "test/core/security/oauth2_utils.h"
+#include "test/core/util/cmdline.h"
 
 static grpc_call_credentials* create_refresh_token_creds(
     const char* json_refresh_token_file_path) {
diff --git a/test/core/security/print_google_default_creds_token.cc b/test/core/security/print_google_default_creds_token.cc
index a90f997..828694a 100644
--- a/test/core/security/print_google_default_creds_token.cc
+++ b/test/core/security/print_google_default_creds_token.cc
@@ -23,7 +23,6 @@
 #include <grpc/grpc_security.h>
 #include <grpc/slice.h>
 #include <grpc/support/alloc.h>
-#include <grpc/support/cmdline.h>
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
 
@@ -31,6 +30,7 @@
 #include "src/core/lib/security/credentials/composite/composite_credentials.h"
 #include "src/core/lib/security/credentials/credentials.h"
 #include "src/core/lib/slice/slice_string_helpers.h"
+#include "test/core/util/cmdline.h"
 
 typedef struct {
   gpr_mu* mu;
diff --git a/test/core/security/secure_endpoint_test.cc b/test/core/security/secure_endpoint_test.cc
index 38c78fe..8e92a21 100644
--- a/test/core/security/secure_endpoint_test.cc
+++ b/test/core/security/secure_endpoint_test.cc
@@ -24,7 +24,7 @@
 #include <grpc/grpc.h>
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
-#include <grpc/support/useful.h>
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/endpoint_pair.h"
 #include "src/core/lib/iomgr/iomgr.h"
 #include "src/core/lib/security/transport/secure_endpoint.h"
diff --git a/test/core/security/security_connector_test.cc b/test/core/security/security_connector_test.cc
index 6eaef2b..e4731fb 100644
--- a/test/core/security/security_connector_test.cc
+++ b/test/core/security/security_connector_test.cc
@@ -23,7 +23,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/gpr/env.h"
 #include "src/core/lib/gpr/string.h"
diff --git a/test/core/security/verify_jwt.cc b/test/core/security/verify_jwt.cc
index 5d32ce0..747508f 100644
--- a/test/core/security/verify_jwt.cc
+++ b/test/core/security/verify_jwt.cc
@@ -23,11 +23,11 @@
 #include <grpc/grpc_security.h>
 #include <grpc/slice.h>
 #include <grpc/support/alloc.h>
-#include <grpc/support/cmdline.h>
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
 
 #include "src/core/lib/security/credentials/jwt/jwt_verifier.h"
+#include "test/core/util/cmdline.h"
 
 typedef struct {
   grpc_pollset* pollset;
diff --git a/test/core/slice/slice_string_helpers_test.cc b/test/core/slice/slice_string_helpers_test.cc
index 1e38f8d..860a1bf 100644
--- a/test/core/slice/slice_string_helpers_test.cc
+++ b/test/core/slice/slice_string_helpers_test.cc
@@ -26,7 +26,6 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/gpr/string.h"
 #include "test/core/util/test_config.h"
diff --git a/test/core/surface/channel_create_test.cc b/test/core/surface/channel_create_test.cc
index 37247f8..56f4f60 100644
--- a/test/core/surface/channel_create_test.cc
+++ b/test/core/surface/channel_create_test.cc
@@ -29,8 +29,8 @@
 void test_unknown_scheme_target(void) {
   grpc_channel* chan;
   /* avoid default prefix */
-  grpc_resolver_registry_shutdown();
-  grpc_resolver_registry_init();
+  grpc_core::ResolverRegistry::Builder::ShutdownRegistry();
+  grpc_core::ResolverRegistry::Builder::InitRegistry();
 
   chan = grpc_insecure_channel_create("blah://blah", nullptr, nullptr);
   GPR_ASSERT(chan != nullptr);
diff --git a/test/core/surface/completion_queue_test.cc b/test/core/surface/completion_queue_test.cc
index fefbb3c..6812914 100644
--- a/test/core/surface/completion_queue_test.cc
+++ b/test/core/surface/completion_queue_test.cc
@@ -21,7 +21,7 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/iomgr.h"
 #include "test/core/util/test_config.h"
 
diff --git a/test/core/surface/completion_queue_threading_test.cc b/test/core/surface/completion_queue_threading_test.cc
index 4a9e818..d97e98b 100644
--- a/test/core/surface/completion_queue_threading_test.cc
+++ b/test/core/surface/completion_queue_threading_test.cc
@@ -22,7 +22,8 @@
 #include <grpc/support/log.h>
 #include <grpc/support/thd.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
+
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/iomgr.h"
 #include "test/core/util/test_config.h"
 
diff --git a/test/core/surface/num_external_connectivity_watchers_test.cc b/test/core/surface/num_external_connectivity_watchers_test.cc
index 9cdd299..e48fd7f 100644
--- a/test/core/surface/num_external_connectivity_watchers_test.cc
+++ b/test/core/surface/num_external_connectivity_watchers_test.cc
@@ -19,11 +19,11 @@
 #include <grpc/grpc.h>
 #include <grpc/grpc_security.h>
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/thd.h>
 
 #include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/iomgr/exec_ctx.h"
 #include "test/core/end2end/data/ssl_test_data.h"
 #include "test/core/util/port.h"
diff --git a/test/core/surface/public_headers_must_be_c89.c b/test/core/surface/public_headers_must_be_c89.c
index a1d736f..14267c1 100644
--- a/test/core/surface/public_headers_must_be_c89.c
+++ b/test/core/surface/public_headers_must_be_c89.c
@@ -46,21 +46,15 @@
 #include <grpc/status.h>
 #include <grpc/support/alloc.h>
 #include <grpc/support/atm.h>
-#include <grpc/support/avl.h>
-#include <grpc/support/cmdline.h>
 #include <grpc/support/cpu.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/port_platform.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/subprocess.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/sync_custom.h>
 #include <grpc/support/sync_generic.h>
 #include <grpc/support/thd.h>
 #include <grpc/support/time.h>
-#include <grpc/support/tls.h>
-#include <grpc/support/useful.h>
 #include <grpc/support/workaround_list.h>
 
 #include <stdio.h>
@@ -240,27 +234,8 @@
   printf("%lx", (unsigned long) gpr_free_aligned);
   printf("%lx", (unsigned long) gpr_set_allocation_functions);
   printf("%lx", (unsigned long) gpr_get_allocation_functions);
-  printf("%lx", (unsigned long) gpr_avl_create);
-  printf("%lx", (unsigned long) gpr_avl_ref);
-  printf("%lx", (unsigned long) gpr_avl_unref);
-  printf("%lx", (unsigned long) gpr_avl_add);
-  printf("%lx", (unsigned long) gpr_avl_remove);
-  printf("%lx", (unsigned long) gpr_avl_get);
-  printf("%lx", (unsigned long) gpr_avl_maybe_get);
-  printf("%lx", (unsigned long) gpr_avl_is_empty);
-  printf("%lx", (unsigned long) gpr_cmdline_create);
-  printf("%lx", (unsigned long) gpr_cmdline_add_int);
-  printf("%lx", (unsigned long) gpr_cmdline_add_flag);
-  printf("%lx", (unsigned long) gpr_cmdline_add_string);
-  printf("%lx", (unsigned long) gpr_cmdline_on_extra_arg);
-  printf("%lx", (unsigned long) gpr_cmdline_set_survive_failure);
-  printf("%lx", (unsigned long) gpr_cmdline_parse);
-  printf("%lx", (unsigned long) gpr_cmdline_destroy);
-  printf("%lx", (unsigned long) gpr_cmdline_usage_string);
   printf("%lx", (unsigned long) gpr_cpu_num_cores);
   printf("%lx", (unsigned long) gpr_cpu_current_cpu);
-  printf("%lx", (unsigned long) gpr_join_host_port);
-  printf("%lx", (unsigned long) gpr_split_host_port);
   printf("%lx", (unsigned long) gpr_log_severity_string);
   printf("%lx", (unsigned long) gpr_log);
   printf("%lx", (unsigned long) gpr_log_message);
@@ -269,11 +244,6 @@
   printf("%lx", (unsigned long) gpr_set_log_function);
   printf("%lx", (unsigned long) gpr_strdup);
   printf("%lx", (unsigned long) gpr_asprintf);
-  printf("%lx", (unsigned long) gpr_subprocess_binary_extension);
-  printf("%lx", (unsigned long) gpr_subprocess_create);
-  printf("%lx", (unsigned long) gpr_subprocess_destroy);
-  printf("%lx", (unsigned long) gpr_subprocess_join);
-  printf("%lx", (unsigned long) gpr_subprocess_interrupt);
   printf("%lx", (unsigned long) gpr_mu_init);
   printf("%lx", (unsigned long) gpr_mu_destroy);
   printf("%lx", (unsigned long) gpr_mu_lock);
diff --git a/test/core/surface/secure_channel_create_test.cc b/test/core/surface/secure_channel_create_test.cc
index fa22cd6..c10d679 100644
--- a/test/core/surface/secure_channel_create_test.cc
+++ b/test/core/surface/secure_channel_create_test.cc
@@ -28,8 +28,8 @@
 #include "test/core/util/test_config.h"
 
 void test_unknown_scheme_target(void) {
-  grpc_resolver_registry_shutdown();
-  grpc_resolver_registry_init();
+  grpc_core::ResolverRegistry::Builder::ShutdownRegistry();
+  grpc_core::ResolverRegistry::Builder::InitRegistry();
   grpc_channel_credentials* creds =
       grpc_fake_transport_security_credentials_create();
   grpc_channel* chan =
diff --git a/test/core/surface/sequential_connectivity_test.cc b/test/core/surface/sequential_connectivity_test.cc
index ac49bd9..1ac0a5e 100644
--- a/test/core/surface/sequential_connectivity_test.cc
+++ b/test/core/surface/sequential_connectivity_test.cc
@@ -19,11 +19,11 @@
 #include <grpc/grpc.h>
 #include <grpc/grpc_security.h>
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/thd.h>
 
 #include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/iomgr/exec_ctx.h"
 #include "test/core/end2end/data/ssl_test_data.h"
 #include "test/core/util/port.h"
diff --git a/test/core/surface/server_chttp2_test.cc b/test/core/surface/server_chttp2_test.cc
index 96eaa6a..f0412d0 100644
--- a/test/core/surface/server_chttp2_test.cc
+++ b/test/core/surface/server_chttp2_test.cc
@@ -19,9 +19,10 @@
 #include <grpc/grpc.h>
 #include <grpc/grpc_security.h>
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
+
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/security/credentials/credentials.h"
 #include "src/core/lib/security/credentials/fake/fake_credentials.h"
 #include "src/core/tsi/fake_transport_security.h"
diff --git a/test/core/surface/server_test.cc b/test/core/surface/server_test.cc
index 969b8cb..3b08efb 100644
--- a/test/core/surface/server_test.cc
+++ b/test/core/surface/server_test.cc
@@ -19,9 +19,10 @@
 #include <grpc/grpc.h>
 #include <grpc/grpc_security.h>
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
+
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/iomgr/resolve_address.h"
 #include "src/core/lib/security/credentials/fake/fake_credentials.h"
 #include "test/core/util/port.h"
diff --git a/test/core/transport/bdp_estimator_test.cc b/test/core/transport/bdp_estimator_test.cc
index 3afcad7..c7e6b2b 100644
--- a/test/core/transport/bdp_estimator_test.cc
+++ b/test/core/transport/bdp_estimator_test.cc
@@ -22,10 +22,12 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
+
 #include <gtest/gtest.h>
 #include <limits.h>
+
 #include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/timer_manager.h"
 #include "test/core/util/test_config.h"
 
diff --git a/test/core/transport/byte_stream_test.cc b/test/core/transport/byte_stream_test.cc
index 2aab6e9..6947d50 100644
--- a/test/core/transport/byte_stream_test.cc
+++ b/test/core/transport/byte_stream_test.cc
@@ -21,8 +21,8 @@
 #include <grpc/grpc.h>
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
-#include <grpc/support/useful.h>
 
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/slice/slice_internal.h"
 
 #include "test/core/util/test_config.h"
diff --git a/test/core/transport/pid_controller_test.cc b/test/core/transport/pid_controller_test.cc
index 1a499c2..8d2cec4 100644
--- a/test/core/transport/pid_controller_test.cc
+++ b/test/core/transport/pid_controller_test.cc
@@ -24,7 +24,7 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
+
 #include <gtest/gtest.h>
 #include "src/core/lib/gpr/string.h"
 #include "test/core/util/test_config.h"
diff --git a/test/core/transport/timeout_encoding_test.cc b/test/core/transport/timeout_encoding_test.cc
index e94be13..26e0785 100644
--- a/test/core/transport/timeout_encoding_test.cc
+++ b/test/core/transport/timeout_encoding_test.cc
@@ -24,9 +24,10 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
+
 #include "src/core/lib/gpr/murmur_hash.h"
 #include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gpr/useful.h"
 #include "test/core/util/test_config.h"
 
 #define LOG_TEST(x) gpr_log(GPR_INFO, "%s", x)
diff --git a/test/core/tsi/transport_security_test.cc b/test/core/tsi/transport_security_test.cc
index 42e17df..5c92912 100644
--- a/test/core/tsi/transport_security_test.cc
+++ b/test/core/tsi/transport_security_test.cc
@@ -23,11 +23,11 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
 
 #include <openssl/crypto.h>
 
 #include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/tsi/fake_transport_security.h"
 #include "src/core/tsi/ssl_transport_security.h"
 #include "test/core/util/test_config.h"
diff --git a/test/core/util/BUILD b/test/core/util/BUILD
index 2237cfc..886cfdd 100644
--- a/test/core/util/BUILD
+++ b/test/core/util/BUILD
@@ -51,6 +51,7 @@
 grpc_cc_library(
     name = "grpc_test_util_base",
     srcs = [
+        "cmdline.cc",
         "grpc_profiler.cc",
         "histogram.cc",
         "mock_endpoint.cc",
@@ -61,11 +62,14 @@
         "port_server_client.cc",
         "reconnect_server.cc",
         "slice_splitter.cc",
+        "subprocess_posix.cc",
+        "subprocess_windows.cc",
         "test_tcp_server.cc",
         "tracer_util.cc",
         "trickle_endpoint.cc",
     ],
     hdrs = [
+        "cmdline.h",
         "grpc_profiler.h",
         "histogram.h",
         "mock_endpoint.h",
@@ -74,6 +78,7 @@
         "port.h",
         "port_server_client.h",
         "reconnect_server.h",
+        "subprocess.h",
         "slice_splitter.h",
         "test_tcp_server.h",
         "tracer_util.h",
@@ -109,6 +114,16 @@
     ],
 )
 
+grpc_cc_test(
+    name = "cmdline_test",
+    srcs = ["cmdline_test.cc"],
+    language = "C++",
+    deps = [
+        ":grpc_test_util",
+        "//:gpr",
+    ],
+)
+
 grpc_cc_library(
     name = "fuzzer_corpus_test",
     testonly = 1,
diff --git a/src/core/lib/gpr/cmdline.cc b/test/core/util/cmdline.cc
similarity index 99%
rename from src/core/lib/gpr/cmdline.cc
rename to test/core/util/cmdline.cc
index 4118f9a..20bce27 100644
--- a/src/core/lib/gpr/cmdline.cc
+++ b/test/core/util/cmdline.cc
@@ -16,7 +16,7 @@
  *
  */
 
-#include <grpc/support/cmdline.h>
+#include "test/core/util/cmdline.h"
 
 #include <limits.h>
 #include <stdio.h>
diff --git a/include/grpc/support/cmdline.h b/test/core/util/cmdline.h
similarity index 69%
rename from include/grpc/support/cmdline.h
rename to test/core/util/cmdline.h
index c34a109..3ae35d6 100644
--- a/include/grpc/support/cmdline.h
+++ b/test/core/util/cmdline.h
@@ -16,15 +16,11 @@
  *
  */
 
-#ifndef GRPC_SUPPORT_CMDLINE_H
-#define GRPC_SUPPORT_CMDLINE_H
+#ifndef GRPC_TEST_CORE_UTIL_CMDLINE_H
+#define GRPC_TEST_CORE_UTIL_CMDLINE_H
 
 #include <grpc/support/port_platform.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /** Simple command line parser.
 
    Supports flags that can be specified as -foo, --foo, --no-foo, -no-foo, etc
@@ -55,34 +51,30 @@
 
 /** Construct a command line parser: takes a short description of the tool
    doing the parsing */
-GPRAPI gpr_cmdline* gpr_cmdline_create(const char* description);
+gpr_cmdline* gpr_cmdline_create(const char* description);
 /** Add an integer parameter, with a name (used on the command line) and some
    helpful text (used in the command usage) */
-GPRAPI void gpr_cmdline_add_int(gpr_cmdline* cl, const char* name,
-                                const char* help, int* value);
+void gpr_cmdline_add_int(gpr_cmdline* cl, const char* name, const char* help,
+                         int* value);
 /** The same, for a boolean flag */
-GPRAPI void gpr_cmdline_add_flag(gpr_cmdline* cl, const char* name,
-                                 const char* help, int* value);
+void gpr_cmdline_add_flag(gpr_cmdline* cl, const char* name, const char* help,
+                          int* value);
 /** And for a string */
-GPRAPI void gpr_cmdline_add_string(gpr_cmdline* cl, const char* name,
-                                   const char* help, const char** value);
+void gpr_cmdline_add_string(gpr_cmdline* cl, const char* name, const char* help,
+                            const char** value);
 /** Set a callback for non-named arguments */
-GPRAPI void gpr_cmdline_on_extra_arg(
+void gpr_cmdline_on_extra_arg(
     gpr_cmdline* cl, const char* name, const char* help,
     void (*on_extra_arg)(void* user_data, const char* arg), void* user_data);
 /** Enable surviving failure: default behavior is to exit the process */
-GPRAPI void gpr_cmdline_set_survive_failure(gpr_cmdline* cl);
+void gpr_cmdline_set_survive_failure(gpr_cmdline* cl);
 /** Parse the command line; returns 1 on success, on failure either dies
    (by default) or returns 0 if gpr_cmdline_set_survive_failure() has been
    called */
-GPRAPI int gpr_cmdline_parse(gpr_cmdline* cl, int argc, char** argv);
+int gpr_cmdline_parse(gpr_cmdline* cl, int argc, char** argv);
 /** Destroy the parser */
-GPRAPI void gpr_cmdline_destroy(gpr_cmdline* cl);
+void gpr_cmdline_destroy(gpr_cmdline* cl);
 /** Get a string describing usage */
-GPRAPI char* gpr_cmdline_usage_string(gpr_cmdline* cl, const char* argv0);
+char* gpr_cmdline_usage_string(gpr_cmdline* cl, const char* argv0);
 
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_SUPPORT_CMDLINE_H */
+#endif /* GRPC_TEST_CORE_UTIL_CMDLINE_H */
diff --git a/test/core/gpr/cmdline_test.cc b/test/core/util/cmdline_test.cc
similarity index 99%
rename from test/core/gpr/cmdline_test.cc
rename to test/core/util/cmdline_test.cc
index 172efda..9f5ad88 100644
--- a/test/core/gpr/cmdline_test.cc
+++ b/test/core/util/cmdline_test.cc
@@ -16,13 +16,13 @@
  *
  */
 
-#include <grpc/support/cmdline.h>
-
 #include <string.h>
 
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
-#include <grpc/support/useful.h>
+
+#include "src/core/lib/gpr/useful.h"
+#include "test/core/util/cmdline.h"
 #include "test/core/util/test_config.h"
 
 #define LOG_TEST() gpr_log(GPR_INFO, "test at %s:%d", __FILE__, __LINE__)
diff --git a/test/core/util/fuzzer_one_entry_runner.sh b/test/core/util/fuzzer_one_entry_runner.sh
index 2634a1b..7c471af 100755
--- a/test/core/util/fuzzer_one_entry_runner.sh
+++ b/test/core/util/fuzzer_one_entry_runner.sh
@@ -15,4 +15,4 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-$1 $2
+"$1" "$2"
diff --git a/test/core/util/histogram.cc b/test/core/util/histogram.cc
index 2f916f8..b251827 100644
--- a/test/core/util/histogram.cc
+++ b/test/core/util/histogram.cc
@@ -16,6 +16,8 @@
  *
  */
 
+#include "test/core/util/histogram.h"
+
 #include <math.h>
 #include <stddef.h>
 #include <string.h>
@@ -23,9 +25,8 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/port_platform.h>
-#include <grpc/support/useful.h>
 
-#include "test/core/util/histogram.h"
+#include "src/core/lib/gpr/useful.h"
 
 /* Histograms are stored with exponentially increasing bucket sizes.
    The first bucket is [0, m) where m = 1 + resolution
diff --git a/test/core/util/reconnect_server.cc b/test/core/util/reconnect_server.cc
index bcafc4e..b5a7749 100644
--- a/test/core/util/reconnect_server.cc
+++ b/test/core/util/reconnect_server.cc
@@ -20,11 +20,12 @@
 
 #include <grpc/grpc.h>
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/time.h>
 #include <string.h>
+
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/iomgr/endpoint.h"
 #include "src/core/lib/iomgr/sockaddr.h"
 #include "src/core/lib/iomgr/tcp_server.h"
diff --git a/test/core/util/run_with_poller.sh b/test/core/util/run_with_poller.sh
index 0579145..382a63e 100755
--- a/test/core/util/run_with_poller.sh
+++ b/test/core/util/run_with_poller.sh
@@ -16,4 +16,4 @@
 set -ex
 export GRPC_POLL_STRATEGY=$1
 shift
-$@
+"$@"
diff --git a/test/core/util/slice_splitter.cc b/test/core/util/slice_splitter.cc
index 7225b6d..c92fc0a 100644
--- a/test/core/util/slice_splitter.cc
+++ b/test/core/util/slice_splitter.cc
@@ -21,7 +21,8 @@
 #include <string.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/support/useful.h>
+
+#include "src/core/lib/gpr/useful.h"
 
 const char* grpc_slice_split_mode_name(grpc_slice_split_mode mode) {
   switch (mode) {
diff --git a/include/grpc/support/subprocess.h b/test/core/util/subprocess.h
similarity index 63%
rename from include/grpc/support/subprocess.h
rename to test/core/util/subprocess.h
index 175f7b5..c7fe9af 100644
--- a/include/grpc/support/subprocess.h
+++ b/test/core/util/subprocess.h
@@ -16,29 +16,21 @@
  *
  */
 
-#ifndef GRPC_SUPPORT_SUBPROCESS_H
-#define GRPC_SUPPORT_SUBPROCESS_H
+#ifndef GRPC_TEST_CORE_UTIL_SUBPROCESS_H
+#define GRPC_TEST_CORE_UTIL_SUBPROCESS_H
 
 #include <grpc/support/port_platform.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 typedef struct gpr_subprocess gpr_subprocess;
 
 /** .exe on windows, empty on unices */
-GPRAPI const char* gpr_subprocess_binary_extension();
+const char* gpr_subprocess_binary_extension();
 
-GPRAPI gpr_subprocess* gpr_subprocess_create(int argc, const char** argv);
+gpr_subprocess* gpr_subprocess_create(int argc, const char** argv);
 /** if subprocess has not been joined, kill it */
-GPRAPI void gpr_subprocess_destroy(gpr_subprocess* p);
+void gpr_subprocess_destroy(gpr_subprocess* p);
 /** returns exit status; can be called at most once */
-GPRAPI int gpr_subprocess_join(gpr_subprocess* p);
-GPRAPI void gpr_subprocess_interrupt(gpr_subprocess* p);
+int gpr_subprocess_join(gpr_subprocess* p);
+void gpr_subprocess_interrupt(gpr_subprocess* p);
 
-#ifdef __cplusplus
-}  // extern "C"
-#endif
-
-#endif /* GRPC_SUPPORT_SUBPROCESS_H */
+#endif /* GRPC_TEST_CORE_UTIL_SUBPROCESS_H */
diff --git a/src/core/lib/gpr/subprocess_posix.cc b/test/core/util/subprocess_posix.cc
similarity index 97%
rename from src/core/lib/gpr/subprocess_posix.cc
rename to test/core/util/subprocess_posix.cc
index dc046b6..0f6c997 100644
--- a/src/core/lib/gpr/subprocess_posix.cc
+++ b/test/core/util/subprocess_posix.cc
@@ -20,8 +20,6 @@
 
 #ifdef GPR_POSIX_SUBPROCESS
 
-#include <grpc/support/subprocess.h>
-
 #include <assert.h>
 #include <errno.h>
 #include <signal.h>
@@ -36,6 +34,8 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 
+#include "test/core/util/subprocess.h"
+
 struct gpr_subprocess {
   int pid;
   bool joined;
diff --git a/src/core/lib/gpr/subprocess_windows.cc b/test/core/util/subprocess_windows.cc
similarity index 98%
rename from src/core/lib/gpr/subprocess_windows.cc
rename to test/core/util/subprocess_windows.cc
index 1947d47..d329524 100644
--- a/src/core/lib/gpr/subprocess_windows.cc
+++ b/test/core/util/subprocess_windows.cc
@@ -26,9 +26,9 @@
 
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
-#include <grpc/support/subprocess.h>
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/gpr/string_windows.h"
+#include "test/core/util/subprocess.h"
 
 struct gpr_subprocess {
   PROCESS_INFORMATION pi;
diff --git a/test/core/util/test_config.cc b/test/core/util/test_config.cc
index 6b41044..e381be6 100644
--- a/test/core/util/test_config.cc
+++ b/test/core/util/test_config.cc
@@ -29,6 +29,7 @@
 
 #include "src/core/lib/gpr/env.h"
 #include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gpr/useful.h"
 
 int64_t g_fixture_slowdown_factor = 1;
 int64_t g_poller_slowdown_factor = 1;
@@ -196,7 +197,6 @@
 #elif GPR_POSIX_CRASH_HANDLER
 #include <errno.h>
 #include <execinfo.h>
-#include <grpc/support/useful.h>
 #include <stdio.h>
 #include <string.h>
 
diff --git a/test/core/util/test_tcp_server.cc b/test/core/util/test_tcp_server.cc
index 5f6af4e..b1b5297 100644
--- a/test/core/util/test_tcp_server.cc
+++ b/test/core/util/test_tcp_server.cc
@@ -22,11 +22,12 @@
 
 #include <grpc/grpc.h>
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/sync.h>
 #include <grpc/support/time.h>
 #include <string.h>
+
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/iomgr/endpoint.h"
 #include "src/core/lib/iomgr/resolve_address.h"
 #include "src/core/lib/iomgr/tcp_server.h"
diff --git a/test/core/util/trickle_endpoint.cc b/test/core/util/trickle_endpoint.cc
index f95ed62..54e1cf1 100644
--- a/test/core/util/trickle_endpoint.cc
+++ b/test/core/util/trickle_endpoint.cc
@@ -26,7 +26,8 @@
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
+
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/slice/slice_internal.h"
 
 #define WRITE_BUFFER_SIZE (2 * 1024 * 1024)
diff --git a/test/cpp/client/client_channel_stress_test.cc b/test/cpp/client/client_channel_stress_test.cc
index 80d1583..bb8553f 100644
--- a/test/cpp/client/client_channel_stress_test.cc
+++ b/test/cpp/client/client_channel_stress_test.cc
@@ -36,6 +36,7 @@
 #include <grpc/support/time.h>
 
 #include "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h"
+#include "src/core/lib/gprpp/ref_counted_ptr.h"
 #include "src/core/lib/iomgr/sockaddr.h"
 
 #include "test/core/util/port.h"
@@ -230,8 +231,7 @@
     }
     grpc_arg fake_addresses = grpc_lb_addresses_create_channel_arg(addresses);
     grpc_channel_args fake_result = {1, &fake_addresses};
-    grpc_fake_resolver_response_generator_set_response(response_generator_,
-                                                       &fake_result);
+    response_generator_->SetResponse(&fake_result);
     grpc_lb_addresses_destroy(addresses);
   }
 
@@ -253,9 +253,10 @@
 
   void CreateStub() {
     ChannelArguments args;
-    response_generator_ = grpc_fake_resolver_response_generator_create();
+    response_generator_ =
+        grpc_core::MakeRefCounted<grpc_core::FakeResolverResponseGenerator>();
     args.SetPointer(GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR,
-                    response_generator_);
+                    response_generator_.get());
     std::ostringstream uri;
     uri << "fake:///servername_not_used";
     channel_ =
@@ -298,7 +299,6 @@
     for (size_t i = 0; i < backends_.size(); ++i) {
       backend_servers_[i].Shutdown();
     }
-    grpc_fake_resolver_response_generator_unref(response_generator_);
   }
 
   std::atomic_bool shutdown_{false};
@@ -310,7 +310,8 @@
   std::vector<std::unique_ptr<BalancerServiceImpl>> balancers_;
   std::vector<ServerThread<BackendServiceImpl>> backend_servers_;
   std::vector<ServerThread<BalancerServiceImpl>> balancer_servers_;
-  grpc_fake_resolver_response_generator* response_generator_;
+  grpc_core::RefCountedPtr<grpc_core::FakeResolverResponseGenerator>
+      response_generator_;
   std::vector<std::thread> client_threads_;
 };
 
diff --git a/test/cpp/common/channel_arguments_test.cc b/test/cpp/common/channel_arguments_test.cc
index f330c01..29e225d 100644
--- a/test/cpp/common/channel_arguments_test.cc
+++ b/test/cpp/common/channel_arguments_test.cc
@@ -20,9 +20,9 @@
 
 #include <grpc++/grpc++.h>
 #include <grpc/grpc.h>
-#include <grpc/support/useful.h>
 #include <gtest/gtest.h>
 
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/exec_ctx.h"
 #include "src/core/lib/iomgr/socket_mutator.h"
 
diff --git a/test/cpp/end2end/OWNERS b/test/cpp/end2end/OWNERS
new file mode 100644
index 0000000..d87b328
--- /dev/null
+++ b/test/cpp/end2end/OWNERS
@@ -0,0 +1,5 @@
+set noparent
+@vjpai
+@yang-g
+@y-zeng
+
diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc
index 44cd81a..482f0cb 100644
--- a/test/cpp/end2end/async_end2end_test.cc
+++ b/test/cpp/end2end/async_end2end_test.cc
@@ -32,9 +32,9 @@
 #include <grpc/support/log.h>
 #include <grpc/support/thd.h>
 #include <grpc/support/time.h>
-#include <grpc/support/tls.h>
 
 #include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/tls.h"
 #include "src/core/lib/iomgr/port.h"
 #include "src/proto/grpc/health/v1/health.grpc.pb.h"
 #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h"
diff --git a/test/cpp/end2end/client_lb_end2end_test.cc b/test/cpp/end2end/client_lb_end2end_test.cc
index b85e286..386d18e 100644
--- a/test/cpp/end2end/client_lb_end2end_test.cc
+++ b/test/cpp/end2end/client_lb_end2end_test.cc
@@ -39,6 +39,8 @@
 #include "src/core/ext/filters/client_channel/subchannel_index.h"
 #include "src/core/lib/backoff/backoff.h"
 #include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gprpp/debug_location.h"
+#include "src/core/lib/gprpp/ref_counted_ptr.h"
 
 #include "src/proto/grpc/testing/echo.grpc.pb.h"
 #include "test/core/util/port.h"
@@ -118,11 +120,11 @@
   }
 
   void SetUp() override {
-    response_generator_ = grpc_fake_resolver_response_generator_create();
+    response_generator_ =
+        grpc_core::MakeRefCounted<grpc_core::FakeResolverResponseGenerator>();
   }
 
   void TearDown() override {
-    grpc_fake_resolver_response_generator_unref(response_generator_);
     for (size_t i = 0; i < servers_.size(); ++i) {
       servers_[i]->Shutdown();
     }
@@ -152,13 +154,30 @@
       grpc_uri_destroy(lb_uri);
       gpr_free(lb_uri_str);
     }
-    const grpc_arg fake_addresses =
-        grpc_lb_addresses_create_channel_arg(addresses);
-    grpc_channel_args* fake_result =
-        grpc_channel_args_copy_and_add(nullptr, &fake_addresses, 1);
-    grpc_fake_resolver_response_generator_set_response(response_generator_,
-                                                       fake_result);
-    grpc_channel_args_destroy(fake_result);
+    grpc_arg fake_addresses = grpc_lb_addresses_create_channel_arg(addresses);
+    grpc_channel_args fake_result = {1, &fake_addresses};
+    response_generator_->SetResponse(&fake_result);
+    grpc_lb_addresses_destroy(addresses);
+  }
+
+  void SetNextResolutionUponError(const std::vector<int>& ports) {
+    grpc_core::ExecCtx exec_ctx;
+    grpc_lb_addresses* addresses =
+        grpc_lb_addresses_create(ports.size(), nullptr);
+    for (size_t i = 0; i < ports.size(); ++i) {
+      char* lb_uri_str;
+      gpr_asprintf(&lb_uri_str, "ipv4:127.0.0.1:%d", ports[i]);
+      grpc_uri* lb_uri = grpc_uri_parse(lb_uri_str, true);
+      GPR_ASSERT(lb_uri != nullptr);
+      grpc_lb_addresses_set_address_from_uri(addresses, i, lb_uri,
+                                             false /* is balancer */,
+                                             "" /* balancer name */, nullptr);
+      grpc_uri_destroy(lb_uri);
+      gpr_free(lb_uri_str);
+    }
+    grpc_arg fake_addresses = grpc_lb_addresses_create_channel_arg(addresses);
+    grpc_channel_args fake_result = {1, &fake_addresses};
+    response_generator_->SetReresolutionResponse(&fake_result);
     grpc_lb_addresses_destroy(addresses);
   }
 
@@ -168,38 +187,51 @@
     return ports;
   }
 
-  void ResetStub(const grpc::string& lb_policy_name,
-                 ChannelArguments args = ChannelArguments()) {
+  std::unique_ptr<grpc::testing::EchoTestService::Stub> BuildStub(
+      const std::shared_ptr<Channel>& channel) {
+    return grpc::testing::EchoTestService::NewStub(channel);
+  }
+
+  std::shared_ptr<Channel> BuildChannel(
+      const grpc::string& lb_policy_name,
+      ChannelArguments args = ChannelArguments()) {
     if (lb_policy_name.size() > 0) {
       args.SetLoadBalancingPolicyName(lb_policy_name);
     }  // else, default to pick first
     args.SetPointer(GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR,
-                    response_generator_);
-    channel_ =
-        CreateCustomChannel("fake:///", InsecureChannelCredentials(), args);
-    stub_ = grpc::testing::EchoTestService::NewStub(channel_);
+                    response_generator_.get());
+    return CreateCustomChannel("fake:///", InsecureChannelCredentials(), args);
   }
 
-  bool SendRpc(EchoResponse* response = nullptr) {
+  bool SendRpc(
+      const std::unique_ptr<grpc::testing::EchoTestService::Stub>& stub,
+      EchoResponse* response = nullptr, int timeout_ms = 1000) {
     const bool local_response = (response == nullptr);
     if (local_response) response = new EchoResponse;
     EchoRequest request;
     request.set_message(kRequestMessage_);
     ClientContext context;
-    Status status = stub_->Echo(&context, request, response);
+    context.set_deadline(grpc_timeout_milliseconds_to_deadline(timeout_ms));
+    Status status = stub->Echo(&context, request, response);
     if (local_response) delete response;
     return status.ok();
   }
 
-  void CheckRpcSendOk() {
+  void CheckRpcSendOk(
+      const std::unique_ptr<grpc::testing::EchoTestService::Stub>& stub,
+      const grpc_core::DebugLocation& location) {
     EchoResponse response;
-    const bool success = SendRpc(&response);
-    EXPECT_TRUE(success);
-    EXPECT_EQ(response.message(), kRequestMessage_);
+    const bool success = SendRpc(stub, &response);
+    if (!success) abort();
+    ASSERT_TRUE(success) << "From " << location.file() << ":"
+                         << location.line();
+    ASSERT_EQ(response.message(), kRequestMessage_)
+        << "From " << location.file() << ":" << location.line();
   }
 
-  void CheckRpcSendFailure() {
-    const bool success = SendRpc();
+  void CheckRpcSendFailure(
+      const std::unique_ptr<grpc::testing::EchoTestService::Stub>& stub) {
+    const bool success = SendRpc(stub);
     EXPECT_FALSE(success);
   }
 
@@ -238,7 +270,7 @@
     }
 
     void Shutdown(bool join = true) {
-      server_->Shutdown();
+      server_->Shutdown(grpc_timeout_milliseconds_to_deadline(0));
       if (join) thread_->join();
     }
   };
@@ -247,9 +279,11 @@
     for (const auto& server : servers_) server->service_.ResetCounters();
   }
 
-  void WaitForServer(size_t server_idx) {
+  void WaitForServer(
+      const std::unique_ptr<grpc::testing::EchoTestService::Stub>& stub,
+      size_t server_idx, const grpc_core::DebugLocation& location) {
     do {
-      CheckRpcSendOk();
+      CheckRpcSendOk(stub, location);
     } while (servers_[server_idx]->service_.request_count() == 0);
     ResetCounters();
   }
@@ -280,10 +314,10 @@
   }
 
   const grpc::string server_host_;
-  std::shared_ptr<Channel> channel_;
   std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_;
   std::vector<std::unique_ptr<ServerData>> servers_;
-  grpc_fake_resolver_response_generator* response_generator_;
+  grpc_core::RefCountedPtr<grpc_core::FakeResolverResponseGenerator>
+      response_generator_;
   const grpc::string kRequestMessage_;
 };
 
@@ -291,14 +325,15 @@
   // Start servers and send one RPC per server.
   const int kNumServers = 3;
   StartServers(kNumServers);
-  ResetStub("");  // test that pick first is the default.
+  auto channel = BuildChannel("");  // test that pick first is the default.
+  auto stub = BuildStub(channel);
   std::vector<int> ports;
   for (size_t i = 0; i < servers_.size(); ++i) {
     ports.emplace_back(servers_[i]->port_);
   }
   SetNextResolution(ports);
   for (size_t i = 0; i < servers_.size(); ++i) {
-    CheckRpcSendOk();
+    CheckRpcSendOk(stub, DEBUG_LOCATION);
   }
   // All requests should have gone to a single server.
   bool found = false;
@@ -312,7 +347,7 @@
   }
   EXPECT_TRUE(found);
   // Check LB policy name for the channel.
-  EXPECT_EQ("pick_first", channel_->GetLoadBalancingPolicyName());
+  EXPECT_EQ("pick_first", channel->GetLoadBalancingPolicyName());
 }
 
 TEST_F(ClientLbEnd2endTest, PickFirstBackOffInitialReconnect) {
@@ -321,15 +356,16 @@
   args.SetInt(GRPC_ARG_INITIAL_RECONNECT_BACKOFF_MS, kInitialBackOffMs);
   const std::vector<int> ports = {grpc_pick_unused_port_or_die()};
   const gpr_timespec t0 = gpr_now(GPR_CLOCK_MONOTONIC);
-  ResetStub("pick_first", args);
+  auto channel = BuildChannel("pick_first", args);
+  auto stub = BuildStub(channel);
   SetNextResolution(ports);
   // The channel won't become connected (there's no server).
-  ASSERT_FALSE(channel_->WaitForConnected(
+  ASSERT_FALSE(channel->WaitForConnected(
       grpc_timeout_milliseconds_to_deadline(kInitialBackOffMs * 2)));
   // Bring up a server on the chosen port.
   StartServers(1, ports);
   // Now it will.
-  ASSERT_TRUE(channel_->WaitForConnected(
+  ASSERT_TRUE(channel->WaitForConnected(
       grpc_timeout_milliseconds_to_deadline(kInitialBackOffMs * 2)));
   const gpr_timespec t1 = gpr_now(GPR_CLOCK_MONOTONIC);
   const grpc_millis waited_ms = gpr_time_to_millis(gpr_time_sub(t1, t0));
@@ -349,14 +385,15 @@
   constexpr int kMinReconnectBackOffMs = 1000;
   args.SetInt(GRPC_ARG_MIN_RECONNECT_BACKOFF_MS, kMinReconnectBackOffMs);
   const std::vector<int> ports = {grpc_pick_unused_port_or_die()};
-  ResetStub("pick_first", args);
+  auto channel = BuildChannel("pick_first", args);
+  auto stub = BuildStub(channel);
   SetNextResolution(ports);
   // Make connection delay a 10% longer than it's willing to in order to make
   // sure we are hitting the codepath that waits for the min reconnect backoff.
   gpr_atm_rel_store(&g_connection_delay_ms, kMinReconnectBackOffMs * 1.10);
   grpc_tcp_client_connect_impl = tcp_client_connect_with_delay;
   const gpr_timespec t0 = gpr_now(GPR_CLOCK_MONOTONIC);
-  channel_->WaitForConnected(
+  channel->WaitForConnected(
       grpc_timeout_milliseconds_to_deadline(kMinReconnectBackOffMs * 2));
   const gpr_timespec t1 = gpr_now(GPR_CLOCK_MONOTONIC);
   const grpc_millis waited_ms = gpr_time_to_millis(gpr_time_sub(t1, t0));
@@ -371,14 +408,16 @@
   // Start servers and send one RPC per server.
   const int kNumServers = 3;
   StartServers(kNumServers);
-  ResetStub("pick_first");
+  auto channel = BuildChannel("pick_first");
+  auto stub = BuildStub(channel);
+
   std::vector<int> ports;
 
   // Perform one RPC against the first server.
   ports.emplace_back(servers_[0]->port_);
   SetNextResolution(ports);
   gpr_log(GPR_INFO, "****** SET [0] *******");
-  CheckRpcSendOk();
+  CheckRpcSendOk(stub, DEBUG_LOCATION);
   EXPECT_EQ(servers_[0]->service_.request_count(), 1);
 
   // An empty update will result in the channel going into TRANSIENT_FAILURE.
@@ -387,7 +426,7 @@
   gpr_log(GPR_INFO, "****** SET none *******");
   grpc_connectivity_state channel_state;
   do {
-    channel_state = channel_->GetState(true /* try to connect */);
+    channel_state = channel->GetState(true /* try to connect */);
   } while (channel_state == GRPC_CHANNEL_READY);
   GPR_ASSERT(channel_state != GRPC_CHANNEL_READY);
   servers_[0]->service_.ResetCounters();
@@ -397,7 +436,7 @@
   ports.emplace_back(servers_[1]->port_);
   SetNextResolution(ports);
   gpr_log(GPR_INFO, "****** SET [1] *******");
-  WaitForServer(1);
+  WaitForServer(stub, 1, DEBUG_LOCATION);
   EXPECT_EQ(servers_[0]->service_.request_count(), 0);
 
   // And again for servers_[2]
@@ -405,26 +444,28 @@
   ports.emplace_back(servers_[2]->port_);
   SetNextResolution(ports);
   gpr_log(GPR_INFO, "****** SET [2] *******");
-  WaitForServer(2);
+  WaitForServer(stub, 2, DEBUG_LOCATION);
   EXPECT_EQ(servers_[0]->service_.request_count(), 0);
   EXPECT_EQ(servers_[1]->service_.request_count(), 0);
 
   // Check LB policy name for the channel.
-  EXPECT_EQ("pick_first", channel_->GetLoadBalancingPolicyName());
+  EXPECT_EQ("pick_first", channel->GetLoadBalancingPolicyName());
 }
 
 TEST_F(ClientLbEnd2endTest, PickFirstUpdateSuperset) {
   // Start servers and send one RPC per server.
   const int kNumServers = 3;
   StartServers(kNumServers);
-  ResetStub("pick_first");
+  auto channel = BuildChannel("pick_first");
+  auto stub = BuildStub(channel);
+
   std::vector<int> ports;
 
   // Perform one RPC against the first server.
   ports.emplace_back(servers_[0]->port_);
   SetNextResolution(ports);
   gpr_log(GPR_INFO, "****** SET [0] *******");
-  CheckRpcSendOk();
+  CheckRpcSendOk(stub, DEBUG_LOCATION);
   EXPECT_EQ(servers_[0]->service_.request_count(), 1);
   servers_[0]->service_.ResetCounters();
 
@@ -434,20 +475,21 @@
   ports.emplace_back(servers_[0]->port_);
   SetNextResolution(ports);
   gpr_log(GPR_INFO, "****** SET superset *******");
-  CheckRpcSendOk();
+  CheckRpcSendOk(stub, DEBUG_LOCATION);
   // We stick to the previously connected server.
-  WaitForServer(0);
+  WaitForServer(stub, 0, DEBUG_LOCATION);
   EXPECT_EQ(0, servers_[1]->service_.request_count());
 
   // Check LB policy name for the channel.
-  EXPECT_EQ("pick_first", channel_->GetLoadBalancingPolicyName());
+  EXPECT_EQ("pick_first", channel->GetLoadBalancingPolicyName());
 }
 
 TEST_F(ClientLbEnd2endTest, PickFirstManyUpdates) {
   // Start servers and send one RPC per server.
   const int kNumServers = 3;
   StartServers(kNumServers);
-  ResetStub("pick_first");
+  auto channel = BuildChannel("pick_first");
+  auto stub = BuildStub(channel);
   std::vector<int> ports;
   for (size_t i = 0; i < servers_.size(); ++i) {
     ports.emplace_back(servers_[i]->port_);
@@ -459,18 +501,19 @@
       std::shuffle(ports.begin(), ports.end(),
                    std::mt19937(std::random_device()()));
       SetNextResolution(ports);
-      if (i % 10 == 0) CheckRpcSendOk();
+      if (i % 10 == 0) CheckRpcSendOk(stub, DEBUG_LOCATION);
     }
   }
   // Check LB policy name for the channel.
-  EXPECT_EQ("pick_first", channel_->GetLoadBalancingPolicyName());
+  EXPECT_EQ("pick_first", channel->GetLoadBalancingPolicyName());
 }
 
 TEST_F(ClientLbEnd2endTest, RoundRobin) {
   // Start servers and send one RPC per server.
   const int kNumServers = 3;
   StartServers(kNumServers);
-  ResetStub("round_robin");
+  auto channel = BuildChannel("round_robin");
+  auto stub = BuildStub(channel);
   std::vector<int> ports;
   for (const auto& server : servers_) {
     ports.emplace_back(server->port_);
@@ -478,15 +521,15 @@
   SetNextResolution(ports);
   // Wait until all backends are ready.
   do {
-    CheckRpcSendOk();
+    CheckRpcSendOk(stub, DEBUG_LOCATION);
   } while (!SeenAllServers());
   ResetCounters();
   // "Sync" to the end of the list. Next sequence of picks will start at the
   // first server (index 0).
-  WaitForServer(servers_.size() - 1);
+  WaitForServer(stub, servers_.size() - 1, DEBUG_LOCATION);
   std::vector<int> connection_order;
   for (size_t i = 0; i < servers_.size(); ++i) {
-    CheckRpcSendOk();
+    CheckRpcSendOk(stub, DEBUG_LOCATION);
     UpdateConnectionOrder(servers_, &connection_order);
   }
   // Backends should be iterated over in the order in which the addresses were
@@ -494,22 +537,23 @@
   const auto expected = std::vector<int>{0, 1, 2};
   EXPECT_EQ(expected, connection_order);
   // Check LB policy name for the channel.
-  EXPECT_EQ("round_robin", channel_->GetLoadBalancingPolicyName());
+  EXPECT_EQ("round_robin", channel->GetLoadBalancingPolicyName());
 }
 
 TEST_F(ClientLbEnd2endTest, RoundRobinUpdates) {
   // Start servers and send one RPC per server.
   const int kNumServers = 3;
   StartServers(kNumServers);
-  ResetStub("round_robin");
+  auto channel = BuildChannel("round_robin");
+  auto stub = BuildStub(channel);
   std::vector<int> ports;
 
   // Start with a single server.
   ports.emplace_back(servers_[0]->port_);
   SetNextResolution(ports);
-  WaitForServer(0);
+  WaitForServer(stub, 0, DEBUG_LOCATION);
   // Send RPCs. They should all go servers_[0]
-  for (size_t i = 0; i < 10; ++i) CheckRpcSendOk();
+  for (size_t i = 0; i < 10; ++i) CheckRpcSendOk(stub, DEBUG_LOCATION);
   EXPECT_EQ(10, servers_[0]->service_.request_count());
   EXPECT_EQ(0, servers_[1]->service_.request_count());
   EXPECT_EQ(0, servers_[2]->service_.request_count());
@@ -523,9 +567,9 @@
   // Wait until update has been processed, as signaled by the second backend
   // receiving a request.
   EXPECT_EQ(0, servers_[1]->service_.request_count());
-  WaitForServer(1);
+  WaitForServer(stub, 1, DEBUG_LOCATION);
 
-  for (size_t i = 0; i < 10; ++i) CheckRpcSendOk();
+  for (size_t i = 0; i < 10; ++i) CheckRpcSendOk(stub, DEBUG_LOCATION);
   EXPECT_EQ(0, servers_[0]->service_.request_count());
   EXPECT_EQ(10, servers_[1]->service_.request_count());
   EXPECT_EQ(0, servers_[2]->service_.request_count());
@@ -535,9 +579,9 @@
   ports.clear();
   ports.emplace_back(servers_[2]->port_);
   SetNextResolution(ports);
-  WaitForServer(2);
+  WaitForServer(stub, 2, DEBUG_LOCATION);
 
-  for (size_t i = 0; i < 10; ++i) CheckRpcSendOk();
+  for (size_t i = 0; i < 10; ++i) CheckRpcSendOk(stub, DEBUG_LOCATION);
   EXPECT_EQ(0, servers_[0]->service_.request_count());
   EXPECT_EQ(0, servers_[1]->service_.request_count());
   EXPECT_EQ(10, servers_[2]->service_.request_count());
@@ -549,12 +593,12 @@
   ports.emplace_back(servers_[1]->port_);
   ports.emplace_back(servers_[2]->port_);
   SetNextResolution(ports);
-  WaitForServer(0);
-  WaitForServer(1);
-  WaitForServer(2);
+  WaitForServer(stub, 0, DEBUG_LOCATION);
+  WaitForServer(stub, 1, DEBUG_LOCATION);
+  WaitForServer(stub, 2, DEBUG_LOCATION);
 
   // Send three RPCs, one per server.
-  for (size_t i = 0; i < 3; ++i) CheckRpcSendOk();
+  for (size_t i = 0; i < 3; ++i) CheckRpcSendOk(stub, DEBUG_LOCATION);
   EXPECT_EQ(1, servers_[0]->service_.request_count());
   EXPECT_EQ(1, servers_[1]->service_.request_count());
   EXPECT_EQ(1, servers_[2]->service_.request_count());
@@ -564,7 +608,7 @@
   SetNextResolution(ports);
   grpc_connectivity_state channel_state;
   do {
-    channel_state = channel_->GetState(true /* try to connect */);
+    channel_state = channel->GetState(true /* try to connect */);
   } while (channel_state == GRPC_CHANNEL_READY);
   GPR_ASSERT(channel_state != GRPC_CHANNEL_READY);
   servers_[0]->service_.ResetCounters();
@@ -573,26 +617,27 @@
   ports.clear();
   ports.emplace_back(servers_[1]->port_);
   SetNextResolution(ports);
-  WaitForServer(1);
-  channel_state = channel_->GetState(false /* try to connect */);
+  WaitForServer(stub, 1, DEBUG_LOCATION);
+  channel_state = channel->GetState(false /* try to connect */);
   GPR_ASSERT(channel_state == GRPC_CHANNEL_READY);
 
   // Check LB policy name for the channel.
-  EXPECT_EQ("round_robin", channel_->GetLoadBalancingPolicyName());
+  EXPECT_EQ("round_robin", channel->GetLoadBalancingPolicyName());
 }
 
 TEST_F(ClientLbEnd2endTest, RoundRobinUpdateInError) {
   const int kNumServers = 3;
   StartServers(kNumServers);
-  ResetStub("round_robin");
+  auto channel = BuildChannel("round_robin");
+  auto stub = BuildStub(channel);
   std::vector<int> ports;
 
   // Start with a single server.
   ports.emplace_back(servers_[0]->port_);
   SetNextResolution(ports);
-  WaitForServer(0);
+  WaitForServer(stub, 0, DEBUG_LOCATION);
   // Send RPCs. They should all go to servers_[0]
-  for (size_t i = 0; i < 10; ++i) SendRpc();
+  for (size_t i = 0; i < 10; ++i) SendRpc(stub);
   EXPECT_EQ(10, servers_[0]->service_.request_count());
   EXPECT_EQ(0, servers_[1]->service_.request_count());
   EXPECT_EQ(0, servers_[2]->service_.request_count());
@@ -603,11 +648,11 @@
   ports.emplace_back(servers_[1]->port_);
   ports.emplace_back(servers_[2]->port_);
   SetNextResolution(ports);
-  WaitForServer(0);
-  WaitForServer(2);
+  WaitForServer(stub, 0, DEBUG_LOCATION);
+  WaitForServer(stub, 2, DEBUG_LOCATION);
 
   // Send three RPCs, one per server.
-  for (size_t i = 0; i < kNumServers; ++i) SendRpc();
+  for (size_t i = 0; i < kNumServers; ++i) SendRpc(stub);
   // The server in shutdown shouldn't receive any.
   EXPECT_EQ(0, servers_[1]->service_.request_count());
 }
@@ -616,7 +661,8 @@
   // Start servers and send one RPC per server.
   const int kNumServers = 3;
   StartServers(kNumServers);
-  ResetStub("round_robin");
+  auto channel = BuildChannel("round_robin");
+  auto stub = BuildStub(channel);
   std::vector<int> ports;
   for (size_t i = 0; i < servers_.size(); ++i) {
     ports.emplace_back(servers_[i]->port_);
@@ -625,10 +671,10 @@
     std::shuffle(ports.begin(), ports.end(),
                  std::mt19937(std::random_device()()));
     SetNextResolution(ports);
-    if (i % 10 == 0) CheckRpcSendOk();
+    if (i % 10 == 0) CheckRpcSendOk(stub, DEBUG_LOCATION);
   }
   // Check LB policy name for the channel.
-  EXPECT_EQ("round_robin", channel_->GetLoadBalancingPolicyName());
+  EXPECT_EQ("round_robin", channel->GetLoadBalancingPolicyName());
 }
 
 TEST_F(ClientLbEnd2endTest, RoundRobinConcurrentUpdates) {
@@ -639,16 +685,21 @@
 TEST_F(ClientLbEnd2endTest, RoundRobinReresolve) {
   // Start servers and send one RPC per server.
   const int kNumServers = 3;
-  std::vector<int> ports;
+  std::vector<int> first_ports;
+  std::vector<int> second_ports;
   for (int i = 0; i < kNumServers; ++i) {
-    ports.push_back(grpc_pick_unused_port_or_die());
+    first_ports.push_back(grpc_pick_unused_port_or_die());
   }
-  StartServers(kNumServers, ports);
-  ResetStub("round_robin");
-  SetNextResolution(ports);
+  for (int i = 0; i < kNumServers; ++i) {
+    second_ports.push_back(grpc_pick_unused_port_or_die());
+  }
+  StartServers(kNumServers, first_ports);
+  auto channel = BuildChannel("round_robin");
+  auto stub = BuildStub(channel);
+  SetNextResolution(first_ports);
   // Send a number of RPCs, which succeed.
   for (size_t i = 0; i < 100; ++i) {
-    CheckRpcSendOk();
+    CheckRpcSendOk(stub, DEBUG_LOCATION);
   }
   // Kill all servers
   gpr_log(GPR_INFO, "****** ABOUT TO KILL SERVERS *******");
@@ -658,18 +709,25 @@
   gpr_log(GPR_INFO, "****** SERVERS KILLED *******");
   gpr_log(GPR_INFO, "****** SENDING DOOMED REQUESTS *******");
   // Client requests should fail. Send enough to tickle all subchannels.
-  for (size_t i = 0; i < servers_.size(); ++i) CheckRpcSendFailure();
+  for (size_t i = 0; i < servers_.size(); ++i) CheckRpcSendFailure(stub);
   gpr_log(GPR_INFO, "****** DOOMED REQUESTS SENT *******");
-  // Bring servers back up on the same port (we aren't recreating the channel).
+  // Bring servers back up on a different set of ports. We need to do this to be
+  // sure that the eventual success is *not* due to subchannel reconnection
+  // attempts and that an actual re-resolution has happened as a result of the
+  // RR policy going into transient failure when all its subchannels become
+  // unavailable (in transient failure as well).
   gpr_log(GPR_INFO, "****** RESTARTING SERVERS *******");
-  StartServers(kNumServers, ports);
+  StartServers(kNumServers, second_ports);
+  // Don't notify of the update. Wait for the LB policy's re-resolution to
+  // "pull" the new ports.
+  SetNextResolutionUponError(second_ports);
   gpr_log(GPR_INFO, "****** SERVERS RESTARTED *******");
   gpr_log(GPR_INFO, "****** SENDING REQUEST TO SUCCEED *******");
   // Client request should eventually (but still fairly soon) succeed.
   const gpr_timespec deadline = grpc_timeout_seconds_to_deadline(5);
   gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC);
   while (gpr_time_cmp(deadline, now) > 0) {
-    if (SendRpc()) break;
+    if (SendRpc(stub)) break;
     now = gpr_now(GPR_CLOCK_MONOTONIC);
   }
   GPR_ASSERT(gpr_time_cmp(deadline, now) > 0);
@@ -679,11 +737,13 @@
   const int kNumServers = 3;
   StartServers(kNumServers);
   const auto ports = GetServersPorts();
-  ResetStub("round_robin");
+  auto channel = BuildChannel("round_robin");
+  auto stub = BuildStub(channel);
   SetNextResolution(ports);
-  for (size_t i = 0; i < kNumServers; ++i) WaitForServer(i);
+  for (size_t i = 0; i < kNumServers; ++i)
+    WaitForServer(stub, i, DEBUG_LOCATION);
   for (size_t i = 0; i < servers_.size(); ++i) {
-    CheckRpcSendOk();
+    CheckRpcSendOk(stub, DEBUG_LOCATION);
     EXPECT_EQ(1, servers_[i]->service_.request_count()) << "for backend #" << i;
   }
   // One request should have gone to each server.
@@ -695,10 +755,14 @@
   servers_[0]->Shutdown(true);
   // Client request still succeed. May need retrying if RR had returned a pick
   // before noticing the change in the server's connectivity.
-  while (!SendRpc())
+  while (!SendRpc(stub)) {
     ;  // Retry until success.
+  }
+  gpr_log(GPR_INFO, "------------------------------------------------------");
   // Send a bunch of RPCs that should succeed.
-  for (int i = 0; i < 10 * kNumServers; ++i) CheckRpcSendOk();
+  for (int i = 0; i < 10 * kNumServers; ++i) {
+    CheckRpcSendOk(stub, DEBUG_LOCATION);
+  }
   const auto post_death = servers_[0]->service_.request_count();
   // No requests have gone to the deceased server.
   EXPECT_EQ(pre_death, post_death);
@@ -708,7 +772,7 @@
   // the server managed to start before the RR policy retried the subchannel) or
   // after the subchannel retry delay otherwise (RR's subchannel retried before
   // the server was fully back up).
-  WaitForServer(0);
+  WaitForServer(stub, 0, DEBUG_LOCATION);
 }
 
 }  // namespace
diff --git a/test/cpp/end2end/grpclb_end2end_test.cc b/test/cpp/end2end/grpclb_end2end_test.cc
index 5591acf..89c9c2b 100644
--- a/test/cpp/end2end/grpclb_end2end_test.cc
+++ b/test/cpp/end2end/grpclb_end2end_test.cc
@@ -35,6 +35,7 @@
 
 #include "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h"
 #include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gprpp/ref_counted_ptr.h"
 #include "src/core/lib/iomgr/sockaddr.h"
 
 #include "test/core/util/port.h"
@@ -339,7 +340,8 @@
   }
 
   void SetUp() override {
-    response_generator_ = grpc_fake_resolver_response_generator_create();
+    response_generator_ =
+        grpc_core::MakeRefCounted<grpc_core::FakeResolverResponseGenerator>();
     // Start the backends.
     for (size_t i = 0; i < num_backends_; ++i) {
       backends_.emplace_back(new BackendServiceImpl());
@@ -363,7 +365,6 @@
     for (size_t i = 0; i < balancers_.size(); ++i) {
       if (balancers_[i]->Shutdown()) balancer_servers_[i].Shutdown();
     }
-    grpc_fake_resolver_response_generator_unref(response_generator_);
   }
 
   void SetNextResolutionAllBalancers() {
@@ -378,7 +379,7 @@
     ChannelArguments args;
     args.SetGrpclbFallbackTimeout(fallback_timeout);
     args.SetPointer(GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR,
-                    response_generator_);
+                    response_generator_.get());
     std::ostringstream uri;
     uri << "fake:///servername_not_used";
     channel_ =
@@ -478,20 +479,18 @@
         CreateLbAddressesFromAddressDataList(address_data);
     grpc_arg fake_addresses = grpc_lb_addresses_create_channel_arg(addresses);
     grpc_channel_args fake_result = {1, &fake_addresses};
-    grpc_fake_resolver_response_generator_set_response(response_generator_,
-                                                       &fake_result);
+    response_generator_->SetResponse(&fake_result);
     grpc_lb_addresses_destroy(addresses);
   }
 
-  void SetNextResolutionUponError(
+  void SetNextReresolutionResponse(
       const std::vector<AddressData>& address_data) {
     grpc_core::ExecCtx exec_ctx;
     grpc_lb_addresses* addresses =
         CreateLbAddressesFromAddressDataList(address_data);
     grpc_arg fake_addresses = grpc_lb_addresses_create_channel_arg(addresses);
     grpc_channel_args fake_result = {1, &fake_addresses};
-    grpc_fake_resolver_response_generator_set_response_upon_error(
-        response_generator_, &fake_result);
+    response_generator_->SetReresolutionResponse(&fake_result);
     grpc_lb_addresses_destroy(addresses);
   }
 
@@ -593,7 +592,8 @@
   std::vector<std::unique_ptr<BalancerServiceImpl>> balancers_;
   std::vector<ServerThread<BackendService>> backend_servers_;
   std::vector<ServerThread<BalancerService>> balancer_servers_;
-  grpc_fake_resolver_response_generator* response_generator_;
+  grpc_core::RefCountedPtr<grpc_core::FakeResolverResponseGenerator>
+      response_generator_;
   const grpc::string kRequestMessage_ = "Live long and prosper.";
 };
 
diff --git a/test/cpp/grpclb/grpclb_test.cc b/test/cpp/grpclb/grpclb_test.cc
index d241594..06ab8c3 100644
--- a/test/cpp/grpclb/grpclb_test.cc
+++ b/test/cpp/grpclb/grpclb_test.cc
@@ -27,7 +27,6 @@
 #include <grpc/grpc.h>
 #include <grpc/impl/codegen/byte_buffer_reader.h>
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/sync.h>
@@ -41,8 +40,10 @@
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/channel/channel_stack.h"
 #include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/gpr/tmpfile.h"
+#include "src/core/lib/gprpp/ref_counted_ptr.h"
 #include "src/core/lib/iomgr/sockaddr.h"
 #include "src/core/lib/security/credentials/fake/fake_credentials.h"
 #include "src/core/lib/surface/channel.h"
@@ -558,8 +559,8 @@
   const char* backends_name = lb_server->servers_hostport;
   gpr_asprintf(&expected_target_names, "%s;%s", backends_name, BALANCERS_NAME);
 
-  grpc_fake_resolver_response_generator* response_generator =
-      grpc_fake_resolver_response_generator_create();
+  auto response_generator =
+      grpc_core::MakeRefCounted<grpc_core::FakeResolverResponseGenerator>();
 
   grpc_lb_addresses* addresses = grpc_lb_addresses_create(1, nullptr);
   char* lb_uri_str;
@@ -578,25 +579,22 @@
       grpc_channel_args_copy_and_add(nullptr, &fake_addresses, 1);
   grpc_lb_addresses_destroy(addresses);
 
-  const grpc_arg new_args[] = {
+  grpc_arg new_args[] = {
       grpc_fake_transport_expected_targets_arg(expected_target_names),
-      grpc_fake_resolver_response_generator_arg(response_generator)};
+      grpc_core::FakeResolverResponseGenerator::MakeChannelArg(
+          response_generator.get())};
 
-  grpc_channel_args* args = grpc_channel_args_copy_and_add(
-      nullptr, new_args, GPR_ARRAY_SIZE(new_args));
-  gpr_free(expected_target_names);
+  grpc_channel_args args = {GPR_ARRAY_SIZE(new_args), new_args};
 
   cf->cq = grpc_completion_queue_create_for_next(nullptr);
   grpc_channel_credentials* fake_creds =
       grpc_fake_transport_security_credentials_create();
   cf->client =
-      grpc_secure_channel_create(fake_creds, cf->server_uri, args, nullptr);
-  grpc_fake_resolver_response_generator_set_response(response_generator,
-                                                     fake_result);
+      grpc_secure_channel_create(fake_creds, cf->server_uri, &args, nullptr);
+  response_generator->SetResponse(fake_result);
   grpc_channel_args_destroy(fake_result);
   grpc_channel_credentials_unref(fake_creds);
-  grpc_channel_args_destroy(args);
-  grpc_fake_resolver_response_generator_unref(response_generator);
+  gpr_free(expected_target_names);
 }
 
 static void teardown_client(client_fixture* cf) {
diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc
index 8958b98..4da9639 100644
--- a/test/cpp/interop/client.cc
+++ b/test/cpp/interop/client.cc
@@ -25,7 +25,6 @@
 #include <grpc/grpc.h>
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/gpr/string.h"
 #include "test/cpp/interop/client_helper.h"
diff --git a/test/cpp/interop/http2_client.cc b/test/cpp/interop/http2_client.cc
index 7a9e3ce..411812d 100644
--- a/test/cpp/interop/http2_client.cc
+++ b/test/cpp/interop/http2_client.cc
@@ -23,7 +23,6 @@
 #include <grpc++/client_context.h>
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/transport/byte_stream.h"
 #include "src/proto/grpc/testing/messages.pb.h"
@@ -31,6 +30,7 @@
 #include "test/cpp/interop/http2_client.h"
 
 #include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gpr/useful.h"
 #include "test/cpp/util/create_test_channel.h"
 #include "test/cpp/util/test_config.h"
 
diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc
index d2192f5..3051afa 100644
--- a/test/cpp/interop/interop_client.cc
+++ b/test/cpp/interop/interop_client.cc
@@ -28,7 +28,6 @@
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/transport/byte_stream.h"
 #include "src/proto/grpc/testing/empty.pb.h"
diff --git a/test/cpp/interop/interop_server.cc b/test/cpp/interop/interop_server.cc
index 7cfdb2f..f78a1f1 100644
--- a/test/cpp/interop/interop_server.cc
+++ b/test/cpp/interop/interop_server.cc
@@ -29,7 +29,6 @@
 #include <grpc/grpc.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
-#include <grpc/support/useful.h>
 
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/transport/byte_stream.h"
diff --git a/test/cpp/interop/interop_test.cc b/test/cpp/interop/interop_test.cc
index 563b7ab..ae155b6 100644
--- a/test/cpp/interop/interop_test.cc
+++ b/test/cpp/interop/interop_test.cc
@@ -31,12 +31,12 @@
 
 #include <gflags/gflags.h>
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 #include "test/core/util/port.h"
 #include "test/cpp/util/test_config.h"
 
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
 #include "src/core/lib/iomgr/socket_utils_posix.h"
 
diff --git a/test/cpp/microbenchmarks/bm_pollset.cc b/test/cpp/microbenchmarks/bm_pollset.cc
index d9d5164..f49f667 100644
--- a/test/cpp/microbenchmarks/bm_pollset.cc
+++ b/test/cpp/microbenchmarks/bm_pollset.cc
@@ -21,8 +21,8 @@
 #include <grpc/grpc.h>
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
-#include <grpc/support/useful.h>
 
+#include "src/core/lib/gpr/useful.h"
 #include "src/core/lib/iomgr/ev_posix.h"
 #include "src/core/lib/iomgr/pollset.h"
 #include "src/core/lib/iomgr/port.h"
diff --git a/test/cpp/microbenchmarks/fullstack_fixtures.h b/test/cpp/microbenchmarks/fullstack_fixtures.h
index d73caa0..fdc04e5 100644
--- a/test/cpp/microbenchmarks/fullstack_fixtures.h
+++ b/test/cpp/microbenchmarks/fullstack_fixtures.h
@@ -61,6 +61,15 @@
 
 class BaseFixture : public TrackCounters {};
 
+// Special tag to be used in Server shutdown. This tag is *NEVER* returned when
+// Cq->Next() API is called (This is because FinalizeResult() function in this
+// class always returns 'false'). This is intentional and makes writing shutdown
+// code easier.
+class ShutdownTag : public internal::CompletionQueueTag {
+ public:
+  bool FinalizeResult(void** tag, bool* status) { return false; }
+};
+
 class FullstackFixture : public BaseFixture {
  public:
   FullstackFixture(Service* service, const FixtureConfiguration& config,
@@ -84,7 +93,11 @@
   }
 
   virtual ~FullstackFixture() {
-    server_->Shutdown(gpr_inf_past(GPR_CLOCK_MONOTONIC));
+    // Dummy shutdown tag (this tag is swallowed by cq->Next() and is not
+    // returned to the user) see ShutdownTag definition for more details
+    ShutdownTag shutdown_tag;
+    grpc_server_shutdown_and_notify(server_->c_server(), cq_->cq(),
+                                    &shutdown_tag);
     cq_->Shutdown();
     void* tag;
     bool ok;
@@ -208,7 +221,11 @@
   }
 
   virtual ~EndpointPairFixture() {
-    server_->Shutdown(gpr_inf_past(GPR_CLOCK_MONOTONIC));
+    // Dummy shutdown tag (this tag is swallowed by cq->Next() and is not
+    // returned to the user) see ShutdownTag definition for more details
+    ShutdownTag shutdown_tag;
+    grpc_server_shutdown_and_notify(server_->c_server(), cq_->cq(),
+                                    &shutdown_tag);
     cq_->Shutdown();
     void* tag;
     bool ok;
diff --git a/test/cpp/naming/create_private_dns_zone.sh b/test/cpp/naming/create_private_dns_zone.sh
index 55a4cfe..5c9364c 100755
--- a/test/cpp/naming/create_private_dns_zone.sh
+++ b/test/cpp/naming/create_private_dns_zone.sh
@@ -17,7 +17,7 @@
 
 set -ex
 
-cd $(dirname $0)/../../..
+cd "$(dirname "$0")/../../.."
 
 gcloud alpha dns managed-zones create \
   resolver-tests-version-4-grpctestingexp-zone-id \
diff --git a/test/cpp/naming/private_dns_zone_init.sh b/test/cpp/naming/private_dns_zone_init.sh
index 8fa5a8a..fba8a00 100755
--- a/test/cpp/naming/private_dns_zone_init.sh
+++ b/test/cpp/naming/private_dns_zone_init.sh
@@ -17,7 +17,7 @@
 
 set -ex
 
-cd $(dirname $0)/../../..
+cd "$(dirname "$0")/../../.."
 
 gcloud dns record-sets transaction start -z=resolver-tests-version-4-grpctestingexp-zone-id
 
diff --git a/test/cpp/naming/resolver_component_test.cc b/test/cpp/naming/resolver_component_test.cc
index 8b5523f..f4be064 100644
--- a/test/cpp/naming/resolver_component_test.cc
+++ b/test/cpp/naming/resolver_component_test.cc
@@ -18,7 +18,6 @@
 
 #include <grpc/grpc.h>
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 #include <grpc/support/sync.h>
@@ -38,7 +37,9 @@
 #include "src/core/ext/filters/client_channel/resolver_registry.h"
 #include "src/core/lib/channel/channel_args.h"
 #include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/gpr/string.h"
+#include "src/core/lib/gprpp/orphanable.h"
 #include "src/core/lib/iomgr/combiner.h"
 #include "src/core/lib/iomgr/executor.h"
 #include "src/core/lib/iomgr/iomgr.h"
@@ -61,11 +62,9 @@
 
 DEFINE_string(target_name, "", "Target name to resolve.");
 DEFINE_string(expected_addrs, "",
-              "Comma-separated list of expected "
-              "'<ip0:port0>,<is_balancer0>;<ip1:port1>,<is_balancer1>;...' "
-              "addresses of "
-              "backend and/or balancers. 'is_balancer' should be bool, i.e. "
-              "true or false.");
+              "List of expected backend or balancer addresses in the form "
+              "'<ip0:port0>,<is_balancer0>;<ip1:port1>,<is_balancer1>;...'. "
+              "'is_balancer' should be bool, i.e. true or false.");
 DEFINE_string(expected_chosen_service_config, "",
               "Expected service config json string that gets chosen (no "
               "whitespace). Empty for none.");
@@ -102,12 +101,10 @@
     // get the next <ip>,<port> (v4 or v6)
     size_t next_comma = expected_addrs.find(",");
     if (next_comma == std::string::npos) {
-      gpr_log(
-          GPR_ERROR,
-          "Missing ','. Expected_addrs arg should be a semi-colon-separated "
-          "list of "
-          "<ip-port>,<bool> pairs. Left-to-be-parsed arg is |%s|",
-          expected_addrs.c_str());
+      gpr_log(GPR_ERROR,
+              "Missing ','. Expected_addrs arg should be a semicolon-separated "
+              "list of <ip-port>,<bool> pairs. Left-to-be-parsed arg is |%s|",
+              expected_addrs.c_str());
       abort();
     }
     std::string next_addr = expected_addrs.substr(0, next_comma);
@@ -125,7 +122,7 @@
   }
   if (out.size() == 0) {
     gpr_log(GPR_ERROR,
-            "expected_addrs arg should be a comma-separated list of "
+            "expected_addrs arg should be a semicolon-separated list of "
             "<ip-port>,<bool> pairs");
     abort();
   }
@@ -287,17 +284,16 @@
                       FLAGS_local_dns_server_address.c_str(),
                       FLAGS_target_name.c_str()));
   // create resolver and resolve
-  grpc_resolver* resolver =
-      grpc_resolver_create(whole_uri, nullptr, args.pollset_set, args.lock);
+  grpc_core::OrphanablePtr<grpc_core::Resolver> resolver =
+      grpc_core::ResolverRegistry::CreateResolver(whole_uri, nullptr,
+                                                  args.pollset_set, args.lock);
   gpr_free(whole_uri);
   grpc_closure on_resolver_result_changed;
   GRPC_CLOSURE_INIT(&on_resolver_result_changed, CheckResolverResultLocked,
                     (void*)&args, grpc_combiner_scheduler(args.lock));
-  grpc_resolver_next_locked(resolver, &args.channel_args,
-                            &on_resolver_result_changed);
+  resolver->NextLocked(&args.channel_args, &on_resolver_result_changed);
   grpc_core::ExecCtx::Get()->Flush();
   PollPollsetUntilRequestDone(&args);
-  GRPC_RESOLVER_UNREF(resolver, nullptr);
   ArgsFinish(&args);
 }
 
diff --git a/test/cpp/naming/resolver_component_tests_runner.sh b/test/cpp/naming/resolver_component_tests_runner.sh
index 11a45d7..618a173 100755
--- a/test/cpp/naming/resolver_component_tests_runner.sh
+++ b/test/cpp/naming/resolver_component_tests_runner.sh
@@ -18,10 +18,10 @@
 set -ex
 
 # all command args required in this set order
-FLAGS_test_bin_path=`echo "$1" | grep '\--test_bin_path=' | cut -d "=" -f 2`
-FLAGS_dns_server_bin_path=`echo "$2" | grep '\--dns_server_bin_path=' | cut -d "=" -f 2`
-FLAGS_records_config_path=`echo "$3" | grep '\--records_config_path=' | cut -d "=" -f 2`
-FLAGS_test_dns_server_port=`echo "$4" | grep '\--test_dns_server_port=' | cut -d "=" -f 2`
+FLAGS_test_bin_path=$(echo "$1" | grep '\--test_bin_path=' | cut -d "=" -f 2)
+FLAGS_dns_server_bin_path=$(echo "$2" | grep '\--dns_server_bin_path=' | cut -d "=" -f 2)
+FLAGS_records_config_path=$(echo "$3" | grep '\--records_config_path=' | cut -d "=" -f 2)
+FLAGS_test_dns_server_port=$(echo "$4" | grep '\--test_dns_server_port=' | cut -d "=" -f 2)
 
 for cmd_arg in "$FLAGS_test_bin_path" "$FLAGS_dns_server_bin_path" "$FLAGS_records_config_path" "$FLAGS_test_dns_server_port"; do
   if [[ "$cmd_arg" == "" ]]; then
@@ -34,7 +34,7 @@
 fi
 export GRPC_DNS_RESOLVER=ares
 
-"$FLAGS_dns_server_bin_path" --records_config_path="$FLAGS_records_config_path" --port="$FLAGS_test_dns_server_port" 2>&1 > /dev/null &
+"$FLAGS_dns_server_bin_path" --records_config_path="$FLAGS_records_config_path" --port="$FLAGS_test_dns_server_port" > /dev/null 2>&1 &
 DNS_SERVER_PID=$!
 echo "Local DNS server started. PID: $DNS_SERVER_PID"
 
@@ -53,15 +53,15 @@
 
 if [[ $RETRY == 1 ]]; then
   echo "FAILED TO START LOCAL DNS SERVER"
-  kill -SIGTERM $DNS_SERVER_PID
+  kill -SIGTERM "$DNS_SERVER_PID"
   wait
   exit 1
 fi
 
 function terminate_all {
   echo "Received signal. Terminating $! and $DNS_SERVER_PID"
-  kill -SIGTERM $! || true
-  kill -SIGTERM $DNS_SERVER_PID || true
+  kill -SIGTERM "$!" || true
+  kill -SIGTERM "$DNS_SERVER_PID" || true
   wait
   exit 1
 }
@@ -77,105 +77,105 @@
   --expected_addrs='1.2.3.4:1234,True' \
   --expected_chosen_service_config='' \
   --expected_lb_policy='' \
-  --local_dns_server_address=127.0.0.1:$FLAGS_test_dns_server_port &
-wait $! || EXIT_CODE=1
+  --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" &
+wait "$!" || EXIT_CODE=1
 
 $FLAGS_test_bin_path \
   --target_name='srv-ipv4-multi-target.resolver-tests-version-4.grpctestingexp.' \
   --expected_addrs='1.2.3.5:1234,True;1.2.3.6:1234,True;1.2.3.7:1234,True' \
   --expected_chosen_service_config='' \
   --expected_lb_policy='' \
-  --local_dns_server_address=127.0.0.1:$FLAGS_test_dns_server_port &
-wait $! || EXIT_CODE=1
+  --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" &
+wait "$!" || EXIT_CODE=1
 
 $FLAGS_test_bin_path \
   --target_name='srv-ipv6-single-target.resolver-tests-version-4.grpctestingexp.' \
   --expected_addrs='[2607:f8b0:400a:801::1001]:1234,True' \
   --expected_chosen_service_config='' \
   --expected_lb_policy='' \
-  --local_dns_server_address=127.0.0.1:$FLAGS_test_dns_server_port &
-wait $! || EXIT_CODE=1
+  --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" &
+wait "$!" || EXIT_CODE=1
 
 $FLAGS_test_bin_path \
   --target_name='srv-ipv6-multi-target.resolver-tests-version-4.grpctestingexp.' \
   --expected_addrs='[2607:f8b0:400a:801::1002]:1234,True;[2607:f8b0:400a:801::1003]:1234,True;[2607:f8b0:400a:801::1004]:1234,True' \
   --expected_chosen_service_config='' \
   --expected_lb_policy='' \
-  --local_dns_server_address=127.0.0.1:$FLAGS_test_dns_server_port &
-wait $! || EXIT_CODE=1
+  --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" &
+wait "$!" || EXIT_CODE=1
 
 $FLAGS_test_bin_path \
   --target_name='srv-ipv4-simple-service-config.resolver-tests-version-4.grpctestingexp.' \
   --expected_addrs='1.2.3.4:1234,True' \
   --expected_chosen_service_config='{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"SimpleService","waitForReady":true}]}]}' \
   --expected_lb_policy='round_robin' \
-  --local_dns_server_address=127.0.0.1:$FLAGS_test_dns_server_port &
-wait $! || EXIT_CODE=1
+  --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" &
+wait "$!" || EXIT_CODE=1
 
 $FLAGS_test_bin_path \
   --target_name='ipv4-no-srv-simple-service-config.resolver-tests-version-4.grpctestingexp.' \
   --expected_addrs='1.2.3.4:443,False' \
   --expected_chosen_service_config='{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"NoSrvSimpleService","waitForReady":true}]}]}' \
   --expected_lb_policy='round_robin' \
-  --local_dns_server_address=127.0.0.1:$FLAGS_test_dns_server_port &
-wait $! || EXIT_CODE=1
+  --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" &
+wait "$!" || EXIT_CODE=1
 
 $FLAGS_test_bin_path \
   --target_name='ipv4-no-config-for-cpp.resolver-tests-version-4.grpctestingexp.' \
   --expected_addrs='1.2.3.4:443,False' \
   --expected_chosen_service_config='' \
   --expected_lb_policy='' \
-  --local_dns_server_address=127.0.0.1:$FLAGS_test_dns_server_port &
-wait $! || EXIT_CODE=1
+  --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" &
+wait "$!" || EXIT_CODE=1
 
 $FLAGS_test_bin_path \
   --target_name='ipv4-cpp-config-has-zero-percentage.resolver-tests-version-4.grpctestingexp.' \
   --expected_addrs='1.2.3.4:443,False' \
   --expected_chosen_service_config='' \
   --expected_lb_policy='' \
-  --local_dns_server_address=127.0.0.1:$FLAGS_test_dns_server_port &
-wait $! || EXIT_CODE=1
+  --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" &
+wait "$!" || EXIT_CODE=1
 
 $FLAGS_test_bin_path \
   --target_name='ipv4-second-language-is-cpp.resolver-tests-version-4.grpctestingexp.' \
   --expected_addrs='1.2.3.4:443,False' \
   --expected_chosen_service_config='{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"CppService","waitForReady":true}]}]}' \
   --expected_lb_policy='round_robin' \
-  --local_dns_server_address=127.0.0.1:$FLAGS_test_dns_server_port &
-wait $! || EXIT_CODE=1
+  --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" &
+wait "$!" || EXIT_CODE=1
 
 $FLAGS_test_bin_path \
   --target_name='ipv4-config-with-percentages.resolver-tests-version-4.grpctestingexp.' \
   --expected_addrs='1.2.3.4:443,False' \
   --expected_chosen_service_config='{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"AlwaysPickedService","waitForReady":true}]}]}' \
   --expected_lb_policy='round_robin' \
-  --local_dns_server_address=127.0.0.1:$FLAGS_test_dns_server_port &
-wait $! || EXIT_CODE=1
+  --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" &
+wait "$!" || EXIT_CODE=1
 
 $FLAGS_test_bin_path \
   --target_name='srv-ipv4-target-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp.' \
   --expected_addrs='1.2.3.4:1234,True;1.2.3.4:443,False' \
   --expected_chosen_service_config='' \
   --expected_lb_policy='' \
-  --local_dns_server_address=127.0.0.1:$FLAGS_test_dns_server_port &
-wait $! || EXIT_CODE=1
+  --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" &
+wait "$!" || EXIT_CODE=1
 
 $FLAGS_test_bin_path \
   --target_name='srv-ipv6-target-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp.' \
   --expected_addrs='[2607:f8b0:400a:801::1002]:1234,True;[2607:f8b0:400a:801::1002]:443,False' \
   --expected_chosen_service_config='' \
   --expected_lb_policy='' \
-  --local_dns_server_address=127.0.0.1:$FLAGS_test_dns_server_port &
-wait $! || EXIT_CODE=1
+  --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" &
+wait "$!" || EXIT_CODE=1
 
 $FLAGS_test_bin_path \
   --target_name='ipv4-config-causing-fallback-to-tcp.resolver-tests-version-4.grpctestingexp.' \
   --expected_addrs='1.2.3.4:443,False' \
   --expected_chosen_service_config='{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwo","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooThree","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooFour","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooFive","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooSix","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooSeven","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooEight","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooNine","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTen","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooEleven","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwelve","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwelve","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwelve","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwelve","service":"SimpleService","waitForReady":true}]}]}' \
   --expected_lb_policy='' \
-  --local_dns_server_address=127.0.0.1:$FLAGS_test_dns_server_port &
-wait $! || EXIT_CODE=1
+  --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" &
+wait "$!" || EXIT_CODE=1
 
-kill -SIGTERM $DNS_SERVER_PID || true
+kill -SIGTERM "$DNS_SERVER_PID" || true
 wait
 exit $EXIT_CODE
diff --git a/test/cpp/naming/resolver_gce_integration_tests_runner.sh b/test/cpp/naming/resolver_gce_integration_tests_runner.sh
index 091f9ef..2f673a5 100755
--- a/test/cpp/naming/resolver_gce_integration_tests_runner.sh
+++ b/test/cpp/naming/resolver_gce_integration_tests_runner.sh
@@ -24,7 +24,7 @@
   exit 1
 fi
 
-cd $(dirname $0)/../../..
+cd "$(dirname "$0")/../../.."
 
 if [[ "$CONFIG" == "" ]]; then
   export CONFIG=opt
diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc
index a2ddbeb..8c1d941 100644
--- a/test/cpp/qps/client_sync.cc
+++ b/test/cpp/qps/client_sync.cc
@@ -30,10 +30,10 @@
 #include <grpc++/server_builder.h>
 #include <grpc/grpc.h>
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/time.h>
 
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/profiling/timers.h"
 #include "src/proto/grpc/testing/services.grpc.pb.h"
 #include "test/cpp/qps/client.h"
diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc
index a809a27..4e0d266 100644
--- a/test/cpp/qps/driver.cc
+++ b/test/cpp/qps/driver.cc
@@ -27,11 +27,11 @@
 #include <grpc++/client_context.h>
 #include <grpc++/create_channel.h>
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 
 #include "src/core/lib/gpr/env.h"
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/profiling/timers.h"
 #include "test/core/util/port.h"
 #include "test/core/util/test_config.h"
diff --git a/test/cpp/qps/qps_worker.cc b/test/cpp/qps/qps_worker.cc
index 4c9ab0e..215a7bf 100644
--- a/test/cpp/qps/qps_worker.cc
+++ b/test/cpp/qps/qps_worker.cc
@@ -32,9 +32,9 @@
 #include <grpc/grpc.h>
 #include <grpc/support/alloc.h>
 #include <grpc/support/cpu.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 
+#include "src/core/lib/gpr/host_port.h"
 #include "src/proto/grpc/testing/services.pb.h"
 #include "test/core/util/grpc_profiler.h"
 #include "test/core/util/histogram.h"
diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc
index 72ae772..b88b884 100644
--- a/test/cpp/qps/server_async.cc
+++ b/test/cpp/qps/server_async.cc
@@ -32,9 +32,9 @@
 #include <grpc++/support/config.h>
 #include <grpc/grpc.h>
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 #include <grpc/support/log.h>
 
+#include "src/core/lib/gpr/host_port.h"
 #include "src/core/lib/surface/completion_queue.h"
 #include "src/proto/grpc/testing/services.grpc.pb.h"
 #include "test/core/util/test_config.h"
diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc
index ea89a30..19cbb53 100644
--- a/test/cpp/qps/server_sync.cc
+++ b/test/cpp/qps/server_sync.cc
@@ -24,8 +24,8 @@
 #include <grpc++/server_context.h>
 #include <grpc/grpc.h>
 #include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
 
+#include "src/core/lib/gpr/host_port.h"
 #include "src/proto/grpc/testing/services.grpc.pb.h"
 #include "test/cpp/qps/server.h"
 #include "test/cpp/qps/usage_timer.h"
diff --git a/test/cpp/util/BUILD b/test/cpp/util/BUILD
index af25fca..d092ba3 100644
--- a/test/cpp/util/BUILD
+++ b/test/cpp/util/BUILD
@@ -74,6 +74,7 @@
     deps = [
         "//:grpc++",
         "//test/core/end2end:ssl_test_data",
+        "//test/core/util:grpc_test_util",
     ],
     external_deps = [
         "protobuf",
@@ -86,6 +87,7 @@
     hdrs = GRPCXX_TESTUTIL_HDRS,
     deps = [
         "//:grpc++_unsecure",
+        "//test/core/util:grpc_test_util",
     ],
     external_deps = [
         "protobuf",
diff --git a/test/cpp/util/subprocess.cc b/test/cpp/util/subprocess.cc
index a54d0c0..ddaad89 100644
--- a/test/cpp/util/subprocess.cc
+++ b/test/cpp/util/subprocess.cc
@@ -20,7 +20,7 @@
 
 #include <vector>
 
-#include <grpc/support/subprocess.h>
+#include "test/core/util/subprocess.h"
 
 namespace grpc {
 
diff --git a/test/distrib/cpp/run_distrib_test_cmake.sh b/test/distrib/cpp/run_distrib_test_cmake.sh
index a9c081c..6ec3cab 100755
--- a/test/distrib/cpp/run_distrib_test_cmake.sh
+++ b/test/distrib/cpp/run_distrib_test_cmake.sh
@@ -15,7 +15,7 @@
 
 set -ex
 
-cd $(dirname $0)/../../..
+cd "$(dirname "$0")/../../.."
 
 echo "deb http://ftp.debian.org/debian jessie-backports main" | tee /etc/apt/sources.list.d/jessie-backports.list
 apt-get update
diff --git a/test/distrib/cpp/run_distrib_test_routeguide.sh b/test/distrib/cpp/run_distrib_test_routeguide.sh
index b043075..dc69ab8 100755
--- a/test/distrib/cpp/run_distrib_test_routeguide.sh
+++ b/test/distrib/cpp/run_distrib_test_routeguide.sh
@@ -16,7 +16,7 @@
 set -ex
 
 # change to grpc repo root
-cd $(dirname $0)/../../..
+cd "$(dirname "$0")/../../.."
 
 cd third_party/protobuf && ./autogen.sh && \
 ./configure && make -j4 && make check && make install && ldconfig
diff --git a/test/distrib/csharp/run_distrib_test.sh b/test/distrib/csharp/run_distrib_test.sh
index 99cdb5e..eee24d0 100755
--- a/test/distrib/csharp/run_distrib_test.sh
+++ b/test/distrib/csharp/run_distrib_test.sh
@@ -15,7 +15,7 @@
 
 set -ex
 
-cd $(dirname $0)
+cd "$(dirname "$0")"
 
 unzip -o "$EXTERNAL_GIT_ROOT/input_artifacts/csharp_nugets_windows_dotnetcli.zip" -d TestNugetFeed
 
diff --git a/test/distrib/csharp/run_distrib_test_dotnetcli.sh b/test/distrib/csharp/run_distrib_test_dotnetcli.sh
index 53117d4..9e31945 100755
--- a/test/distrib/csharp/run_distrib_test_dotnetcli.sh
+++ b/test/distrib/csharp/run_distrib_test_dotnetcli.sh
@@ -15,7 +15,7 @@
 
 set -ex
 
-cd $(dirname $0)
+cd "$(dirname "$0")"
 
 unzip -o "$EXTERNAL_GIT_ROOT/input_artifacts/csharp_nugets_windows_dotnetcli.zip" -d TestNugetFeed
 
diff --git a/test/distrib/csharp/update_version.sh b/test/distrib/csharp/update_version.sh
index 2e9050c..734ec21 100755
--- a/test/distrib/csharp/update_version.sh
+++ b/test/distrib/csharp/update_version.sh
@@ -15,12 +15,14 @@
 
 set -e
 
-cd $(dirname $0)
+cd "$(dirname "$0")"
 
 CSHARP_VERSION="$1"
 if [ "$CSHARP_VERSION" == "auto" ]
 then
   # autodetect C# version from the name of Grpc.Core.0.0.0-x.nupkg file
+  # TODO: find a better shellcheck-compliant way to write the following line
+  # shellcheck disable=SC2010
   CSHARP_VERSION=$(ls TestNugetFeed | grep -m 1 '^Grpc\.Core\.[0-9].*\.nupkg$' | sed s/^Grpc\.Core\.// | sed s/\.nupkg$// | sed s/\.symbols$//)
   echo "Autodetected nuget ${CSHARP_VERSION}"
 fi
diff --git a/test/distrib/php/run_distrib_test.sh b/test/distrib/php/run_distrib_test.sh
index 70ebaf8..f781815 100755
--- a/test/distrib/php/run_distrib_test.sh
+++ b/test/distrib/php/run_distrib_test.sh
@@ -15,9 +15,9 @@
 
 set -ex
 
-cd $(dirname $0)
+cd "$(dirname "$0")"
 
-cp -r $EXTERNAL_GIT_ROOT/input_artifacts/grpc-*.tgz .
+cp -r "$EXTERNAL_GIT_ROOT"/input_artifacts/grpc-*.tgz .
 
 find . -regextype sed -regex ".*/grpc-[0-9].*.tgz" | cut -b3- | \
     xargs pecl install
diff --git a/test/distrib/python/run_distrib_test.sh b/test/distrib/python/run_distrib_test.sh
index 02654be..a855ae3 100755
--- a/test/distrib/python/run_distrib_test.sh
+++ b/test/distrib/python/run_distrib_test.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2015 gRPC authors.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,23 +15,25 @@
 
 set -ex
 
-cd $(dirname $0)
+cd "$(dirname "$0")"
+
+shopt -s nullglob
 
 # Pick up the source dist archive whatever its version is
-SDIST_ARCHIVES=$EXTERNAL_GIT_ROOT/input_artifacts/grpcio-*.tar.gz
-BDIST_ARCHIVES=$EXTERNAL_GIT_ROOT/input_artifacts/grpcio-*.whl
-TOOLS_SDIST_ARCHIVES=$EXTERNAL_GIT_ROOT/input_artifacts/grpcio_tools-*.tar.gz
-TOOLS_BDIST_ARCHIVES=$EXTERNAL_GIT_ROOT/input_artifacts/grpcio_tools-*.whl
+SDIST_ARCHIVES=("$EXTERNAL_GIT_ROOT"/input_artifacts/grpcio-*.tar.gz)
+BDIST_ARCHIVES=("$EXTERNAL_GIT_ROOT"/input_artifacts/grpcio-*.whl)
+TOOLS_SDIST_ARCHIVES=("$EXTERNAL_GIT_ROOT"/input_artifacts/grpcio_tools-*.tar.gz)
+TOOLS_BDIST_ARCHIVES=("$EXTERNAL_GIT_ROOT"/input_artifacts/grpcio_tools-*.whl)
 
 function make_virtualenv() {
-  virtualenv $1
-  $1/bin/python -m pip install --upgrade six pip
-  $1/bin/python -m pip install cython
+  virtualenv "$1"
+  "$1/bin/python" -m pip install --upgrade six pip
+  "$1/bin/python" -m pip install cython
 }
 
 function at_least_one_installs() {
   for file in "$@"; do
-    if python -m pip install $file; then
+    if python -m pip install "$file"; then
       return 0
     fi
   done
@@ -45,11 +47,11 @@
 # Install our distributions in order of dependencies
 #
 
-(source bdist_test/bin/activate && at_least_one_installs ${BDIST_ARCHIVES})
-(source bdist_test/bin/activate && at_least_one_installs ${TOOLS_BDIST_ARCHIVES})
+(source bdist_test/bin/activate && at_least_one_installs "${BDIST_ARCHIVES[@]}")
+(source bdist_test/bin/activate && at_least_one_installs "${TOOLS_BDIST_ARCHIVES[@]}")
 
-(source sdist_test/bin/activate && at_least_one_installs ${SDIST_ARCHIVES})
-(source sdist_test/bin/activate && at_least_one_installs ${TOOLS_SDIST_ARCHIVES})
+(source sdist_test/bin/activate && at_least_one_installs "${SDIST_ARCHIVES[@]}")
+(source sdist_test/bin/activate && at_least_one_installs "${TOOLS_SDIST_ARCHIVES[@]}")
 
 #
 # Test our distributions
diff --git a/test/distrib/ruby/run_distrib_test.sh b/test/distrib/ruby/run_distrib_test.sh
index d74f4cd..99fb873 100755
--- a/test/distrib/ruby/run_distrib_test.sh
+++ b/test/distrib/ruby/run_distrib_test.sh
@@ -15,20 +15,22 @@
 
 set -ex
 
-cd $(dirname $0)
+cd "$(dirname "$0")"
 
 ARCH=$1
 PLATFORM=$2
 # Create an indexed local gem source with gRPC gems to test
 GEM_SOURCE=../../../gem_source
-mkdir -p ${GEM_SOURCE}/gems
-cp $EXTERNAL_GIT_ROOT/input_artifacts/grpc-*$ARCH-$PLATFORM.gem ${GEM_SOURCE}/gems
-if [[ "$(ls ${GEM_SOURCE}/gems | grep grpc | wc -l)" != 1 ]]; then
+mkdir -p "${GEM_SOURCE}/gems"
+cp "$EXTERNAL_GIT_ROOT"/input_artifacts/grpc-*"$ARCH-$PLATFORM".gem "${GEM_SOURCE}/gems"
+# TODO: rewrite the following line to be shellcheck-compliant
+# shellcheck disable=SC2010
+if [[ "$(ls "${GEM_SOURCE}/gems" | grep -c grpc)" != 1 ]]; then
   echo "Sanity check failed. Copied over more than one grpc gem into the gem source directory."
   exit 1
 fi;
 gem install builder
-gem generate_index --directory ${GEM_SOURCE}
+gem generate_index --directory "${GEM_SOURCE}"
 
 bundle install
 
diff --git a/tools/distrib/python_wrapper.sh b/tools/distrib/python_wrapper.sh
index 9ace915..a099b2f 100755
--- a/tools/distrib/python_wrapper.sh
+++ b/tools/distrib/python_wrapper.sh
@@ -16,7 +16,7 @@
 
 for p in python2.7 python2.6 python2 python not_found ; do 
 
-  python=`which $p || echo not_found`
+  python=$(which $p || echo not_found)
 
   if [ -x "$python" ] ; then
     break
@@ -25,7 +25,7 @@
 done
 
 if [ -x "$python" ] ; then
-  exec $python $@
+  exec "$python" "$@"
 else
   echo "No acceptable version of python found on the system"
   exit 1
diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++
index f84b4fe..4877535 100644
--- a/tools/doxygen/Doxyfile.c++
+++ b/tools/doxygen/Doxyfile.c++
@@ -909,15 +909,11 @@
 include/grpc/support/atm_gcc_atomic.h \
 include/grpc/support/atm_gcc_sync.h \
 include/grpc/support/atm_windows.h \
-include/grpc/support/avl.h \
-include/grpc/support/cmdline.h \
 include/grpc/support/cpu.h \
-include/grpc/support/host_port.h \
 include/grpc/support/log.h \
 include/grpc/support/log_windows.h \
 include/grpc/support/port_platform.h \
 include/grpc/support/string_util.h \
-include/grpc/support/subprocess.h \
 include/grpc/support/sync.h \
 include/grpc/support/sync_custom.h \
 include/grpc/support/sync_generic.h \
@@ -925,11 +921,6 @@
 include/grpc/support/sync_windows.h \
 include/grpc/support/thd.h \
 include/grpc/support/time.h \
-include/grpc/support/tls.h \
-include/grpc/support/tls_gcc.h \
-include/grpc/support/tls_msvc.h \
-include/grpc/support/tls_pthread.h \
-include/grpc/support/useful.h \
 include/grpc/support/workaround_list.h
 
 # This tag can be used to specify the character encoding of the source files
diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal
index d4ed461..8dd282a 100644
--- a/tools/doxygen/Doxyfile.c++.internal
+++ b/tools/doxygen/Doxyfile.c++.internal
@@ -910,15 +910,11 @@
 include/grpc/support/atm_gcc_atomic.h \
 include/grpc/support/atm_gcc_sync.h \
 include/grpc/support/atm_windows.h \
-include/grpc/support/avl.h \
-include/grpc/support/cmdline.h \
 include/grpc/support/cpu.h \
-include/grpc/support/host_port.h \
 include/grpc/support/log.h \
 include/grpc/support/log_windows.h \
 include/grpc/support/port_platform.h \
 include/grpc/support/string_util.h \
-include/grpc/support/subprocess.h \
 include/grpc/support/sync.h \
 include/grpc/support/sync_custom.h \
 include/grpc/support/sync_generic.h \
@@ -926,13 +922,9 @@
 include/grpc/support/sync_windows.h \
 include/grpc/support/thd.h \
 include/grpc/support/time.h \
-include/grpc/support/tls.h \
-include/grpc/support/tls_gcc.h \
-include/grpc/support/tls_msvc.h \
-include/grpc/support/tls_pthread.h \
-include/grpc/support/useful.h \
 include/grpc/support/workaround_list.h \
 src/core/ext/transport/inproc/inproc_transport.h \
+src/core/lib/avl/avl.h \
 src/core/lib/backoff/backoff.h \
 src/core/lib/channel/channel_args.h \
 src/core/lib/channel/channel_stack.h \
@@ -954,6 +946,7 @@
 src/core/lib/gpr/arena.h \
 src/core/lib/gpr/env.h \
 src/core/lib/gpr/fork.h \
+src/core/lib/gpr/host_port.h \
 src/core/lib/gpr/mpscq.h \
 src/core/lib/gpr/murmur_hash.h \
 src/core/lib/gpr/spinlock.h \
@@ -961,7 +954,12 @@
 src/core/lib/gpr/string_windows.h \
 src/core/lib/gpr/thd_internal.h \
 src/core/lib/gpr/time_precise.h \
+src/core/lib/gpr/tls.h \
+src/core/lib/gpr/tls_gcc.h \
+src/core/lib/gpr/tls_msvc.h \
+src/core/lib/gpr/tls_pthread.h \
 src/core/lib/gpr/tmpfile.h \
+src/core/lib/gpr/useful.h \
 src/core/lib/gprpp/abstract.h \
 src/core/lib/gprpp/atomic.h \
 src/core/lib/gprpp/atomic_with_atm.h \
diff --git a/tools/doxygen/Doxyfile.core b/tools/doxygen/Doxyfile.core
index 3d42772..d398783 100644
--- a/tools/doxygen/Doxyfile.core
+++ b/tools/doxygen/Doxyfile.core
@@ -849,15 +849,11 @@
 include/grpc/support/atm_gcc_atomic.h \
 include/grpc/support/atm_gcc_sync.h \
 include/grpc/support/atm_windows.h \
-include/grpc/support/avl.h \
-include/grpc/support/cmdline.h \
 include/grpc/support/cpu.h \
-include/grpc/support/host_port.h \
 include/grpc/support/log.h \
 include/grpc/support/log_windows.h \
 include/grpc/support/port_platform.h \
 include/grpc/support/string_util.h \
-include/grpc/support/subprocess.h \
 include/grpc/support/sync.h \
 include/grpc/support/sync_custom.h \
 include/grpc/support/sync_generic.h \
@@ -865,11 +861,6 @@
 include/grpc/support/sync_windows.h \
 include/grpc/support/thd.h \
 include/grpc/support/time.h \
-include/grpc/support/tls.h \
-include/grpc/support/tls_gcc.h \
-include/grpc/support/tls_msvc.h \
-include/grpc/support/tls_pthread.h \
-include/grpc/support/useful.h \
 include/grpc/support/workaround_list.h
 
 # This tag can be used to specify the character encoding of the source files
diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal
index 47f4301..c563f40 100644
--- a/tools/doxygen/Doxyfile.core.internal
+++ b/tools/doxygen/Doxyfile.core.internal
@@ -849,15 +849,11 @@
 include/grpc/support/atm_gcc_atomic.h \
 include/grpc/support/atm_gcc_sync.h \
 include/grpc/support/atm_windows.h \
-include/grpc/support/avl.h \
-include/grpc/support/cmdline.h \
 include/grpc/support/cpu.h \
-include/grpc/support/host_port.h \
 include/grpc/support/log.h \
 include/grpc/support/log_windows.h \
 include/grpc/support/port_platform.h \
 include/grpc/support/string_util.h \
-include/grpc/support/subprocess.h \
 include/grpc/support/sync.h \
 include/grpc/support/sync_custom.h \
 include/grpc/support/sync_generic.h \
@@ -865,11 +861,6 @@
 include/grpc/support/sync_windows.h \
 include/grpc/support/thd.h \
 include/grpc/support/time.h \
-include/grpc/support/tls.h \
-include/grpc/support/tls_gcc.h \
-include/grpc/support/tls_msvc.h \
-include/grpc/support/tls_pthread.h \
-include/grpc/support/useful.h \
 include/grpc/support/workaround_list.h \
 src/core/README.md \
 src/core/ext/README.md \
@@ -932,7 +923,6 @@
 src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h \
 src/core/ext/filters/client_channel/resolver/sockaddr/README.md \
 src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc \
-src/core/ext/filters/client_channel/resolver_factory.cc \
 src/core/ext/filters/client_channel/resolver_factory.h \
 src/core/ext/filters/client_channel/resolver_registry.cc \
 src/core/ext/filters/client_channel/resolver_registry.h \
@@ -1030,6 +1020,8 @@
 src/core/ext/transport/inproc/inproc_transport.cc \
 src/core/ext/transport/inproc/inproc_transport.h \
 src/core/lib/README.md \
+src/core/lib/avl/avl.cc \
+src/core/lib/avl/avl.h \
 src/core/lib/backoff/backoff.cc \
 src/core/lib/backoff/backoff.h \
 src/core/lib/channel/README.md \
@@ -1071,8 +1063,6 @@
 src/core/lib/gpr/arena.cc \
 src/core/lib/gpr/arena.h \
 src/core/lib/gpr/atm.cc \
-src/core/lib/gpr/avl.cc \
-src/core/lib/gpr/cmdline.cc \
 src/core/lib/gpr/cpu_iphone.cc \
 src/core/lib/gpr/cpu_linux.cc \
 src/core/lib/gpr/cpu_posix.cc \
@@ -1084,6 +1074,7 @@
 src/core/lib/gpr/fork.cc \
 src/core/lib/gpr/fork.h \
 src/core/lib/gpr/host_port.cc \
+src/core/lib/gpr/host_port.h \
 src/core/lib/gpr/log.cc \
 src/core/lib/gpr/log_android.cc \
 src/core/lib/gpr/log_linux.cc \
@@ -1100,8 +1091,6 @@
 src/core/lib/gpr/string_util_windows.cc \
 src/core/lib/gpr/string_windows.cc \
 src/core/lib/gpr/string_windows.h \
-src/core/lib/gpr/subprocess_posix.cc \
-src/core/lib/gpr/subprocess_windows.cc \
 src/core/lib/gpr/sync.cc \
 src/core/lib/gpr/sync_posix.cc \
 src/core/lib/gpr/sync_windows.cc \
@@ -1114,11 +1103,16 @@
 src/core/lib/gpr/time_precise.cc \
 src/core/lib/gpr/time_precise.h \
 src/core/lib/gpr/time_windows.cc \
+src/core/lib/gpr/tls.h \
+src/core/lib/gpr/tls_gcc.h \
+src/core/lib/gpr/tls_msvc.h \
 src/core/lib/gpr/tls_pthread.cc \
+src/core/lib/gpr/tls_pthread.h \
 src/core/lib/gpr/tmpfile.h \
 src/core/lib/gpr/tmpfile_msys.cc \
 src/core/lib/gpr/tmpfile_posix.cc \
 src/core/lib/gpr/tmpfile_windows.cc \
+src/core/lib/gpr/useful.h \
 src/core/lib/gpr/wrap_memcpy.cc \
 src/core/lib/gprpp/README.md \
 src/core/lib/gprpp/abstract.h \
diff --git a/tools/internal_ci/helper_scripts/prepare_build_macos_rc b/tools/internal_ci/helper_scripts/prepare_build_macos_rc
index bd8c8eb..3a09701 100644
--- a/tools/internal_ci/helper_scripts/prepare_build_macos_rc
+++ b/tools/internal_ci/helper_scripts/prepare_build_macos_rc
@@ -50,7 +50,11 @@
 set +ex  # rvm script is very verbose and exits with errorcode
 source $HOME/.rvm/scripts/rvm
 set -e  # rvm commands are very verbose
-rvm use ruby-2.4
+time rvm install 2.5.0
+rvm use 2.5.0 --default
+gem install bundler --no-ri --no-doc
+gem install cocoapods --version 1.3.1 --no-ri --no-doc
+gem install rake-compiler --no-ri --no-doc
 rvm osx-ssl-certs status all
 rvm osx-ssl-certs update all
 set -ex
diff --git a/tools/openssl/use_openssl.sh b/tools/openssl/use_openssl.sh
index a97a54b..dea16ca 100755
--- a/tools/openssl/use_openssl.sh
+++ b/tools/openssl/use_openssl.sh
@@ -16,7 +16,7 @@
 
 set -ex
 
-cd $(dirname $0)/../..
+cd "$(dirname "$0")/../.."
 set root=`pwd`
 CC=${CC:-cc}
 
diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json
index 910f3c1..e1ac146 100644
--- a/tools/run_tests/generated/sources_and_headers.json
+++ b/tools/run_tests/generated/sources_and_headers.json
@@ -86,6 +86,22 @@
     "deps": [
       "gpr", 
       "gpr_test_util", 
+      "grpc"
+    ], 
+    "headers": [], 
+    "is_filegroup": false, 
+    "language": "c", 
+    "name": "avl_test", 
+    "src": [
+      "test/core/avl/avl_test.cc"
+    ], 
+    "third_party": false, 
+    "type": "target"
+  }, 
+  {
+    "deps": [
+      "gpr", 
+      "gpr_test_util", 
       "grpc", 
       "grpc_test_util", 
       "test_tcp_server"
@@ -251,6 +267,22 @@
     "deps": [
       "gpr", 
       "gpr_test_util", 
+      "grpc_test_util"
+    ], 
+    "headers": [], 
+    "is_filegroup": false, 
+    "language": "c", 
+    "name": "cmdline_test", 
+    "src": [
+      "test/core/util/cmdline_test.cc"
+    ], 
+    "third_party": false, 
+    "type": "target"
+  }, 
+  {
+    "deps": [
+      "gpr", 
+      "gpr_test_util", 
       "grpc", 
       "grpc_test_util"
     ], 
@@ -595,36 +627,6 @@
     "headers": [], 
     "is_filegroup": false, 
     "language": "c", 
-    "name": "gpr_avl_test", 
-    "src": [
-      "test/core/gpr/avl_test.cc"
-    ], 
-    "third_party": false, 
-    "type": "target"
-  }, 
-  {
-    "deps": [
-      "gpr", 
-      "gpr_test_util"
-    ], 
-    "headers": [], 
-    "is_filegroup": false, 
-    "language": "c", 
-    "name": "gpr_cmdline_test", 
-    "src": [
-      "test/core/gpr/cmdline_test.cc"
-    ], 
-    "third_party": false, 
-    "type": "target"
-  }, 
-  {
-    "deps": [
-      "gpr", 
-      "gpr_test_util"
-    ], 
-    "headers": [], 
-    "is_filegroup": false, 
-    "language": "c", 
     "name": "gpr_cpu_test", 
     "src": [
       "test/core/gpr/cpu_test.cc"
@@ -950,6 +952,7 @@
   }, 
   {
     "deps": [
+      "cmdline", 
       "gpr", 
       "grpc"
     ], 
@@ -1050,6 +1053,7 @@
   }, 
   {
     "deps": [
+      "cmdline", 
       "gpr", 
       "grpc"
     ], 
@@ -1099,6 +1103,7 @@
   }, 
   {
     "deps": [
+      "cmdline", 
       "gpr", 
       "grpc"
     ], 
@@ -1393,7 +1398,9 @@
   {
     "deps": [
       "gpr", 
-      "grpc"
+      "gpr_test_util", 
+      "grpc", 
+      "grpc_test_util"
     ], 
     "headers": [], 
     "is_filegroup": false, 
@@ -8164,6 +8171,23 @@
     "deps": [
       "gpr_base_headers"
     ], 
+    "headers": [
+      "test/core/util/cmdline.h"
+    ], 
+    "is_filegroup": true, 
+    "language": "c", 
+    "name": "cmdline", 
+    "src": [
+      "test/core/util/cmdline.cc", 
+      "test/core/util/cmdline.h"
+    ], 
+    "third_party": false, 
+    "type": "filegroup"
+  }, 
+  {
+    "deps": [
+      "gpr_base_headers"
+    ], 
     "headers": [], 
     "is_filegroup": true, 
     "language": "c", 
@@ -8172,8 +8196,6 @@
       "src/core/lib/gpr/alloc.cc", 
       "src/core/lib/gpr/arena.cc", 
       "src/core/lib/gpr/atm.cc", 
-      "src/core/lib/gpr/avl.cc", 
-      "src/core/lib/gpr/cmdline.cc", 
       "src/core/lib/gpr/cpu_iphone.cc", 
       "src/core/lib/gpr/cpu_linux.cc", 
       "src/core/lib/gpr/cpu_posix.cc", 
@@ -8194,8 +8216,6 @@
       "src/core/lib/gpr/string_posix.cc", 
       "src/core/lib/gpr/string_util_windows.cc", 
       "src/core/lib/gpr/string_windows.cc", 
-      "src/core/lib/gpr/subprocess_posix.cc", 
-      "src/core/lib/gpr/subprocess_windows.cc", 
       "src/core/lib/gpr/sync.cc", 
       "src/core/lib/gpr/sync_posix.cc", 
       "src/core/lib/gpr/sync_windows.cc", 
@@ -8227,15 +8247,11 @@
       "include/grpc/support/atm_gcc_atomic.h", 
       "include/grpc/support/atm_gcc_sync.h", 
       "include/grpc/support/atm_windows.h", 
-      "include/grpc/support/avl.h", 
-      "include/grpc/support/cmdline.h", 
       "include/grpc/support/cpu.h", 
-      "include/grpc/support/host_port.h", 
       "include/grpc/support/log.h", 
       "include/grpc/support/log_windows.h", 
       "include/grpc/support/port_platform.h", 
       "include/grpc/support/string_util.h", 
-      "include/grpc/support/subprocess.h", 
       "include/grpc/support/sync.h", 
       "include/grpc/support/sync_custom.h", 
       "include/grpc/support/sync_generic.h", 
@@ -8243,14 +8259,10 @@
       "include/grpc/support/sync_windows.h", 
       "include/grpc/support/thd.h", 
       "include/grpc/support/time.h", 
-      "include/grpc/support/tls.h", 
-      "include/grpc/support/tls_gcc.h", 
-      "include/grpc/support/tls_msvc.h", 
-      "include/grpc/support/tls_pthread.h", 
-      "include/grpc/support/useful.h", 
       "src/core/lib/gpr/arena.h", 
       "src/core/lib/gpr/env.h", 
       "src/core/lib/gpr/fork.h", 
+      "src/core/lib/gpr/host_port.h", 
       "src/core/lib/gpr/mpscq.h", 
       "src/core/lib/gpr/murmur_hash.h", 
       "src/core/lib/gpr/spinlock.h", 
@@ -8258,7 +8270,12 @@
       "src/core/lib/gpr/string_windows.h", 
       "src/core/lib/gpr/thd_internal.h", 
       "src/core/lib/gpr/time_precise.h", 
+      "src/core/lib/gpr/tls.h", 
+      "src/core/lib/gpr/tls_gcc.h", 
+      "src/core/lib/gpr/tls_msvc.h", 
+      "src/core/lib/gpr/tls_pthread.h", 
       "src/core/lib/gpr/tmpfile.h", 
+      "src/core/lib/gpr/useful.h", 
       "src/core/lib/gprpp/abstract.h", 
       "src/core/lib/gprpp/atomic.h", 
       "src/core/lib/gprpp/atomic_with_atm.h", 
@@ -8276,15 +8293,11 @@
       "include/grpc/support/atm_gcc_atomic.h", 
       "include/grpc/support/atm_gcc_sync.h", 
       "include/grpc/support/atm_windows.h", 
-      "include/grpc/support/avl.h", 
-      "include/grpc/support/cmdline.h", 
       "include/grpc/support/cpu.h", 
-      "include/grpc/support/host_port.h", 
       "include/grpc/support/log.h", 
       "include/grpc/support/log_windows.h", 
       "include/grpc/support/port_platform.h", 
       "include/grpc/support/string_util.h", 
-      "include/grpc/support/subprocess.h", 
       "include/grpc/support/sync.h", 
       "include/grpc/support/sync_custom.h", 
       "include/grpc/support/sync_generic.h", 
@@ -8292,14 +8305,10 @@
       "include/grpc/support/sync_windows.h", 
       "include/grpc/support/thd.h", 
       "include/grpc/support/time.h", 
-      "include/grpc/support/tls.h", 
-      "include/grpc/support/tls_gcc.h", 
-      "include/grpc/support/tls_msvc.h", 
-      "include/grpc/support/tls_pthread.h", 
-      "include/grpc/support/useful.h", 
       "src/core/lib/gpr/arena.h", 
       "src/core/lib/gpr/env.h", 
       "src/core/lib/gpr/fork.h", 
+      "src/core/lib/gpr/host_port.h", 
       "src/core/lib/gpr/mpscq.h", 
       "src/core/lib/gpr/murmur_hash.h", 
       "src/core/lib/gpr/spinlock.h", 
@@ -8307,7 +8316,12 @@
       "src/core/lib/gpr/string_windows.h", 
       "src/core/lib/gpr/thd_internal.h", 
       "src/core/lib/gpr/time_precise.h", 
+      "src/core/lib/gpr/tls.h", 
+      "src/core/lib/gpr/tls_gcc.h", 
+      "src/core/lib/gpr/tls_msvc.h", 
+      "src/core/lib/gpr/tls_pthread.h", 
       "src/core/lib/gpr/tmpfile.h", 
+      "src/core/lib/gpr/useful.h", 
       "src/core/lib/gprpp/abstract.h", 
       "src/core/lib/gprpp/atomic.h", 
       "src/core/lib/gprpp/atomic_with_atm.h", 
@@ -8399,6 +8413,7 @@
     "language": "c", 
     "name": "grpc_base", 
     "src": [
+      "src/core/lib/avl/avl.cc", 
       "src/core/lib/backoff/backoff.cc", 
       "src/core/lib/channel/channel_args.cc", 
       "src/core/lib/channel/channel_stack.cc", 
@@ -8555,6 +8570,7 @@
       "include/grpc/slice_buffer.h", 
       "include/grpc/status.h", 
       "include/grpc/support/workaround_list.h", 
+      "src/core/lib/avl/avl.h", 
       "src/core/lib/backoff/backoff.h", 
       "src/core/lib/channel/channel_args.h", 
       "src/core/lib/channel/channel_stack.h", 
@@ -8696,6 +8712,7 @@
       "include/grpc/slice_buffer.h", 
       "include/grpc/status.h", 
       "include/grpc/support/workaround_list.h", 
+      "src/core/lib/avl/avl.h", 
       "src/core/lib/backoff/backoff.h", 
       "src/core/lib/channel/channel_args.h", 
       "src/core/lib/channel/channel_stack.h", 
@@ -8883,7 +8900,6 @@
       "src/core/ext/filters/client_channel/proxy_mapper_registry.h", 
       "src/core/ext/filters/client_channel/resolver.cc", 
       "src/core/ext/filters/client_channel/resolver.h", 
-      "src/core/ext/filters/client_channel/resolver_factory.cc", 
       "src/core/ext/filters/client_channel/resolver_factory.h", 
       "src/core/ext/filters/client_channel/resolver_registry.cc", 
       "src/core/ext/filters/client_channel/resolver_registry.h", 
@@ -9331,6 +9347,7 @@
   }, 
   {
     "deps": [
+      "cmdline", 
       "gpr", 
       "gpr_test_util", 
       "grpc_base", 
@@ -9353,6 +9370,7 @@
       "test/core/util/port.h", 
       "test/core/util/port_server_client.h", 
       "test/core/util/slice_splitter.h", 
+      "test/core/util/subprocess.h", 
       "test/core/util/tracer_util.h", 
       "test/core/util/trickle_endpoint.h"
     ], 
@@ -9391,6 +9409,9 @@
       "test/core/util/port_server_client.h", 
       "test/core/util/slice_splitter.cc", 
       "test/core/util/slice_splitter.h", 
+      "test/core/util/subprocess.h", 
+      "test/core/util/subprocess_posix.cc", 
+      "test/core/util/subprocess_windows.cc", 
       "test/core/util/tracer_util.cc", 
       "test/core/util/tracer_util.h", 
       "test/core/util/trickle_endpoint.cc", 
diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json
index a176392..ae5d6cb 100644
--- a/tools/run_tests/generated/tests.json
+++ b/tools/run_tests/generated/tests.json
@@ -108,6 +108,30 @@
     ], 
     "cpu_cost": 1.0, 
     "exclude_configs": [], 
+    "exclude_iomgrs": [], 
+    "flaky": false, 
+    "gtest": false, 
+    "language": "c", 
+    "name": "avl_test", 
+    "platforms": [
+      "linux", 
+      "mac", 
+      "posix", 
+      "windows"
+    ], 
+    "uses_polling": false
+  }, 
+  {
+    "args": [], 
+    "benchmark": false, 
+    "ci_platforms": [
+      "linux", 
+      "mac", 
+      "posix", 
+      "windows"
+    ], 
+    "cpu_cost": 1.0, 
+    "exclude_configs": [], 
     "exclude_iomgrs": [
       "uv"
     ], 
@@ -300,6 +324,30 @@
       "posix", 
       "windows"
     ], 
+    "cpu_cost": 1.0, 
+    "exclude_configs": [], 
+    "exclude_iomgrs": [], 
+    "flaky": false, 
+    "gtest": false, 
+    "language": "c", 
+    "name": "cmdline_test", 
+    "platforms": [
+      "linux", 
+      "mac", 
+      "posix", 
+      "windows"
+    ], 
+    "uses_polling": false
+  }, 
+  {
+    "args": [], 
+    "benchmark": false, 
+    "ci_platforms": [
+      "linux", 
+      "mac", 
+      "posix", 
+      "windows"
+    ], 
     "cpu_cost": 10, 
     "exclude_configs": [], 
     "exclude_iomgrs": [], 
@@ -728,54 +776,6 @@
       "posix", 
       "windows"
     ], 
-    "cpu_cost": 1.0, 
-    "exclude_configs": [], 
-    "exclude_iomgrs": [], 
-    "flaky": false, 
-    "gtest": false, 
-    "language": "c", 
-    "name": "gpr_avl_test", 
-    "platforms": [
-      "linux", 
-      "mac", 
-      "posix", 
-      "windows"
-    ], 
-    "uses_polling": false
-  }, 
-  {
-    "args": [], 
-    "benchmark": false, 
-    "ci_platforms": [
-      "linux", 
-      "mac", 
-      "posix", 
-      "windows"
-    ], 
-    "cpu_cost": 1.0, 
-    "exclude_configs": [], 
-    "exclude_iomgrs": [], 
-    "flaky": false, 
-    "gtest": false, 
-    "language": "c", 
-    "name": "gpr_cmdline_test", 
-    "platforms": [
-      "linux", 
-      "mac", 
-      "posix", 
-      "windows"
-    ], 
-    "uses_polling": false
-  }, 
-  {
-    "args": [], 
-    "benchmark": false, 
-    "ci_platforms": [
-      "linux", 
-      "mac", 
-      "posix", 
-      "windows"
-    ], 
     "cpu_cost": 30, 
     "exclude_configs": [], 
     "exclude_iomgrs": [], 
@@ -105337,6 +105337,29 @@
   }, 
   {
     "args": [
+      "test/core/end2end/fuzzers/api_fuzzer_corpus/poc-2d730ebd78b3052e4367ad0d485208dcb205482cbcd6289f17907989b8de1fba"
+    ], 
+    "ci_platforms": [
+      "linux"
+    ], 
+    "cpu_cost": 0.1, 
+    "exclude_configs": [
+      "tsan"
+    ], 
+    "exclude_iomgrs": [
+      "uv"
+    ], 
+    "flaky": false, 
+    "language": "c", 
+    "name": "api_fuzzer_one_entry", 
+    "platforms": [
+      "mac", 
+      "linux"
+    ], 
+    "uses_polling": false
+  }, 
+  {
+    "args": [
       "test/core/end2end/fuzzers/api_fuzzer_corpus/poc-c726ee220e980ed6ad17809fd9efe2844ee61555ac08e4f88afd8901cc2dd53a"
     ], 
     "ci_platforms": [
diff --git a/tools/run_tests/sanity/check_shellcheck.sh b/tools/run_tests/sanity/check_shellcheck.sh
index 64f59cb..6e60ea2 100755
--- a/tools/run_tests/sanity/check_shellcheck.sh
+++ b/tools/run_tests/sanity/check_shellcheck.sh
@@ -19,6 +19,7 @@
 ROOT="$(dirname "$0")/../../.."
 
 DIRS=(
+    'test'
     'tools/run_tests'
 )