// Generated by `wit-bindgen` 0.53.1. DO NOT EDIT!
#include "wasi/wasip3.h"
#include <stdlib.h>
#include <string.h>

// Imported Functions from `wasi:cli/environment@0.3.0-rc-2026-03-15`

__attribute__((__import_module__("wasi:cli/environment@0.3.0-rc-2026-03-15"), __import_name__("get-environment")))
extern void __wasm_import_environment_get_environment(uint8_t *);

__attribute__((__import_module__("wasi:cli/environment@0.3.0-rc-2026-03-15"), __import_name__("get-arguments")))
extern void __wasm_import_environment_get_arguments(uint8_t *);

__attribute__((__import_module__("wasi:cli/environment@0.3.0-rc-2026-03-15"), __import_name__("get-initial-cwd")))
extern void __wasm_import_environment_get_initial_cwd(uint8_t *);

// Imported Functions from `wasi:cli/exit@0.3.0-rc-2026-03-15`

__attribute__((__import_module__("wasi:cli/exit@0.3.0-rc-2026-03-15"), __import_name__("exit")))
_Noreturn extern void __wasm_import_exit_exit(int32_t);

// Imported Functions from `wasi:cli/stdin@0.3.0-rc-2026-03-15`

__attribute__((__import_module__("wasi:cli/stdin@0.3.0-rc-2026-03-15"), __import_name__("read-via-stream")))
extern void __wasm_import_stdin_read_via_stream(uint8_t *);

// Imported Functions from `wasi:cli/stdout@0.3.0-rc-2026-03-15`

__attribute__((__import_module__("wasi:cli/stdout@0.3.0-rc-2026-03-15"), __import_name__("write-via-stream")))
extern int32_t __wasm_import_stdout_write_via_stream(int32_t);

// Imported Functions from `wasi:cli/stderr@0.3.0-rc-2026-03-15`

__attribute__((__import_module__("wasi:cli/stderr@0.3.0-rc-2026-03-15"), __import_name__("write-via-stream")))
extern int32_t __wasm_import_stderr_write_via_stream(int32_t);

// Imported Functions from `wasi:cli/terminal-stdin@0.3.0-rc-2026-03-15`

__attribute__((__import_module__("wasi:cli/terminal-stdin@0.3.0-rc-2026-03-15"), __import_name__("get-terminal-stdin")))
extern void __wasm_import_terminal_stdin_get_terminal_stdin(uint8_t *);

// Imported Functions from `wasi:cli/terminal-stdout@0.3.0-rc-2026-03-15`

__attribute__((__import_module__("wasi:cli/terminal-stdout@0.3.0-rc-2026-03-15"), __import_name__("get-terminal-stdout")))
extern void __wasm_import_terminal_stdout_get_terminal_stdout(uint8_t *);

// Imported Functions from `wasi:cli/terminal-stderr@0.3.0-rc-2026-03-15`

__attribute__((__import_module__("wasi:cli/terminal-stderr@0.3.0-rc-2026-03-15"), __import_name__("get-terminal-stderr")))
extern void __wasm_import_terminal_stderr_get_terminal_stderr(uint8_t *);

// Imported Functions from `wasi:clocks/monotonic-clock@0.3.0-rc-2026-03-15`

__attribute__((__import_module__("wasi:clocks/monotonic-clock@0.3.0-rc-2026-03-15"), __import_name__("now")))
extern int64_t __wasm_import_monotonic_clock_now(void);

__attribute__((__import_module__("wasi:clocks/monotonic-clock@0.3.0-rc-2026-03-15"), __import_name__("get-resolution")))
extern int64_t __wasm_import_monotonic_clock_get_resolution(void);

__attribute__((__import_module__("wasi:clocks/monotonic-clock@0.3.0-rc-2026-03-15"), __import_name__("wait-until")))
extern void __wasm_import_monotonic_clock_wait_until(int64_t);

__attribute__((__import_module__("wasi:clocks/monotonic-clock@0.3.0-rc-2026-03-15"), __import_name__("[async-lower]wait-for")))
extern int32_t __wasm_import_monotonic_clock_wait_for(int64_t);

// Imported Functions from `wasi:clocks/system-clock@0.3.0-rc-2026-03-15`

__attribute__((__import_module__("wasi:clocks/system-clock@0.3.0-rc-2026-03-15"), __import_name__("now")))
extern void __wasm_import_system_clock_now(uint8_t *);

__attribute__((__import_module__("wasi:clocks/system-clock@0.3.0-rc-2026-03-15"), __import_name__("get-resolution")))
extern int64_t __wasm_import_system_clock_get_resolution(void);

// Imported Functions from `wasi:filesystem/types@0.3.0-rc-2026-03-15`

__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[method]descriptor.read-via-stream")))
extern void __wasm_import_filesystem_method_descriptor_read_via_stream(int32_t, int64_t, uint8_t *);

__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[method]descriptor.write-via-stream")))
extern int32_t __wasm_import_filesystem_method_descriptor_write_via_stream(int32_t, int32_t, int64_t);

__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[method]descriptor.append-via-stream")))
extern int32_t __wasm_import_filesystem_method_descriptor_append_via_stream(int32_t, int32_t);

__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[method]descriptor.advise")))
extern void __wasm_import_filesystem_method_descriptor_advise(int32_t, int64_t, int64_t, int32_t, uint8_t *);

__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[method]descriptor.sync-data")))
extern void __wasm_import_filesystem_method_descriptor_sync_data(int32_t, uint8_t *);

__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[method]descriptor.get-flags")))
extern void __wasm_import_filesystem_method_descriptor_get_flags(int32_t, uint8_t *);

__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[async-lower][method]descriptor.get-type")))
extern int32_t __wasm_import_filesystem_method_descriptor_get_type(int32_t, uint8_t *);

__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[method]descriptor.set-size")))
extern void __wasm_import_filesystem_method_descriptor_set_size(int32_t, int64_t, uint8_t *);

__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[method]descriptor.set-times")))
extern void __wasm_import_filesystem_method_descriptor_set_times(int32_t, int32_t, int64_t, int32_t, int32_t, int64_t, int32_t, uint8_t *);

__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[method]descriptor.read-directory")))
extern void __wasm_import_filesystem_method_descriptor_read_directory(int32_t, uint8_t *);

__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[method]descriptor.sync")))
extern void __wasm_import_filesystem_method_descriptor_sync(int32_t, uint8_t *);

__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[method]descriptor.create-directory-at")))
extern void __wasm_import_filesystem_method_descriptor_create_directory_at(int32_t, uint8_t *, size_t, uint8_t *);

__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[method]descriptor.stat")))
extern void __wasm_import_filesystem_method_descriptor_stat(int32_t, uint8_t *);

__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[method]descriptor.stat-at")))
extern void __wasm_import_filesystem_method_descriptor_stat_at(int32_t, int32_t, uint8_t *, size_t, uint8_t *);

__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[method]descriptor.set-times-at")))
extern void __wasm_import_filesystem_method_descriptor_set_times_at(int32_t, int32_t, uint8_t *, size_t, int32_t, int64_t, int32_t, int32_t, int64_t, int32_t, uint8_t *);

__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[method]descriptor.link-at")))
extern void __wasm_import_filesystem_method_descriptor_link_at(int32_t, int32_t, uint8_t *, size_t, int32_t, uint8_t *, size_t, uint8_t *);

__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[method]descriptor.open-at")))
extern void __wasm_import_filesystem_method_descriptor_open_at(int32_t, int32_t, uint8_t *, size_t, int32_t, int32_t, uint8_t *);

__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[method]descriptor.readlink-at")))
extern void __wasm_import_filesystem_method_descriptor_readlink_at(int32_t, uint8_t *, size_t, uint8_t *);

__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[method]descriptor.remove-directory-at")))
extern void __wasm_import_filesystem_method_descriptor_remove_directory_at(int32_t, uint8_t *, size_t, uint8_t *);

__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[method]descriptor.rename-at")))
extern void __wasm_import_filesystem_method_descriptor_rename_at(int32_t, uint8_t *, size_t, int32_t, uint8_t *, size_t, uint8_t *);

__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[method]descriptor.symlink-at")))
extern void __wasm_import_filesystem_method_descriptor_symlink_at(int32_t, uint8_t *, size_t, uint8_t *, size_t, uint8_t *);

__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[method]descriptor.unlink-file-at")))
extern void __wasm_import_filesystem_method_descriptor_unlink_file_at(int32_t, uint8_t *, size_t, uint8_t *);

__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[async-lower][method]descriptor.is-same-object")))
extern int32_t __wasm_import_filesystem_method_descriptor_is_same_object(int32_t, int32_t, uint8_t *);

__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[method]descriptor.metadata-hash")))
extern void __wasm_import_filesystem_method_descriptor_metadata_hash(int32_t, uint8_t *);

__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[method]descriptor.metadata-hash-at")))
extern void __wasm_import_filesystem_method_descriptor_metadata_hash_at(int32_t, int32_t, uint8_t *, size_t, uint8_t *);

// Imported Functions from `wasi:filesystem/preopens@0.3.0-rc-2026-03-15`

__attribute__((__import_module__("wasi:filesystem/preopens@0.3.0-rc-2026-03-15"), __import_name__("get-directories")))
extern void __wasm_import_filesystem_preopens_get_directories(uint8_t *);

// Imported Functions from `wasi:sockets/types@0.3.0-rc-2026-03-15`

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[static]tcp-socket.create")))
extern void __wasm_import_sockets_static_tcp_socket_create(int32_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]tcp-socket.bind")))
extern void __wasm_import_sockets_method_tcp_socket_bind(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[async-lower][method]tcp-socket.connect")))
extern int32_t __wasm_import_sockets_method_tcp_socket_connect(uint8_t *, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]tcp-socket.listen")))
extern void __wasm_import_sockets_method_tcp_socket_listen(int32_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]tcp-socket.send")))
extern int32_t __wasm_import_sockets_method_tcp_socket_send(int32_t, int32_t);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]tcp-socket.receive")))
extern void __wasm_import_sockets_method_tcp_socket_receive(int32_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]tcp-socket.get-local-address")))
extern void __wasm_import_sockets_method_tcp_socket_get_local_address(int32_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]tcp-socket.get-remote-address")))
extern void __wasm_import_sockets_method_tcp_socket_get_remote_address(int32_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]tcp-socket.get-is-listening")))
extern int32_t __wasm_import_sockets_method_tcp_socket_get_is_listening(int32_t);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]tcp-socket.get-address-family")))
extern int32_t __wasm_import_sockets_method_tcp_socket_get_address_family(int32_t);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]tcp-socket.set-listen-backlog-size")))
extern void __wasm_import_sockets_method_tcp_socket_set_listen_backlog_size(int32_t, int64_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]tcp-socket.get-keep-alive-enabled")))
extern void __wasm_import_sockets_method_tcp_socket_get_keep_alive_enabled(int32_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]tcp-socket.set-keep-alive-enabled")))
extern void __wasm_import_sockets_method_tcp_socket_set_keep_alive_enabled(int32_t, int32_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]tcp-socket.get-keep-alive-idle-time")))
extern void __wasm_import_sockets_method_tcp_socket_get_keep_alive_idle_time(int32_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]tcp-socket.set-keep-alive-idle-time")))
extern void __wasm_import_sockets_method_tcp_socket_set_keep_alive_idle_time(int32_t, int64_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]tcp-socket.get-keep-alive-interval")))
extern void __wasm_import_sockets_method_tcp_socket_get_keep_alive_interval(int32_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]tcp-socket.set-keep-alive-interval")))
extern void __wasm_import_sockets_method_tcp_socket_set_keep_alive_interval(int32_t, int64_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]tcp-socket.get-keep-alive-count")))
extern void __wasm_import_sockets_method_tcp_socket_get_keep_alive_count(int32_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]tcp-socket.set-keep-alive-count")))
extern void __wasm_import_sockets_method_tcp_socket_set_keep_alive_count(int32_t, int32_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]tcp-socket.get-hop-limit")))
extern void __wasm_import_sockets_method_tcp_socket_get_hop_limit(int32_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]tcp-socket.set-hop-limit")))
extern void __wasm_import_sockets_method_tcp_socket_set_hop_limit(int32_t, int32_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]tcp-socket.get-receive-buffer-size")))
extern void __wasm_import_sockets_method_tcp_socket_get_receive_buffer_size(int32_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]tcp-socket.set-receive-buffer-size")))
extern void __wasm_import_sockets_method_tcp_socket_set_receive_buffer_size(int32_t, int64_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]tcp-socket.get-send-buffer-size")))
extern void __wasm_import_sockets_method_tcp_socket_get_send_buffer_size(int32_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]tcp-socket.set-send-buffer-size")))
extern void __wasm_import_sockets_method_tcp_socket_set_send_buffer_size(int32_t, int64_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[static]udp-socket.create")))
extern void __wasm_import_sockets_static_udp_socket_create(int32_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]udp-socket.bind")))
extern void __wasm_import_sockets_method_udp_socket_bind(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]udp-socket.connect")))
extern void __wasm_import_sockets_method_udp_socket_connect(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]udp-socket.disconnect")))
extern void __wasm_import_sockets_method_udp_socket_disconnect(int32_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[async-lower][method]udp-socket.send")))
extern int32_t __wasm_import_sockets_method_udp_socket_send(uint8_t *, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[async-lower][method]udp-socket.receive")))
extern int32_t __wasm_import_sockets_method_udp_socket_receive(int32_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]udp-socket.get-local-address")))
extern void __wasm_import_sockets_method_udp_socket_get_local_address(int32_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]udp-socket.get-remote-address")))
extern void __wasm_import_sockets_method_udp_socket_get_remote_address(int32_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]udp-socket.get-address-family")))
extern int32_t __wasm_import_sockets_method_udp_socket_get_address_family(int32_t);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]udp-socket.get-unicast-hop-limit")))
extern void __wasm_import_sockets_method_udp_socket_get_unicast_hop_limit(int32_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]udp-socket.set-unicast-hop-limit")))
extern void __wasm_import_sockets_method_udp_socket_set_unicast_hop_limit(int32_t, int32_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]udp-socket.get-receive-buffer-size")))
extern void __wasm_import_sockets_method_udp_socket_get_receive_buffer_size(int32_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]udp-socket.set-receive-buffer-size")))
extern void __wasm_import_sockets_method_udp_socket_set_receive_buffer_size(int32_t, int64_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]udp-socket.get-send-buffer-size")))
extern void __wasm_import_sockets_method_udp_socket_get_send_buffer_size(int32_t, uint8_t *);

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[method]udp-socket.set-send-buffer-size")))
extern void __wasm_import_sockets_method_udp_socket_set_send_buffer_size(int32_t, int64_t, uint8_t *);

// Imported Functions from `wasi:sockets/ip-name-lookup@0.3.0-rc-2026-03-15`

__attribute__((__import_module__("wasi:sockets/ip-name-lookup@0.3.0-rc-2026-03-15"), __import_name__("resolve-addresses")))
extern void __wasm_import_ip_name_lookup_resolve_addresses(uint8_t *, size_t, uint8_t *);

// Imported Functions from `wasi:random/random@0.3.0-rc-2026-03-15`

__attribute__((__import_module__("wasi:random/random@0.3.0-rc-2026-03-15"), __import_name__("get-random-bytes")))
extern void __wasm_import_random_get_random_bytes(int64_t, uint8_t *);

__attribute__((__import_module__("wasi:random/random@0.3.0-rc-2026-03-15"), __import_name__("get-random-u64")))
extern int64_t __wasm_import_random_get_random_u64(void);

// Imported Functions from `wasi:random/insecure@0.3.0-rc-2026-03-15`

__attribute__((__import_module__("wasi:random/insecure@0.3.0-rc-2026-03-15"), __import_name__("get-insecure-random-bytes")))
extern void __wasm_import_random_insecure_get_insecure_random_bytes(int64_t, uint8_t *);

__attribute__((__import_module__("wasi:random/insecure@0.3.0-rc-2026-03-15"), __import_name__("get-insecure-random-u64")))
extern int64_t __wasm_import_random_insecure_get_insecure_random_u64(void);

// Imported Functions from `wasi:random/insecure-seed@0.3.0-rc-2026-03-15`

__attribute__((__import_module__("wasi:random/insecure-seed@0.3.0-rc-2026-03-15"), __import_name__("get-insecure-seed")))
extern void __wasm_import_random_insecure_seed_get_insecure_seed(uint8_t *);

// Canonical ABI intrinsics

__attribute__((__weak__, __export_name__("cabi_realloc")))
void *cabi_realloc(void *ptr, size_t old_size, size_t align, size_t new_size) {
  (void) old_size;
  if (new_size == 0) return (void*) align;
  void *ret = realloc(ptr, new_size);
  if (!ret) abort();
  return ret;
}

// Helper Functions

void wasip3_tuple2_string_string_free(wasip3_tuple2_string_string_t *ptr) {
  wasip3_string_free(&ptr->f0);
  wasip3_string_free(&ptr->f1);
}

void wasip3_list_tuple2_string_string_free(wasip3_list_tuple2_string_string_t *ptr) {
  size_t list_len = ptr->len;
  if (list_len > 0) {
    wasip3_tuple2_string_string_t *list_ptr = ptr->ptr;
    for (size_t i = 0; i < list_len; i++) {
      wasip3_tuple2_string_string_free(&list_ptr[i]);
    }
    free(list_ptr);
  }
}

void wasip3_list_string_free(wasip3_list_string_t *ptr) {
  size_t list_len = ptr->len;
  if (list_len > 0) {
    wasip3_string_t *list_ptr = ptr->ptr;
    for (size_t i = 0; i < list_len; i++) {
      wasip3_string_free(&list_ptr[i]);
    }
    free(list_ptr);
  }
}

void wasip3_option_string_free(wasip3_option_string_t *ptr) {
  if (ptr->is_some) {
    wasip3_string_free(&ptr->val);
  }
}

void exit_result_void_void_free(exit_result_void_void_t *ptr) {
  if (!ptr->is_err) {
  }
}

void stdin_result_void_error_code_free(stdin_result_void_error_code_t *ptr) {
  if (!ptr->is_err) {
  } else {
  }
}

__attribute__((__import_module__("wasi:cli/stdin@0.3.0-rc-2026-03-15"), __import_name__("[stream-new-0]read-via-stream")))
extern uint64_t stdin_stream_u8__new(void);
__attribute__((__import_module__("wasi:cli/stdin@0.3.0-rc-2026-03-15"), __import_name__("[async-lower][stream-read-0]read-via-stream")))
extern uint32_t stdin_stream_u8__read(uint32_t, uint8_t*, size_t);
__attribute__((__import_module__("wasi:cli/stdin@0.3.0-rc-2026-03-15"), __import_name__("[async-lower][stream-write-0]read-via-stream")))
extern uint32_t stdin_stream_u8__write(uint32_t, const uint8_t*, size_t);
__attribute__((__import_module__("wasi:cli/stdin@0.3.0-rc-2026-03-15"), __import_name__("[stream-cancel-read-0]read-via-stream")))
extern uint32_t stdin_stream_u8__cancel_read(uint32_t);
__attribute__((__import_module__("wasi:cli/stdin@0.3.0-rc-2026-03-15"), __import_name__("[stream-cancel-write-0]read-via-stream")))
extern uint32_t stdin_stream_u8__cancel_write(uint32_t);
__attribute__((__import_module__("wasi:cli/stdin@0.3.0-rc-2026-03-15"), __import_name__("[stream-drop-readable-0]read-via-stream")))
extern void stdin_stream_u8__drop_readable(uint32_t);
__attribute__((__import_module__("wasi:cli/stdin@0.3.0-rc-2026-03-15"), __import_name__("[stream-drop-writable-0]read-via-stream")))
extern void stdin_stream_u8__drop_writable(uint32_t);

stdin_stream_u8_t stdin_stream_u8_new(stdin_stream_u8_writer_t *writer) {
  uint64_t packed = stdin_stream_u8__new();
  *writer = (uint32_t) (packed >> 32);
  return (uint32_t) packed;
}

wasip3_waitable_status_t stdin_stream_u8_read(stdin_stream_u8_t reader, uint8_t *buf, size_t amt) {
  return stdin_stream_u8__read(reader, (uint8_t*) buf, amt);
}

wasip3_waitable_status_t stdin_stream_u8_write(stdin_stream_u8_writer_t writer, const uint8_t *buf, size_t amt) {
  return stdin_stream_u8__write(writer, (const uint8_t*) buf, amt);
}

wasip3_waitable_status_t stdin_stream_u8_cancel_read(stdin_stream_u8_t reader){
  return stdin_stream_u8__cancel_read(reader);
}

wasip3_waitable_status_t stdin_stream_u8_cancel_write(stdin_stream_u8_writer_t writer) {
  return stdin_stream_u8__cancel_write(writer);
}

void stdin_stream_u8_drop_readable(stdin_stream_u8_t reader){
  stdin_stream_u8__drop_readable(reader);
}

void stdin_stream_u8_drop_writable(stdin_stream_u8_writer_t writer) {
  stdin_stream_u8__drop_writable(writer);
}


__attribute__((__import_module__("wasi:cli/stdin@0.3.0-rc-2026-03-15"), __import_name__("[future-new-1]read-via-stream")))
extern uint64_t stdin_future_result_void_error_code__new(void);
__attribute__((__import_module__("wasi:cli/stdin@0.3.0-rc-2026-03-15"), __import_name__("[async-lower][future-read-1]read-via-stream")))
extern uint32_t stdin_future_result_void_error_code__read(uint32_t, uint8_t*);
__attribute__((__import_module__("wasi:cli/stdin@0.3.0-rc-2026-03-15"), __import_name__("[async-lower][future-write-1]read-via-stream")))
extern uint32_t stdin_future_result_void_error_code__write(uint32_t, const uint8_t*);
__attribute__((__import_module__("wasi:cli/stdin@0.3.0-rc-2026-03-15"), __import_name__("[future-cancel-read-1]read-via-stream")))
extern uint32_t stdin_future_result_void_error_code__cancel_read(uint32_t);
__attribute__((__import_module__("wasi:cli/stdin@0.3.0-rc-2026-03-15"), __import_name__("[future-cancel-write-1]read-via-stream")))
extern uint32_t stdin_future_result_void_error_code__cancel_write(uint32_t);
__attribute__((__import_module__("wasi:cli/stdin@0.3.0-rc-2026-03-15"), __import_name__("[future-drop-readable-1]read-via-stream")))
extern void stdin_future_result_void_error_code__drop_readable(uint32_t);
__attribute__((__import_module__("wasi:cli/stdin@0.3.0-rc-2026-03-15"), __import_name__("[future-drop-writable-1]read-via-stream")))
extern void stdin_future_result_void_error_code__drop_writable(uint32_t);

stdin_future_result_void_error_code_t stdin_future_result_void_error_code_new(stdin_future_result_void_error_code_writer_t *writer) {
  uint64_t packed = stdin_future_result_void_error_code__new();
  *writer = (uint32_t) (packed >> 32);
  return (uint32_t) packed;
}

wasip3_waitable_status_t stdin_future_result_void_error_code_read(stdin_future_result_void_error_code_t reader, stdin_result_void_error_code_t *buf) {
  return stdin_future_result_void_error_code__read(reader, (uint8_t*) buf);
}

wasip3_waitable_status_t stdin_future_result_void_error_code_write(stdin_future_result_void_error_code_writer_t writer, const stdin_result_void_error_code_t *buf) {
  return stdin_future_result_void_error_code__write(writer, (const uint8_t*) buf);
}

wasip3_waitable_status_t stdin_future_result_void_error_code_cancel_read(stdin_future_result_void_error_code_t reader){
  return stdin_future_result_void_error_code__cancel_read(reader);
}

wasip3_waitable_status_t stdin_future_result_void_error_code_cancel_write(stdin_future_result_void_error_code_writer_t writer) {
  return stdin_future_result_void_error_code__cancel_write(writer);
}

void stdin_future_result_void_error_code_drop_readable(stdin_future_result_void_error_code_t reader){
  stdin_future_result_void_error_code__drop_readable(reader);
}

void stdin_future_result_void_error_code_drop_writable(stdin_future_result_void_error_code_writer_t writer) {
  stdin_future_result_void_error_code__drop_writable(writer);
}


void stdout_result_void_error_code_free(stdout_result_void_error_code_t *ptr) {
  if (!ptr->is_err) {
  } else {
  }
}

__attribute__((__import_module__("wasi:cli/stdout@0.3.0-rc-2026-03-15"), __import_name__("[future-new-1]write-via-stream")))
extern uint64_t stdout_future_result_void_error_code__new(void);
__attribute__((__import_module__("wasi:cli/stdout@0.3.0-rc-2026-03-15"), __import_name__("[async-lower][future-read-1]write-via-stream")))
extern uint32_t stdout_future_result_void_error_code__read(uint32_t, uint8_t*);
__attribute__((__import_module__("wasi:cli/stdout@0.3.0-rc-2026-03-15"), __import_name__("[async-lower][future-write-1]write-via-stream")))
extern uint32_t stdout_future_result_void_error_code__write(uint32_t, const uint8_t*);
__attribute__((__import_module__("wasi:cli/stdout@0.3.0-rc-2026-03-15"), __import_name__("[future-cancel-read-1]write-via-stream")))
extern uint32_t stdout_future_result_void_error_code__cancel_read(uint32_t);
__attribute__((__import_module__("wasi:cli/stdout@0.3.0-rc-2026-03-15"), __import_name__("[future-cancel-write-1]write-via-stream")))
extern uint32_t stdout_future_result_void_error_code__cancel_write(uint32_t);
__attribute__((__import_module__("wasi:cli/stdout@0.3.0-rc-2026-03-15"), __import_name__("[future-drop-readable-1]write-via-stream")))
extern void stdout_future_result_void_error_code__drop_readable(uint32_t);
__attribute__((__import_module__("wasi:cli/stdout@0.3.0-rc-2026-03-15"), __import_name__("[future-drop-writable-1]write-via-stream")))
extern void stdout_future_result_void_error_code__drop_writable(uint32_t);

stdout_future_result_void_error_code_t stdout_future_result_void_error_code_new(stdout_future_result_void_error_code_writer_t *writer) {
  uint64_t packed = stdout_future_result_void_error_code__new();
  *writer = (uint32_t) (packed >> 32);
  return (uint32_t) packed;
}

wasip3_waitable_status_t stdout_future_result_void_error_code_read(stdout_future_result_void_error_code_t reader, stdout_result_void_error_code_t *buf) {
  return stdout_future_result_void_error_code__read(reader, (uint8_t*) buf);
}

wasip3_waitable_status_t stdout_future_result_void_error_code_write(stdout_future_result_void_error_code_writer_t writer, const stdout_result_void_error_code_t *buf) {
  return stdout_future_result_void_error_code__write(writer, (const uint8_t*) buf);
}

wasip3_waitable_status_t stdout_future_result_void_error_code_cancel_read(stdout_future_result_void_error_code_t reader){
  return stdout_future_result_void_error_code__cancel_read(reader);
}

wasip3_waitable_status_t stdout_future_result_void_error_code_cancel_write(stdout_future_result_void_error_code_writer_t writer) {
  return stdout_future_result_void_error_code__cancel_write(writer);
}

void stdout_future_result_void_error_code_drop_readable(stdout_future_result_void_error_code_t reader){
  stdout_future_result_void_error_code__drop_readable(reader);
}

void stdout_future_result_void_error_code_drop_writable(stdout_future_result_void_error_code_writer_t writer) {
  stdout_future_result_void_error_code__drop_writable(writer);
}


void stderr_result_void_error_code_free(stderr_result_void_error_code_t *ptr) {
  if (!ptr->is_err) {
  } else {
  }
}

__attribute__((__import_module__("wasi:cli/stderr@0.3.0-rc-2026-03-15"), __import_name__("[future-new-1]write-via-stream")))
extern uint64_t stderr_future_result_void_error_code__new(void);
__attribute__((__import_module__("wasi:cli/stderr@0.3.0-rc-2026-03-15"), __import_name__("[async-lower][future-read-1]write-via-stream")))
extern uint32_t stderr_future_result_void_error_code__read(uint32_t, uint8_t*);
__attribute__((__import_module__("wasi:cli/stderr@0.3.0-rc-2026-03-15"), __import_name__("[async-lower][future-write-1]write-via-stream")))
extern uint32_t stderr_future_result_void_error_code__write(uint32_t, const uint8_t*);
__attribute__((__import_module__("wasi:cli/stderr@0.3.0-rc-2026-03-15"), __import_name__("[future-cancel-read-1]write-via-stream")))
extern uint32_t stderr_future_result_void_error_code__cancel_read(uint32_t);
__attribute__((__import_module__("wasi:cli/stderr@0.3.0-rc-2026-03-15"), __import_name__("[future-cancel-write-1]write-via-stream")))
extern uint32_t stderr_future_result_void_error_code__cancel_write(uint32_t);
__attribute__((__import_module__("wasi:cli/stderr@0.3.0-rc-2026-03-15"), __import_name__("[future-drop-readable-1]write-via-stream")))
extern void stderr_future_result_void_error_code__drop_readable(uint32_t);
__attribute__((__import_module__("wasi:cli/stderr@0.3.0-rc-2026-03-15"), __import_name__("[future-drop-writable-1]write-via-stream")))
extern void stderr_future_result_void_error_code__drop_writable(uint32_t);

stderr_future_result_void_error_code_t stderr_future_result_void_error_code_new(stderr_future_result_void_error_code_writer_t *writer) {
  uint64_t packed = stderr_future_result_void_error_code__new();
  *writer = (uint32_t) (packed >> 32);
  return (uint32_t) packed;
}

wasip3_waitable_status_t stderr_future_result_void_error_code_read(stderr_future_result_void_error_code_t reader, stderr_result_void_error_code_t *buf) {
  return stderr_future_result_void_error_code__read(reader, (uint8_t*) buf);
}

wasip3_waitable_status_t stderr_future_result_void_error_code_write(stderr_future_result_void_error_code_writer_t writer, const stderr_result_void_error_code_t *buf) {
  return stderr_future_result_void_error_code__write(writer, (const uint8_t*) buf);
}

wasip3_waitable_status_t stderr_future_result_void_error_code_cancel_read(stderr_future_result_void_error_code_t reader){
  return stderr_future_result_void_error_code__cancel_read(reader);
}

wasip3_waitable_status_t stderr_future_result_void_error_code_cancel_write(stderr_future_result_void_error_code_writer_t writer) {
  return stderr_future_result_void_error_code__cancel_write(writer);
}

void stderr_future_result_void_error_code_drop_readable(stderr_future_result_void_error_code_t reader){
  stderr_future_result_void_error_code__drop_readable(reader);
}

void stderr_future_result_void_error_code_drop_writable(stderr_future_result_void_error_code_writer_t writer) {
  stderr_future_result_void_error_code__drop_writable(writer);
}


__attribute__((__import_module__("wasi:cli/terminal-input@0.3.0-rc-2026-03-15"), __import_name__("[resource-drop]terminal-input")))
extern void __wasm_import_terminal_input_terminal_input_drop(int32_t handle);

void terminal_input_terminal_input_drop_own(terminal_input_own_terminal_input_t handle) {
  __wasm_import_terminal_input_terminal_input_drop(handle.__handle);
}

terminal_input_borrow_terminal_input_t terminal_input_borrow_terminal_input(terminal_input_own_terminal_input_t arg) {
  return (terminal_input_borrow_terminal_input_t) { arg.__handle };
}

__attribute__((__import_module__("wasi:cli/terminal-output@0.3.0-rc-2026-03-15"), __import_name__("[resource-drop]terminal-output")))
extern void __wasm_import_terminal_output_terminal_output_drop(int32_t handle);

void terminal_output_terminal_output_drop_own(terminal_output_own_terminal_output_t handle) {
  __wasm_import_terminal_output_terminal_output_drop(handle.__handle);
}

terminal_output_borrow_terminal_output_t terminal_output_borrow_terminal_output(terminal_output_own_terminal_output_t arg) {
  return (terminal_output_borrow_terminal_output_t) { arg.__handle };
}

void terminal_stdin_option_own_terminal_input_free(terminal_stdin_option_own_terminal_input_t *ptr) {
  if (ptr->is_some) {
  }
}

void terminal_stdout_option_own_terminal_output_free(terminal_stdout_option_own_terminal_output_t *ptr) {
  if (ptr->is_some) {
  }
}

void terminal_stderr_option_own_terminal_output_free(terminal_stderr_option_own_terminal_output_t *ptr) {
  if (ptr->is_some) {
  }
}

void filesystem_descriptor_type_free(filesystem_descriptor_type_t *ptr) {
  switch ((int32_t) ptr->tag) {
    case 7: {
      break;
    }
  }
}

void filesystem_option_instant_free(filesystem_option_instant_t *ptr) {
  if (ptr->is_some) {
  }
}

void filesystem_descriptor_stat_free(filesystem_descriptor_stat_t *ptr) {
  filesystem_descriptor_type_free(&ptr->type);
  filesystem_option_instant_free(&ptr->data_access_timestamp);
  filesystem_option_instant_free(&ptr->data_modification_timestamp);
  filesystem_option_instant_free(&ptr->status_change_timestamp);
}

void filesystem_new_timestamp_free(filesystem_new_timestamp_t *ptr) {
  switch ((int32_t) ptr->tag) {
    case 2: {
      break;
    }
  }
}

void filesystem_directory_entry_free(filesystem_directory_entry_t *ptr) {
  filesystem_descriptor_type_free(&ptr->type);
  wasip3_string_free(&ptr->name);
}

void filesystem_error_code_free(filesystem_error_code_t *ptr) {
  switch ((int32_t) ptr->tag) {
    case 36: {
      break;
    }
  }
}

__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[resource-drop]descriptor")))
extern void __wasm_import_filesystem_descriptor_drop(int32_t handle);

void filesystem_descriptor_drop_own(filesystem_own_descriptor_t handle) {
  __wasm_import_filesystem_descriptor_drop(handle.__handle);
}

filesystem_borrow_descriptor_t filesystem_borrow_descriptor(filesystem_own_descriptor_t arg) {
  return (filesystem_borrow_descriptor_t) { arg.__handle };
}

void filesystem_result_void_error_code_free(filesystem_result_void_error_code_t *ptr) {
  if (!ptr->is_err) {
  } else {
    filesystem_error_code_free(&ptr->val.err);
  }
}

void filesystem_result_descriptor_flags_error_code_free(filesystem_result_descriptor_flags_error_code_t *ptr) {
  if (!ptr->is_err) {
  } else {
    filesystem_error_code_free(&ptr->val.err);
  }
}

void filesystem_result_descriptor_type_error_code_free(filesystem_result_descriptor_type_error_code_t *ptr) {
  if (!ptr->is_err) {
    filesystem_descriptor_type_free(&ptr->val.ok);
  } else {
    filesystem_error_code_free(&ptr->val.err);
  }
}

void filesystem_result_descriptor_stat_error_code_free(filesystem_result_descriptor_stat_error_code_t *ptr) {
  if (!ptr->is_err) {
    filesystem_descriptor_stat_free(&ptr->val.ok);
  } else {
    filesystem_error_code_free(&ptr->val.err);
  }
}

void filesystem_result_own_descriptor_error_code_free(filesystem_result_own_descriptor_error_code_t *ptr) {
  if (!ptr->is_err) {
  } else {
    filesystem_error_code_free(&ptr->val.err);
  }
}

void filesystem_result_string_error_code_free(filesystem_result_string_error_code_t *ptr) {
  if (!ptr->is_err) {
    wasip3_string_free(&ptr->val.ok);
  } else {
    filesystem_error_code_free(&ptr->val.err);
  }
}

void filesystem_result_metadata_hash_value_error_code_free(filesystem_result_metadata_hash_value_error_code_t *ptr) {
  if (!ptr->is_err) {
  } else {
    filesystem_error_code_free(&ptr->val.err);
  }
}

__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[stream-new-0][method]descriptor.read-via-stream")))
extern uint64_t filesystem_stream_u8__new(void);
__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[async-lower][stream-read-0][method]descriptor.read-via-stream")))
extern uint32_t filesystem_stream_u8__read(uint32_t, uint8_t*, size_t);
__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[async-lower][stream-write-0][method]descriptor.read-via-stream")))
extern uint32_t filesystem_stream_u8__write(uint32_t, const uint8_t*, size_t);
__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[stream-cancel-read-0][method]descriptor.read-via-stream")))
extern uint32_t filesystem_stream_u8__cancel_read(uint32_t);
__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[stream-cancel-write-0][method]descriptor.read-via-stream")))
extern uint32_t filesystem_stream_u8__cancel_write(uint32_t);
__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[stream-drop-readable-0][method]descriptor.read-via-stream")))
extern void filesystem_stream_u8__drop_readable(uint32_t);
__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[stream-drop-writable-0][method]descriptor.read-via-stream")))
extern void filesystem_stream_u8__drop_writable(uint32_t);

filesystem_stream_u8_t filesystem_stream_u8_new(filesystem_stream_u8_writer_t *writer) {
  uint64_t packed = filesystem_stream_u8__new();
  *writer = (uint32_t) (packed >> 32);
  return (uint32_t) packed;
}

wasip3_waitable_status_t filesystem_stream_u8_read(filesystem_stream_u8_t reader, uint8_t *buf, size_t amt) {
  return filesystem_stream_u8__read(reader, (uint8_t*) buf, amt);
}

wasip3_waitable_status_t filesystem_stream_u8_write(filesystem_stream_u8_writer_t writer, const uint8_t *buf, size_t amt) {
  return filesystem_stream_u8__write(writer, (const uint8_t*) buf, amt);
}

wasip3_waitable_status_t filesystem_stream_u8_cancel_read(filesystem_stream_u8_t reader){
  return filesystem_stream_u8__cancel_read(reader);
}

wasip3_waitable_status_t filesystem_stream_u8_cancel_write(filesystem_stream_u8_writer_t writer) {
  return filesystem_stream_u8__cancel_write(writer);
}

void filesystem_stream_u8_drop_readable(filesystem_stream_u8_t reader){
  filesystem_stream_u8__drop_readable(reader);
}

void filesystem_stream_u8_drop_writable(filesystem_stream_u8_writer_t writer) {
  filesystem_stream_u8__drop_writable(writer);
}


__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[future-new-1][method]descriptor.read-via-stream")))
extern uint64_t filesystem_future_result_void_error_code__new(void);
__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[async-lower][future-read-1][method]descriptor.read-via-stream")))
extern uint32_t filesystem_future_result_void_error_code__read(uint32_t, uint8_t*);
__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[async-lower][future-write-1][method]descriptor.read-via-stream")))
extern uint32_t filesystem_future_result_void_error_code__write(uint32_t, const uint8_t*);
__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[future-cancel-read-1][method]descriptor.read-via-stream")))
extern uint32_t filesystem_future_result_void_error_code__cancel_read(uint32_t);
__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[future-cancel-write-1][method]descriptor.read-via-stream")))
extern uint32_t filesystem_future_result_void_error_code__cancel_write(uint32_t);
__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[future-drop-readable-1][method]descriptor.read-via-stream")))
extern void filesystem_future_result_void_error_code__drop_readable(uint32_t);
__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[future-drop-writable-1][method]descriptor.read-via-stream")))
extern void filesystem_future_result_void_error_code__drop_writable(uint32_t);

filesystem_future_result_void_error_code_t filesystem_future_result_void_error_code_new(filesystem_future_result_void_error_code_writer_t *writer) {
  uint64_t packed = filesystem_future_result_void_error_code__new();
  *writer = (uint32_t) (packed >> 32);
  return (uint32_t) packed;
}

wasip3_waitable_status_t filesystem_future_result_void_error_code_read(filesystem_future_result_void_error_code_t reader, filesystem_result_void_error_code_t *buf) {
  return filesystem_future_result_void_error_code__read(reader, (uint8_t*) buf);
}

wasip3_waitable_status_t filesystem_future_result_void_error_code_write(filesystem_future_result_void_error_code_writer_t writer, const filesystem_result_void_error_code_t *buf) {
  return filesystem_future_result_void_error_code__write(writer, (const uint8_t*) buf);
}

wasip3_waitable_status_t filesystem_future_result_void_error_code_cancel_read(filesystem_future_result_void_error_code_t reader){
  return filesystem_future_result_void_error_code__cancel_read(reader);
}

wasip3_waitable_status_t filesystem_future_result_void_error_code_cancel_write(filesystem_future_result_void_error_code_writer_t writer) {
  return filesystem_future_result_void_error_code__cancel_write(writer);
}

void filesystem_future_result_void_error_code_drop_readable(filesystem_future_result_void_error_code_t reader){
  filesystem_future_result_void_error_code__drop_readable(reader);
}

void filesystem_future_result_void_error_code_drop_writable(filesystem_future_result_void_error_code_writer_t writer) {
  filesystem_future_result_void_error_code__drop_writable(writer);
}


__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[stream-new-0][method]descriptor.read-directory")))
extern uint64_t filesystem_stream_directory_entry__new(void);
__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[async-lower][stream-read-0][method]descriptor.read-directory")))
extern uint32_t filesystem_stream_directory_entry__read(uint32_t, uint8_t*, size_t);
__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[async-lower][stream-write-0][method]descriptor.read-directory")))
extern uint32_t filesystem_stream_directory_entry__write(uint32_t, const uint8_t*, size_t);
__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[stream-cancel-read-0][method]descriptor.read-directory")))
extern uint32_t filesystem_stream_directory_entry__cancel_read(uint32_t);
__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[stream-cancel-write-0][method]descriptor.read-directory")))
extern uint32_t filesystem_stream_directory_entry__cancel_write(uint32_t);
__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[stream-drop-readable-0][method]descriptor.read-directory")))
extern void filesystem_stream_directory_entry__drop_readable(uint32_t);
__attribute__((__import_module__("wasi:filesystem/types@0.3.0-rc-2026-03-15"), __import_name__("[stream-drop-writable-0][method]descriptor.read-directory")))
extern void filesystem_stream_directory_entry__drop_writable(uint32_t);

filesystem_stream_directory_entry_t filesystem_stream_directory_entry_new(filesystem_stream_directory_entry_writer_t *writer) {
  uint64_t packed = filesystem_stream_directory_entry__new();
  *writer = (uint32_t) (packed >> 32);
  return (uint32_t) packed;
}

wasip3_waitable_status_t filesystem_stream_directory_entry_read(filesystem_stream_directory_entry_t reader, filesystem_directory_entry_t *buf, size_t amt) {
  return filesystem_stream_directory_entry__read(reader, (uint8_t*) buf, amt);
}

wasip3_waitable_status_t filesystem_stream_directory_entry_write(filesystem_stream_directory_entry_writer_t writer, const filesystem_directory_entry_t *buf, size_t amt) {
  return filesystem_stream_directory_entry__write(writer, (const uint8_t*) buf, amt);
}

wasip3_waitable_status_t filesystem_stream_directory_entry_cancel_read(filesystem_stream_directory_entry_t reader){
  return filesystem_stream_directory_entry__cancel_read(reader);
}

wasip3_waitable_status_t filesystem_stream_directory_entry_cancel_write(filesystem_stream_directory_entry_writer_t writer) {
  return filesystem_stream_directory_entry__cancel_write(writer);
}

void filesystem_stream_directory_entry_drop_readable(filesystem_stream_directory_entry_t reader){
  filesystem_stream_directory_entry__drop_readable(reader);
}

void filesystem_stream_directory_entry_drop_writable(filesystem_stream_directory_entry_writer_t writer) {
  filesystem_stream_directory_entry__drop_writable(writer);
}


void filesystem_preopens_tuple2_own_descriptor_string_free(filesystem_preopens_tuple2_own_descriptor_string_t *ptr) {
  wasip3_string_free(&ptr->f1);
}

void filesystem_preopens_list_tuple2_own_descriptor_string_free(filesystem_preopens_list_tuple2_own_descriptor_string_t *ptr) {
  size_t list_len = ptr->len;
  if (list_len > 0) {
    filesystem_preopens_tuple2_own_descriptor_string_t *list_ptr = ptr->ptr;
    for (size_t i = 0; i < list_len; i++) {
      filesystem_preopens_tuple2_own_descriptor_string_free(&list_ptr[i]);
    }
    free(list_ptr);
  }
}

void sockets_error_code_free(sockets_error_code_t *ptr) {
  switch ((int32_t) ptr->tag) {
    case 14: {
      break;
    }
  }
}

void sockets_ip_address_free(sockets_ip_address_t *ptr) {
  switch ((int32_t) ptr->tag) {
    case 0: {
      break;
    }
    case 1: {
      break;
    }
  }
}

void sockets_ip_socket_address_free(sockets_ip_socket_address_t *ptr) {
  switch ((int32_t) ptr->tag) {
    case 0: {
      break;
    }
    case 1: {
      break;
    }
  }
}

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[resource-drop]tcp-socket")))
extern void __wasm_import_sockets_tcp_socket_drop(int32_t handle);

void sockets_tcp_socket_drop_own(sockets_own_tcp_socket_t handle) {
  __wasm_import_sockets_tcp_socket_drop(handle.__handle);
}

sockets_borrow_tcp_socket_t sockets_borrow_tcp_socket(sockets_own_tcp_socket_t arg) {
  return (sockets_borrow_tcp_socket_t) { arg.__handle };
}

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[resource-drop]udp-socket")))
extern void __wasm_import_sockets_udp_socket_drop(int32_t handle);

void sockets_udp_socket_drop_own(sockets_own_udp_socket_t handle) {
  __wasm_import_sockets_udp_socket_drop(handle.__handle);
}

sockets_borrow_udp_socket_t sockets_borrow_udp_socket(sockets_own_udp_socket_t arg) {
  return (sockets_borrow_udp_socket_t) { arg.__handle };
}

void sockets_result_own_tcp_socket_error_code_free(sockets_result_own_tcp_socket_error_code_t *ptr) {
  if (!ptr->is_err) {
  } else {
    sockets_error_code_free(&ptr->val.err);
  }
}

void sockets_result_void_error_code_free(sockets_result_void_error_code_t *ptr) {
  if (!ptr->is_err) {
  } else {
    sockets_error_code_free(&ptr->val.err);
  }
}

void sockets_result_stream_own_tcp_socket_error_code_free(sockets_result_stream_own_tcp_socket_error_code_t *ptr) {
  if (!ptr->is_err) {
  } else {
    sockets_error_code_free(&ptr->val.err);
  }
}

void sockets_result_ip_socket_address_error_code_free(sockets_result_ip_socket_address_error_code_t *ptr) {
  if (!ptr->is_err) {
    sockets_ip_socket_address_free(&ptr->val.ok);
  } else {
    sockets_error_code_free(&ptr->val.err);
  }
}

void sockets_result_bool_error_code_free(sockets_result_bool_error_code_t *ptr) {
  if (!ptr->is_err) {
  } else {
    sockets_error_code_free(&ptr->val.err);
  }
}

void sockets_result_duration_error_code_free(sockets_result_duration_error_code_t *ptr) {
  if (!ptr->is_err) {
  } else {
    sockets_error_code_free(&ptr->val.err);
  }
}

void sockets_result_u32_error_code_free(sockets_result_u32_error_code_t *ptr) {
  if (!ptr->is_err) {
  } else {
    sockets_error_code_free(&ptr->val.err);
  }
}

void sockets_result_u8_error_code_free(sockets_result_u8_error_code_t *ptr) {
  if (!ptr->is_err) {
  } else {
    sockets_error_code_free(&ptr->val.err);
  }
}

void sockets_result_u64_error_code_free(sockets_result_u64_error_code_t *ptr) {
  if (!ptr->is_err) {
  } else {
    sockets_error_code_free(&ptr->val.err);
  }
}

void sockets_result_own_udp_socket_error_code_free(sockets_result_own_udp_socket_error_code_t *ptr) {
  if (!ptr->is_err) {
  } else {
    sockets_error_code_free(&ptr->val.err);
  }
}

void wasip3_list_u8_free(wasip3_list_u8_t *ptr) {
  size_t list_len = ptr->len;
  if (list_len > 0) {
    uint8_t *list_ptr = ptr->ptr;
    for (size_t i = 0; i < list_len; i++) {
    }
    free(list_ptr);
  }
}

void sockets_option_ip_socket_address_free(sockets_option_ip_socket_address_t *ptr) {
  if (ptr->is_some) {
    sockets_ip_socket_address_free(&ptr->val);
  }
}

void sockets_tuple2_list_u8_ip_socket_address_free(sockets_tuple2_list_u8_ip_socket_address_t *ptr) {
  wasip3_list_u8_free(&ptr->f0);
  sockets_ip_socket_address_free(&ptr->f1);
}

void sockets_result_tuple2_list_u8_ip_socket_address_error_code_free(sockets_result_tuple2_list_u8_ip_socket_address_error_code_t *ptr) {
  if (!ptr->is_err) {
    sockets_tuple2_list_u8_ip_socket_address_free(&ptr->val.ok);
  } else {
    sockets_error_code_free(&ptr->val.err);
  }
}

__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[stream-new-0][method]tcp-socket.listen")))
extern uint64_t sockets_stream_own_tcp_socket__new(void);
__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[async-lower][stream-read-0][method]tcp-socket.listen")))
extern uint32_t sockets_stream_own_tcp_socket__read(uint32_t, uint8_t*, size_t);
__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[async-lower][stream-write-0][method]tcp-socket.listen")))
extern uint32_t sockets_stream_own_tcp_socket__write(uint32_t, const uint8_t*, size_t);
__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[stream-cancel-read-0][method]tcp-socket.listen")))
extern uint32_t sockets_stream_own_tcp_socket__cancel_read(uint32_t);
__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[stream-cancel-write-0][method]tcp-socket.listen")))
extern uint32_t sockets_stream_own_tcp_socket__cancel_write(uint32_t);
__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[stream-drop-readable-0][method]tcp-socket.listen")))
extern void sockets_stream_own_tcp_socket__drop_readable(uint32_t);
__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[stream-drop-writable-0][method]tcp-socket.listen")))
extern void sockets_stream_own_tcp_socket__drop_writable(uint32_t);

sockets_stream_own_tcp_socket_t sockets_stream_own_tcp_socket_new(sockets_stream_own_tcp_socket_writer_t *writer) {
  uint64_t packed = sockets_stream_own_tcp_socket__new();
  *writer = (uint32_t) (packed >> 32);
  return (uint32_t) packed;
}

wasip3_waitable_status_t sockets_stream_own_tcp_socket_read(sockets_stream_own_tcp_socket_t reader, sockets_own_tcp_socket_t *buf, size_t amt) {
  return sockets_stream_own_tcp_socket__read(reader, (uint8_t*) buf, amt);
}

wasip3_waitable_status_t sockets_stream_own_tcp_socket_write(sockets_stream_own_tcp_socket_writer_t writer, const sockets_own_tcp_socket_t *buf, size_t amt) {
  return sockets_stream_own_tcp_socket__write(writer, (const uint8_t*) buf, amt);
}

wasip3_waitable_status_t sockets_stream_own_tcp_socket_cancel_read(sockets_stream_own_tcp_socket_t reader){
  return sockets_stream_own_tcp_socket__cancel_read(reader);
}

wasip3_waitable_status_t sockets_stream_own_tcp_socket_cancel_write(sockets_stream_own_tcp_socket_writer_t writer) {
  return sockets_stream_own_tcp_socket__cancel_write(writer);
}

void sockets_stream_own_tcp_socket_drop_readable(sockets_stream_own_tcp_socket_t reader){
  sockets_stream_own_tcp_socket__drop_readable(reader);
}

void sockets_stream_own_tcp_socket_drop_writable(sockets_stream_own_tcp_socket_writer_t writer) {
  sockets_stream_own_tcp_socket__drop_writable(writer);
}


__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[stream-new-0][method]tcp-socket.send")))
extern uint64_t sockets_stream_u8__new(void);
__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[async-lower][stream-read-0][method]tcp-socket.send")))
extern uint32_t sockets_stream_u8__read(uint32_t, uint8_t*, size_t);
__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[async-lower][stream-write-0][method]tcp-socket.send")))
extern uint32_t sockets_stream_u8__write(uint32_t, const uint8_t*, size_t);
__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[stream-cancel-read-0][method]tcp-socket.send")))
extern uint32_t sockets_stream_u8__cancel_read(uint32_t);
__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[stream-cancel-write-0][method]tcp-socket.send")))
extern uint32_t sockets_stream_u8__cancel_write(uint32_t);
__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[stream-drop-readable-0][method]tcp-socket.send")))
extern void sockets_stream_u8__drop_readable(uint32_t);
__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[stream-drop-writable-0][method]tcp-socket.send")))
extern void sockets_stream_u8__drop_writable(uint32_t);

sockets_stream_u8_t sockets_stream_u8_new(sockets_stream_u8_writer_t *writer) {
  uint64_t packed = sockets_stream_u8__new();
  *writer = (uint32_t) (packed >> 32);
  return (uint32_t) packed;
}

wasip3_waitable_status_t sockets_stream_u8_read(sockets_stream_u8_t reader, uint8_t *buf, size_t amt) {
  return sockets_stream_u8__read(reader, (uint8_t*) buf, amt);
}

wasip3_waitable_status_t sockets_stream_u8_write(sockets_stream_u8_writer_t writer, const uint8_t *buf, size_t amt) {
  return sockets_stream_u8__write(writer, (const uint8_t*) buf, amt);
}

wasip3_waitable_status_t sockets_stream_u8_cancel_read(sockets_stream_u8_t reader){
  return sockets_stream_u8__cancel_read(reader);
}

wasip3_waitable_status_t sockets_stream_u8_cancel_write(sockets_stream_u8_writer_t writer) {
  return sockets_stream_u8__cancel_write(writer);
}

void sockets_stream_u8_drop_readable(sockets_stream_u8_t reader){
  sockets_stream_u8__drop_readable(reader);
}

void sockets_stream_u8_drop_writable(sockets_stream_u8_writer_t writer) {
  sockets_stream_u8__drop_writable(writer);
}


__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[future-new-1][method]tcp-socket.send")))
extern uint64_t sockets_future_result_void_error_code__new(void);
__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[async-lower][future-read-1][method]tcp-socket.send")))
extern uint32_t sockets_future_result_void_error_code__read(uint32_t, uint8_t*);
__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[async-lower][future-write-1][method]tcp-socket.send")))
extern uint32_t sockets_future_result_void_error_code__write(uint32_t, const uint8_t*);
__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[future-cancel-read-1][method]tcp-socket.send")))
extern uint32_t sockets_future_result_void_error_code__cancel_read(uint32_t);
__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[future-cancel-write-1][method]tcp-socket.send")))
extern uint32_t sockets_future_result_void_error_code__cancel_write(uint32_t);
__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[future-drop-readable-1][method]tcp-socket.send")))
extern void sockets_future_result_void_error_code__drop_readable(uint32_t);
__attribute__((__import_module__("wasi:sockets/types@0.3.0-rc-2026-03-15"), __import_name__("[future-drop-writable-1][method]tcp-socket.send")))
extern void sockets_future_result_void_error_code__drop_writable(uint32_t);

sockets_future_result_void_error_code_t sockets_future_result_void_error_code_new(sockets_future_result_void_error_code_writer_t *writer) {
  uint64_t packed = sockets_future_result_void_error_code__new();
  *writer = (uint32_t) (packed >> 32);
  return (uint32_t) packed;
}

wasip3_waitable_status_t sockets_future_result_void_error_code_read(sockets_future_result_void_error_code_t reader, sockets_result_void_error_code_t *buf) {
  return sockets_future_result_void_error_code__read(reader, (uint8_t*) buf);
}

wasip3_waitable_status_t sockets_future_result_void_error_code_write(sockets_future_result_void_error_code_writer_t writer, const sockets_result_void_error_code_t *buf) {
  return sockets_future_result_void_error_code__write(writer, (const uint8_t*) buf);
}

wasip3_waitable_status_t sockets_future_result_void_error_code_cancel_read(sockets_future_result_void_error_code_t reader){
  return sockets_future_result_void_error_code__cancel_read(reader);
}

wasip3_waitable_status_t sockets_future_result_void_error_code_cancel_write(sockets_future_result_void_error_code_writer_t writer) {
  return sockets_future_result_void_error_code__cancel_write(writer);
}

void sockets_future_result_void_error_code_drop_readable(sockets_future_result_void_error_code_t reader){
  sockets_future_result_void_error_code__drop_readable(reader);
}

void sockets_future_result_void_error_code_drop_writable(sockets_future_result_void_error_code_writer_t writer) {
  sockets_future_result_void_error_code__drop_writable(writer);
}


void ip_name_lookup_ip_address_free(ip_name_lookup_ip_address_t *ptr) {
  sockets_ip_address_free(ptr);
}

void ip_name_lookup_error_code_free(ip_name_lookup_error_code_t *ptr) {
  switch ((int32_t) ptr->tag) {
    case 5: {
      break;
    }
  }
}

void ip_name_lookup_list_ip_address_free(ip_name_lookup_list_ip_address_t *ptr) {
  size_t list_len = ptr->len;
  if (list_len > 0) {
    ip_name_lookup_ip_address_t *list_ptr = ptr->ptr;
    for (size_t i = 0; i < list_len; i++) {
      ip_name_lookup_ip_address_free(&list_ptr[i]);
    }
    free(list_ptr);
  }
}

void ip_name_lookup_result_list_ip_address_error_code_free(ip_name_lookup_result_list_ip_address_error_code_t *ptr) {
  if (!ptr->is_err) {
    ip_name_lookup_list_ip_address_free(&ptr->val.ok);
  } else {
    ip_name_lookup_error_code_free(&ptr->val.err);
  }
}

void wasip3_string_set(wasip3_string_t *ret, const char*s) {
  ret->ptr = (uint8_t*) s;
  ret->len = strlen(s);
}

void wasip3_string_dup(wasip3_string_t *ret, const char*s) {
  ret->len = strlen(s);
  ret->ptr = (uint8_t*) cabi_realloc(NULL, 0, 1, ret->len * 1);
  memcpy(ret->ptr, s, ret->len * 1);
}

void wasip3_string_dup_n(wasip3_string_t *ret, const char*s, size_t len) {
  ret->len = len;
  ret->ptr = (uint8_t*) cabi_realloc(NULL, 0, 1, ret->len * 1);
  memcpy(ret->ptr, s, ret->len * 1);
}

void wasip3_string_free(wasip3_string_t *ret) {
  if (ret->len > 0) {
    free(ret->ptr);
  }
  ret->ptr = NULL;
  ret->len = 0;
}

// Async Helper Functions

__attribute__((__import_module__("$root"), __import_name__("[subtask-cancel]")))
extern uint32_t __subtask_cancel(uint32_t handle);

wasip3_subtask_status_t wasip3_subtask_cancel(wasip3_subtask_t subtask) {
  return __subtask_cancel(subtask);
}

__attribute__((__import_module__("$root"), __import_name__("[subtask-drop]")))
extern void __subtask_drop(uint32_t handle);

void wasip3_subtask_drop(wasip3_subtask_t subtask) {
  __subtask_drop(subtask);
}

__attribute__((__import_module__("$root"), __import_name__("[waitable-set-new]")))
extern uint32_t __waitable_set_new(void);

wasip3_waitable_set_t wasip3_waitable_set_new(void) {
  return __waitable_set_new();
}

__attribute__((__import_module__("$root"), __import_name__("[waitable-join]")))
extern void __waitable_join(uint32_t, uint32_t);

void wasip3_waitable_join(uint32_t waitable, wasip3_waitable_set_t set) {
  __waitable_join(waitable, set);
}

__attribute__((__import_module__("$root"), __import_name__("[waitable-set-drop]")))
extern void __waitable_set_drop(uint32_t);

void wasip3_waitable_set_drop(wasip3_waitable_set_t set) {
  __waitable_set_drop(set);
}

__attribute__((__import_module__("$root"), __import_name__("[waitable-set-wait]")))
extern uint32_t __waitable_set_wait(uint32_t, uint32_t*);
__attribute__((__import_module__("$root"), __import_name__("[waitable-set-poll]")))
extern uint32_t __waitable_set_poll(uint32_t, uint32_t*);

void wasip3_waitable_set_wait(wasip3_waitable_set_t set, wasip3_event_t *event) {
  event->event = (wasip3_event_code_t) __waitable_set_wait(set, &event->waitable);
}

void wasip3_waitable_set_poll(wasip3_waitable_set_t set, wasip3_event_t *event) {
  event->event = (wasip3_event_code_t) __waitable_set_poll(set, &event->waitable);
}

__attribute__((__import_module__("[export]$root"), __import_name__("[task-cancel]")))
extern void __task_cancel(void);

void wasip3_task_cancel() {
  __task_cancel();
}

__attribute__((__import_module__("$root"), __import_name__("[backpressure-inc]")))
extern void __backpressure_inc(void);

void wasip3_backpressure_inc(void) {
  __backpressure_inc();
}

__attribute__((__import_module__("$root"), __import_name__("[backpressure-dec]")))
extern void __backpressure_dec(void);

void wasip3_backpressure_dec(void) {
  __backpressure_dec();
}

__attribute__((__import_module__("$root"), __import_name__("[context-get-0]")))
extern void* __context_get_0(void);

void* wasip3_context_get_0(void) {
  return __context_get_0();
}

__attribute__((__import_module__("$root"), __import_name__("[context-set-0]")))
extern void __context_set_0(void*);


void wasip3_context_set_0(void *value) {
  __context_set_0(value);
}

__attribute__((__import_module__("$root"), __import_name__("[thread-yield]")))
extern uint32_t __thread_yield(void);

void wasip3_thread_yield(void) {
  __thread_yield();
}


__attribute__((__import_module__("$root"), __import_name__("[context-get-1]")))
extern void* __context_get_1(void);

void* wasip3_context_get_1(void) {
  return __context_get_1();
}

__attribute__((__import_module__("$root"), __import_name__("[context-set-1]")))
extern void __context_set_1(void*);

void wasip3_context_set_1(void* value) {
  __context_set_1(value);
}

__attribute__((__import_module__("$root"), __import_name__("[cancellable][thread-yield]")))
extern uint32_t __thread_yield_cancellable(void);

uint32_t wasip3_thread_yield_cancellable(void) {
  return __thread_yield_cancellable();
}

__attribute__((__import_module__("$root"), __import_name__("[thread-index]")))
extern uint32_t __thread_index(void);

uint32_t wasip3_thread_index(void) {
  return __thread_index();
}

__attribute__((__import_module__("$root"), __import_name__("[thread-new-indirect-v0]")))
extern uint32_t __thread_new_indirect(uint32_t, void*);

uint32_t wasip3_thread_new_indirect(void (*start_function)(void*), void* arg) {
  return __thread_new_indirect((uint32_t)(uintptr_t)start_function, arg
  );
}

__attribute__((__import_module__("$root"), __import_name__("[thread-suspend-to-suspended]")))
extern uint32_t __thread_suspend_to_suspended(uint32_t);

void wasip3_thread_suspend_to_suspended(uint32_t thread) {
  __thread_suspend_to_suspended(thread);
}

__attribute__((__import_module__("$root"), __import_name__("[cancellable][thread-suspend-to-suspended]")))
extern uint32_t __thread_suspend_to_suspended_cancellable(uint32_t);

uint32_t wasip3_thread_suspend_to_suspended_cancellable(uint32_t thread) {
  return __thread_suspend_to_suspended_cancellable(thread);
}

__attribute__((__import_module__("$root"), __import_name__("[thread-suspend-to]")))
extern uint32_t __thread_suspend_to(uint32_t);

void wasip3_thread_suspend_to(uint32_t thread) {
  __thread_suspend_to(thread);
}

__attribute__((__import_module__("$root"), __import_name__("[cancellable][thread-suspend-to]")))
extern uint32_t __thread_suspend_to_cancellable(uint32_t);

uint32_t wasip3_thread_suspend_to_cancellable(uint32_t thread) {
  return __thread_suspend_to_cancellable(thread);
}

__attribute__((__import_module__("$root"), __import_name__("[thread-unsuspend]")))
extern void __thread_unsuspend(uint32_t);

void wasip3_thread_unsuspend(uint32_t thread) {
  __thread_unsuspend(thread);
}

__attribute__((__import_module__("$root"), __import_name__("[thread-yield-to-suspended]")))
extern uint32_t __thread_yield_to_suspended(uint32_t);

void wasip3_thread_yield_to_suspended(uint32_t thread) {
  __thread_yield_to_suspended(thread);
}

__attribute__((__import_module__("$root"), __import_name__("[cancellable][thread-yield-to-suspended]")))
extern uint32_t __thread_yield_to_suspended_cancellable(uint32_t);

uint32_t wasip3_thread_yield_to_suspended_cancellable(uint32_t thread) {
  return __thread_yield_to_suspended_cancellable(thread);
}

__attribute__((__import_module__("$root"), __import_name__("[thread-suspend]")))
extern uint32_t __thread_suspend(void);

void wasip3_thread_suspend(void) {
  __thread_suspend();
}

__attribute__((__import_module__("$root"), __import_name__("[cancellable][thread-suspend]")))
extern uint32_t __thread_suspend_cancellable(void);
uint32_t wasip3_thread_suspend_cancellable(void) {
  return __thread_suspend_cancellable();
}



// Component Adapters

void environment_get_environment(wasip3_list_tuple2_string_string_t *ret) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(2*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_environment_get_environment(ptr);
  *ret = (wasip3_list_tuple2_string_string_t) { (wasip3_tuple2_string_string_t*)(*((uint8_t **) (ptr + 0))), (*((size_t*) (ptr + sizeof(void*)))) };
}

void environment_get_arguments(wasip3_list_string_t *ret) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(2*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_environment_get_arguments(ptr);
  *ret = (wasip3_list_string_t) { (wasip3_string_t*)(*((uint8_t **) (ptr + 0))), (*((size_t*) (ptr + sizeof(void*)))) };
}

bool environment_get_initial_cwd(wasip3_string_t *ret) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(3*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_environment_get_initial_cwd(ptr);
  wasip3_option_string_t option;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      option.is_some = false;
      break;
    }
    case 1: {
      option.is_some = true;
      option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + sizeof(void*)))), (*((size_t*) (ptr + (2*sizeof(void*))))) };
      break;
    }
  }
  *ret = option.val;
  return option.is_some;
}

void exit_exit(exit_result_void_void_t *status) {
  int32_t result;
  if ((*status).is_err) {
    result = 1;
  } else {
    result = 0;
  }
  __wasm_import_exit_exit(result);
}

void stdin_read_via_stream(stdin_tuple2_stream_u8_future_result_void_error_code_t *ret) {
  __attribute__((__aligned__(4)))
  uint8_t ret_area[8];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_stdin_read_via_stream(ptr);
  *ret = (stdin_tuple2_stream_u8_future_result_void_error_code_t) {
    (stdin_stream_u8_t) ((uint32_t) *((int32_t*) (ptr + 0))),
    (stdin_future_result_void_error_code_t) ((uint32_t) *((int32_t*) (ptr + 4))),
  };
}

stdout_future_result_void_error_code_t stdout_write_via_stream(stdin_stream_u8_t data) {
  int32_t ret = __wasm_import_stdout_write_via_stream(((int32_t) data));
  return ((uint32_t) ret);
}

stderr_future_result_void_error_code_t stderr_write_via_stream(stdin_stream_u8_t data) {
  int32_t ret = __wasm_import_stderr_write_via_stream(((int32_t) data));
  return ((uint32_t) ret);
}

bool terminal_stdin_get_terminal_stdin(terminal_stdin_own_terminal_input_t *ret) {
  __attribute__((__aligned__(4)))
  uint8_t ret_area[8];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_terminal_stdin_get_terminal_stdin(ptr);
  terminal_stdin_option_own_terminal_input_t option;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      option.is_some = false;
      break;
    }
    case 1: {
      option.is_some = true;
      option.val = (terminal_stdin_own_terminal_input_t) { *((int32_t*) (ptr + 4)) };
      break;
    }
  }
  *ret = option.val;
  return option.is_some;
}

bool terminal_stdout_get_terminal_stdout(terminal_stdout_own_terminal_output_t *ret) {
  __attribute__((__aligned__(4)))
  uint8_t ret_area[8];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_terminal_stdout_get_terminal_stdout(ptr);
  terminal_stdout_option_own_terminal_output_t option;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      option.is_some = false;
      break;
    }
    case 1: {
      option.is_some = true;
      option.val = (terminal_stdout_own_terminal_output_t) { *((int32_t*) (ptr + 4)) };
      break;
    }
  }
  *ret = option.val;
  return option.is_some;
}

bool terminal_stderr_get_terminal_stderr(terminal_stderr_own_terminal_output_t *ret) {
  __attribute__((__aligned__(4)))
  uint8_t ret_area[8];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_terminal_stderr_get_terminal_stderr(ptr);
  terminal_stderr_option_own_terminal_output_t option;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      option.is_some = false;
      break;
    }
    case 1: {
      option.is_some = true;
      option.val = (terminal_stderr_own_terminal_output_t) { *((int32_t*) (ptr + 4)) };
      break;
    }
  }
  *ret = option.val;
  return option.is_some;
}

monotonic_clock_mark_t monotonic_clock_now(void) {
  int64_t ret = __wasm_import_monotonic_clock_now();
  return (uint64_t) (ret);
}

monotonic_clock_duration_t monotonic_clock_get_resolution(void) {
  int64_t ret = __wasm_import_monotonic_clock_get_resolution();
  return (uint64_t) (ret);
}

void monotonic_clock_wait_until(monotonic_clock_mark_t when) {
  __wasm_import_monotonic_clock_wait_until((int64_t) (when));
}

wasip3_subtask_status_t monotonic_clock_wait_for(monotonic_clock_duration_t how_long) {
  return __wasm_import_monotonic_clock_wait_for((int64_t) (how_long));
}

void system_clock_now(system_clock_instant_t *ret) {
  __attribute__((__aligned__(8)))
  uint8_t ret_area[16];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_system_clock_now(ptr);
  *ret = (system_clock_instant_t) {
    (int64_t) *((int64_t*) (ptr + 0)),
    (uint32_t) (uint32_t) (*((int32_t*) (ptr + 8))),
  };
}

system_clock_duration_t system_clock_get_resolution(void) {
  int64_t ret = __wasm_import_system_clock_get_resolution();
  return (uint64_t) (ret);
}

void filesystem_method_descriptor_read_via_stream(filesystem_borrow_descriptor_t self, filesystem_filesize_t offset, filesystem_tuple2_stream_u8_future_result_void_error_code_t *ret) {
  __attribute__((__aligned__(4)))
  uint8_t ret_area[8];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_filesystem_method_descriptor_read_via_stream((self).__handle, (int64_t) (offset), ptr);
  *ret = (filesystem_tuple2_stream_u8_future_result_void_error_code_t) {
    (filesystem_stream_u8_t) ((uint32_t) *((int32_t*) (ptr + 0))),
    (filesystem_future_result_void_error_code_t) ((uint32_t) *((int32_t*) (ptr + 4))),
  };
}

filesystem_future_result_void_error_code_t filesystem_method_descriptor_write_via_stream(filesystem_borrow_descriptor_t self, filesystem_stream_u8_t data, filesystem_filesize_t offset) {
  int32_t ret = __wasm_import_filesystem_method_descriptor_write_via_stream((self).__handle, ((int32_t) data), (int64_t) (offset));
  return ((uint32_t) ret);
}

filesystem_future_result_void_error_code_t filesystem_method_descriptor_append_via_stream(filesystem_borrow_descriptor_t self, filesystem_stream_u8_t data) {
  int32_t ret = __wasm_import_filesystem_method_descriptor_append_via_stream((self).__handle, ((int32_t) data));
  return ((uint32_t) ret);
}

bool filesystem_method_descriptor_advise(filesystem_borrow_descriptor_t self, filesystem_filesize_t offset, filesystem_filesize_t length, filesystem_advice_t advice, filesystem_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_filesystem_method_descriptor_advise((self).__handle, (int64_t) (offset), (int64_t) (length), (int32_t) advice, ptr);
  filesystem_result_void_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      break;
    }
    case 1: {
      result.is_err = true;
      filesystem_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          break;
        }
        case 15: {
          break;
        }
        case 16: {
          break;
        }
        case 17: {
          break;
        }
        case 18: {
          break;
        }
        case 19: {
          break;
        }
        case 20: {
          break;
        }
        case 21: {
          break;
        }
        case 22: {
          break;
        }
        case 23: {
          break;
        }
        case 24: {
          break;
        }
        case 25: {
          break;
        }
        case 26: {
          break;
        }
        case 27: {
          break;
        }
        case 28: {
          break;
        }
        case 29: {
          break;
        }
        case 30: {
          break;
        }
        case 31: {
          break;
        }
        case 32: {
          break;
        }
        case 33: {
          break;
        }
        case 34: {
          break;
        }
        case 35: {
          break;
        }
        case 36: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool filesystem_method_descriptor_sync_data(filesystem_borrow_descriptor_t self, filesystem_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_filesystem_method_descriptor_sync_data((self).__handle, ptr);
  filesystem_result_void_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      break;
    }
    case 1: {
      result.is_err = true;
      filesystem_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          break;
        }
        case 15: {
          break;
        }
        case 16: {
          break;
        }
        case 17: {
          break;
        }
        case 18: {
          break;
        }
        case 19: {
          break;
        }
        case 20: {
          break;
        }
        case 21: {
          break;
        }
        case 22: {
          break;
        }
        case 23: {
          break;
        }
        case 24: {
          break;
        }
        case 25: {
          break;
        }
        case 26: {
          break;
        }
        case 27: {
          break;
        }
        case 28: {
          break;
        }
        case 29: {
          break;
        }
        case 30: {
          break;
        }
        case 31: {
          break;
        }
        case 32: {
          break;
        }
        case 33: {
          break;
        }
        case 34: {
          break;
        }
        case 35: {
          break;
        }
        case 36: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool filesystem_method_descriptor_get_flags(filesystem_borrow_descriptor_t self, filesystem_descriptor_flags_t *ret, filesystem_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_filesystem_method_descriptor_get_flags((self).__handle, ptr);
  filesystem_result_descriptor_flags_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      result.val.ok = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      break;
    }
    case 1: {
      result.is_err = true;
      filesystem_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          break;
        }
        case 15: {
          break;
        }
        case 16: {
          break;
        }
        case 17: {
          break;
        }
        case 18: {
          break;
        }
        case 19: {
          break;
        }
        case 20: {
          break;
        }
        case 21: {
          break;
        }
        case 22: {
          break;
        }
        case 23: {
          break;
        }
        case 24: {
          break;
        }
        case 25: {
          break;
        }
        case 26: {
          break;
        }
        case 27: {
          break;
        }
        case 28: {
          break;
        }
        case 29: {
          break;
        }
        case 30: {
          break;
        }
        case 31: {
          break;
        }
        case 32: {
          break;
        }
        case 33: {
          break;
        }
        case 34: {
          break;
        }
        case 35: {
          break;
        }
        case 36: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    *ret = result.val.ok;
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

wasip3_subtask_status_t filesystem_method_descriptor_get_type(filesystem_borrow_descriptor_t self, filesystem_result_descriptor_type_error_code_t *result) {
  return __wasm_import_filesystem_method_descriptor_get_type((self).__handle, (uint8_t*) result);
}

bool filesystem_method_descriptor_set_size(filesystem_borrow_descriptor_t self, filesystem_filesize_t size, filesystem_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_filesystem_method_descriptor_set_size((self).__handle, (int64_t) (size), ptr);
  filesystem_result_void_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      break;
    }
    case 1: {
      result.is_err = true;
      filesystem_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          break;
        }
        case 15: {
          break;
        }
        case 16: {
          break;
        }
        case 17: {
          break;
        }
        case 18: {
          break;
        }
        case 19: {
          break;
        }
        case 20: {
          break;
        }
        case 21: {
          break;
        }
        case 22: {
          break;
        }
        case 23: {
          break;
        }
        case 24: {
          break;
        }
        case 25: {
          break;
        }
        case 26: {
          break;
        }
        case 27: {
          break;
        }
        case 28: {
          break;
        }
        case 29: {
          break;
        }
        case 30: {
          break;
        }
        case 31: {
          break;
        }
        case 32: {
          break;
        }
        case 33: {
          break;
        }
        case 34: {
          break;
        }
        case 35: {
          break;
        }
        case 36: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool filesystem_method_descriptor_set_times(filesystem_borrow_descriptor_t self, filesystem_new_timestamp_t *data_access_timestamp, filesystem_new_timestamp_t *data_modification_timestamp, filesystem_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  int32_t variant;
  int64_t variant2;
  int32_t variant3;
  switch ((int32_t) (*data_access_timestamp).tag) {
    case 0: {
      variant = 0;
      variant2 = 0;
      variant3 = 0;
      break;
    }
    case 1: {
      variant = 1;
      variant2 = 0;
      variant3 = 0;
      break;
    }
    case 2: {
      const filesystem_instant_t *payload1 = &(*data_access_timestamp).val.timestamp;
      variant = 2;
      variant2 = (*payload1).seconds;
      variant3 = (int32_t) ((*payload1).nanoseconds);
      break;
    }
  }
  int32_t variant7;
  int64_t variant8;
  int32_t variant9;
  switch ((int32_t) (*data_modification_timestamp).tag) {
    case 0: {
      variant7 = 0;
      variant8 = 0;
      variant9 = 0;
      break;
    }
    case 1: {
      variant7 = 1;
      variant8 = 0;
      variant9 = 0;
      break;
    }
    case 2: {
      const filesystem_instant_t *payload6 = &(*data_modification_timestamp).val.timestamp;
      variant7 = 2;
      variant8 = (*payload6).seconds;
      variant9 = (int32_t) ((*payload6).nanoseconds);
      break;
    }
  }
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_filesystem_method_descriptor_set_times((self).__handle, variant, variant2, variant3, variant7, variant8, variant9, ptr);
  filesystem_result_void_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      break;
    }
    case 1: {
      result.is_err = true;
      filesystem_error_code_t variant10;
      variant10.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant10.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          break;
        }
        case 15: {
          break;
        }
        case 16: {
          break;
        }
        case 17: {
          break;
        }
        case 18: {
          break;
        }
        case 19: {
          break;
        }
        case 20: {
          break;
        }
        case 21: {
          break;
        }
        case 22: {
          break;
        }
        case 23: {
          break;
        }
        case 24: {
          break;
        }
        case 25: {
          break;
        }
        case 26: {
          break;
        }
        case 27: {
          break;
        }
        case 28: {
          break;
        }
        case 29: {
          break;
        }
        case 30: {
          break;
        }
        case 31: {
          break;
        }
        case 32: {
          break;
        }
        case 33: {
          break;
        }
        case 34: {
          break;
        }
        case 35: {
          break;
        }
        case 36: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant10.val.other = option;
          break;
        }
      }

      result.val.err = variant10;
      break;
    }
  }
  if (!result.is_err) {
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

void filesystem_method_descriptor_read_directory(filesystem_borrow_descriptor_t self, filesystem_tuple2_stream_directory_entry_future_result_void_error_code_t *ret) {
  __attribute__((__aligned__(4)))
  uint8_t ret_area[8];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_filesystem_method_descriptor_read_directory((self).__handle, ptr);
  *ret = (filesystem_tuple2_stream_directory_entry_future_result_void_error_code_t) {
    (filesystem_stream_directory_entry_t) ((uint32_t) *((int32_t*) (ptr + 0))),
    (filesystem_future_result_void_error_code_t) ((uint32_t) *((int32_t*) (ptr + 4))),
  };
}

bool filesystem_method_descriptor_sync(filesystem_borrow_descriptor_t self, filesystem_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_filesystem_method_descriptor_sync((self).__handle, ptr);
  filesystem_result_void_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      break;
    }
    case 1: {
      result.is_err = true;
      filesystem_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          break;
        }
        case 15: {
          break;
        }
        case 16: {
          break;
        }
        case 17: {
          break;
        }
        case 18: {
          break;
        }
        case 19: {
          break;
        }
        case 20: {
          break;
        }
        case 21: {
          break;
        }
        case 22: {
          break;
        }
        case 23: {
          break;
        }
        case 24: {
          break;
        }
        case 25: {
          break;
        }
        case 26: {
          break;
        }
        case 27: {
          break;
        }
        case 28: {
          break;
        }
        case 29: {
          break;
        }
        case 30: {
          break;
        }
        case 31: {
          break;
        }
        case 32: {
          break;
        }
        case 33: {
          break;
        }
        case 34: {
          break;
        }
        case 35: {
          break;
        }
        case 36: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool filesystem_method_descriptor_create_directory_at(filesystem_borrow_descriptor_t self, wasip3_string_t *path, filesystem_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_filesystem_method_descriptor_create_directory_at((self).__handle, (uint8_t *) (*path).ptr, (*path).len, ptr);
  filesystem_result_void_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      break;
    }
    case 1: {
      result.is_err = true;
      filesystem_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          break;
        }
        case 15: {
          break;
        }
        case 16: {
          break;
        }
        case 17: {
          break;
        }
        case 18: {
          break;
        }
        case 19: {
          break;
        }
        case 20: {
          break;
        }
        case 21: {
          break;
        }
        case 22: {
          break;
        }
        case 23: {
          break;
        }
        case 24: {
          break;
        }
        case 25: {
          break;
        }
        case 26: {
          break;
        }
        case 27: {
          break;
        }
        case 28: {
          break;
        }
        case 29: {
          break;
        }
        case 30: {
          break;
        }
        case 31: {
          break;
        }
        case 32: {
          break;
        }
        case 33: {
          break;
        }
        case 34: {
          break;
        }
        case 35: {
          break;
        }
        case 36: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool filesystem_method_descriptor_stat(filesystem_borrow_descriptor_t self, filesystem_descriptor_stat_t *ret, filesystem_error_code_t *err) {
  __attribute__((__aligned__(8)))
  uint8_t ret_area[(96+4*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_filesystem_method_descriptor_stat((self).__handle, ptr);
  filesystem_result_descriptor_stat_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      filesystem_descriptor_type_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + 8));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (8+1*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (8+2*sizeof(void*))))), (*((size_t*) (ptr + (8+3*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }
      filesystem_option_instant_t option0;
      switch ((int32_t) *((uint8_t*) (ptr + (24+4*sizeof(void*))))) {
        case 0: {
          option0.is_some = false;
          break;
        }
        case 1: {
          option0.is_some = true;
          option0.val = (system_clock_instant_t) {
            (int64_t) *((int64_t*) (ptr + (32+4*sizeof(void*)))),
            (uint32_t) (uint32_t) (*((int32_t*) (ptr + (40+4*sizeof(void*))))),
          };
          break;
        }
      }
      filesystem_option_instant_t option1;
      switch ((int32_t) *((uint8_t*) (ptr + (48+4*sizeof(void*))))) {
        case 0: {
          option1.is_some = false;
          break;
        }
        case 1: {
          option1.is_some = true;
          option1.val = (system_clock_instant_t) {
            (int64_t) *((int64_t*) (ptr + (56+4*sizeof(void*)))),
            (uint32_t) (uint32_t) (*((int32_t*) (ptr + (64+4*sizeof(void*))))),
          };
          break;
        }
      }
      filesystem_option_instant_t option2;
      switch ((int32_t) *((uint8_t*) (ptr + (72+4*sizeof(void*))))) {
        case 0: {
          option2.is_some = false;
          break;
        }
        case 1: {
          option2.is_some = true;
          option2.val = (system_clock_instant_t) {
            (int64_t) *((int64_t*) (ptr + (80+4*sizeof(void*)))),
            (uint32_t) (uint32_t) (*((int32_t*) (ptr + (88+4*sizeof(void*))))),
          };
          break;
        }
      }

      result.val.ok = (filesystem_descriptor_stat_t) {
        (filesystem_descriptor_type_t) variant,
        (filesystem_link_count_t) (uint64_t) (*((int64_t*) (ptr + (8+4*sizeof(void*))))),
        (filesystem_filesize_t) (uint64_t) (*((int64_t*) (ptr + (16+4*sizeof(void*))))),
        (filesystem_option_instant_t) option0,
        (filesystem_option_instant_t) option1,
        (filesystem_option_instant_t) option2,
      };
      break;
    }
    case 1: {
      result.is_err = true;
      filesystem_error_code_t variant4;
      variant4.tag = (int32_t) *((uint8_t*) (ptr + 8));
      switch ((int32_t) variant4.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          break;
        }
        case 15: {
          break;
        }
        case 16: {
          break;
        }
        case 17: {
          break;
        }
        case 18: {
          break;
        }
        case 19: {
          break;
        }
        case 20: {
          break;
        }
        case 21: {
          break;
        }
        case 22: {
          break;
        }
        case 23: {
          break;
        }
        case 24: {
          break;
        }
        case 25: {
          break;
        }
        case 26: {
          break;
        }
        case 27: {
          break;
        }
        case 28: {
          break;
        }
        case 29: {
          break;
        }
        case 30: {
          break;
        }
        case 31: {
          break;
        }
        case 32: {
          break;
        }
        case 33: {
          break;
        }
        case 34: {
          break;
        }
        case 35: {
          break;
        }
        case 36: {
          wasip3_option_string_t option3;
          switch ((int32_t) *((uint8_t*) (ptr + (8+1*sizeof(void*))))) {
            case 0: {
              option3.is_some = false;
              break;
            }
            case 1: {
              option3.is_some = true;
              option3.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (8+2*sizeof(void*))))), (*((size_t*) (ptr + (8+3*sizeof(void*))))) };
              break;
            }
          }
          variant4.val.other = option3;
          break;
        }
      }

      result.val.err = variant4;
      break;
    }
  }
  if (!result.is_err) {
    *ret = result.val.ok;
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool filesystem_method_descriptor_stat_at(filesystem_borrow_descriptor_t self, filesystem_path_flags_t path_flags, wasip3_string_t *path, filesystem_descriptor_stat_t *ret, filesystem_error_code_t *err) {
  __attribute__((__aligned__(8)))
  uint8_t ret_area[(96+4*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_filesystem_method_descriptor_stat_at((self).__handle, path_flags, (uint8_t *) (*path).ptr, (*path).len, ptr);
  filesystem_result_descriptor_stat_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      filesystem_descriptor_type_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + 8));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (8+1*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (8+2*sizeof(void*))))), (*((size_t*) (ptr + (8+3*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }
      filesystem_option_instant_t option0;
      switch ((int32_t) *((uint8_t*) (ptr + (24+4*sizeof(void*))))) {
        case 0: {
          option0.is_some = false;
          break;
        }
        case 1: {
          option0.is_some = true;
          option0.val = (system_clock_instant_t) {
            (int64_t) *((int64_t*) (ptr + (32+4*sizeof(void*)))),
            (uint32_t) (uint32_t) (*((int32_t*) (ptr + (40+4*sizeof(void*))))),
          };
          break;
        }
      }
      filesystem_option_instant_t option1;
      switch ((int32_t) *((uint8_t*) (ptr + (48+4*sizeof(void*))))) {
        case 0: {
          option1.is_some = false;
          break;
        }
        case 1: {
          option1.is_some = true;
          option1.val = (system_clock_instant_t) {
            (int64_t) *((int64_t*) (ptr + (56+4*sizeof(void*)))),
            (uint32_t) (uint32_t) (*((int32_t*) (ptr + (64+4*sizeof(void*))))),
          };
          break;
        }
      }
      filesystem_option_instant_t option2;
      switch ((int32_t) *((uint8_t*) (ptr + (72+4*sizeof(void*))))) {
        case 0: {
          option2.is_some = false;
          break;
        }
        case 1: {
          option2.is_some = true;
          option2.val = (system_clock_instant_t) {
            (int64_t) *((int64_t*) (ptr + (80+4*sizeof(void*)))),
            (uint32_t) (uint32_t) (*((int32_t*) (ptr + (88+4*sizeof(void*))))),
          };
          break;
        }
      }

      result.val.ok = (filesystem_descriptor_stat_t) {
        (filesystem_descriptor_type_t) variant,
        (filesystem_link_count_t) (uint64_t) (*((int64_t*) (ptr + (8+4*sizeof(void*))))),
        (filesystem_filesize_t) (uint64_t) (*((int64_t*) (ptr + (16+4*sizeof(void*))))),
        (filesystem_option_instant_t) option0,
        (filesystem_option_instant_t) option1,
        (filesystem_option_instant_t) option2,
      };
      break;
    }
    case 1: {
      result.is_err = true;
      filesystem_error_code_t variant4;
      variant4.tag = (int32_t) *((uint8_t*) (ptr + 8));
      switch ((int32_t) variant4.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          break;
        }
        case 15: {
          break;
        }
        case 16: {
          break;
        }
        case 17: {
          break;
        }
        case 18: {
          break;
        }
        case 19: {
          break;
        }
        case 20: {
          break;
        }
        case 21: {
          break;
        }
        case 22: {
          break;
        }
        case 23: {
          break;
        }
        case 24: {
          break;
        }
        case 25: {
          break;
        }
        case 26: {
          break;
        }
        case 27: {
          break;
        }
        case 28: {
          break;
        }
        case 29: {
          break;
        }
        case 30: {
          break;
        }
        case 31: {
          break;
        }
        case 32: {
          break;
        }
        case 33: {
          break;
        }
        case 34: {
          break;
        }
        case 35: {
          break;
        }
        case 36: {
          wasip3_option_string_t option3;
          switch ((int32_t) *((uint8_t*) (ptr + (8+1*sizeof(void*))))) {
            case 0: {
              option3.is_some = false;
              break;
            }
            case 1: {
              option3.is_some = true;
              option3.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (8+2*sizeof(void*))))), (*((size_t*) (ptr + (8+3*sizeof(void*))))) };
              break;
            }
          }
          variant4.val.other = option3;
          break;
        }
      }

      result.val.err = variant4;
      break;
    }
  }
  if (!result.is_err) {
    *ret = result.val.ok;
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool filesystem_method_descriptor_set_times_at(filesystem_borrow_descriptor_t self, filesystem_path_flags_t path_flags, wasip3_string_t *path, filesystem_new_timestamp_t *data_access_timestamp, filesystem_new_timestamp_t *data_modification_timestamp, filesystem_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  int32_t variant;
  int64_t variant2;
  int32_t variant3;
  switch ((int32_t) (*data_access_timestamp).tag) {
    case 0: {
      variant = 0;
      variant2 = 0;
      variant3 = 0;
      break;
    }
    case 1: {
      variant = 1;
      variant2 = 0;
      variant3 = 0;
      break;
    }
    case 2: {
      const filesystem_instant_t *payload1 = &(*data_access_timestamp).val.timestamp;
      variant = 2;
      variant2 = (*payload1).seconds;
      variant3 = (int32_t) ((*payload1).nanoseconds);
      break;
    }
  }
  int32_t variant7;
  int64_t variant8;
  int32_t variant9;
  switch ((int32_t) (*data_modification_timestamp).tag) {
    case 0: {
      variant7 = 0;
      variant8 = 0;
      variant9 = 0;
      break;
    }
    case 1: {
      variant7 = 1;
      variant8 = 0;
      variant9 = 0;
      break;
    }
    case 2: {
      const filesystem_instant_t *payload6 = &(*data_modification_timestamp).val.timestamp;
      variant7 = 2;
      variant8 = (*payload6).seconds;
      variant9 = (int32_t) ((*payload6).nanoseconds);
      break;
    }
  }
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_filesystem_method_descriptor_set_times_at((self).__handle, path_flags, (uint8_t *) (*path).ptr, (*path).len, variant, variant2, variant3, variant7, variant8, variant9, ptr);
  filesystem_result_void_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      break;
    }
    case 1: {
      result.is_err = true;
      filesystem_error_code_t variant10;
      variant10.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant10.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          break;
        }
        case 15: {
          break;
        }
        case 16: {
          break;
        }
        case 17: {
          break;
        }
        case 18: {
          break;
        }
        case 19: {
          break;
        }
        case 20: {
          break;
        }
        case 21: {
          break;
        }
        case 22: {
          break;
        }
        case 23: {
          break;
        }
        case 24: {
          break;
        }
        case 25: {
          break;
        }
        case 26: {
          break;
        }
        case 27: {
          break;
        }
        case 28: {
          break;
        }
        case 29: {
          break;
        }
        case 30: {
          break;
        }
        case 31: {
          break;
        }
        case 32: {
          break;
        }
        case 33: {
          break;
        }
        case 34: {
          break;
        }
        case 35: {
          break;
        }
        case 36: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant10.val.other = option;
          break;
        }
      }

      result.val.err = variant10;
      break;
    }
  }
  if (!result.is_err) {
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool filesystem_method_descriptor_link_at(filesystem_borrow_descriptor_t self, filesystem_path_flags_t old_path_flags, wasip3_string_t *old_path, filesystem_borrow_descriptor_t new_descriptor, wasip3_string_t *new_path, filesystem_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_filesystem_method_descriptor_link_at((self).__handle, old_path_flags, (uint8_t *) (*old_path).ptr, (*old_path).len, (new_descriptor).__handle, (uint8_t *) (*new_path).ptr, (*new_path).len, ptr);
  filesystem_result_void_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      break;
    }
    case 1: {
      result.is_err = true;
      filesystem_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          break;
        }
        case 15: {
          break;
        }
        case 16: {
          break;
        }
        case 17: {
          break;
        }
        case 18: {
          break;
        }
        case 19: {
          break;
        }
        case 20: {
          break;
        }
        case 21: {
          break;
        }
        case 22: {
          break;
        }
        case 23: {
          break;
        }
        case 24: {
          break;
        }
        case 25: {
          break;
        }
        case 26: {
          break;
        }
        case 27: {
          break;
        }
        case 28: {
          break;
        }
        case 29: {
          break;
        }
        case 30: {
          break;
        }
        case 31: {
          break;
        }
        case 32: {
          break;
        }
        case 33: {
          break;
        }
        case 34: {
          break;
        }
        case 35: {
          break;
        }
        case 36: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool filesystem_method_descriptor_open_at(filesystem_borrow_descriptor_t self, filesystem_path_flags_t path_flags, wasip3_string_t *path, filesystem_open_flags_t open_flags, filesystem_descriptor_flags_t flags, filesystem_own_descriptor_t *ret, filesystem_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_filesystem_method_descriptor_open_at((self).__handle, path_flags, (uint8_t *) (*path).ptr, (*path).len, open_flags, flags, ptr);
  filesystem_result_own_descriptor_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      result.val.ok = (filesystem_own_descriptor_t) { *((int32_t*) (ptr + sizeof(void*))) };
      break;
    }
    case 1: {
      result.is_err = true;
      filesystem_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          break;
        }
        case 15: {
          break;
        }
        case 16: {
          break;
        }
        case 17: {
          break;
        }
        case 18: {
          break;
        }
        case 19: {
          break;
        }
        case 20: {
          break;
        }
        case 21: {
          break;
        }
        case 22: {
          break;
        }
        case 23: {
          break;
        }
        case 24: {
          break;
        }
        case 25: {
          break;
        }
        case 26: {
          break;
        }
        case 27: {
          break;
        }
        case 28: {
          break;
        }
        case 29: {
          break;
        }
        case 30: {
          break;
        }
        case 31: {
          break;
        }
        case 32: {
          break;
        }
        case 33: {
          break;
        }
        case 34: {
          break;
        }
        case 35: {
          break;
        }
        case 36: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    *ret = result.val.ok;
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool filesystem_method_descriptor_readlink_at(filesystem_borrow_descriptor_t self, wasip3_string_t *path, wasip3_string_t *ret, filesystem_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_filesystem_method_descriptor_readlink_at((self).__handle, (uint8_t *) (*path).ptr, (*path).len, ptr);
  filesystem_result_string_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      result.val.ok = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + sizeof(void*)))), (*((size_t*) (ptr + (2*sizeof(void*))))) };
      break;
    }
    case 1: {
      result.is_err = true;
      filesystem_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          break;
        }
        case 15: {
          break;
        }
        case 16: {
          break;
        }
        case 17: {
          break;
        }
        case 18: {
          break;
        }
        case 19: {
          break;
        }
        case 20: {
          break;
        }
        case 21: {
          break;
        }
        case 22: {
          break;
        }
        case 23: {
          break;
        }
        case 24: {
          break;
        }
        case 25: {
          break;
        }
        case 26: {
          break;
        }
        case 27: {
          break;
        }
        case 28: {
          break;
        }
        case 29: {
          break;
        }
        case 30: {
          break;
        }
        case 31: {
          break;
        }
        case 32: {
          break;
        }
        case 33: {
          break;
        }
        case 34: {
          break;
        }
        case 35: {
          break;
        }
        case 36: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    *ret = result.val.ok;
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool filesystem_method_descriptor_remove_directory_at(filesystem_borrow_descriptor_t self, wasip3_string_t *path, filesystem_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_filesystem_method_descriptor_remove_directory_at((self).__handle, (uint8_t *) (*path).ptr, (*path).len, ptr);
  filesystem_result_void_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      break;
    }
    case 1: {
      result.is_err = true;
      filesystem_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          break;
        }
        case 15: {
          break;
        }
        case 16: {
          break;
        }
        case 17: {
          break;
        }
        case 18: {
          break;
        }
        case 19: {
          break;
        }
        case 20: {
          break;
        }
        case 21: {
          break;
        }
        case 22: {
          break;
        }
        case 23: {
          break;
        }
        case 24: {
          break;
        }
        case 25: {
          break;
        }
        case 26: {
          break;
        }
        case 27: {
          break;
        }
        case 28: {
          break;
        }
        case 29: {
          break;
        }
        case 30: {
          break;
        }
        case 31: {
          break;
        }
        case 32: {
          break;
        }
        case 33: {
          break;
        }
        case 34: {
          break;
        }
        case 35: {
          break;
        }
        case 36: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool filesystem_method_descriptor_rename_at(filesystem_borrow_descriptor_t self, wasip3_string_t *old_path, filesystem_borrow_descriptor_t new_descriptor, wasip3_string_t *new_path, filesystem_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_filesystem_method_descriptor_rename_at((self).__handle, (uint8_t *) (*old_path).ptr, (*old_path).len, (new_descriptor).__handle, (uint8_t *) (*new_path).ptr, (*new_path).len, ptr);
  filesystem_result_void_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      break;
    }
    case 1: {
      result.is_err = true;
      filesystem_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          break;
        }
        case 15: {
          break;
        }
        case 16: {
          break;
        }
        case 17: {
          break;
        }
        case 18: {
          break;
        }
        case 19: {
          break;
        }
        case 20: {
          break;
        }
        case 21: {
          break;
        }
        case 22: {
          break;
        }
        case 23: {
          break;
        }
        case 24: {
          break;
        }
        case 25: {
          break;
        }
        case 26: {
          break;
        }
        case 27: {
          break;
        }
        case 28: {
          break;
        }
        case 29: {
          break;
        }
        case 30: {
          break;
        }
        case 31: {
          break;
        }
        case 32: {
          break;
        }
        case 33: {
          break;
        }
        case 34: {
          break;
        }
        case 35: {
          break;
        }
        case 36: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool filesystem_method_descriptor_symlink_at(filesystem_borrow_descriptor_t self, wasip3_string_t *old_path, wasip3_string_t *new_path, filesystem_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_filesystem_method_descriptor_symlink_at((self).__handle, (uint8_t *) (*old_path).ptr, (*old_path).len, (uint8_t *) (*new_path).ptr, (*new_path).len, ptr);
  filesystem_result_void_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      break;
    }
    case 1: {
      result.is_err = true;
      filesystem_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          break;
        }
        case 15: {
          break;
        }
        case 16: {
          break;
        }
        case 17: {
          break;
        }
        case 18: {
          break;
        }
        case 19: {
          break;
        }
        case 20: {
          break;
        }
        case 21: {
          break;
        }
        case 22: {
          break;
        }
        case 23: {
          break;
        }
        case 24: {
          break;
        }
        case 25: {
          break;
        }
        case 26: {
          break;
        }
        case 27: {
          break;
        }
        case 28: {
          break;
        }
        case 29: {
          break;
        }
        case 30: {
          break;
        }
        case 31: {
          break;
        }
        case 32: {
          break;
        }
        case 33: {
          break;
        }
        case 34: {
          break;
        }
        case 35: {
          break;
        }
        case 36: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool filesystem_method_descriptor_unlink_file_at(filesystem_borrow_descriptor_t self, wasip3_string_t *path, filesystem_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_filesystem_method_descriptor_unlink_file_at((self).__handle, (uint8_t *) (*path).ptr, (*path).len, ptr);
  filesystem_result_void_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      break;
    }
    case 1: {
      result.is_err = true;
      filesystem_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          break;
        }
        case 15: {
          break;
        }
        case 16: {
          break;
        }
        case 17: {
          break;
        }
        case 18: {
          break;
        }
        case 19: {
          break;
        }
        case 20: {
          break;
        }
        case 21: {
          break;
        }
        case 22: {
          break;
        }
        case 23: {
          break;
        }
        case 24: {
          break;
        }
        case 25: {
          break;
        }
        case 26: {
          break;
        }
        case 27: {
          break;
        }
        case 28: {
          break;
        }
        case 29: {
          break;
        }
        case 30: {
          break;
        }
        case 31: {
          break;
        }
        case 32: {
          break;
        }
        case 33: {
          break;
        }
        case 34: {
          break;
        }
        case 35: {
          break;
        }
        case 36: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

wasip3_subtask_status_t filesystem_method_descriptor_is_same_object(filesystem_borrow_descriptor_t self, filesystem_borrow_descriptor_t other, bool *result) {
  return __wasm_import_filesystem_method_descriptor_is_same_object((self).__handle, (other).__handle, (uint8_t*) result);
}

bool filesystem_method_descriptor_metadata_hash(filesystem_borrow_descriptor_t self, filesystem_metadata_hash_value_t *ret, filesystem_error_code_t *err) {
  __attribute__((__aligned__(8)))
  uint8_t ret_area[(8+4*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_filesystem_method_descriptor_metadata_hash((self).__handle, ptr);
  filesystem_result_metadata_hash_value_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      result.val.ok = (filesystem_metadata_hash_value_t) {
        (uint64_t) (uint64_t) (*((int64_t*) (ptr + 8))),
        (uint64_t) (uint64_t) (*((int64_t*) (ptr + 16))),
      };
      break;
    }
    case 1: {
      result.is_err = true;
      filesystem_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + 8));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          break;
        }
        case 15: {
          break;
        }
        case 16: {
          break;
        }
        case 17: {
          break;
        }
        case 18: {
          break;
        }
        case 19: {
          break;
        }
        case 20: {
          break;
        }
        case 21: {
          break;
        }
        case 22: {
          break;
        }
        case 23: {
          break;
        }
        case 24: {
          break;
        }
        case 25: {
          break;
        }
        case 26: {
          break;
        }
        case 27: {
          break;
        }
        case 28: {
          break;
        }
        case 29: {
          break;
        }
        case 30: {
          break;
        }
        case 31: {
          break;
        }
        case 32: {
          break;
        }
        case 33: {
          break;
        }
        case 34: {
          break;
        }
        case 35: {
          break;
        }
        case 36: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (8+1*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (8+2*sizeof(void*))))), (*((size_t*) (ptr + (8+3*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    *ret = result.val.ok;
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool filesystem_method_descriptor_metadata_hash_at(filesystem_borrow_descriptor_t self, filesystem_path_flags_t path_flags, wasip3_string_t *path, filesystem_metadata_hash_value_t *ret, filesystem_error_code_t *err) {
  __attribute__((__aligned__(8)))
  uint8_t ret_area[(8+4*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_filesystem_method_descriptor_metadata_hash_at((self).__handle, path_flags, (uint8_t *) (*path).ptr, (*path).len, ptr);
  filesystem_result_metadata_hash_value_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      result.val.ok = (filesystem_metadata_hash_value_t) {
        (uint64_t) (uint64_t) (*((int64_t*) (ptr + 8))),
        (uint64_t) (uint64_t) (*((int64_t*) (ptr + 16))),
      };
      break;
    }
    case 1: {
      result.is_err = true;
      filesystem_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + 8));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          break;
        }
        case 15: {
          break;
        }
        case 16: {
          break;
        }
        case 17: {
          break;
        }
        case 18: {
          break;
        }
        case 19: {
          break;
        }
        case 20: {
          break;
        }
        case 21: {
          break;
        }
        case 22: {
          break;
        }
        case 23: {
          break;
        }
        case 24: {
          break;
        }
        case 25: {
          break;
        }
        case 26: {
          break;
        }
        case 27: {
          break;
        }
        case 28: {
          break;
        }
        case 29: {
          break;
        }
        case 30: {
          break;
        }
        case 31: {
          break;
        }
        case 32: {
          break;
        }
        case 33: {
          break;
        }
        case 34: {
          break;
        }
        case 35: {
          break;
        }
        case 36: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (8+1*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (8+2*sizeof(void*))))), (*((size_t*) (ptr + (8+3*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    *ret = result.val.ok;
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

void filesystem_preopens_get_directories(filesystem_preopens_list_tuple2_own_descriptor_string_t *ret) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(2*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_filesystem_preopens_get_directories(ptr);
  *ret = (filesystem_preopens_list_tuple2_own_descriptor_string_t) { (filesystem_preopens_tuple2_own_descriptor_string_t*)(*((uint8_t **) (ptr + 0))), (*((size_t*) (ptr + sizeof(void*)))) };
}

bool sockets_static_tcp_socket_create(sockets_ip_address_family_t address_family, sockets_own_tcp_socket_t *ret, sockets_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_static_tcp_socket_create((int32_t) address_family, ptr);
  sockets_result_own_tcp_socket_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      result.val.ok = (sockets_own_tcp_socket_t) { *((int32_t*) (ptr + sizeof(void*))) };
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    *ret = result.val.ok;
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool sockets_method_tcp_socket_bind(sockets_borrow_tcp_socket_t self, sockets_ip_socket_address_t *local_address, sockets_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  int32_t variant;
  int32_t variant1;
  int32_t variant2;
  int32_t variant3;
  int32_t variant4;
  int32_t variant5;
  int32_t variant6;
  int32_t variant7;
  int32_t variant8;
  int32_t variant9;
  int32_t variant10;
  int32_t variant11;
  switch ((int32_t) (*local_address).tag) {
    case 0: {
      const sockets_ipv4_socket_address_t *payload = &(*local_address).val.ipv4;
      variant = 0;
      variant1 = (int32_t) ((*payload).port);
      variant2 = (int32_t) (((*payload).address).f0);
      variant3 = (int32_t) (((*payload).address).f1);
      variant4 = (int32_t) (((*payload).address).f2);
      variant5 = (int32_t) (((*payload).address).f3);
      variant6 = 0;
      variant7 = 0;
      variant8 = 0;
      variant9 = 0;
      variant10 = 0;
      variant11 = 0;
      break;
    }
    case 1: {
      const sockets_ipv6_socket_address_t *payload0 = &(*local_address).val.ipv6;
      variant = 1;
      variant1 = (int32_t) ((*payload0).port);
      variant2 = (int32_t) ((*payload0).flow_info);
      variant3 = (int32_t) (((*payload0).address).f0);
      variant4 = (int32_t) (((*payload0).address).f1);
      variant5 = (int32_t) (((*payload0).address).f2);
      variant6 = (int32_t) (((*payload0).address).f3);
      variant7 = (int32_t) (((*payload0).address).f4);
      variant8 = (int32_t) (((*payload0).address).f5);
      variant9 = (int32_t) (((*payload0).address).f6);
      variant10 = (int32_t) (((*payload0).address).f7);
      variant11 = (int32_t) ((*payload0).scope_id);
      break;
    }
  }
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_tcp_socket_bind((self).__handle, variant, variant1, variant2, variant3, variant4, variant5, variant6, variant7, variant8, variant9, variant10, variant11, ptr);
  sockets_result_void_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant12;
      variant12.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant12.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant12.val.other = option;
          break;
        }
      }

      result.val.err = variant12;
      break;
    }
  }
  if (!result.is_err) {
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

wasip3_subtask_status_t sockets_method_tcp_socket_connect(sockets_method_tcp_socket_connect_args_t *args, sockets_result_void_error_code_t *result) {
  return __wasm_import_sockets_method_tcp_socket_connect((uint8_t*) args, (uint8_t*) result);
}

bool sockets_method_tcp_socket_listen(sockets_borrow_tcp_socket_t self, sockets_stream_own_tcp_socket_t *ret, sockets_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_tcp_socket_listen((self).__handle, ptr);
  sockets_result_stream_own_tcp_socket_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      result.val.ok = ((uint32_t) *((int32_t*) (ptr + sizeof(void*))));
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    *ret = result.val.ok;
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

sockets_future_result_void_error_code_t sockets_method_tcp_socket_send(sockets_borrow_tcp_socket_t self, sockets_stream_u8_t data) {
  int32_t ret = __wasm_import_sockets_method_tcp_socket_send((self).__handle, ((int32_t) data));
  return ((uint32_t) ret);
}

void sockets_method_tcp_socket_receive(sockets_borrow_tcp_socket_t self, sockets_tuple2_stream_u8_future_result_void_error_code_t *ret) {
  __attribute__((__aligned__(4)))
  uint8_t ret_area[8];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_tcp_socket_receive((self).__handle, ptr);
  *ret = (sockets_tuple2_stream_u8_future_result_void_error_code_t) {
    (sockets_stream_u8_t) ((uint32_t) *((int32_t*) (ptr + 0))),
    (sockets_future_result_void_error_code_t) ((uint32_t) *((int32_t*) (ptr + 4))),
  };
}

bool sockets_method_tcp_socket_get_local_address(sockets_borrow_tcp_socket_t self, sockets_ip_socket_address_t *ret, sockets_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(32+1*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_tcp_socket_get_local_address((self).__handle, ptr);
  sockets_result_ip_socket_address_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      sockets_ip_socket_address_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          variant.val.ipv4 = (sockets_ipv4_socket_address_t) {
            (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (4+1*sizeof(void*))))),
            (sockets_ipv4_address_t) (sockets_ipv4_address_t) {
              (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + (6+1*sizeof(void*))))),
              (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + (7+1*sizeof(void*))))),
              (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + (8+1*sizeof(void*))))),
              (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + (9+1*sizeof(void*))))),
            },
          };
          break;
        }
        case 1: {
          variant.val.ipv6 = (sockets_ipv6_socket_address_t) {
            (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (4+1*sizeof(void*))))),
            (uint32_t) (uint32_t) (*((int32_t*) (ptr + (8+1*sizeof(void*))))),
            (sockets_ipv6_address_t) (sockets_ipv6_address_t) {
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (12+1*sizeof(void*))))),
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (14+1*sizeof(void*))))),
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (16+1*sizeof(void*))))),
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (18+1*sizeof(void*))))),
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (20+1*sizeof(void*))))),
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (22+1*sizeof(void*))))),
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (24+1*sizeof(void*))))),
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (26+1*sizeof(void*))))),
            },
            (uint32_t) (uint32_t) (*((int32_t*) (ptr + (28+1*sizeof(void*))))),
          };
          break;
        }
      }

      result.val.ok = variant;
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant0;
      variant0.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant0.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant0.val.other = option;
          break;
        }
      }

      result.val.err = variant0;
      break;
    }
  }
  if (!result.is_err) {
    *ret = result.val.ok;
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool sockets_method_tcp_socket_get_remote_address(sockets_borrow_tcp_socket_t self, sockets_ip_socket_address_t *ret, sockets_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(32+1*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_tcp_socket_get_remote_address((self).__handle, ptr);
  sockets_result_ip_socket_address_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      sockets_ip_socket_address_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          variant.val.ipv4 = (sockets_ipv4_socket_address_t) {
            (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (4+1*sizeof(void*))))),
            (sockets_ipv4_address_t) (sockets_ipv4_address_t) {
              (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + (6+1*sizeof(void*))))),
              (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + (7+1*sizeof(void*))))),
              (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + (8+1*sizeof(void*))))),
              (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + (9+1*sizeof(void*))))),
            },
          };
          break;
        }
        case 1: {
          variant.val.ipv6 = (sockets_ipv6_socket_address_t) {
            (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (4+1*sizeof(void*))))),
            (uint32_t) (uint32_t) (*((int32_t*) (ptr + (8+1*sizeof(void*))))),
            (sockets_ipv6_address_t) (sockets_ipv6_address_t) {
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (12+1*sizeof(void*))))),
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (14+1*sizeof(void*))))),
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (16+1*sizeof(void*))))),
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (18+1*sizeof(void*))))),
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (20+1*sizeof(void*))))),
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (22+1*sizeof(void*))))),
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (24+1*sizeof(void*))))),
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (26+1*sizeof(void*))))),
            },
            (uint32_t) (uint32_t) (*((int32_t*) (ptr + (28+1*sizeof(void*))))),
          };
          break;
        }
      }

      result.val.ok = variant;
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant0;
      variant0.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant0.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant0.val.other = option;
          break;
        }
      }

      result.val.err = variant0;
      break;
    }
  }
  if (!result.is_err) {
    *ret = result.val.ok;
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool sockets_method_tcp_socket_get_is_listening(sockets_borrow_tcp_socket_t self) {
  int32_t ret = __wasm_import_sockets_method_tcp_socket_get_is_listening((self).__handle);
  return ret;
}

sockets_ip_address_family_t sockets_method_tcp_socket_get_address_family(sockets_borrow_tcp_socket_t self) {
  int32_t ret = __wasm_import_sockets_method_tcp_socket_get_address_family((self).__handle);
  return ret;
}

bool sockets_method_tcp_socket_set_listen_backlog_size(sockets_borrow_tcp_socket_t self, uint64_t value, sockets_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_tcp_socket_set_listen_backlog_size((self).__handle, (int64_t) (value), ptr);
  sockets_result_void_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool sockets_method_tcp_socket_get_keep_alive_enabled(sockets_borrow_tcp_socket_t self, bool *ret, sockets_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_tcp_socket_get_keep_alive_enabled((self).__handle, ptr);
  sockets_result_bool_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      result.val.ok = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    *ret = result.val.ok;
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool sockets_method_tcp_socket_set_keep_alive_enabled(sockets_borrow_tcp_socket_t self, bool value, sockets_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_tcp_socket_set_keep_alive_enabled((self).__handle, value, ptr);
  sockets_result_void_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool sockets_method_tcp_socket_get_keep_alive_idle_time(sockets_borrow_tcp_socket_t self, sockets_duration_t *ret, sockets_error_code_t *err) {
  __attribute__((__aligned__(8)))
  uint8_t ret_area[(8+4*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_tcp_socket_get_keep_alive_idle_time((self).__handle, ptr);
  sockets_result_duration_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      result.val.ok = (uint64_t) (*((int64_t*) (ptr + 8)));
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + 8));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (8+1*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (8+2*sizeof(void*))))), (*((size_t*) (ptr + (8+3*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    *ret = result.val.ok;
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool sockets_method_tcp_socket_set_keep_alive_idle_time(sockets_borrow_tcp_socket_t self, sockets_duration_t value, sockets_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_tcp_socket_set_keep_alive_idle_time((self).__handle, (int64_t) (value), ptr);
  sockets_result_void_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool sockets_method_tcp_socket_get_keep_alive_interval(sockets_borrow_tcp_socket_t self, sockets_duration_t *ret, sockets_error_code_t *err) {
  __attribute__((__aligned__(8)))
  uint8_t ret_area[(8+4*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_tcp_socket_get_keep_alive_interval((self).__handle, ptr);
  sockets_result_duration_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      result.val.ok = (uint64_t) (*((int64_t*) (ptr + 8)));
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + 8));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (8+1*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (8+2*sizeof(void*))))), (*((size_t*) (ptr + (8+3*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    *ret = result.val.ok;
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool sockets_method_tcp_socket_set_keep_alive_interval(sockets_borrow_tcp_socket_t self, sockets_duration_t value, sockets_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_tcp_socket_set_keep_alive_interval((self).__handle, (int64_t) (value), ptr);
  sockets_result_void_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool sockets_method_tcp_socket_get_keep_alive_count(sockets_borrow_tcp_socket_t self, uint32_t *ret, sockets_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_tcp_socket_get_keep_alive_count((self).__handle, ptr);
  sockets_result_u32_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      result.val.ok = (uint32_t) (*((int32_t*) (ptr + sizeof(void*))));
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    *ret = result.val.ok;
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool sockets_method_tcp_socket_set_keep_alive_count(sockets_borrow_tcp_socket_t self, uint32_t value, sockets_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_tcp_socket_set_keep_alive_count((self).__handle, (int32_t) (value), ptr);
  sockets_result_void_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool sockets_method_tcp_socket_get_hop_limit(sockets_borrow_tcp_socket_t self, uint8_t *ret, sockets_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_tcp_socket_get_hop_limit((self).__handle, ptr);
  sockets_result_u8_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      result.val.ok = (uint8_t) ((int32_t) *((uint8_t*) (ptr + sizeof(void*))));
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    *ret = result.val.ok;
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool sockets_method_tcp_socket_set_hop_limit(sockets_borrow_tcp_socket_t self, uint8_t value, sockets_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_tcp_socket_set_hop_limit((self).__handle, (int32_t) (value), ptr);
  sockets_result_void_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool sockets_method_tcp_socket_get_receive_buffer_size(sockets_borrow_tcp_socket_t self, uint64_t *ret, sockets_error_code_t *err) {
  __attribute__((__aligned__(8)))
  uint8_t ret_area[(8+4*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_tcp_socket_get_receive_buffer_size((self).__handle, ptr);
  sockets_result_u64_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      result.val.ok = (uint64_t) (*((int64_t*) (ptr + 8)));
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + 8));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (8+1*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (8+2*sizeof(void*))))), (*((size_t*) (ptr + (8+3*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    *ret = result.val.ok;
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool sockets_method_tcp_socket_set_receive_buffer_size(sockets_borrow_tcp_socket_t self, uint64_t value, sockets_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_tcp_socket_set_receive_buffer_size((self).__handle, (int64_t) (value), ptr);
  sockets_result_void_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool sockets_method_tcp_socket_get_send_buffer_size(sockets_borrow_tcp_socket_t self, uint64_t *ret, sockets_error_code_t *err) {
  __attribute__((__aligned__(8)))
  uint8_t ret_area[(8+4*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_tcp_socket_get_send_buffer_size((self).__handle, ptr);
  sockets_result_u64_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      result.val.ok = (uint64_t) (*((int64_t*) (ptr + 8)));
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + 8));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (8+1*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (8+2*sizeof(void*))))), (*((size_t*) (ptr + (8+3*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    *ret = result.val.ok;
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool sockets_method_tcp_socket_set_send_buffer_size(sockets_borrow_tcp_socket_t self, uint64_t value, sockets_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_tcp_socket_set_send_buffer_size((self).__handle, (int64_t) (value), ptr);
  sockets_result_void_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool sockets_static_udp_socket_create(sockets_ip_address_family_t address_family, sockets_own_udp_socket_t *ret, sockets_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_static_udp_socket_create((int32_t) address_family, ptr);
  sockets_result_own_udp_socket_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      result.val.ok = (sockets_own_udp_socket_t) { *((int32_t*) (ptr + sizeof(void*))) };
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    *ret = result.val.ok;
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool sockets_method_udp_socket_bind(sockets_borrow_udp_socket_t self, sockets_ip_socket_address_t *local_address, sockets_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  int32_t variant;
  int32_t variant1;
  int32_t variant2;
  int32_t variant3;
  int32_t variant4;
  int32_t variant5;
  int32_t variant6;
  int32_t variant7;
  int32_t variant8;
  int32_t variant9;
  int32_t variant10;
  int32_t variant11;
  switch ((int32_t) (*local_address).tag) {
    case 0: {
      const sockets_ipv4_socket_address_t *payload = &(*local_address).val.ipv4;
      variant = 0;
      variant1 = (int32_t) ((*payload).port);
      variant2 = (int32_t) (((*payload).address).f0);
      variant3 = (int32_t) (((*payload).address).f1);
      variant4 = (int32_t) (((*payload).address).f2);
      variant5 = (int32_t) (((*payload).address).f3);
      variant6 = 0;
      variant7 = 0;
      variant8 = 0;
      variant9 = 0;
      variant10 = 0;
      variant11 = 0;
      break;
    }
    case 1: {
      const sockets_ipv6_socket_address_t *payload0 = &(*local_address).val.ipv6;
      variant = 1;
      variant1 = (int32_t) ((*payload0).port);
      variant2 = (int32_t) ((*payload0).flow_info);
      variant3 = (int32_t) (((*payload0).address).f0);
      variant4 = (int32_t) (((*payload0).address).f1);
      variant5 = (int32_t) (((*payload0).address).f2);
      variant6 = (int32_t) (((*payload0).address).f3);
      variant7 = (int32_t) (((*payload0).address).f4);
      variant8 = (int32_t) (((*payload0).address).f5);
      variant9 = (int32_t) (((*payload0).address).f6);
      variant10 = (int32_t) (((*payload0).address).f7);
      variant11 = (int32_t) ((*payload0).scope_id);
      break;
    }
  }
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_udp_socket_bind((self).__handle, variant, variant1, variant2, variant3, variant4, variant5, variant6, variant7, variant8, variant9, variant10, variant11, ptr);
  sockets_result_void_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant12;
      variant12.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant12.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant12.val.other = option;
          break;
        }
      }

      result.val.err = variant12;
      break;
    }
  }
  if (!result.is_err) {
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool sockets_method_udp_socket_connect(sockets_borrow_udp_socket_t self, sockets_ip_socket_address_t *remote_address, sockets_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  int32_t variant;
  int32_t variant1;
  int32_t variant2;
  int32_t variant3;
  int32_t variant4;
  int32_t variant5;
  int32_t variant6;
  int32_t variant7;
  int32_t variant8;
  int32_t variant9;
  int32_t variant10;
  int32_t variant11;
  switch ((int32_t) (*remote_address).tag) {
    case 0: {
      const sockets_ipv4_socket_address_t *payload = &(*remote_address).val.ipv4;
      variant = 0;
      variant1 = (int32_t) ((*payload).port);
      variant2 = (int32_t) (((*payload).address).f0);
      variant3 = (int32_t) (((*payload).address).f1);
      variant4 = (int32_t) (((*payload).address).f2);
      variant5 = (int32_t) (((*payload).address).f3);
      variant6 = 0;
      variant7 = 0;
      variant8 = 0;
      variant9 = 0;
      variant10 = 0;
      variant11 = 0;
      break;
    }
    case 1: {
      const sockets_ipv6_socket_address_t *payload0 = &(*remote_address).val.ipv6;
      variant = 1;
      variant1 = (int32_t) ((*payload0).port);
      variant2 = (int32_t) ((*payload0).flow_info);
      variant3 = (int32_t) (((*payload0).address).f0);
      variant4 = (int32_t) (((*payload0).address).f1);
      variant5 = (int32_t) (((*payload0).address).f2);
      variant6 = (int32_t) (((*payload0).address).f3);
      variant7 = (int32_t) (((*payload0).address).f4);
      variant8 = (int32_t) (((*payload0).address).f5);
      variant9 = (int32_t) (((*payload0).address).f6);
      variant10 = (int32_t) (((*payload0).address).f7);
      variant11 = (int32_t) ((*payload0).scope_id);
      break;
    }
  }
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_udp_socket_connect((self).__handle, variant, variant1, variant2, variant3, variant4, variant5, variant6, variant7, variant8, variant9, variant10, variant11, ptr);
  sockets_result_void_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant12;
      variant12.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant12.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant12.val.other = option;
          break;
        }
      }

      result.val.err = variant12;
      break;
    }
  }
  if (!result.is_err) {
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool sockets_method_udp_socket_disconnect(sockets_borrow_udp_socket_t self, sockets_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_udp_socket_disconnect((self).__handle, ptr);
  sockets_result_void_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

wasip3_subtask_status_t sockets_method_udp_socket_send(sockets_method_udp_socket_send_args_t *args, sockets_result_void_error_code_t *result) {
  return __wasm_import_sockets_method_udp_socket_send((uint8_t*) args, (uint8_t*) result);
}

wasip3_subtask_status_t sockets_method_udp_socket_receive(sockets_borrow_udp_socket_t self, sockets_result_tuple2_list_u8_ip_socket_address_error_code_t *result) {
  return __wasm_import_sockets_method_udp_socket_receive((self).__handle, (uint8_t*) result);
}

bool sockets_method_udp_socket_get_local_address(sockets_borrow_udp_socket_t self, sockets_ip_socket_address_t *ret, sockets_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(32+1*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_udp_socket_get_local_address((self).__handle, ptr);
  sockets_result_ip_socket_address_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      sockets_ip_socket_address_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          variant.val.ipv4 = (sockets_ipv4_socket_address_t) {
            (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (4+1*sizeof(void*))))),
            (sockets_ipv4_address_t) (sockets_ipv4_address_t) {
              (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + (6+1*sizeof(void*))))),
              (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + (7+1*sizeof(void*))))),
              (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + (8+1*sizeof(void*))))),
              (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + (9+1*sizeof(void*))))),
            },
          };
          break;
        }
        case 1: {
          variant.val.ipv6 = (sockets_ipv6_socket_address_t) {
            (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (4+1*sizeof(void*))))),
            (uint32_t) (uint32_t) (*((int32_t*) (ptr + (8+1*sizeof(void*))))),
            (sockets_ipv6_address_t) (sockets_ipv6_address_t) {
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (12+1*sizeof(void*))))),
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (14+1*sizeof(void*))))),
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (16+1*sizeof(void*))))),
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (18+1*sizeof(void*))))),
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (20+1*sizeof(void*))))),
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (22+1*sizeof(void*))))),
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (24+1*sizeof(void*))))),
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (26+1*sizeof(void*))))),
            },
            (uint32_t) (uint32_t) (*((int32_t*) (ptr + (28+1*sizeof(void*))))),
          };
          break;
        }
      }

      result.val.ok = variant;
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant0;
      variant0.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant0.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant0.val.other = option;
          break;
        }
      }

      result.val.err = variant0;
      break;
    }
  }
  if (!result.is_err) {
    *ret = result.val.ok;
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool sockets_method_udp_socket_get_remote_address(sockets_borrow_udp_socket_t self, sockets_ip_socket_address_t *ret, sockets_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(32+1*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_udp_socket_get_remote_address((self).__handle, ptr);
  sockets_result_ip_socket_address_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      sockets_ip_socket_address_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          variant.val.ipv4 = (sockets_ipv4_socket_address_t) {
            (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (4+1*sizeof(void*))))),
            (sockets_ipv4_address_t) (sockets_ipv4_address_t) {
              (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + (6+1*sizeof(void*))))),
              (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + (7+1*sizeof(void*))))),
              (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + (8+1*sizeof(void*))))),
              (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + (9+1*sizeof(void*))))),
            },
          };
          break;
        }
        case 1: {
          variant.val.ipv6 = (sockets_ipv6_socket_address_t) {
            (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (4+1*sizeof(void*))))),
            (uint32_t) (uint32_t) (*((int32_t*) (ptr + (8+1*sizeof(void*))))),
            (sockets_ipv6_address_t) (sockets_ipv6_address_t) {
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (12+1*sizeof(void*))))),
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (14+1*sizeof(void*))))),
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (16+1*sizeof(void*))))),
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (18+1*sizeof(void*))))),
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (20+1*sizeof(void*))))),
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (22+1*sizeof(void*))))),
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (24+1*sizeof(void*))))),
              (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + (26+1*sizeof(void*))))),
            },
            (uint32_t) (uint32_t) (*((int32_t*) (ptr + (28+1*sizeof(void*))))),
          };
          break;
        }
      }

      result.val.ok = variant;
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant0;
      variant0.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant0.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant0.val.other = option;
          break;
        }
      }

      result.val.err = variant0;
      break;
    }
  }
  if (!result.is_err) {
    *ret = result.val.ok;
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

sockets_ip_address_family_t sockets_method_udp_socket_get_address_family(sockets_borrow_udp_socket_t self) {
  int32_t ret = __wasm_import_sockets_method_udp_socket_get_address_family((self).__handle);
  return ret;
}

bool sockets_method_udp_socket_get_unicast_hop_limit(sockets_borrow_udp_socket_t self, uint8_t *ret, sockets_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_udp_socket_get_unicast_hop_limit((self).__handle, ptr);
  sockets_result_u8_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      result.val.ok = (uint8_t) ((int32_t) *((uint8_t*) (ptr + sizeof(void*))));
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    *ret = result.val.ok;
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool sockets_method_udp_socket_set_unicast_hop_limit(sockets_borrow_udp_socket_t self, uint8_t value, sockets_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_udp_socket_set_unicast_hop_limit((self).__handle, (int32_t) (value), ptr);
  sockets_result_void_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool sockets_method_udp_socket_get_receive_buffer_size(sockets_borrow_udp_socket_t self, uint64_t *ret, sockets_error_code_t *err) {
  __attribute__((__aligned__(8)))
  uint8_t ret_area[(8+4*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_udp_socket_get_receive_buffer_size((self).__handle, ptr);
  sockets_result_u64_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      result.val.ok = (uint64_t) (*((int64_t*) (ptr + 8)));
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + 8));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (8+1*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (8+2*sizeof(void*))))), (*((size_t*) (ptr + (8+3*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    *ret = result.val.ok;
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool sockets_method_udp_socket_set_receive_buffer_size(sockets_borrow_udp_socket_t self, uint64_t value, sockets_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_udp_socket_set_receive_buffer_size((self).__handle, (int64_t) (value), ptr);
  sockets_result_void_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool sockets_method_udp_socket_get_send_buffer_size(sockets_borrow_udp_socket_t self, uint64_t *ret, sockets_error_code_t *err) {
  __attribute__((__aligned__(8)))
  uint8_t ret_area[(8+4*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_udp_socket_get_send_buffer_size((self).__handle, ptr);
  sockets_result_u64_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      result.val.ok = (uint64_t) (*((int64_t*) (ptr + 8)));
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + 8));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (8+1*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (8+2*sizeof(void*))))), (*((size_t*) (ptr + (8+3*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    *ret = result.val.ok;
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool sockets_method_udp_socket_set_send_buffer_size(sockets_borrow_udp_socket_t self, uint64_t value, sockets_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_sockets_method_udp_socket_set_send_buffer_size((self).__handle, (int64_t) (value), ptr);
  sockets_result_void_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      break;
    }
    case 1: {
      result.is_err = true;
      sockets_error_code_t variant;
      variant.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          break;
        }
        case 6: {
          break;
        }
        case 7: {
          break;
        }
        case 8: {
          break;
        }
        case 9: {
          break;
        }
        case 10: {
          break;
        }
        case 11: {
          break;
        }
        case 12: {
          break;
        }
        case 13: {
          break;
        }
        case 14: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant.val.other = option;
          break;
        }
      }

      result.val.err = variant;
      break;
    }
  }
  if (!result.is_err) {
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

bool ip_name_lookup_resolve_addresses(wasip3_string_t *name, ip_name_lookup_list_ip_address_t *ret, ip_name_lookup_error_code_t *err) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(5*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_ip_name_lookup_resolve_addresses((uint8_t *) (*name).ptr, (*name).len, ptr);
  ip_name_lookup_result_list_ip_address_error_code_t result;
  switch ((int32_t) *((uint8_t*) (ptr + 0))) {
    case 0: {
      result.is_err = false;
      result.val.ok = (ip_name_lookup_list_ip_address_t) { (ip_name_lookup_ip_address_t*)(*((uint8_t **) (ptr + sizeof(void*)))), (*((size_t*) (ptr + (2*sizeof(void*))))) };
      break;
    }
    case 1: {
      result.is_err = true;
      ip_name_lookup_error_code_t variant0;
      variant0.tag = (int32_t) *((uint8_t*) (ptr + sizeof(void*)));
      switch ((int32_t) variant0.tag) {
        case 0: {
          break;
        }
        case 1: {
          break;
        }
        case 2: {
          break;
        }
        case 3: {
          break;
        }
        case 4: {
          break;
        }
        case 5: {
          wasip3_option_string_t option;
          switch ((int32_t) *((uint8_t*) (ptr + (2*sizeof(void*))))) {
            case 0: {
              option.is_some = false;
              break;
            }
            case 1: {
              option.is_some = true;
              option.val = (wasip3_string_t) { (uint8_t*)(*((uint8_t **) (ptr + (3*sizeof(void*))))), (*((size_t*) (ptr + (4*sizeof(void*))))) };
              break;
            }
          }
          variant0.val.other = option;
          break;
        }
      }

      result.val.err = variant0;
      break;
    }
  }
  if (!result.is_err) {
    *ret = result.val.ok;
    return 1;
  } else {
    *err = result.val.err;
    return 0;
  }
}

void random_get_random_bytes(uint64_t max_len, wasip3_list_u8_t *ret) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(2*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_random_get_random_bytes((int64_t) (max_len), ptr);
  *ret = (wasip3_list_u8_t) { (uint8_t*)(*((uint8_t **) (ptr + 0))), (*((size_t*) (ptr + sizeof(void*)))) };
}

uint64_t random_get_random_u64(void) {
  int64_t ret = __wasm_import_random_get_random_u64();
  return (uint64_t) (ret);
}

void random_insecure_get_insecure_random_bytes(uint64_t max_len, wasip3_list_u8_t *ret) {
  __attribute__((__aligned__(sizeof(void*))))
  uint8_t ret_area[(2*sizeof(void*))];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_random_insecure_get_insecure_random_bytes((int64_t) (max_len), ptr);
  *ret = (wasip3_list_u8_t) { (uint8_t*)(*((uint8_t **) (ptr + 0))), (*((size_t*) (ptr + sizeof(void*)))) };
}

uint64_t random_insecure_get_insecure_random_u64(void) {
  int64_t ret = __wasm_import_random_insecure_get_insecure_random_u64();
  return (uint64_t) (ret);
}

void random_insecure_seed_get_insecure_seed(wasip3_tuple2_u64_u64_t *ret) {
  __attribute__((__aligned__(8)))
  uint8_t ret_area[16];
  uint8_t *ptr = (uint8_t *) &ret_area;
  __wasm_import_random_insecure_seed_get_insecure_seed(ptr);
  *ret = (wasip3_tuple2_u64_u64_t) {
    (uint64_t) (uint64_t) (*((int64_t*) (ptr + 0))),
    (uint64_t) (uint64_t) (*((int64_t*) (ptr + 8))),
  };
}

// Ensure that the *_component_type.o object is linked in

extern void __component_type_object_force_link_wasip3(void);
__attribute__((used))
void __component_type_object_force_link_wasip3_public_use_in_this_compilation_unit(void) {
  __component_type_object_force_link_wasip3();
}
