/* This file was generated by the Hex-Rays decompiler version 9.2.0.250908.
   Copyright (c) 2007-2021 Hex-Rays <info@hex-rays.com>

   Detected compiler: GNU C++
*/

#include <defs.h>
#include <sys/syscall.h>
#include <stdarg.h>
@import Foundation;

#ifndef RECOMP_TRACE_DMAFAIL
#define RECOMP_TRACE_DMAFAIL 0
#endif

#ifndef RECOMP_TRACE_PHYSMAP
#define RECOMP_TRACE_PHYSMAP 0
#endif

#ifndef RECOMP_TRACE_PORTS
#define RECOMP_TRACE_PORTS 0
#endif

#ifndef RECOMP_PHYSMAP_VALIDATE_CACHE
#define RECOMP_PHYSMAP_VALIDATE_CACHE 1
#endif

#ifndef RECOMP_ENABLE_STOCK_CLOSE_RESTORE
#define RECOMP_ENABLE_STOCK_CLOSE_RESTORE 0
#endif

#if RECOMP_TRACE_DMAFAIL
#define TRACE_DMAFAIL(...) NSLog(@__VA_ARGS__)
#else
#define TRACE_DMAFAIL(...) do { } while (0)
#endif

#if RECOMP_TRACE_PHYSMAP
#define TRACE_PHYSMAP(...) NSLog(@__VA_ARGS__)
#else
#define TRACE_PHYSMAP(...) do { } while (0)
#endif

#if RECOMP_TRACE_PORTS
#define TRACE_PORTS(...) NSLog(@__VA_ARGS__)
#else
#define TRACE_PORTS(...) do { } while (0)
#endif


typedef struct {
  uint64_t packed_info;
  uint64_t object_id;
} vm_region_nesting_result;

//-------------------------------------------------------------------------
// Function declarations

__int64 __fastcall driver(uint64_t *a1);
__int64 __fastcall driver_free(__int128 *a1);
__int64 __fastcall driver_init(__int64 vtable, char something, struct_krwCtx **krwCtxOut);
__int64 __fastcall driver_dispatch_command(
        __int64 vtable,
        struct_krwCtx *krwCtx,
        int cmd,
        __int64 arg0,
        __int64 arg1,
        __int64 arg2,
        __int64 arg3,
        __int64 arg4);
__int64 __fastcall krw_teardown_dispatch(__int64 a1, __int64 a2);
__int64 __fastcall driver_close(__int64 a1, char *a2);
__int64 __fastcall krw_get_conn_port(__int64, __int64, uint32_t *);
__int64 __fastcall krw_read_iogpu(__int64 a1, __int64 *a2, __int64 a3, unsigned int a4, int a5);
__int64 __fastcall parse_kernel_version(__int64 a1, __int64 a2);
vm_address_t __fastcall vm_remap_new_target(vm_address_t src_address, vm_size_t size, boolean_t copy);
__int64 __fastcall vm_remap_inplace(vm_address_t src_address, vm_size_t size, boolean_t copy); // idb
vm_region_nesting_result __fastcall query_vm_region_nesting(vm_address_t a1);
__int64 __fastcall compare_entry_by_offset(__int64, __int64);
__int64 __fastcall compare_entry_unsigned(__int64, __int64);
__int64 setup_thread_policy();
void __fastcall sort_compact_vm_regions(__int64 a1, __int64 a2);
void __fastcall grow_vm_region_list(uint64_t *a1);
__int64 __fastcall get_vm_region_slot(uint64_t *a1);
void __fastcall deallocate_physmap_pages(__int64 a1);
__int64 __fastcall acquire_physmap_page(__int64 a1);
__int64 __fastcall start_physmap_worker_thread(__int64 a1, mem_entry_name_port_t *a2);
__int64 __fastcall request_physmap_page(uint64_t *a1, __int64 a2);
__int64 __fastcall physmap_read_dword(uint64_t *a1, unsigned __int64 a2, uint32_t *a3);
void *__fastcall physmap_read_aligned(uint64_t *a1, unsigned __int64 a2, void *a3, size_t a4);
__int64 __fastcall physmap_write_aligned(uint64_t *a1, const void *a2, unsigned __int64 a3, size_t a4);
unsigned __int64 __fastcall build_physmap_page_table(uint64_t *a1, unsigned __int64 a2);
uint64_t *__fastcall iogpu_kread_loop(uint64_t *result, __int16 a2, char *a3, unsigned __int64 a4);
uint64_t *__fastcall iogpu_kwrite_loop(uint64_t *result, char *a2, __int16 a3, unsigned __int64 a4);
__int64 __fastcall find_mem_region(__int64 result);
__int64 __fastcall alloc_krw_region_map(__int64 a1);
__int64 __fastcall alloc_vm_page_array(__int64 a1);
__int64 __fastcall allocate_two_buffers_for_something(uint64_t *a1);
__int64 __fastcall setup_krw_region_structure(uint64_t *a1);
__int64 __fastcall physmap_vmregion_init(uint64_t *a1);
void *__fastcall alloc_physmap_page_entry(uint64_t *a1);
void *__fastcall physmap_page_entry_alloc(uint64_t *a1, int a2);
uint64_t *__fastcall fill_physmap_page_entries(uint64_t *a1, __int64 a2);
uint64_t *__fastcall dequeue_physmap_page_entry(uint64_t *a1, uint64_t *a2);
uint64_t *__fastcall dequeue_multiple_physmap_entries(uint64_t *a1);
__int64 __fastcall trigger_vm_copy_shared_mem(__int64 a1);
__int64 __fastcall thread_realtime_vm_copy(__int64 a1);
__int64 __fastcall scan_physmap_for_region(__int64 a1, unsigned __int64 a2);
__int64 __fastcall get_physmap_region_ptr(__int64 a1, int a2);
unsigned __int64 __fastcall run_physmap_worker_threads(__int64 a1);
uintptr_t __fastcall physmap_madvise_free(__int64 a1, __int64 a2);
__int64 __fastcall puaf_vmregion_race_trigger(uint64_t *a1);
uintptr_t __fastcall puaf_vm_region_scan_1(__int64 a1);
void __fastcall validate_physmap_range_2(__int64 a1);
void __fastcall run_physmap_setup_sequence(uint64_t *a1);
__int64 __fastcall validate_physmap_range_3(vm_address_t *a1);
void __fastcall scan_physmap_overlap(uint64_t *a1, __int64 a2, unsigned __int64 *a3, unsigned __int64 *a4);
void __fastcall scan_physmap_addr_range(uint64_t *a1, __int64 a2, int a3, uint64_t *a4);
void *__fastcall setup_physmap_copy_structure(uint64_t *a1);
__int64 __fastcall reset_physmap_copy_area(__int64 a1);
__int64 __fastcall dealloc_krw_port_array(__int64 result, __int64 a2);
void __fastcall cleanup_physmap_copy_entries(__int64 a1);
__int64 __fastcall dealloc_physmap_copy_slot(__int64 a1, __int64 a2);
__int64 __fastcall dealloc_physmap_2page_slot(__int64 a1, vm_address_t *a2);
__int64 __fastcall dealloc_physmap_3page_slot(__int64 a1, vm_address_t *a2);
__int64 __fastcall dealloc_iogpu_physmap_2(__int64 a1, uint64_t *a2);
__int64 __fastcall dealloc_iogpu_physmap_entry(__int64 a1, uint64_t *a2);
__int64 __fastcall dealloc_iogpu_physmap_triple(__int64 a1, uint64_t *a2);
void __fastcall cleanup_physmap_context(__int64 a1);
__int64 __fastcall free_vm_page_array_list(__int64 a1);
void __fastcall teardown_iogpu_vm_copy(vm_address_t *a1);
__int64 __fastcall necp_send_msg_1(struct_krwCtx *krwCtx);
__int64 __fastcall iogpu_kread(struct_krwCtx *krwCtx, __int16 a2, char *a3, unsigned int a4, int a5);
__int64 __fastcall iogpu_kwrite(struct_krwCtx *krwCtx, __int16 a2, char *a3, unsigned int a4, int a5);
__int64 __fastcall iogpu_kread2(struct_krwCtx *krwCtx, unsigned __int64 a2, void *a3, unsigned int a4, int a5);
__int64 __fastcall iogpu_kwrite2(struct_krwCtx *krwCtx, unsigned __int64 a2, const void *a3, unsigned int a4, int a5);
__int64 __fastcall setup_kernel_region_via_flags(struct_krwCtx *krwCtx);
__int64 __fastcall read_task_kobject_physmap(struct_krwCtx *krwCtx, unsigned __int64 a2);
__int64 __fastcall get_read_task_port_kobject(struct_krwCtx *krwCtx, mach_port_t a2);
unsigned __int64 __fastcall check_task_port_type(__int64 krwCtx, unsigned __int64 a2);
__int64 __fastcall free_iogpu_krw_ctx(struct_krwCtx *krwCtx);
__int64 __fastcall iogpu_teardown_ctx(struct_krwCtx *krwCtx);
__int64 __fastcall create_iogpu_shmem_entry(struct_krwCtx *krwCtx, uint32_t *a2, uint32_t *a3, mach_port_t *a4, uint64_t *a5);
__int64 __fastcall iogpu_physmap_init(struct_krwCtx *krwCtx);
__int64 __fastcall iogpu_init_private_ctx(struct_krwCtx *krwCtx, uint64_t *a2, mem_entry_name_port_t a3, mem_entry_name_port_t a4, mem_entry_name_port_t a5, uint64_t *a6);
__int64 __fastcall iogpu_krw_ctx_setup(struct_krwCtx *krwCtx, uint32_t *a2);
__int64 __fastcall get_iogpu_physmap_base(struct_krwCtx *krwCtx);
void memory_barrier_dsb_isb();
__int64 __fastcall iogpu_kernel_read_op(struct_krwCtx *krwCtx, unsigned __int64 a2, int a3);
unsigned __int64 __fastcall scan_for_macho_header(__int64 *krwCtx, __int64 a2);
__int64 __fastcall acquire_physmap_page_atomic(__int64 a1);
__int64 __fastcall query_vm_region_prot_info(vm_address_t a1);
__int64 __fastcall iokit_slot_alloc_with_mem_entry(__int64 a1, vm_size_t size, __int64 a3, mem_entry_name_port_t *a4);
__int64 __fastcall vm_map_with_retry(vm_address_t *a1, vm_size_t size, vm_address_t mask, int flags, int a5);
__int64 __fastcall kernel_read_loop_physmap(struct_krwCtx *krwCtx, __int64 a2, unsigned int a3, __int64 a4);
__int64 __fastcall kext_exploit_main(uint64_t x0, uint32_t w1, uint64_t x2);
__int64 __fastcall kext_exploit_main_trampoline(uint64_t x0, uint64_t x1_idk, uint32_t w2, uint64_t x3);
__int64 __fastcall kext_image_scan_init(uint64_t *a1);
__int64 __fastcall kext_image_scan_trampoline_0(struct_krwCtx *krwCtx, uint64_t x1);
__int64 __fastcall ioconnect_kread_physmap(struct_krwCtx *krwCtx, __int64 a2, __int64 a3, unsigned int a4);
__int64 __fastcall physmap_read_rebuild_page(uint64_t *a1, int8x8_t *a2);
__int64 __fastcall check_physmap_page_count(uint32_t *a1, __int64 a2);
__int64 __fastcall map_sptm_state_page(__int64 a1);
__int64 __fastcall get_physmap_region_ptrs(struct_krwCtx *krwCtx, __int64, __int64, uint64_t *);
__int64 __fastcall iokit_kwrite_via_port(struct_krwCtx *krwCtx, __int64 a2, __int64 a3, int a4, __int64 a5, __int64 a6, unsigned __int64 a7);
void __fastcall cfdict_set_int32(CFMutableDictionaryRef a1, const void *a2);
__int64 __fastcall setup_vm_for_kwrite(struct_krwCtx *krwCtx, __int64 a2, unsigned __int64 a3);
__int64 __fastcall get_ipc_kobject_offset(struct_krwCtx *krwCtx, __int64 a2, unsigned __int64 *a3);
__int64 __fastcall read_ipc_port_table_entry(struct_krwCtx *krwCtx, __int64 a2, unsigned int a3, unsigned __int64 *a4);
__int64 __fastcall kwrite_u64_via_kobject(__int64 a1, __int64 a2, __int64 a3, __int64 a4);
__int64 __fastcall kread_via_kobject(__int64 a1, __int64 a2, __int64 a3, __int64 a4);
__int64 __fastcall kread_u64_value(__int64 a1, __int64 a2);
__int64 __fastcall kwrite_u64_to_addr(__int64 a1, __int64 a2, __int64 a3);
__int64 __fastcall kread_u32_value(__int64 a1, unsigned __int64 a2);
__int64 __fastcall flush_cpu_cache(__int64 a1, mach_vm_address_t a2, int a3);
__int64 __fastcall setup_iokit_notify_dispatch(uint64_t *a1, uint64_t **a2);
unsigned __int64 __fastcall send_port_alloc_msg(__int64 a1, int a2);
__int64 __fastcall setup_kernel_exploit_msg(__int64 a1, __int64 a2, __int64 a3, unsigned int a4, __int64 a5, __int64 a6, __int64 a7);
__int64 __fastcall mach_vm_page_info_query(uint64_t *a1, __int64 a2, unsigned int a3, __int64 a4, __int64 a5, __int64 a6);
__int64 __fastcall query_phys_page_info(__int64 a1, __int64 a2, __int64 a3);
__int64 __fastcall setup_ipc_port_exploit_payload(__int64 a1, __int64 a2, int a3, __int64 a4);
__int64 __fastcall send_iokit_notification(__int64 a1, __int64 a2, uint64_t *a3);
__int64 __fastcall prepare_iokit_notification_payload(__int64 a1, __int64 a2, __int64 a3);
__int64 __fastcall vtable_call_slot2(__int64 a1, __int64 a2);
__int64 __fastcall setup_notification_extra_args(__int64 a1, __int64 a2, __int64 a3);
__int64 __fastcall trigger_kstate_write_vtable(__int64 *a1, __int64 a2, __int64 a3);
__int64 __fastcall pack_exploit_args_buffer(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, __int64 a7, __int64 a8, __int64 a9);
__int64 __fastcall call_vtable_ptr_slot2(__int64 a1);
__int64 __fastcall exploit_thread_vmcopy_race(__int64 a1);
__int64 __fastcall run_exploit_thread(__int64 a1);
__int64 __fastcall write_kaddr_to_physmap(__int64 a1, unsigned __int8 a2);
__int64 __fastcall trigger_thread_state_mod(__int64 a1);
__int64 __fastcall get_ppnum_via_kread(__int64 a1);
__int64 __fastcall compare_cfdict_entries(const void *a1, const void *a2);
void __fastcall iterate_cftype_values(const void *a1, CFTypeRef cf, __int64 a3);
__int64 __fastcall merge_cfdict_entries(const void *a1, const void *a2);
void __fastcall apply_cfdict_update(void *key, CFTypeRef value, __int64 a3);
void __fastcall cfarray_add_unique(const void *a1, __int64 a2);
const void *__fastcall check_cfstring_type(const void *result, uint8_t *a2);
const void *__fastcall cfarray_contains_check(const void *result, __int64 a2);
void __fastcall necp_dispatch_by_version(struct_krwCtx *krwCtx);
bool __fastcall check_necp_flag(struct_krwCtx *krwCtx);
bool __fastcall necp_kread_region(struct_krwCtx *krwCtx, unsigned __int64 a2, __int64 a3, unsigned int a4);
bool __fastcall ppl_physmap_table_patch_write(struct_krwCtx *krwCtx, mach_vm_address_t vaddr, __int64 newBytes, __int64 size, int a5);
bool __fastcall get_kwrite_fn(struct_krwCtx *krwCtx, uint64_t *a2, uint32_t *a3);
bool __fastcall pgtable_walk_for_physmap(struct_krwCtx *krwCtx, unsigned __int64 a2, unsigned __int64 a3);
bool __fastcall physmap_table_write_versioned(struct_krwCtx *krwCtx, unsigned __int64 a2, int a3);
bool __fastcall check_physmap_range_necp(struct_krwCtx *krwCtx, unsigned __int64 a2, int a3);
__int64 __fastcall ppl_kwritebuf(struct_krwCtx *krwCtx, unsigned __int64 vaddr, void *newBytes, int size);
bool __fastcall kaddr_need_ppl_bypass(struct_krwCtx *krwCtx, unsigned __int64 vaddr);
bool __fastcall ppl_kwritebuf_nocheck(struct_krwCtx *krwCtx, mach_vm_address_t vaddr, __int64 newBytes, __int64 size, char pplBypass, int);
bool __fastcall ppl_kwrite_physmap_checked(struct_krwCtx *krwCtx, unsigned __int64 a2, __int64 a3);
__int64 __fastcall kwrite_something(struct_krwCtx *krwCtx, mach_vm_address_t a2, __int64 a3, __int64 a4, int a5);
__int64 __fastcall get_root_statfs(struct_krwCtx *krwCtx, int *outIsReadWrite);
bool __fastcall check_iogpu_krw_ready_3(struct_krwCtx *krwCtx, char *a2);
__int64 __fastcall get_kernel_base_physmap(struct_krwCtx *krwCtx, int a2);
__int64 __fastcall check_root_disk_identity(struct_krwCtx *krwCtx);
__int64 __fastcall add_rw_to_disk(struct_krwCtx *krwCtx, const char *a2, const char *a3);
bool __fastcall check_path_on_disk0s1s1(const char *a1);
__int64 __fastcall check_mount_thread_info(struct_krwCtx *krwCtx, int a2);
__int64 __fastcall check_disk0s1s1_path(struct_krwCtx *krwCtx, char *a2);
__int64 __fastcall get_mount_disk_info(struct_krwCtx *krwCtx, int a2);
__int64 __fastcall get_root_prefix_path(__int64 a1, void *a2, uint32_t *a3, int *a4);
__int64 __fastcall get_kbase_from_fileport(struct_krwCtx *krwCtx, int w1_0);
__int64 __fastcall validate_physmap_range_4(struct_krwCtx *krwCtx, char *a2, int a3, unsigned int *a4);
__int64 __fastcall get_kernel_load_addr_bsm(__int64 a1, const char *a2, unsigned int a3);
__int64 __fastcall remount_hfs(__int64 a1, const char *a2, int a3);
bool check_root_is_apfs();
__int64 __fastcall krw_inject_entitlements_maybe(struct_krwCtx *krwCtx, __int64 task, char *entitlementXml);
__int64 __fastcall krw_inject_entitlements_to_task(struct_krwCtx *krwCtx, __int64 a2, char *a3, __int64 a4, int a5);
__int64 __fastcall find_connect_ioavservice(__int64 a1);
__int64 __fastcall get_kernel_task_iokit(__int64 a1);
__int64 test_appsepmanager_presence();
void __fastcall necp_send_msg_2(struct_krwCtx *krwCtx);
__int64 __fastcall pgtable_locked_kwrite32_retry(struct_krwCtx *krwCtx, __int64 a2, int a3);
__int64 __fastcall krw_physmap_ctx_init(struct_krwCtx *krwCtx);
unsigned __int64 __fastcall read_cryptex_manifest(struct_krwCtx *krwCtx, unsigned __int64 a2);
char *__fastcall scan_physmap_state_entries(struct_krwCtx *, uint32_t *, uint32_t *, unsigned __int64);
__int64 __fastcall lookup_sptm_state_entry(struct_krwCtx *krwCtx, unsigned __int64 a2, uint64_t *a3);
unsigned __int64 __fastcall read_pgtable_entry(struct_krwCtx *krwCtx, unsigned __int64 a2, __int64 *a3, char a4);
__int64 __fastcall get_pgtable_walk_result(struct_krwCtx *krwCtx, unsigned __int64 a2, uint64_t *a3);
__int64 __fastcall setup_physmap_page_with_size(struct_krwCtx *krwCtx, unsigned __int64 a2, __int64 a3);
__int64 __fastcall setup_physmap_rw_multi(struct_krwCtx *krwCtx, unsigned __int64 a2, __int64 a3);
void __fastcall setup_macho_section_dispatch(struct_krwCtx *krwCtx, __int64, int);
__int64 __fastcall get_kernel_version_build_0(struct_krwCtx *krwCtx, __int64 a2, int a3);
__int64 __fastcall nullsub_1(uint64_t); // weak
__int64 __fastcall validate_kaddr_range(__int64, __int64);
static __attribute__((noinline)) __int64 validate_kaddr_range_reloaded(__int64 krwCtx, __int64 addr)
{
  return validate_kaddr_range(krwCtx, addr);
}
unsigned __int64 __fastcall check_kaddr_in_physmap(struct_krwCtx *krwCtx, unsigned __int64 vaddr);
typedef struct sub_197A8_result
{
  unsigned __int64 addr;
  unsigned __int64 size;
} sub_197A8_result;
sub_197A8_result macho_find_segment(SearchObj *a1, int /*unused*/ a2);
__int64 get_const_8();
__int64 __fastcall unmap_macho_image(__int64 a1);
__int64 __fastcall macho_walk_segment_by_name_impl(__int64 a1, unsigned __int64 a2, unsigned __int64 a3, unsigned __int64 a4, char a5);
__int64 __fastcall macho_walk_segment_by_name_0(__int64 a1, unsigned __int64 a2, unsigned __int64 a3, unsigned __int64 a4);
unsigned int __fastcall macho_read_u32(__int64 *a1, __int64 *a2);
unsigned __int64 __fastcall macho_read_u64(__int64 *a1, __int64 *a2);
__int64 __fastcall macho_read_u64_thunk(uint64_t, uint64_t); // weak
void __usercall macho_walk_segment_by_name(char *s2, __int64 a2, SearchObj *a3);
__n128 macho_getsectbyname(char *seg, __int64 a2, const char *sect, uint64_t *a4);
double macho_find_text_section(__int64 a1, uint64_t *a2);
__int64 __fastcall macho_find_loadcmd_by_name(__int64 a1, char *__s2, unsigned __int64 a3);
double __fastcall krw_ctx_zero_fields(struct_a1 *a1, struct_krwCtx *krwCtx);
__int64 __fastcall free_macho_image_vm(__int64 a1);
bool __fastcall map_macho_image_vm(__int64 a1);
bool __fastcall alloc_kernel_offset_table(__int64 a1, __int64 a2);
bool __fastcall iosurface_physmap_setup_bool(__int64 a1, int a2, __int64 a3, unsigned int a4);
bool __fastcall iosurface_physmap_setup(__int64 a1, int a2, __int64 a3, unsigned int a4);
bool __fastcall iosurface_physmap_setup_alt(__int64 a1, int a2, __int64 a3, int a4);
void __fastcall free_kernel_image_resources(__int64 a1);
__int64 __fastcall krw_ctx_setup_physmap(__int64 a1, uint64_t **a2, __int64 a3);
__int64 __fastcall spin_wait_el0_transition(__int64 result);
__int64 __fastcall necp_set_opt_string_2(__int64 a1, __int64 a2);
__int64 __fastcall write_task_kobject_fields(__int64 a1, __int64 a2);
__int64 __fastcall trigger_iokit_property_exploit(__int64 a1);
__int64 __fastcall wait_thread_ready(__int64 a1, uint64_t **a2);
__int64 __fastcall thread_hijack_exploit(__int64 a1);
__int64 __fastcall call_vtable_ptr_slot2_v2(__int64 a1);
__int64 __fastcall spin_wait_el0_via_ptr(__int64 a1);
__int64 __fastcall wait_thread_via_ptr(__int64 a1);
__int64 __fastcall get_task_vm_region_base(task_name_t a1);
__int64 __fastcall get_task_vm_info_0(task_name_t a1, uint64_t *a2);
__int64 __fastcall iosurface_enum_mach_port(__int64 a1, unsigned int a2);
__int64 __fastcall iosurface_id_to_index(unsigned int);
__int64 __fastcall get_iosurface_mem_entry(struct_krwCtx *krwCtx, unsigned int a2, mach_port_name_t *a3);
__int64 __fastcall alloc_vm_page_mem_entry(struct_krwCtx *krwCtx, unsigned int a2, vm_size_t size, vm_address_t *address);
__int64 __fastcall alloc_vm_page(struct_krwCtx *krwCtx);
bool __fastcall krw_setup_with_stat(struct_krwCtx *krwCtx, uint32_t *a2);
bool __fastcall krw_setup_ports_vm(struct_krwCtx *krwCtx, uint32_t *a2);
__int64 __fastcall setup_voucher_exploit_ctx(struct_krwCtx *krwCtx, unsigned int *a2, unsigned int a3);
__int64 __fastcall alloc_iosurface_mach_port(struct_krwCtx *krwCtx, unsigned int a2, unsigned int a3);
__int64 __fastcall insert_mach_port_send_right(struct_krwCtx *krwCtx, task_name_t a2, unsigned int a3, __int64 a4, unsigned int a5);
__int64 __fastcall mementry_iosurface_port_alloc(struct_krwCtx *krwCtx, unsigned int a2, vm_size_t size, vm_offset_t offset, vm_address_t *a5);
__int64 __fastcall alloc_vm_page_v2(struct_krwCtx *krwCtx);
bool __fastcall krw_setup_voucher(struct_krwCtx *krwCtx);
bool __fastcall krw_setup_physmap(struct_krwCtx *krwCtx);
bool __fastcall krw_setup_iosurface(struct_krwCtx *krwCtx);
bool __fastcall krw_setup_iosurface_v2(struct_krwCtx *krwCtx, uint32_t *a2);
mach_vm_address_t __fastcall build_kernel_vtable(struct_krwCtx *krwCtx, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, uint64_t *a7);
__int64 kernel_pattern_scan(SearchObj *obj, const char *pattern_str, uint32_t align_flag);
//__int64 scan_kernel_text_gadget(SearchObj *obj, int16_t *pattern, intptr_t pat_len, intptr_t anchor, uint32_t align_flag, uint32_t flags);
__int64 __fastcall scan_kernel_text_gadget(__int64 *a1, __int64 a2, __int64 a3, __int64 a4, int a5, __int64 a6);
__int64 __fastcall search_binary_pattern_text(__int128 *a1, char *__s, int a3, char a4);
unsigned __int64 __fastcall find_pattern_kernel_section(__int64 *a1, __int64 a2, int a3);
char *__fastcall find_pattern_macho_binary(__int64 *a1, uint32_t *a2, uint32_t *a3, unsigned __int64 a4);
unsigned __int64 __fastcall kernel_find_symbol_by_cstring_scan(__int64 a1, char *a2, const char *a3, char *a4);
char *__fastcall find_kernel_gadget(__int64 a1);
__int64 __fastcall get_sptm_version_index(__int64);
unsigned __int64 __fastcall find_kernel_func_aligned(__int64 *a1, __int64 a2);
__int64 __fastcall find_kernel_func_by_scan(__int64 *a1);
char *__fastcall find_kernel_branch_target(__int64 *a1);
char *__fastcall resolve_branch_target(__int64 *a1, __int64 *a2);
unsigned __int64 __fastcall find_kernel_func(__int64 *a1, __int64 *a2);
unsigned __int64 __fastcall find_kernel_func_versioned(__int64 *someStruct, int *a2);
unsigned __int64 __fastcall find_kread_pattern_versioned(__int64 someStruct, unsigned __int64 *a2, unsigned __int64 *a3);
__int64 __fastcall find_kernel_func_at_offset(struct_krwCtx *krwCtx, int a2);
char *__fastcall find_kernel_func_by_branch(__int64 *a1, __int64 *a2, int a3);
__int64 __fastcall get_kernel_version_string_0(char *a1, size_t a2);
int __fastcall kernel_version_parse(struct_xnuMajorVersion *xnuMajorVersion, int *a2, int *a3);
__int64 __fastcall mach_vm_page_info_query_0(vm_map_read_t a1, mach_vm_address_t a2, uint64_t *a3);
__int64 number_of_cpus();
unsigned __int64 comm_page_memory_size();
__int64 sub_get_page_size();
__int64 __fastcall get_task_vm_info_1(task_name_t a1);
__int64 get_page_size();
__int64 __fastcall get_task_memory_info(task_name_t a1, uint64_t *a2, uint64_t *a3);
unsigned __int64 __fastcall comm_page_get_cpu_family(uint32_t *cpuFamily);
__int64 __fastcall alloc_buf_with_magic(unsigned int a1, uint64_t *a2);
__int64 __fastcall parse_load_command_entry(__int64 *a1, int a2, size_t __n, uint64_t *__src);
__int64 __fastcall copy_buf_struct_to_heap(__int64 a1, uint64_t *a2, uint32_t *a3);
__int64 __fastcall free_and_null_ptr(void **a1);
__int64 __fastcall fd_make_pipe(int a1[2]);
__int64 __fastcall fd_read_test(int *fd);
__int64 __fastcall setup_two_fds(int *a1);
__int64 __fastcall setup_fd(int a1);
__int64 __fastcall fd_write(__int64 a1, const void *a2, size_t a3);
__int64 __fastcall fd_read(int *a1, void *a2, size_t a3);
int *__fastcall sptm_ulock_write_trampoline(__int64 a1);
int *__fastcall mkdir_factory_mount(int *a1);
int *__fastcall mmap_with_ctx_params(__int64 a1);
__int64 __fastcall krw_dispatch_call_6args(struct_krwCtx *krwCtx, int a2, __int64 a3, __int64 a4, int a5, __int64 a6);
int *__fastcall unlink_and_close_fd(int *a1);
__int64 __fastcall krw_dispatch_call_1arg(struct_krwCtx *krwCtx, int a2);
__int64 __fastcall krw_dispatch_call_3args(struct_krwCtx *krwCtx, __int64 a2, int a3, __int64 a4);
__int64 __fastcall create_temp_file_in_factory_mount(__int64 a1);
__int64 __fastcall get_mount_point_via_dispatch(struct_krwCtx *krwCtx);
__int64 __fastcall check_factory_mount_hfs(struct statfs *a1);
__int64 __fastcall driver_cmd_setup_untethered_persistence_maybe(struct_krwCtx *krwCtx, int a2);
__int64 __fastcall get_root_mount_info(struct_krwCtx *krwCtx, uint32_t *a2, char *a3);
__int64 __fastcall physmap_check_range_wrapper(struct_krwCtx *krwCtx, __int64 a2, int a3);
int *__fastcall unmount_path_retry(__int64 a1);
int *__fastcall stat_path_or_notfound(__int64 a1);
const CFDictionaryRef *__fastcall iokit_connect_call_struct_method(const CFDictionaryRef *result);
__int64 __fastcall ioregistry_iter_read_cf_props(__int64 a1, io_iterator_t iterator);
__int64 __fastcall append_to_dynamic_buf(struct_krwCtx *krwCtx, __int64 *a2, __int64 a3);
__int64 __fastcall write_loop_to_fd_from_ctx(__int64 a1, int a2, char a3);
__int64 __fastcall append_buf_and_get_pid(struct_krwCtx *krwCtx, __int64 a2, __int64 a3, int *a4);
__int64 __fastcall append_buf_and_wait_port(struct_krwCtx *krwCtx, __int64 a2, __int64 a3, int *a4);
__int64 __fastcall read_two_consecutive_port_slots(struct_krwCtx *krwCtx, __int64 a2, __int64 a3, unsigned __int64 *a4);
__int64 __fastcall check_iogpu_krw_ready_4(struct_krwCtx *krwCtx, __int64 a2, unsigned __int64 a3, int a4, unsigned __int64 *a5);
__int64 __fastcall iokit_slot_alloc_pgtable_lookup(struct_krwCtx *krwCtx, __int64 a2, __int16 a3, __int64 a4);
__int64 __fastcall check_iogpu_krw_ready_type2(struct_krwCtx *krwCtx, __int64 a2, unsigned __int64 a3, unsigned __int64 *a4);
__int64 __fastcall fileport_kobj_vm_attr_check(struct_krwCtx *krwCtx, int w1_0);
uint64_t __fastcall update_timer_lru_cache(struct_krwCtx *krwCtx);
unsigned __int64 __fastcall krw_lookup_and_process_entry(struct_krwCtx *krwCtx);
__n128 __fastcall pgtable_walk_full(struct_krwCtx *krwCtx, unsigned __int64 a2, __int64 a3, __int64 a4);
int __fastcall pgtable_walk_wrapper(struct_krwCtx *krwCtx, unsigned __int64 a2, void *a3);
unsigned __int64 __fastcall kaddr_to_phys_v1(struct_krwCtx *krwCtx, unsigned __int64 a2);
unsigned __int64 __fastcall kaddr_to_phys_v2(struct_krwCtx *krwCtx, unsigned __int64 a2, __int64 a3);
__int64 __fastcall free_entry_struct(int a1, uint64_t *a2);
__int64 __fastcall validate_physmap_range_5(struct_krwCtx *krwCtx, vm_size_t **a2);
bool __fastcall compare_krw_chunk_data(int a1, __int64 a2, void *__s2, size_t __n);
size_t __fastcall lookup_and_copy_krw_chunk(struct_krwCtx *krwCtx, __int64 a2, void *a3, size_t __n);
__int64 __fastcall read_kaddr_via_chunk_offset(struct_krwCtx *krwCtx, __int64 a2);
bool __fastcall physmap_entry_check(struct_krwCtx *krwCtx, unsigned int a2, int a3, __int64 a4);
bool __fastcall physmap_single_check(struct_krwCtx *krwCtx, __int64 a2, int a3);
__int64 __fastcall memcmp20(__int64, __int64);
__int64 __fastcall krw_lookup_via_ctx_field32(struct_krwCtx *krwCtx, unsigned int a2);
unsigned __int64 __fastcall get_task_kobject_addr_from_field32(struct_krwCtx *krwCtx, unsigned int a2);
__int64 __fastcall get_iodevicetree_chosen_data(char **a1, unsigned int a2);
__int64 check_necp_kread_available();
__int64 __fastcall open_and_kread_ptr_data(const char *a1, uint64_t *a2, unsigned int *a3);
bool __fastcall getattrlist_check_file(const char *a1);
__int64 __fastcall check_and_copy_file_paths(const char *a1, const char *a2, char a3);
__int64 __fastcall enumerate_file_paths(const char *a1, const char *a2);
bool __fastcall check_root_fs_mounted(bool *a1);
__int64 __fastcall nullsub_2(uint64_t); // weak
__int64 __fastcall dmaFail_physwrite32(struct_krwCtx *krwCtx, __int64 a2, int a3);
__int64 __fastcall dmaFail_set_power_state(struct_krwCtx *krwCtx, int a2);
__int64 __fastcall dmaFail_gfx_power_init(struct_krwCtx *krwCtx);
bool __fastcall dmaFail_map_dbgwrap(struct_krwCtx *krwCtx, __int64 a2, __int128 *a3);
__int64 __fastcall dmaFail_phystokv_cached(struct_krwCtx *krwCtx, __int64 a2);
__int64 __fastcall dmaFail_dbgwrap_halt_cpu(struct_krwCtx *krwCtx, __int64 a2);
uint32_t __fastcall dmaFail_dbgwrap_unhalt_cpu(struct_krwCtx *krwCtx, __int64 a2);
__int64 __fastcall kwrite_sandbox_entry(struct_krwCtx *krwCtx, __int64 a2);
__int64 __fastcall read_kernel_data_buf(struct_krwCtx *krwCtx, uint64_t *a2, uint32_t *a3, uint64_t *a4, uint32_t *a5, int a6);
mach_vm_address_t __fastcall setup_sandbox_bypass(struct_krwCtx *krwCtx, char a2);
__int64 __fastcall run_callback_with_physmap_write(struct_krwCtx *krwCtx, void (__fastcall *a2)(__int64), __int64 a3);
__int64 __fastcall check_sandboxed(int a1);
__int64 __fastcall another_sandbox_check(__int64 a1);
unsigned __int64 __fastcall find_appleevent_kaddr(struct_krwCtx *krwCtx);
void *__fastcall parse_necp_opt_struct(struct_krwCtx *krwCtx, __int16 *a2, __int64 a3);
__int64 __fastcall mark_necp_option_visited(__int64 a1, __int64 a2, __int64 a3, __int64 a4, unsigned int a5, unsigned int *a6);
__int64 __fastcall get_kext_base_addr(struct_krwCtx *krwCtx, char *__s, uint64_t *a3);
__int64 __fastcall find_macho_entry_by_name(struct_krwCtx *krwCtx, char *__s2, unsigned __int64 a3, __int64 *a4);
__int64 __fastcall find_macho_entry_by_name_wrap(struct_krwCtx *krwCtx, char *a2, unsigned __int64 a3, uint64_t *a4);
__int64 __fastcall init_krw_ctx_fields(__int64);
__int64 __fastcall free_krw_ctx_flags(__int64 a1);
double __fastcall krw_ctx_buf_append_typed_val(__int64 a1, int a2);
__int64 __fastcall buf_ensure_capacity(__int64 a1, unsigned int a2);
__int64 __fastcall krw_ctx_buf_append_entry(__int64 a1, __int64 a2, int a3);
__int64 __fastcall buf_append_data(__int64 a1, const void *a2, unsigned int a3);
__int64 __fastcall send_mach_msg_from_ctx(__int64 a1, mach_port_t a2, mach_port_t a3, mach_msg_id_t a4);
int __fastcall parse_xnu_version_string(__int64 a1);
io_service_t __fastcall ioservice_get_matching(const char *a1);
__int64 __fastcall ioservice_notification_send(unsigned int a1, __int64 a2, __int64 a3, unsigned int a4, unsigned int a5, const void *a6, int a7);
__int64 __fastcall register_ioservice_publish_notify(__int64 a1, unsigned int a2, mach_port_name_t *a3);
bool __fastcall set_thread_realtime_policy_1(thread_act_t a1, thread_policy_t policy_info);
bool __fastcall set_thread_abs_realtime(thread_act_t a1, unsigned int a2);
bool __fastcall set_thread_abs_realtime_50(thread_act_t a1);
__int64 __fastcall release_write_semaphore_lock(struct_krwCtx *krwCtx, unsigned int a2);
__int64 __fastcall acquire_write_semaphore_lock(struct_krwCtx *krwCtx, unsigned int a2, unsigned int a3);
__int64 __fastcall fd_close(int a1);
__int64 __fastcall fd_open_dev_null(int *fdOut);
__int64 __fastcall kreadbuf_via_dev_null_simple(struct_krwCtx *krwCtx, unsigned __int64 a2, void *a3, unsigned int a4, int a5);
__int64 __fastcall pipe_pair_krw(struct_krwCtx *krwCtx, unsigned __int64 a2, const void *a3, unsigned int a4, int a5);
__int64 __fastcall init_necp_option_struct(__int64 result, __int64, __int64, __int64, int);
__int64 __fastcall krw_fd_verify_roundtrip(struct_krwCtx *krwCtx, int *a2, unsigned __int64 a3);
__int64 __fastcall krw_read_thunk(struct_krwCtx *krwCtx, __int64 vaddr, __int64 size, void *outBuf);
bool __fastcall krw_ctx_has_read_caps(struct_krwCtx *krwCtx);
__int64 __fastcall setup_krw_engine(struct_krwCtx *krwCtx);
__int64 __fastcall teardown_krw_thread(struct_krwCtx *krwCtx);
__int64 __fastcall get_page_size_for_kaddr(struct_krwCtx *krwCtx);
bool __fastcall has_valid_krw_path(struct_krwCtx *krwCtx);
__int64 __fastcall kreadbuf_via_dev_null_only(struct_krwCtx *krwCtx, unsigned __int64 a2, __int64 a3, unsigned int a4, int a5);
__int64 __fastcall necp_semaphore_kread(struct_krwCtx *krwCtx, __int64 a2, char *a3, mach_msg_type_number_t a4);
__int64 __fastcall necp_fd_verify_roundtrip(struct_krwCtx *krwCtx, __int64 a2);
__int64 __fastcall pipe_krw_roundtrip_verify(struct_krwCtx *krwCtx);
__int64 __fastcall necp_ioconnect_krw(struct_krwCtx *krwCtx, unsigned __int64 a2, __int64 a3, unsigned int a4, int a5);
__int64 __fastcall teardown_semaphore_helper_ctx(struct_krwCtx *krwCtx, int a2);
__int64 __fastcall setup_iosurface_semaphore_helper(struct_krwCtx *krwCtx);
__int64 __fastcall kreadbuf_via_IOConnectCallMethod(struct_krwCtx *krwCtx, unsigned __int64 a2, __int64 a3, unsigned int a4, int a5);
__int64 __fastcall ioconnect_callmethod_write(struct_krwCtx *krwCtx, unsigned __int64 a2, __int64 a3, unsigned int a4, int a5);
__int64 __fastcall physmap_maybe(struct_krwCtx *krwCtx, vm_address_t *address, vm_size_t size, __int64 paddr);
__int64 __fastcall cleanup_ioconnect_resources(__int64 a1);
__int64 __fastcall setup_physmap_krw(struct_krwCtx *krwCtx, char a2);
__int64 __fastcall krw_read_validation(struct_krwCtx *krwCtx, char a2);
__int64 __fastcall map_physpage_with_mem_entry(struct_krwCtx *krwCtx, vm_address_t *a2, vm_size_t a3, __int64 a4);
__int64 __fastcall join_destroy_krw_thread(__int64 a1);
__int64 __fastcall iosurface_check_and_alloc_port(struct_krwCtx *krwCtx);
__int64 __fastcall iosurface_call_struct_method_1(struct_krwCtx *krwCtx, mach_port_t *a2);
__int64 __fastcall find_map_iosurface_memory(struct_krwCtx *krwCtx);
bool __fastcall kread_physmap_decorated(struct_krwCtx *krwCtx, unsigned __int64 vaddr, unsigned __int64 *out);
bool __fastcall kwrite_physmap_with_a3_ptr(struct_krwCtx *krwCtx, unsigned __int64 a2, __int64 a3);
__int64 __fastcall krw_write_validation(struct_krwCtx *krwCtx);
unsigned __int64 __fastcall find_sptm_pgtable_state_block(struct_krwCtx *krwCtx, unsigned __int64 a2, __int64 a3);
__int64 __fastcall teardown_sptm_pgtable_state(struct_krwCtx *krwCtx);
bool __fastcall noppl_kwrite32(struct_krwCtx *krwCtx, mach_vm_address_t address, int a3);
__int64 __fastcall iosurface_physmap_kwrite(struct_krwCtx *krwCtx, unsigned __int64 a2, __int64 a3, unsigned int a4, int a5);
bool __fastcall kread_u32(struct_krwCtx *krwCtx, unsigned __int64 vaddr, void *outBuf);
__int64 __fastcall kreadbuf_via_dev_null_and_thread_state(struct_krwCtx *krwCtx, unsigned __int64 vaddr, __int64 outBuf, unsigned int size, int a5);
__int64 __fastcall kreadbuf_via_tfp0(vm_map_read_t target_task, __int64 vaddr, mach_vm_size_t size, mach_vm_size_t size2, __int64 outBuf, uint64_t *a6);
bool __fastcall kread64_internal(struct_krwCtx *krwCtx, unsigned __int64 a2, uint64_t *a3);
unsigned __int64 __fastcall maybe_sptm_translate_kaddr(struct_krwCtx *krwCtx, __int64 a2);
unsigned __int64 __fastcall krw_xpac_vaddr_2(struct_krwCtx *krwCtx, __int64 a2);
unsigned __int64 __fastcall krw_xpac_vaddr(struct_krwCtx *krwCtx, __int64 a2);
bool __fastcall kwrite64_last_arg(struct_krwCtx *krwCtx, mach_vm_address_t address, __int64 newValue, int whatIsThis);
bool __fastcall kwrite64(struct_krwCtx *krwCtx, mach_vm_address_t a2, __int64 a3);
__int64 __fastcall pgtable_walk_and_physmap_remap(struct_krwCtx *krwCtx, __int64 a2, __int64 a3);
__int64 __fastcall kwrite_with_retry(struct_krwCtx *krwCtx, __int64 address, const void *buf, mach_vm_size_t bufSize);
unsigned __int64 __fastcall port_right_index_to_kaddr(struct_krwCtx *krwCtx, unsigned int a2);
unsigned __int64 __fastcall decode_pte_to_physmap_addr(struct_krwCtx *krwCtx, unsigned __int64 a2, uint32_t *a3);
bool __fastcall kreadbuf_universal(struct_krwCtx *krwCtx, unsigned __int64 vaddr, mach_vm_size_t size, void *outBuf, __int64 a5);
bool __fastcall kreadbuf_last_0(struct_krwCtx *krwCtx, unsigned __int64 addr, mach_vm_size_t size, void *outBuf);
bool __fastcall noppl_kwritebuf(struct_krwCtx *krwCtx, unsigned __int64 a2, const void *a3, mach_vm_size_t a4, int a5);
bool __fastcall kwritebuf_last_0(struct_krwCtx *krwCtx, unsigned __int64 a2, const void *a3, mach_vm_size_t a4);
mach_vm_address_t __fastcall ppl_kwrite32(struct_krwCtx *krwCtx, mach_vm_address_t a2, int a3);
int __fastcall kwrite64_dispatch(struct_krwCtx *krwCtx, mach_vm_address_t address, __int64 newValue);
unsigned __int64 __fastcall kwritebuf_universal(struct_krwCtx *krwCtx, unsigned __int64 vaddr, const void *newBytes, mach_vm_size_t length);
__int64 __fastcall mach_vm_read_with_attr_chunks(vm_map_t target_task, mach_vm_address_t address, __int64 a3, mach_vm_size_t size, unsigned int a5);
__int64 __fastcall pgtable_write_aligned(struct_krwCtx *krwCtx);
__int64 __fastcall semaphore_timedwait_ns(__int64 a1, unsigned int a2);
__int64 vtable_trampoline_b();
__int64 __fastcall necp_socket_fileport_setup(struct_krwCtx *krwCtx);
__int64 __fastcall semaphore_wait_wrapper(semaphore_t a1);
__int64 __fastcall semaphore_mem_acquire_thread(__int64 a1);
__int64 __fastcall ulock_wait_loop(__int64 a1);
kern_return_t ioconnect_struct_method_kwrite(struct_krwCtx *krwCtx, uint64_t vaddr, uint64_t a3);
__int64 __fastcall physwrite64_maybe(struct_krwCtx *krwCtx, unsigned __int64 paddr, __int64 value_1);
__int64 __fastcall dmaFail_physwritebuf_ppl(struct_krwCtx *krwCtx, __int64 paddr, uint64_t *data, unsigned int size);
__int64 __fastcall necp_ioservice_auth_write(struct_krwCtx *krwCtx, __int64 a2);
__int64 __fastcall posix_spawn_with_sigdefault(const char **a1);
unsigned __int64 __fastcall walk_task_csblob_chain(struct_krwCtx *krwCtx, unsigned int a2, __int64 *a3, unsigned __int8 a4, unsigned __int64 *a5);
__int64 __fastcall get_csblob_offset_pair(struct_krwCtx *krwCtx, int *a2, int *a3);
__int64 __fastcall get_csblob_size_pair(struct_krwCtx *krwCtx, uint32_t *a2, uint32_t *a3);
__int64 __fastcall compute_sha_hash(int a1, const void *a2, CC_LONG a3, void *a4, uint32_t *a5);
__int64 __fastcall cfplist_compare_and_serialize(UInt8 *a1, CFIndex a2, UInt8 *a3, CFIndex a4, uint64_t *a5, uint64_t *a6, uint8_t *a7);
CFErrorRef __fastcall cfplist_from_bytes(UInt8 *bytes, CFIndex length);
bool __fastcall cfdict_compare_or_merge(const void *a1, const void *a2, uint8_t *a3);
void *__fastcall cfplist_serialize_xml(CFPropertyListRef propertyList, size_t *a2);
bool __fastcall csblob_inject_entitlement(struct_krwCtx *krwCtx, unsigned int a2, const char *a3);
__int64 __fastcall csblob_read_and_patch(struct_krwCtx *krwCtx, unsigned int a2, __int64 a3);
struct csblob_walk_ctx;
unsigned int *__fastcall csblob_find_entry(struct csblob_walk_ctx *ctx, int slot, int magic);
__int64 __fastcall csblob_replace_entry(struct csblob_walk_ctx *ctx, int slot, unsigned int *replacement);
__int64 __fastcall csblob_apply_with_physmap_write(struct_krwCtx *krwCtx, __int64 a2);
void __fastcall csblob_free_entry(struct csblob_walk_ctx *ctx);
__int64 __fastcall krw_inject_entitlements2_maybe(struct_krwCtx *krwCtx, __int64 task, char *entitlementXml, char a4);
__int64 __fastcall ce_context_cfdata_transform(const UInt8 *a1, CFIndex a2, char *a3, uint64_t *a4, size_t *a5, uint8_t *a6);
__int64 __fastcall kread_task_slot_and_necp_set(struct_krwCtx *krwCtx, __int64 a2, unsigned int a3, bool *a4);
uint32_t *__fastcall csblob_set_entry_data(struct csblob_walk_ctx *ctx, int slot, unsigned int magic, const void *data, unsigned int size);
__int64 __fastcall csblob_zero_entry_region(struct csblob_walk_ctx *ctx, unsigned int slot, int magic);
bool __fastcall ce_serialize_cfplist(const UInt8 *a1, CFIndex a2, __int64 a3);
uint32_t *__fastcall csblob_alloc_and_insert_entry(struct csblob_walk_ctx *ctx, int slot, unsigned int magic, const void *data, unsigned int size);
unsigned int *__fastcall csblob_repack_entries(struct csblob_walk_ctx *ctx, unsigned int minSlotCount);
__int64 __fastcall validate_physmap_range_6(struct_krwCtx *krwCtx, unsigned int a2);
__int64 __fastcall physmap_pgtable_check_and_append(struct_krwCtx *krwCtx, unsigned int a2);
mach_vm_address_t __fastcall kread_and_set_vm_attr(struct_krwCtx *krwCtx, unsigned int a2);
mach_vm_address_t __fastcall pgtable_kread_vm_attr_loop(struct_krwCtx *krwCtx, unsigned int a2, int a3);
mach_vm_address_t __fastcall setup_pgtable_and_patch_csblob(struct_krwCtx *krwCtx, unsigned int a2);
__int64 __fastcall csblob_set_cs_flags(struct_krwCtx *krwCtx, __int64 a2);
__int64 __fastcall walk_proc_and_get_csblob_addr(struct_krwCtx *krwCtx, unsigned int a2, unsigned __int64 *a3);
__int64 __fastcall csblob_chain_walk_offsets(struct_krwCtx *krwCtx, unsigned int a2, __int64 *a3, unsigned __int8 a4, __int64 a5);
__int64 __fastcall krw_read_with_version_check(struct_krwCtx *krwCtx, unsigned int a2, unsigned __int64 a3, bool *a4);
__int64 __fastcall kwrite_with_version_check(struct_krwCtx *krwCtx, unsigned int a2, unsigned __int64 a3, int a4);
__int64 __fastcall setup_physmap_and_wire_region(struct_krwCtx *krwCtx, unsigned int a2, unsigned __int64 a3, mach_vm_size_t a4, vm_prot_t a5, int a6, int a7);
bool __fastcall csblob_modify_entitlement_bits(struct_krwCtx *krwCtx, unsigned int a2, int a3, int a4);
__int64 __fastcall check_csblob_patchable(struct_krwCtx *krwCtx, unsigned int a2);
unsigned __int64 __fastcall patch_csblob_in_all_procs(struct_krwCtx *krwCtx, unsigned int a2, __int64 a3);
__int64 __fastcall walk_csblob_chain_for_offset(struct_krwCtx *krwCtx, int a2);
unsigned __int64 __fastcall proc_kread_and_patch_slot(struct_krwCtx *krwCtx, unsigned int a2, __int64 a3);
__int64 __fastcall csblob_find_slot_by_pair(struct csblob_walk_ctx *ctx, int slot, int magic);
void *__fastcall csblob_dup_entry(unsigned int *a1);
void __fastcall csblob_bzero_and_free(uint32_t *a1);
struct csblob_proc_patch_dispatch_args;
void __fastcall csblob_proc_patch_dispatch(struct csblob_proc_patch_dispatch_args *args);
uint32_t *__fastcall csblob_alloc_and_fill_slots(__int64 a1, uint64_t *a2, size_t *a3, unsigned int *a4, unsigned int *a5, unsigned int *a6);
__int64 __fastcall wire_proc_page_via_kobject(struct_krwCtx *krwCtx, __int64 a2, mach_vm_address_t *a3, uint64_t *a4, int *a5);
__int64 __fastcall csblob_compute_and_copy_hash(struct csblob_walk_ctx *ctx, void *outHash);
__int64 __fastcall physmap_kwrite_chain_entry(struct_krwCtx *krwCtx, unsigned __int64 a2, unsigned int a3, const void *a4, mach_vm_size_t a5);
__int64 __fastcall get_version_specific_offset(struct_krwCtx *krwCtx);
__int64 __fastcall get_dyld_slide_info(struct_krwCtx *krwCtx);
__int64 __fastcall spinlock_acquire_clear_bit(__int64 a1);
__int64 __fastcall dyld_fcntl59_mmap_setup(struct_krwCtx *krwCtx, int *a2);
__int64 __fastcall scan_iosurface_slot_realtime(__int64 a1);
uint64_t *__fastcall alloc_physmap_page_aligned(struct_krwCtx *krwCtx, unsigned int *a2);
void __fastcall csblob_free_array(unsigned int *a1);
__int64 __fastcall csblob_realloc_array(unsigned int *a1, int a2, __int64 a3);
uint64_t *csblob_alloc_container();
__int64 __fastcall pread_loop(int __fd, __int64 a2, unsigned __int64 a3, __int64 a4);
__int64 __fastcall ipc_port_kobject_field_offset(struct_krwCtx *krwCtx, __int64 ipc_port);
unsigned __int64 __fastcall maybe_ipc_port_get_kobject(struct_krwCtx *krwCtx, unsigned __int64 ipc_port_kaddr);
__int64 __fastcall get_task_struct_offset(struct_krwCtx *krwCtx, __int64 a2);
__int64 __fastcall get_ipc_port_offset_by_version(struct_krwCtx *krwCtx, __int64 a2);
__int64 __fastcall get_privileged_host_port(struct_krwCtx *krwCtx);
__int64 __fastcall get_task_struct_cached_offset(struct_krwCtx *krwCtx);
unsigned __int64 __fastcall get_task_kobject_addr(struct_krwCtx *krwCtx, mach_port_t a2);
unsigned __int64 __fastcall lookup_or_resolve_kaddr(struct_krwCtx *krwCtx);
unsigned __int64 __fastcall task_self_get_ipc_port(struct_krwCtx *krwCtx, mach_port_t port);
__int64 __fastcall kreadptr(struct_krwCtx *krwCtx, __int64 addr);
__int64 __fastcall get_task_pid_offset(struct_krwCtx *krwCtx);
__int64 __fastcall task_proc_struct_field_offset(struct_krwCtx *krwCtx);
__int64 __fastcall get_ptrauth_data_ptr_offset(struct_krwCtx *krwCtx);
__int64 __fastcall get_context_version_offset_40(struct_krwCtx *krwCtx);
__int64 __fastcall get_context_version_offset_112(struct_krwCtx *krwCtx);
__int64 __fastcall get_version_adjusted_offset(struct_krwCtx *krwCtx);
unsigned __int64 __fastcall get_ptrauth_base_offset(struct_krwCtx *krwCtx, unsigned int a2);
__int64 __fastcall read_kaddr_at_task_offset(struct_krwCtx *krwCtx, __int64 a2);
__int64 __fastcall get_task_context_size(struct_krwCtx *krwCtx);
__int64 __fastcall krw_task_for_pid_0(struct_krwCtx *krwCtx, __int64 a2, int pid);
__int64 __fastcall krw_task_for_pid_or_name_ret_x0(struct_krwCtx *krwCtx, __int64 a2, int pid, const char *a4);
__int64 __fastcall krw_task_for_name(struct_krwCtx *krwCtx, __int64 a2, const char *a3);
__int64 __fastcall read_pte_entry_chain(struct_krwCtx *krwCtx, __int64 a2, uint32_t *a3, uint32_t *a4);
__int64 __fastcall setup_task_port_chain(struct_krwCtx *krwCtx, mach_port_name_t task, uint32_t *a3, uint32_t *a4);
__int64 __fastcall task_get_ipc_port_ptr(struct_krwCtx *krwCtx, mach_port_name_t task, mach_port_t port);
__int64 __fastcall task_self_get_ipc_port_ptr(struct_krwCtx *krwCtx, unsigned int a2);
unsigned __int64 __fastcall task_get_ipc_port(struct_krwCtx *krwCtx, mach_port_name_t task, mach_port_t port);
__int64 __fastcall walk_kaddr_chain_to_target(struct_krwCtx *krwCtx, __int64 a2, char a3);
__int64 __fastcall traverse_sptm_pgtable_chain(struct_krwCtx *krwCtx, unsigned int a2, unsigned __int64 a3);
unsigned __int64 __fastcall find_kernel_struct_addr(struct_krwCtx *krwCtx, unsigned int a2);
unsigned __int64 __fastcall scan_and_validate_kaddr(struct_krwCtx *krwCtx, unsigned int port, unsigned __int64 a3, unsigned __int64 *a4);
unsigned __int64 __fastcall kread_task_struct(struct_krwCtx *krwCtx, unsigned int a2);
__int64 __fastcall walk_task_kaddr_chain(struct_krwCtx *krwCtx, __int64 a2);
unsigned __int64 __fastcall get_task_kobj_and_walk_chain(struct_krwCtx *krwCtx, mach_port_t a2);
unsigned __int64 __fastcall resolve_task_kobj_kaddr(struct_krwCtx *krwCtx, __int64 a2, uint64_t *a3);
__int64 __fastcall get_kobj_and_resolve_kaddr(struct_krwCtx *krwCtx, unsigned int a2, uint64_t *a3);
unsigned __int64 __fastcall get_task_kobj_kaddr_with_flags(struct_krwCtx *krwCtx, unsigned int a2);
unsigned __int64 __fastcall get_task_kobj_dispatch(struct_krwCtx *krwCtx, unsigned int a2);
unsigned __int64 __fastcall get_task_kobj_via_physmap(struct_krwCtx *krwCtx, unsigned int a2);
__int64 __fastcall thread_port_field_offset(struct_krwCtx *krwCtx);
__int64 __fastcall get_task_kobj_with_offset(struct_krwCtx *krwCtx, unsigned int a2);
unsigned __int64 __fastcall get_task_csflags_kaddr(struct_krwCtx *krwCtx, unsigned int a2);
__int64 __fastcall kread_physmap_two_hops(struct_krwCtx *krwCtx, unsigned int a2);
__int64 __fastcall get_task_struct_csblob_offset(struct_krwCtx *krwCtx);
__int64 __fastcall get_task_struct_small_offset(struct_krwCtx *krwCtx);
__int64 __fastcall walk_task_context_to_kobj(struct_krwCtx *krwCtx, __int64 a2);
unsigned __int64 __fastcall task_struct_field_kread(struct_krwCtx *krwCtx, unsigned int a2);
__int64 __fastcall kread_task_port_entry(struct_krwCtx *krwCtx, __int64 a2);
__int64 __fastcall necp_set_opt_string_6(struct_krwCtx *krwCtx, unsigned int a2);
unsigned __int64 __fastcall get_task_port_kaddr(struct_krwCtx *krwCtx, unsigned int a2, int a3);
unsigned __int64 __fastcall get_task_port_kaddr_checked(struct_krwCtx *krwCtx, unsigned int a2, int a3, unsigned int *a4);
unsigned __int64 __fastcall get_task_port_kaddr_wrap(struct_krwCtx *krwCtx, unsigned int a2, unsigned int *a3);
__int64 __fastcall find_proc_kobj_via_processors(struct_krwCtx *krwCtx, int a2, __int64 a3, unsigned int *a4);
__int64 __fastcall get_task_port_offset(struct_krwCtx *krwCtx);
__int64 __fastcall get_task_version_field(struct_krwCtx *krwCtx, __int64 a2);
unsigned __int64 __fastcall get_mach_task_port_slot(struct_krwCtx *krwCtx, unsigned int a2);
__int64 __fastcall kread_mach_task_port_slot(struct_krwCtx *krwCtx, unsigned int a2);
__int64 __fastcall kread_mach_task_port_slot_plus80(struct_krwCtx *krwCtx, unsigned int a2);
unsigned __int64 __fastcall get_ipc_port_kaddr_via_host(struct_krwCtx *krwCtx, int a2);
__int64 __fastcall get_task_bsd_info_kaddr(struct_krwCtx *krwCtx, unsigned int a2, __int64 *a3);
__int64 __fastcall get_port_set_kaddr(struct_krwCtx *krwCtx, int a2, __int64 *a3);
__int64 __fastcall validate_port_set_chain(struct_krwCtx *krwCtx, int a2, __int64 *a3);
unsigned __int64 __fastcall kernel_va_base_resolver(struct_krwCtx *krwCtx, int a2, uint32_t *a3);
int __fastcall necp_set_opt_string_7(struct_krwCtx *krwCtx, unsigned int a2, __int64 a3);
mach_vm_address_t __fastcall ipc_port_kread_and_vm_attr(struct_krwCtx *krwCtx, __int64 a2, int a3);
__int64 __fastcall kread_modify_u32_with_delta(struct_krwCtx *krwCtx, __int64 a2, int a3);
__int64 __fastcall kread_and_vm_attr_double(struct_krwCtx *krwCtx, __int64 a2);
__int64 __fastcall vm_attr_increment_offset_bounded(struct_krwCtx *krwCtx, unsigned __int64 a2, int a3);
__int64 __fastcall vm_attr_increment_offset_check(struct_krwCtx *krwCtx, unsigned __int64 a2);
__int64 __fastcall vm_attr_field_offset_add4_check(struct_krwCtx *krwCtx, __int64 a2);
struct_krwCtx *__fastcall krw_ctx_set_flag(struct_krwCtx *result, int);
struct_krwCtx *__fastcall krw_ctx_clr_flag(struct_krwCtx *result, int);
bool __fastcall krw_ctx_has_flag(struct_krwCtx *krwCtx, int flag);
__int64 __fastcall get_task_struct_offset_cached(struct_krwCtx *krwCtx);
__int64 __fastcall lookup_physmap_page_slot(struct_krwCtx *krwCtx, unsigned int a2, __int64 *a3);
__int64 __fastcall cache_physmap_page_slot(struct_krwCtx *krwCtx, unsigned int a2, __int64 a3);
bool __fastcall voucher_create_mach_voucher(__int64 a1, __int64 a2, ipc_voucher_t *voucherOut);
__int64 __fastcall create_mach_port_with_a2(struct_krwCtx *krwCtx, unsigned int a2);
__int64 __fastcall create_mach_port(int a1);
__int64 __fastcall validate_physmap_range_7(__int64 a1, unsigned int a2);
uint32_t __fastcall plist_elem_is_string_6(struct_krwCtx *krwCtx, unsigned __int64 a2, mach_port_name_t *a3);
uint64_t *__fastcall build_csblob_buf_from_load_cmds(struct_krwCtx *krwCtx, unsigned int a2);
__int64 __fastcall map_shared_mem_and_transfer_data(struct_krwCtx *krwCtx, __int64 a2, __int64 size);
unsigned __int64 __fastcall alloc_physmap_page(struct_krwCtx *krwCtx, unsigned int *a2);
unsigned __int64 __fastcall alloc_physmap_scratch_page(struct_krwCtx *krwCtx, uint32_t *a2);
__int64 __fastcall kwrite_task_kobj_field_via_physmap(struct_krwCtx *krwCtx, unsigned int a2, int a3, int a4, __int16 a5);
__int64 __fastcall check_krw_capabilities_version(int *, int *, int *, int *, int *);
__int64 __fastcall get_proc_kobj_pair_cached(struct_krwCtx *krwCtx, int a2, uint64_t *a3);
__int64 __fastcall port_table_lookup_v1(struct_krwCtx *krwCtx, __int64 a2, int a3, int a4, __int16 a5);
__int64 __fastcall map_physpage_with_ports(struct_krwCtx *krwCtx, __int64 a2, int a3, int a4, __int16 a5);
unsigned __int64 __fastcall translate_physmap_addr_via_segments(struct_krwCtx *krwCtx, __int64 a2, __int64 a3, unsigned __int64 a4);
__int64 __fastcall init_or_get_kread_pattern_table(struct_krwCtx *krwCtx);
unsigned __int64 __fastcall map_physpage_to_user(struct_krwCtx *krwCtx, __int64 a2, __int64 a3, unsigned __int64 a4);
__int64 __fastcall map_physpage_for_kobj(struct_krwCtx *krwCtx, unsigned __int64 a2);
__int64 __fastcall resolve_physpage_addr(struct_krwCtx *krwCtx, unsigned __int64 a2);
__int64 __fastcall iterate_active_threads(struct_krwCtx *krwCtx);
uint32_t __fastcall physmap_map_cached(struct_krwCtx *krwCtx, unsigned __int64 paddr, __int64 a3);
__int64 __fastcall physmap_unmap_cached(struct_krwCtx *krwCtx, __int64 a2);
__int64 __fastcall append_kaddr_to_physmem_table(struct_krwCtx *krwCtx, __int64 a2, __int64 a3);
__int64 __fastcall read_via_mapped_physmem_region(struct_krwCtx *krwCtx, unsigned __int64 a2, void *a3, unsigned int a4, int a5);
__int64 __fastcall physwritebuf_direct_mapped(struct_krwCtx *krwCtx, unsigned __int64 paddr, const void *buf, unsigned int size, int something);
__int64 __fastcall check_krw_read_thunk_ok(struct_krwCtx *krwCtx, __int64 a2, __int64 a3);
__int64 __fastcall kwrite_u16_at_plus8(struct_krwCtx *krwCtx, __int64 a2, __int16 a3);
__int64 __fastcall u16_add10_clamped(unsigned int);
__int64 __fastcall kread_and_kwrite_u16_plus8_bumped(struct_krwCtx *krwCtx, __int64 a2);
uint64_t __fastcall remap_kaddr_through_physmap(struct_krwCtx *krwCtx, __int64 a2);
__int64 __fastcall task_thread_port_cred_patch(__int64 x0_0);
unsigned __int64 __fastcall kernel_get_base_slid(struct_krwCtx *krwCtx, unsigned __int64 optional_vtable_func);
__int64 __fastcall init_pgtable_walk_ctx(struct_krwCtx *krwCtx, unsigned __int64 a2);
unsigned __int64 __fastcall init_kread_pattern_addrs(uint64_t *a1);
void __usercall resolve_kernel_text_range(SearchObj *x8_0, struct_krwCtx *a2);
__int64 __fastcall check_task_dyld_info_versioned(struct_krwCtx *krwCtx, task_name_t target_task, int a3, const void *a4, mach_vm_size_t a5);
__int64 __fastcall create_pthread_something(struct_krwCtx *krwCtx, pthread_t *a2, __int64 a3, void *a4);
bool __fastcall kwrite_task_dispatch_via_kobj(struct_krwCtx *someCtx, unsigned int a2, unsigned int a3);
bool __fastcall pthread_create_and_join(struct_krwCtx *krwCtx, __int64 a2, void *a3);
__int64 __fastcall get_or_set_uid_cred_in_task(struct_krwCtx *krwCtx, int a2, int a3, int a4);
bool __fastcall kread_u32_modify_lo10_kwrite(struct_krwCtx *krwCtx, unsigned __int64 a2, int a3, int *a4);
__int64 __fastcall insert_task_port_send_right_versioned(struct_krwCtx *krwCtx, task_name_t a2);
unsigned __int64 __fastcall get_kernel_task_host_port(struct_krwCtx *krwCtx);
unsigned __int64 __fastcall get_ioservice_conn_port(struct_krwCtx *krwCtx);
__int64 __fastcall kread_proc_kobj_entitlement_data(struct_krwCtx *krwCtx, unsigned int a2);
int __fastcall necp_send_msg_3(struct_krwCtx *krwCtx, unsigned int a2, int a3);
__int64 __fastcall get_task_port_pid_field_offset(struct_krwCtx *krwCtx, unsigned int a2);
bool __fastcall kread_proc_kobj_entitlement_full(struct_krwCtx *krwCtx, unsigned int a2, int a3, int a4, int a5);
mach_vm_address_t __fastcall set_proc_flag_bit7_kwrite(struct_krwCtx *krwCtx, unsigned int a2, int a3);
unsigned __int64 __fastcall get_proc_kobj_exec_flags(struct_krwCtx *krwCtx, unsigned int a2, bool *a3, bool *a4, bool *a5);
int set_task_special_port_and_patch_uid(struct_krwCtx *krwCtx, task_inspect_t task, mach_port_t a3);
bool __fastcall krw_task_for_pid(struct_krwCtx *krwCtx, int a2, mach_port_name_t *a3);
bool __fastcall krw_task_for_pid_or_name_ret_ptr(struct_krwCtx *krwCtx, int victim_pid, const char *victim_process_name, mach_port_name_t *out_task);
bool __fastcall set_thread_state_versioned(struct_krwCtx *krwCtx, int a2, thread_act_t a3, thread_state_flavor_t a4, natural_t *a5, mach_msg_type_number_t a6);
__int64 __fastcall thread_set_state_with_kobj_offset(struct_krwCtx *krwCtx, thread_act_t target_act, thread_state_flavor_t flavor, thread_state_t new_state, mach_msg_type_number_t new_stateCnt);
unsigned __int64 __fastcall find_kernel_base_ptr(struct_krwCtx *krwCtx);
__int64 __fastcall refresh_target_task_port(struct_krwCtx *krwCtx, unsigned int a2, int a3, uint8_t *a4);
__int64 __fastcall physmap_kread(struct_krwCtx *krwCtx, unsigned int a2);
__int64 __fastcall driver_init2_1(struct_krwCtx *krwCtx, int something);
bool __fastcall validate_ipc_kobject_read(struct_krwCtx *krwCtx, mach_port_t a2);
__int64 __fastcall driver_init2(struct_krwCtx **krwCtxOut, char something);
__int64 __fastcall free_decompressed_macho(uint64_t *a1);
__int64 __fastcall driver_dispatch_command2(
        struct_krwCtx *krwCtx,
        int cmd,
        __int64 cmdMirror,
        __int64 arg0,
        __int64 arg1,
        __int64 arg2,
        __int64 arg3,
        __int64 arg4,
        __int64 inoutValue);
__int64 __fastcall driver_dispatch_command3(struct_krwCtx *krwCtx, int cmd, __int64 inoutValue);
__int64 __fastcall reinit_and_refresh_krw_ctx(struct_krwCtx *krwCtx);
__int64 __fastcall driver_close_internal(struct_krwCtx *krwCtx);
__int64 __fastcall task_kobject_update_flag_bits(struct_krwCtx *krwCtx, unsigned int a2, int a3, int a4);
bool __fastcall check_krw_necp_state(struct_krwCtx *krwCtx, bool *a2);
bool __fastcall check_dispatch_krw_state(struct_krwCtx *krwCtx, int a2);
bool __fastcall find_kernel_text_exec_section(struct_krwCtx *krwCtx, __int64 *a2, __int64 *a3);
int __fastcall update_physmap_table_entry_count(struct_krwCtx *krwCtx, task_inspect_t a2, host_t *a3);
uint64_t *__fastcall alloc_kobj_snapshot_buf(__int64 a1, __int64 a2);
__int64 __fastcall read_u32_from_kobj_snapshot(__int64, uint64_t *, __int64);
unsigned __int64 __fastcall kobj_snapshot_lookup_wrapper(uint64_t **a1, __int64 a2, __int64 a3, unsigned int a4);
unsigned __int64 __fastcall kobj_snapshot_pattern_search(__int64, uint64_t *, __int64, __int64, unsigned int);
unsigned __int64 __fastcall kobj_snapshot_pattern_search_via_ctx(__int64 a1, __int64 a2, __int64 a3, unsigned int a4);
uint64_t *__fastcall find_section_in_macho_snapshot(__int64 a1, const char *a2);
__int64 __fastcall init_text_exec_data_const_sections(uint64_t *a1);
__int64 __fastcall compute_optimal_kobj_stride(__int64 result, __int64);
__int64 __fastcall compute_kobj_scan_halfstride(struct_krwCtx *krwCtx);
__int64 __fastcall get_voucher_attr_recipe_versioned(struct_krwCtx *krwCtx, __int128 *a2, uint32_t *a3);
__int64 __fastcall voucher_attr_recipe_scan(struct_krwCtx *krwCtx, unsigned int a2);
__int64 __fastcall find_aligned_kaddr_in_region(struct_krwCtx *, unsigned __int64, unsigned int, unsigned int);
unsigned __int64 __fastcall kernel_cstring_pattern_scan(struct_krwCtx *krwCtx, const char *a2);
__int64 __fastcall find_kfunc_ptr_in_kernel_data(struct_krwCtx *krwCtx, __int64 a2);
__int64 __fastcall scan_kernel_page_for_pattern(struct_krwCtx *krwCtx, __int64 a2, mach_vm_size_t a3, unsigned __int64 a4, __int64 (__fastcall *a5)(__int64, __int64), __int64 a6);
__int64 __fastcall resolve_kfunc_via_page_dispatch(struct_krwCtx *krwCtx, __int64 a2, unsigned int a3, __int64 *a4, __int64 (__fastcall *a5)(__int64, __int64), __int64 a6);

#include "entry1_type0x09_driver_dispatch.m"

__int64 __fastcall j__fileport_makeport(int a1, mach_port_t *a2);
int __fastcall j__fileport_makefd(mach_port_t);
__int64 __fastcall __mac_syscall(__int64 a1, __int64 a2, __int64 a3);
//__int64 __fastcall getattrlistbulk(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5);
__int64 __fastcall fs_snapshot(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6);
__int64 j___get_cpu_capabilities(void); // weak
__int64 _get_cpu_capabilities(void);
extern __int64 real_get_cpu_capabilities(void) __asm("__get_cpu_capabilities");
unsigned __int64 comm_page64_base_address();
enum
{
  COMM_PAGE_CPU_CAPABILITIES64_OFFSET = 0x10,
  COMM_PAGE_CACHE_LINESIZE_OFFSET = 0x26,
  COMM_PAGE_MEMORY_SIZE_OFFSET = 0x38,
  COMM_PAGE_CPUFAMILY_OFFSET = 0x80,
};

enum
{
  // Dopamine dmaFail.c MMIO layout:
  //   0x206040000 dbgwrap, 0x206140000 DMA control, 0x206150000 DMA address/data.
  DMAFAIL_REG_BASE = 0x206000000ULL,
  DMAFAIL_DBGWRAP_MAP_OFFSET = 0x40000ULL,
  DMAFAIL_DMA_CTRL_MAP_OFFSET = 0x140000ULL,
  DMAFAIL_DMA_DATA_MAP_OFFSET = 0x150000ULL,
  DMAFAIL_DBGWRAP_DBGHALT = 1u << 31,
  DMAFAIL_DBGWRAP_DBGACK = 1u << 28,
  DMAFAIL_DMA_CTRL_STATUS_OFFSET = 0x108,
  DMAFAIL_DMA_ENABLE_OFFSET = 0x8,
  DMAFAIL_DMA_A15_A16_BACKUP_OFFSET = 0x20,
  DMAFAIL_DMA_ADDR_OFFSET = 0x40,
  DMAFAIL_DMA_DATA_OFFSET = 0x48,
  DMAFAIL_DMA_CTRL = DMAFAIL_REG_BASE + DMAFAIL_DMA_CTRL_MAP_OFFSET + DMAFAIL_DMA_CTRL_STATUS_OFFSET,
  DMAFAIL_DMA_ENABLE = DMAFAIL_REG_BASE + DMAFAIL_DMA_CTRL_MAP_OFFSET + DMAFAIL_DMA_ENABLE_OFFSET,
  DMAFAIL_DMA_DATA = DMAFAIL_REG_BASE + DMAFAIL_DMA_DATA_MAP_OFFSET + DMAFAIL_DMA_DATA_OFFSET,
  DMAFAIL_DMA_ADDR = DMAFAIL_REG_BASE + DMAFAIL_DMA_DATA_MAP_OFFSET + DMAFAIL_DMA_ADDR_OFFSET,
  DMAFAIL_A15_A16_DMA_BACKUP = DMAFAIL_REG_BASE + DMAFAIL_DMA_DATA_MAP_OFFSET + DMAFAIL_DMA_A15_A16_BACKUP_OFFSET,
  DMAFAIL_CACHE_LINE_SIZE = 0x40,
  DMAFAIL_CACHE_LINE_MASK = DMAFAIL_CACHE_LINE_SIZE - 1,
  DMAFAIL_PHYS_PAGE_SHIFT = 14,
  DMAFAIL_PHYS_UPPER_SHIFT = 18,
  DMAFAIL_DMA_ADDR_VALID = 0x2000000,
  DMAFAIL_DMA_ADDR_TTE_LOW_MASK = 0x7FC0,
  DMAFAIL_DMA_ADDR_TTE_KEEP_BIT = 0x4000,
  DMAFAIL_DMA_TARGET_UPPER_MASK = 0x3FFFFFFFFFFFFULL,
  DMAFAIL_DMA_HASH2_SHIFT = 50,
  DMAFAIL_DMA_HASH1_INDEX_LEGACY = 40, // Dopamine gDMAIndex on A12-A14
  DMAFAIL_DMA_HASH1_INDEX_A15_A16 = 8, // Dopamine gDMAIndex on A15/A16
  DMAFAIL_DMA_REG_BASE_LEGACY = 0x206000000ULL,
  DMAFAIL_DMA_REG_BASE_ALT = 0x406000000ULL,
  DMAFAIL_DMA_MASK_A16 = 0x7FFFFFF, // Dopamine gDMAMask on A16
  DMAFAIL_DMA_MASK_ALT = 0x3FFFFFF, // Dopamine gDMAMask on A14/A15 alt path
  DMAFAIL_DMA_MASK_LEGACY = 0x3FFFFF, // Dopamine gDMAMask on A12-A14 legacy path
  DMAFAIL_DMA_CTRL_BUSY_BITS = 0x8000000000000001ULL,
  DMAFAIL_DMA_CTRL_RESTORE_MASK = 0x8000000000000000ULL,
  DMAFAIL_DMA_ENABLE_BIT = 0x1000000000000000ULL,
  DMAFAIL_DMA_A15_ADDR_HASH_MASK = 0x1F,
  DMAFAIL_DMA_A15_ADDR_HASH_SHIFT = 37,
  DMAFAIL_DMA_HASH1_A15_A16_KEEP_MASK = 0x3E0,
};
void *__memcpy_chk(void *dst, const void *src, size_t len, size_t dstlen);
void *__memset_chk(void *dst, int val, size_t len, size_t dstlen);
size_t __strlcpy_chk(char *dst, const char *src, size_t len, size_t dstlen);
extern const char ___kernelVersionString[];
int sandbox_check(pid_t pid, const char *operation, int flags, ...);
void *_os_alloc_once(void *slot, size_t size, void *init);
void *__os_alloc_once(void *slot, size_t size, void *init);
mach_port_t mach_reply_port(void);
CFDataRef IOCFSerialize(CFTypeRef object, CFOptionFlags options);
kern_return_t host_get_io_master(host_t host, io_master_t *io_master);
int uuid_is_null(const unsigned char uu[16]);
__int64 _IOServiceSetAuthorizationID(void);
__int64 __semwait_signal(void);
int __ulock_wait(unsigned int operation, void *addr, unsigned __int64 value, unsigned int timeout);
int __ulock_wake(unsigned int operation, void *addr, unsigned __int64 wake_value);
int necp_open(int flags);
int necp_client_action(int fd, uint32_t action, const void *client_id, size_t client_id_len, void *buffer, size_t buffer_size);
int proc_pidinfo(int pid, int flavor, uint64_t arg, void *buffer, int buffersize);
char *_CFProcessPath(void);
#if 0
int __cdecl CC_SHA1_Final(unsigned __int8 *md, CC_SHA1_CTX *c);
int __cdecl CC_SHA1_Init(CC_SHA1_CTX *c);
int __cdecl CC_SHA1_Update(CC_SHA1_CTX *c, const void *data, CC_LONG len);
int __cdecl CC_SHA256_Final(unsigned __int8 *md, CC_SHA256_CTX *c);
int __cdecl CC_SHA256_Init(CC_SHA256_CTX *c);
int __cdecl CC_SHA256_Update(CC_SHA256_CTX *c, const void *data, CC_LONG len);
int __cdecl CC_SHA384_Final(unsigned __int8 *md, CC_SHA512_CTX *c);
int __cdecl CC_SHA384_Init(CC_SHA512_CTX *c);
int __cdecl CC_SHA384_Update(CC_SHA512_CTX *c, const void *data, CC_LONG len);
void __cdecl CFArrayAppendValue(CFMutableArrayRef theArray, const void *value);
void __cdecl CFArrayApplyFunction(CFArrayRef theArray, CFRange range, CFArrayApplierFunction applier, void *context);
Boolean __cdecl CFArrayContainsValue(CFArrayRef theArray, CFRange range, const void *value);
CFIndex __cdecl CFArrayGetCount(CFArrayRef theArray);
CFTypeID CFArrayGetTypeID(void);
CFTypeID CFBooleanGetTypeID(void);
CFDataRef __cdecl CFDataCreate(CFAllocatorRef allocator, const UInt8 *bytes, CFIndex length);
CFDataRef __cdecl CFDataCreateWithBytesNoCopy(CFAllocatorRef allocator, const UInt8 *bytes, CFIndex length, CFAllocatorRef bytesDeallocator);
const UInt8 *__cdecl CFDataGetBytePtr(CFDataRef theData);
CFIndex __cdecl CFDataGetLength(CFDataRef theData);
CFTypeID CFDataGetTypeID(void);
void __cdecl CFDictionaryAddValue(CFMutableDictionaryRef theDict, const void *key, const void *value);
void __cdecl CFDictionaryApplyFunction(CFDictionaryRef theDict, CFDictionaryApplierFunction applier, void *context);
CFMutableDictionaryRef __cdecl CFDictionaryCreateMutable(CFAllocatorRef allocator, CFIndex capacity, const CFDictionaryKeyCallBacks *keyCallBacks, const CFDictionaryValueCallBacks *valueCallBacks);
CFMutableDictionaryRef __cdecl CFDictionaryCreateMutableCopy(CFAllocatorRef allocator, CFIndex capacity, CFDictionaryRef theDict);
CFTypeID CFDictionaryGetTypeID(void);
Boolean __cdecl CFDictionaryGetValueIfPresent(CFDictionaryRef theDict, const void *key, const void **value);
void __cdecl CFDictionarySetValue(CFMutableDictionaryRef theDict, const void *key, const void *value);
Boolean __cdecl CFEqual(CFTypeRef cf1, CFTypeRef cf2);
CFTypeID __cdecl CFGetTypeID(CFTypeRef cf);
CFNumberRef __cdecl CFNumberCreate(CFAllocatorRef allocator, CFNumberType theType, const void *valuePtr);
CFTypeID CFNumberGetTypeID(void);
Boolean __cdecl CFNumberGetValue(CFNumberRef number, CFNumberType theType, void *valuePtr);
CFDataRef __cdecl CFPropertyListCreateData(CFAllocatorRef allocator, CFPropertyListRef propertyList, CFPropertyListFormat format, CFOptionFlags options, CFErrorRef *error);
CFPropertyListRef __cdecl CFPropertyListCreateWithData(CFAllocatorRef allocator, CFDataRef data, CFOptionFlags options, CFPropertyListFormat *format, CFErrorRef *error);
CFPropertyListRef __cdecl CFPropertyListCreateWithStream(CFAllocatorRef allocator, CFReadStreamRef stream, CFIndex streamLength, CFOptionFlags options, CFPropertyListFormat *format, CFErrorRef *error);
void __cdecl CFReadStreamClose(CFReadStreamRef stream);
CFReadStreamRef __cdecl CFReadStreamCreateWithBytesNoCopy(CFAllocatorRef alloc, const UInt8 *bytes, CFIndex length, CFAllocatorRef bytesDeallocator);
Boolean __cdecl CFReadStreamOpen(CFReadStreamRef stream);
void __cdecl CFRelease(CFTypeRef cf);
void __cdecl CFRunLoopAddSource(CFRunLoopRef rl, CFRunLoopSourceRef source, CFRunLoopMode mode);
CFRunLoopRef CFRunLoopGetCurrent(void);
void __cdecl CFRunLoopRemoveSource(CFRunLoopRef rl, CFRunLoopSourceRef source, CFRunLoopMode mode);
CFRunLoopRunResult __cdecl CFRunLoopRunInMode(CFRunLoopMode mode, CFTimeInterval seconds, Boolean returnAfterSourceHandled);
CFStringRef __cdecl CFStringCreateWithCString(CFAllocatorRef alloc, const char *cStr, CFStringEncoding encoding);
Boolean __cdecl CFStringGetCString(CFStringRef theString, char *buffer, CFIndex bufferSize, CFStringEncoding encoding);
CFStringEncoding CFStringGetSystemEncoding(void);
CFTypeID CFStringGetTypeID(void);
Boolean __cdecl CFStringHasPrefix(CFStringRef theString, CFStringRef prefix);
CFDataRef __cdecl IOCFSerialize(CFTypeRef object, CFOptionFlags options);
kern_return_t __cdecl IOConnectCallMethod(mach_port_t connection, uint32_t selector, const uint64_t *input, uint32_t inputCnt, const void *inputStruct, size_t inputStructCnt, uint64_t *output, uint32_t *outputCnt, void *outputStruct, size_t *outputStructCnt);
kern_return_t __cdecl IOConnectCallScalarMethod(mach_port_t connection, uint32_t selector, const uint64_t *input, uint32_t inputCnt, uint64_t *output, uint32_t *outputCnt);
kern_return_t __cdecl IOConnectCallStructMethod(mach_port_t connection, uint32_t selector, const void *inputStruct, size_t inputStructCnt, void *outputStruct, size_t *outputStructCnt);
kern_return_t __cdecl IOConnectTrap4(io_connect_t connect, uint32_t index, uintptr_t p1, uintptr_t p2, uintptr_t p3, uintptr_t p4);
kern_return_t __cdecl IOConnectTrap6(io_connect_t connect, uint32_t index, uintptr_t p1, uintptr_t p2, uintptr_t p3, uintptr_t p4, uintptr_t p5, uintptr_t p6);
io_object_t __cdecl IOIteratorNext(io_iterator_t iterator);
IONotificationPortRef __cdecl IONotificationPortCreate(mach_port_t masterPort);
void __cdecl IONotificationPortDestroy(IONotificationPortRef notify);
CFRunLoopSourceRef __cdecl IONotificationPortGetRunLoopSource(IONotificationPortRef notify);
kern_return_t __cdecl IOObjectRelease(io_object_t object);
kern_return_t __cdecl IORegistryEntryCreateCFProperties(io_registry_entry_t entry, CFMutableDictionaryRef *properties, CFAllocatorRef allocator, IOOptionBits options);
CFTypeRef __cdecl IORegistryEntryCreateCFProperty(io_registry_entry_t entry, CFStringRef key, CFAllocatorRef allocator, IOOptionBits options);
io_registry_entry_t __cdecl IORegistryEntryFromPath(mach_port_t masterPort, const io_string_t path);
kern_return_t __cdecl IORegistryEntryGetChildIterator(io_registry_entry_t entry, const io_name_t plane, io_iterator_t *iterator);
CFTypeRef __cdecl IORegistryEntrySearchCFProperty(io_registry_entry_t entry, const io_name_t plane, CFStringRef key, CFAllocatorRef allocator, IOOptionBits options);
kern_return_t __cdecl IOServiceAddMatchingNotification(IONotificationPortRef notifyPort, const io_name_t notificationType, CFDictionaryRef matching, IOServiceMatchingCallback callback, void *refCon, io_iterator_t *notification);
kern_return_t __cdecl IOServiceClose(io_connect_t connect);
io_service_t __cdecl IOServiceGetMatchingService(mach_port_t masterPort, CFDictionaryRef matching);
CFMutableDictionaryRef __cdecl IOServiceMatching(const char *name);
kern_return_t __cdecl IOServiceOpen(io_service_t service, task_port_t owningTask, uint32_t type, io_connect_t *connect);
kern_return_t __cdecl IOServiceWaitQuiet(io_service_t service, mach_timespec_t *waitTime);
__int64 _CFProcessPath();
__int64 _IOServiceSetAuthorizationID();
int *__error(void);
void *__memcpy_chk(void *dst, const void *src, size_t len, size_t dstlen);
void *__memset_chk(void *dst, int val, size_t len, size_t dstlen);
__int64 __semwait_signal();
size_t __strlcpy_chk(char *dst, const char *src, size_t len, size_t dstlen);
int __ulock_wait(unsigned int operation, void *addr, unsigned __int64 value, unsigned int timeout);
int __ulock_wake(unsigned int operation, void *addr, unsigned __int64 wake_value);
__int64 _get_cpu_capabilities();
void *_os_alloc_once(void *slot, size_t size, void *init);
void *__os_alloc_once(void *slot, size_t size, void *init);
void __cdecl arc4random_buf(void *__buf, size_t __nbytes);
void __cdecl bzero(void *, size_t);
void *__cdecl calloc(size_t __count, size_t __size);
int __cdecl chown(const char *, uid_t, gid_t);
int __cdecl close(int);
int __cdecl connect(int, const sockaddr *, socklen_t);
int __cdecl dlclose(void *__handle);
void *__cdecl dlopen(const char *__path, int __mode);
void *__cdecl dlsym(void *__handle, const char *__symbol);
int fcntl(int, int, ...);
int __cdecl ffsctl(int, unsigned __int64, void *, unsigned int);
int fileport_makefd(mach_port_t port);
void __cdecl free(void *);
int __cdecl fstat(int, stat *);
int __cdecl getattrlist(const char *, void *, void *, size_t, unsigned int);
int __cdecl getmntinfo(struct statfs **, int);
pid_t getpid(void);
pid_t getppid(void);
uid_t getuid(void);
kern_return_t __cdecl host_create_mach_voucher(host_t host, mach_voucher_attr_raw_recipe_array_t recipes, mach_msg_type_number_t recipesCnt, ipc_voucher_t *voucher);
kern_return_t __cdecl host_get_io_master(host_t host, io_master_t *io_master);
kern_return_t __cdecl host_get_special_port(host_priv_t host_priv, int node, int which, mach_port_t *port);
kern_return_t __cdecl host_kernel_version(host_t host, kernel_version_t kernel_version);
extern const char ___kernelVersionString[];
kern_return_t __cdecl host_page_size(host_t, vm_size_t *);
kern_return_t __cdecl host_processors(host_priv_t host_priv, processor_array_t *out_processor_list, mach_msg_type_number_t *out_processor_listCnt);
kern_return_t __cdecl host_security_set_task_token(host_security_t host_security, task_t target_task, security_token_t sec_token, audit_token_t *__struct_ptr audit_token, host_t host);
int ioctl(int, unsigned __int64, ...);
int __cdecl lstat(const char *, stat *);
uint64_t mach_absolute_time(void);
mach_port_t mach_host_self(void);
kern_return_t __cdecl mach_make_memory_entry(vm_map_t target_task, vm_size_t *size, vm_offset_t offset, vm_prot_t permission, mem_entry_name_port_t *object_handle, mem_entry_name_port_t parent_entry);
kern_return_t __cdecl mach_make_memory_entry_64(vm_map_t target_task, memory_object_size_t *size, memory_object_offset_t offset, vm_prot_t permission, mach_port_t *object_handle, mem_entry_name_port_t parent_entry);
mach_msg_return_t __cdecl mach_msg(mach_msg_header_t *msg, mach_msg_option_t option, mach_msg_size_t send_size, mach_msg_size_t rcv_size, mach_port_name_t rcv_name, mach_msg_timeout_t timeout, mach_port_name_t notify);
void __cdecl mach_msg_destroy(mach_msg_header_t *);
mach_msg_return_t __cdecl mach_msg_send(mach_msg_header_t *);
kern_return_t __cdecl mach_port_allocate(ipc_space_t task, mach_port_right_t right, mach_port_name_t *name);
kern_return_t __cdecl mach_port_deallocate(ipc_space_t task, mach_port_name_t name);
kern_return_t __cdecl mach_port_destroy(ipc_space_t task, mach_port_name_t name);
kern_return_t __cdecl mach_port_get_attributes(ipc_space_read_t task, mach_port_name_t name, mach_port_flavor_t flavor, mach_port_info_t port_info_out, mach_msg_type_number_t *port_info_outCnt);
kern_return_t __cdecl mach_port_insert_right(ipc_space_t task, mach_port_name_t name, mach_port_t poly, mach_msg_type_name_t polyPoly);
kern_return_t __cdecl mach_port_mod_refs(ipc_space_t task, mach_port_name_t name, mach_port_right_t right, mach_port_delta_t delta);
kern_return_t __cdecl mach_port_request_notification(ipc_space_t task, mach_port_name_t name, mach_msg_id_t msgid, mach_port_mscount_t sync, mach_port_t notify, mach_msg_type_name_t notifyPoly, mach_port_t *previous);
kern_return_t __cdecl mach_port_set_attributes(ipc_space_t task, mach_port_name_t name, mach_port_flavor_t flavor, mach_port_info_t port_info, mach_msg_type_number_t port_infoCnt);
kern_return_t __cdecl mach_port_space_info(ipc_space_read_t space, ipc_info_space_t *space_info, ipc_info_name_array_t *table_info, mach_msg_type_number_t *table_infoCnt, ipc_info_tree_name_array_t *tree_info, mach_msg_type_number_t *tree_infoCnt);
kern_return_t __cdecl mach_ports_register(task_t target_task, mach_port_array_t init_port_set, mach_msg_type_number_t init_port_setCnt);
__int64 mach_reply_port();
mach_port_t mach_thread_self(void);
kern_return_t __cdecl mach_timebase_info(mach_timebase_info_t info);
kern_return_t __cdecl mach_vm_allocate(vm_map_t target, mach_vm_address_t *address, mach_vm_size_t size, int flags);
kern_return_t __cdecl mach_vm_deallocate(vm_map_t target, mach_vm_address_t address, mach_vm_size_t size);
kern_return_t __cdecl mach_vm_machine_attribute(vm_map_t target_task, mach_vm_address_t address, mach_vm_size_t size, vm_machine_attribute_t attribute, vm_machine_attribute_val_t *value);
kern_return_t __cdecl mach_vm_page_info(vm_map_read_t target_task, mach_vm_address_t address, vm_page_info_flavor_t flavor, vm_page_info_t info, mach_msg_type_number_t *infoCnt);
kern_return_t __cdecl mach_vm_read_overwrite(vm_map_read_t target_task, mach_vm_address_t address, mach_vm_size_t size, mach_vm_address_t data, mach_vm_size_t *outsize);
kern_return_t __cdecl mach_vm_wire(host_priv_t host_priv, vm_map_t task, mach_vm_address_t address, mach_vm_size_t size, vm_prot_t desired_access);
kern_return_t __cdecl mach_vm_write(vm_map_t target_task, mach_vm_address_t address, vm_offset_t data, mach_msg_type_number_t dataCnt);
int __cdecl madvise(void *, size_t, int);
void *__cdecl malloc(size_t __size);
int __cdecl memcmp(const void *__s1, const void *__s2, size_t __n);
void *__cdecl memcpy(void *__dst, const void *__src, size_t __n);
void __cdecl mig_dealloc_reply_port(mach_port_t reply_port);
mach_port_t mig_get_reply_port(void);
int __cdecl mkdir(const char *, mode_t);
char *__cdecl mktemp(char *);
// void *__cdecl mmap(void *, size_t, int, int, int, off_t);
int __cdecl mount(const char *, const char *, int, void *);
int necp_client_action(int fd, uint32_t action, const void *client_id, size_t client_id_len, void *buffer, size_t buffer_size);
int necp_open(int flags);
int open(const char *, int, ...);
int open_dprotected_np(const char *, int, int, int, ...);
kern_return_t __cdecl pid_for_task(mach_port_name_t t, int *x);
int __cdecl pipe(int[2]);
int __cdecl posix_spawn(pid_t *, const char *, const posix_spawn_file_actions_t *, const posix_spawnattr_t *, char *const __argv[], char *const __envp[]);
int __cdecl posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *, int, const char *, int, mode_t);
int __cdecl posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *);
int __cdecl posix_spawn_file_actions_init(posix_spawn_file_actions_t *);
int __cdecl posix_spawnattr_destroy(posix_spawnattr_t *);
int __cdecl posix_spawnattr_init(posix_spawnattr_t *);
int __cdecl posix_spawnattr_setflags(posix_spawnattr_t *, __int16);
int __cdecl posix_spawnattr_setpgroup(posix_spawnattr_t *, pid_t);
int __cdecl posix_spawnattr_setsigdefault(posix_spawnattr_t *, const sigset_t *);
ssize_t __cdecl pread(int __fd, void *__buf, size_t __nbyte, off_t __offset);
int __cdecl proc_pidinfo(int pid, int flavor, uint64_t arg, void *buffer, int buffersize);
kern_return_t __cdecl processor_set_default(host_t host, processor_set_name_t *default_set);
kern_return_t __cdecl processor_set_info(processor_set_name_t set_name, int flavor, host_t *host, processor_set_info_t info_out, mach_msg_type_number_t *info_outCnt);
int __cdecl pthread_attr_destroy(pthread_attr_t *);
int __cdecl pthread_attr_init(pthread_attr_t *);
int __cdecl pthread_attr_setdetachstate(pthread_attr_t *, int);
int __cdecl pthread_create(pthread_t *, const pthread_attr_t *, void *(__cdecl *)(void *), void *);
int __cdecl pthread_create_suspended_np(pthread_t *, const pthread_attr_t *, void *(__cdecl *)(void *), void *);
pthread_t __cdecl pthread_from_mach_thread_np(mach_port_t);
int __cdecl pthread_join(pthread_t, void **);
mach_port_t __cdecl pthread_mach_thread_np(pthread_t);
int __cdecl pthread_mutex_destroy(pthread_mutex_t *);
int __cdecl pthread_mutex_init(pthread_mutex_t *, const pthread_mutexattr_t *);
int __cdecl pthread_mutex_lock(pthread_mutex_t *);
int __cdecl pthread_mutex_unlock(pthread_mutex_t *);
pthread_t pthread_self(void);
void __cdecl qsort(void *__base, size_t __nel, size_t __width, int (__cdecl *__compar)(const void *, const void *));
ssize_t __cdecl read(int, void *, size_t);
void *__cdecl realloc(void *__ptr, size_t __size);
int __cdecl rmdir(const char *);
int sandbox_check(pid_t pid, const char *operation, int flags, ...);
int sched_yield(void);
kern_return_t __cdecl semaphore_create(task_t task, semaphore_t *semaphore, int policy, int value);
kern_return_t __cdecl semaphore_destroy(task_t task, semaphore_t semaphore);
kern_return_t __cdecl semaphore_signal(semaphore_t semaphore);
kern_return_t __cdecl semaphore_timedwait(semaphore_t semaphore, mach_timespec_t wait_time);
kern_return_t __cdecl semaphore_wait(semaphore_t semaphore);
int __cdecl seteuid(uid_t);
int __cdecl setsockopt(int, int, int, const void *, socklen_t);
int snprintf(char *__str, size_t __size, const char *__format, ...);
int __cdecl socket(int, int, int);
int sscanf(const char *, const char *, ...);
int __cdecl stat(const char *, stat *);
int __cdecl statfs(const char *, struct statfs *);
char *__cdecl strchr(const char *__s, int __c);
int __cdecl strcmp(const char *__s1, const char *__s2);
char *__cdecl strcpy(char *__dst, const char *__src);
char *__cdecl strdup(const char *__s1);
size_t __cdecl strlcpy(char *__dst, const char *__source, size_t __size);
size_t __cdecl strlen(const char *__s);
int __cdecl strncmp(const char *__s1, const char *__s2, size_t __n);
char *__cdecl strsep(char **__stringp, const char *__delim);
char *__cdecl strstr(const char *__big, const char *__little);
__int64 __cdecl strtol(const char *__str, char **__endptr, int __base);
int syscall(int, ...);
int __cdecl sysctl(int *, u_int, void *, size_t *, void *, size_t);
int __cdecl sysctlbyname(const char *, void *, size_t *, void *, size_t);
kern_return_t __cdecl task_get_special_port(task_inspect_t task, int which_port, mach_port_t *special_port);
kern_return_t __cdecl task_info(task_name_t target_task, task_flavor_t flavor, task_info_t task_info_out, mach_msg_type_number_t *task_info_outCnt);
kern_return_t __cdecl task_map_corpse_info_64(task_t task, task_read_t corspe_task, mach_vm_address_t *kcd_addr_begin, mach_vm_size_t *kcd_size);
kern_return_t __cdecl task_resume2(task_suspension_token_t suspend_token);
kern_return_t __cdecl task_set_special_port(task_t task, int which_port, mach_port_t special_port);
kern_return_t __cdecl task_suspend2(task_t target_task, task_suspension_token_t *suspend_token);
kern_return_t __cdecl task_threads(task_inspect_t target_task, thread_act_array_t *act_list, mach_msg_type_number_t *act_listCnt);
kern_return_t __cdecl thread_create(task_t parent_task, thread_act_t *child_act);
kern_return_t __cdecl thread_get_state(thread_read_t target_act, thread_state_flavor_t flavor, thread_state_t old_state, mach_msg_type_number_t *old_stateCnt);
kern_return_t __cdecl thread_policy_set(thread_act_t thread, thread_policy_flavor_t flavor, thread_policy_t policy_info, mach_msg_type_number_t policy_infoCnt);
kern_return_t __cdecl thread_resume(thread_act_t target_act);
kern_return_t __cdecl thread_set_exception_ports(thread_act_t thread, exception_mask_t exception_mask, mach_port_t new_port, exception_behavior_t behavior, thread_state_flavor_t new_flavor);
kern_return_t __cdecl thread_set_state(thread_act_t target_act, thread_state_flavor_t flavor, thread_state_t new_state, mach_msg_type_number_t new_stateCnt);
kern_return_t __cdecl thread_suspend(thread_act_t target_act);
kern_return_t __cdecl thread_switch(mach_port_name_t thread_name, int option, mach_msg_timeout_t option_time);
kern_return_t __cdecl thread_terminate(thread_act_t target_act);
int __cdecl uname(utsname *);
int __cdecl unlink(const char *);
int __cdecl unmount(const char *, int);
int __cdecl usleep(useconds_t);
int __cdecl uuid_is_null(const uuid_t uu);
kern_return_t __cdecl vm_allocate(vm_map_t target_task, vm_address_t *address, vm_size_t size, int flags);
kern_return_t __cdecl vm_copy(vm_map_t target_task, vm_address_t source_address, vm_size_t size, vm_address_t dest_address);
kern_return_t __cdecl vm_deallocate(vm_map_t target_task, vm_address_t address, vm_size_t size);
kern_return_t __cdecl vm_map(vm_map_t target_task, vm_address_t *address, vm_size_t size, vm_address_t mask, int flags, mem_entry_name_port_t object, vm_offset_t offset, boolean_t copy, vm_prot_t cur_protection, vm_prot_t max_protection, vm_inherit_t inheritance);
kern_return_t __cdecl vm_protect(vm_map_t target_task, vm_address_t address, vm_size_t size, boolean_t set_maximum, vm_prot_t new_protection);
kern_return_t __cdecl vm_read_overwrite(vm_map_t target_task, vm_address_t address, vm_size_t size, vm_address_t data, vm_size_t *outsize);
kern_return_t __cdecl vm_region_64(vm_map_t target_task, vm_address_t *address, vm_size_t *size, vm_region_flavor_t flavor, vm_region_info_t info, mach_msg_type_number_t *infoCnt, mach_port_t *object_name);
kern_return_t __cdecl vm_region_recurse_64(vm_map_t target_task, vm_address_t *address, vm_size_t *size, natural_t *nesting_depth, vm_region_recurse_info_t info, mach_msg_type_number_t *infoCnt);
kern_return_t __cdecl vm_remap(vm_map_t target_task, vm_address_t *target_address, vm_size_t size, vm_address_t mask, int flags, vm_map_t src_task, vm_address_t src_address, boolean_t copy, vm_prot_t *cur_protection, vm_prot_t *max_protection, vm_inherit_t inheritance);
kern_return_t __cdecl vm_write(vm_map_t target_task, vm_address_t address, vm_offset_t data, mach_msg_type_number_t dataCnt);
pid_t __cdecl waitpid(pid_t, int *, int);
ssize_t __cdecl write(int __fd, const void *__buf, size_t __nbyte);
#endif
// void __cdecl _CFArrayAppendValue(CFMutableArrayRef theArray, const void *value);
// void __cdecl _CFArrayApplyFunction(CFArrayRef theArray, CFRange range, CFArrayApplierFunction applier, void *context);
// Boolean __cdecl _CFArrayContainsValue(CFArrayRef theArray, CFRange range, const void *value);
// CFIndex __cdecl _CFArrayGetCount(CFArrayRef theArray);
// CFTypeID _CFArrayGetTypeID(void);
// CFTypeID _CFBooleanGetTypeID(void);
// CFDataRef __cdecl _CFDataCreate(CFAllocatorRef allocator, const UInt8 *bytes, CFIndex length);
// CFDataRef __cdecl _CFDataCreateWithBytesNoCopy(CFAllocatorRef allocator, const UInt8 *bytes, CFIndex length, CFAllocatorRef bytesDeallocator);
// const UInt8 *__cdecl _CFDataGetBytePtr(CFDataRef theData);
// CFIndex __cdecl _CFDataGetLength(CFDataRef theData);
// CFTypeID _CFDataGetTypeID(void);
// void __cdecl _CFDictionaryAddValue(CFMutableDictionaryRef theDict, const void *key, const void *value);
// void __cdecl _CFDictionaryApplyFunction(CFDictionaryRef theDict, CFDictionaryApplierFunction applier, void *context);
// CFMutableDictionaryRef __cdecl _CFDictionaryCreateMutable(CFAllocatorRef allocator, CFIndex capacity, const CFDictionaryKeyCallBacks *keyCallBacks, const CFDictionaryValueCallBacks *valueCallBacks);
// CFMutableDictionaryRef __cdecl _CFDictionaryCreateMutableCopy(CFAllocatorRef allocator, CFIndex capacity, CFDictionaryRef theDict);
// CFTypeID _CFDictionaryGetTypeID(void);
// Boolean __cdecl _CFDictionaryGetValueIfPresent(CFDictionaryRef theDict, const void *key, const void **value);
// void __cdecl _CFDictionarySetValue(CFMutableDictionaryRef theDict, const void *key, const void *value);
// Boolean __cdecl _CFEqual(CFTypeRef cf1, CFTypeRef cf2);
// CFTypeID __cdecl _CFGetTypeID(CFTypeRef cf);
// CFNumberRef __cdecl _CFNumberCreate(CFAllocatorRef allocator, CFNumberType theType, const void *valuePtr);
// CFTypeID _CFNumberGetTypeID(void);
// Boolean __cdecl _CFNumberGetValue(CFNumberRef number, CFNumberType theType, void *valuePtr);
// CFDataRef __cdecl _CFPropertyListCreateData(CFAllocatorRef allocator, CFPropertyListRef propertyList, CFPropertyListFormat format, CFOptionFlags options, CFErrorRef *error);
// CFPropertyListRef __cdecl _CFPropertyListCreateWithData(CFAllocatorRef allocator, CFDataRef data, CFOptionFlags options, CFPropertyListFormat *format, CFErrorRef *error);
// CFPropertyListRef __cdecl _CFPropertyListCreateWithStream(CFAllocatorRef allocator, CFReadStreamRef stream, CFIndex streamLength, CFOptionFlags options, CFPropertyListFormat *format, CFErrorRef *error);
// void __cdecl _CFReadStreamClose(CFReadStreamRef stream);
// CFReadStreamRef __cdecl _CFReadStreamCreateWithBytesNoCopy(CFAllocatorRef alloc, const UInt8 *bytes, CFIndex length, CFAllocatorRef bytesDeallocator);
// Boolean __cdecl _CFReadStreamOpen(CFReadStreamRef stream);
// void __cdecl _CFRelease(CFTypeRef cf);
// void __cdecl _CFRunLoopAddSource(CFRunLoopRef rl, CFRunLoopSourceRef source, CFRunLoopMode mode);
// CFRunLoopRef _CFRunLoopGetCurrent(void);
// void __cdecl _CFRunLoopRemoveSource(CFRunLoopRef rl, CFRunLoopSourceRef source, CFRunLoopMode mode);
// CFRunLoopRunResult __cdecl _CFRunLoopRunInMode(CFRunLoopMode mode, CFTimeInterval seconds, Boolean returnAfterSourceHandled);
// CFStringRef __cdecl _CFStringCreateWithCString(CFAllocatorRef alloc, const char *cStr, CFStringEncoding encoding);
// Boolean __cdecl _CFStringGetCString(CFStringRef theString, char *buffer, CFIndex bufferSize, CFStringEncoding encoding);
// CFStringEncoding _CFStringGetSystemEncoding(void);
// CFTypeID _CFStringGetTypeID(void);
// Boolean __cdecl _CFStringHasPrefix(CFStringRef theString, CFStringRef prefix);
// __int64 __CFProcessPath(void); weak
// CFDataRef __cdecl _IOCFSerialize(CFTypeRef object, CFOptionFlags options);
// kern_return_t __cdecl _IOConnectCallMethod(mach_port_t connection, uint32_t selector, const uint64_t *input, uint32_t inputCnt, const void *inputStruct, size_t inputStructCnt, uint64_t *output, uint32_t *outputCnt, void *outputStruct, size_t *outputStructCnt);
// kern_return_t __cdecl _IOConnectCallScalarMethod(mach_port_t connection, uint32_t selector, const uint64_t *input, uint32_t inputCnt, uint64_t *output, uint32_t *outputCnt);
// kern_return_t __cdecl _IOConnectCallStructMethod(mach_port_t connection, uint32_t selector, const void *inputStruct, size_t inputStructCnt, void *outputStruct, size_t *outputStructCnt);
// kern_return_t __cdecl _IOConnectTrap4(io_connect_t connect, uint32_t index, uintptr_t p1, uintptr_t p2, uintptr_t p3, uintptr_t p4);
// kern_return_t __cdecl _IOConnectTrap6(io_connect_t connect, uint32_t index, uintptr_t p1, uintptr_t p2, uintptr_t p3, uintptr_t p4, uintptr_t p5, uintptr_t p6);
// io_object_t __cdecl _IOIteratorNext(io_iterator_t iterator);
// IONotificationPortRef __cdecl _IONotificationPortCreate(mach_port_t masterPort);
// void __cdecl _IONotificationPortDestroy(IONotificationPortRef notify);
// CFRunLoopSourceRef __cdecl _IONotificationPortGetRunLoopSource(IONotificationPortRef notify);
// kern_return_t __cdecl _IOObjectRelease(io_object_t object);
// kern_return_t __cdecl _IORegistryEntryCreateCFProperties(io_registry_entry_t entry, CFMutableDictionaryRef *properties, CFAllocatorRef allocator, IOOptionBits options);
// CFTypeRef __cdecl _IORegistryEntryCreateCFProperty(io_registry_entry_t entry, CFStringRef key, CFAllocatorRef allocator, IOOptionBits options);
// io_registry_entry_t __cdecl _IORegistryEntryFromPath(mach_port_t masterPort, const io_string_t path);
// kern_return_t __cdecl _IORegistryEntryGetChildIterator(io_registry_entry_t entry, const io_name_t plane, io_iterator_t *iterator);
// CFTypeRef __cdecl _IORegistryEntrySearchCFProperty(io_registry_entry_t entry, const io_name_t plane, CFStringRef key, CFAllocatorRef allocator, IOOptionBits options);
// kern_return_t __cdecl _IOServiceAddMatchingNotification(IONotificationPortRef notifyPort, const io_name_t notificationType, CFDictionaryRef matching, IOServiceMatchingCallback callback, void *refCon, io_iterator_t *notification);
// kern_return_t __cdecl _IOServiceClose(io_connect_t connect);
// io_service_t __cdecl _IOServiceGetMatchingService(mach_port_t masterPort, CFDictionaryRef matching);
// CFMutableDictionaryRef __cdecl _IOServiceMatching(const char *name);
// kern_return_t __cdecl _IOServiceOpen(io_service_t service, task_port_t owningTask, uint32_t type, io_connect_t *connect);
// kern_return_t __cdecl _IOServiceWaitQuiet(io_service_t service, mach_timespec_t *waitTime);
// __int64 __IOServiceSetAuthorizationID(void); weak
// int __cdecl _CC_SHA1_Final(unsigned __int8 *md, CC_SHA1_CTX *c);
// int __cdecl _CC_SHA1_Init(CC_SHA1_CTX *c);
// int __cdecl _CC_SHA1_Update(CC_SHA1_CTX *c, const void *data, CC_LONG len);
// int __cdecl _CC_SHA256_Final(unsigned __int8 *md, CC_SHA256_CTX *c);
// int __cdecl _CC_SHA256_Init(CC_SHA256_CTX *c);
// int __cdecl _CC_SHA256_Update(CC_SHA256_CTX *c, const void *data, CC_LONG len);
// int __cdecl _CC_SHA384_Final(unsigned __int8 *md, CC_SHA512_CTX *c);
// int __cdecl _CC_SHA384_Init(CC_SHA512_CTX *c);
// int __cdecl _CC_SHA384_Update(CC_SHA512_CTX *c, const void *data, CC_LONG len);
// int *___error(void);
// __int64 ___memcpy_chk(void); weak
// __int64 ___memset_chk(void); weak
// __int64 ___semwait_signal(void); weak
// __int64 ___strlcpy_chk(void); weak
// int ___ulock_wait(unsigned int, void *, unsigned __int64, unsigned int); weak
// int ___ulock_wake(unsigned int, void *, unsigned __int64); weak
// __int64 j___get_cpu_capabilities(void); weak
// void *__os_alloc_once(void *slot, size_t size, void *init); weak
// void __cdecl _arc4random_buf(void *__buf, size_t __nbytes);
// void __cdecl _bzero(void *, size_t);
// void *__cdecl _calloc(size_t __count, size_t __size);
// int __cdecl _chown(const char *, uid_t, gid_t);
// int __cdecl _close(int);
// int __cdecl _connect(int, const sockaddr *, socklen_t);
// int __cdecl _dlclose(void *__handle);
// void *__cdecl _dlopen(const char *__path, int __mode);
// void *__cdecl _dlsym(void *__handle, const char *__symbol);
// int _fcntl(int, int, ...);
// int __cdecl _ffsctl(int, unsigned __int64, void *, unsigned int);
// int _fileport_makefd(mach_port_t port); weak
// __int64 __fastcall _fileport_makeport(uint64_t, uint64_t); weak
// void __cdecl _free(void *);
// int __cdecl _fstat(int, stat *);
// int __cdecl _getattrlist(const char *, void *, void *, size_t, unsigned int);
// int __cdecl _getmntinfo(struct statfs **, int);
// pid_t _getpid(void);
// pid_t _getppid(void);
// uid_t _getuid(void);
// kern_return_t __cdecl _host_create_mach_voucher(host_t host, mach_voucher_attr_raw_recipe_array_t recipes, mach_msg_type_number_t recipesCnt, ipc_voucher_t *voucher);
// kern_return_t __cdecl _host_get_io_master(host_t host, io_master_t *io_master);
// kern_return_t __cdecl _host_get_special_port(host_priv_t host_priv, int node, int which, mach_port_t *port);
// kern_return_t __cdecl _host_kernel_version(host_t host, kernel_version_t kernel_version);
// kern_return_t __cdecl _host_page_size(host_t, vm_size_t *);
// kern_return_t __cdecl _host_processors(host_priv_t host_priv, processor_array_t *out_processor_list, mach_msg_type_number_t *out_processor_listCnt);
// kern_return_t __cdecl _host_security_set_task_token(host_security_t host_security, task_t target_task, security_token_t sec_token, audit_token_t *__struct_ptr audit_token, host_t host);
// int _ioctl(int, unsigned __int64, ...);
// int __cdecl _lstat(const char *, stat *);
// uint64_t _mach_absolute_time(void);
// mach_port_t _mach_host_self(void);
// kern_return_t __cdecl _mach_make_memory_entry(vm_map_t target_task, vm_size_t *size, vm_offset_t offset, vm_prot_t permission, mem_entry_name_port_t *object_handle, mem_entry_name_port_t parent_entry);
// kern_return_t __cdecl _mach_make_memory_entry_64(vm_map_t target_task, memory_object_size_t *size, memory_object_offset_t offset, vm_prot_t permission, mach_port_t *object_handle, mem_entry_name_port_t parent_entry);
// mach_msg_return_t __cdecl _mach_msg(mach_msg_header_t *msg, mach_msg_option_t option, mach_msg_size_t send_size, mach_msg_size_t rcv_size, mach_port_name_t rcv_name, mach_msg_timeout_t timeout, mach_port_name_t notify);
// void __cdecl _mach_msg_destroy(mach_msg_header_t *);
// mach_msg_return_t __cdecl _mach_msg_send(mach_msg_header_t *);
// kern_return_t __cdecl _mach_port_allocate(ipc_space_t task, mach_port_right_t right, mach_port_name_t *name);
// kern_return_t __cdecl _mach_port_deallocate(ipc_space_t task, mach_port_name_t name);
// kern_return_t __cdecl _mach_port_destroy(ipc_space_t task, mach_port_name_t name);
// kern_return_t __cdecl _mach_port_get_attributes(ipc_space_read_t task, mach_port_name_t name, mach_port_flavor_t flavor, mach_port_info_t port_info_out, mach_msg_type_number_t *port_info_outCnt);
// kern_return_t __cdecl _mach_port_insert_right(ipc_space_t task, mach_port_name_t name, mach_port_t poly, mach_msg_type_name_t polyPoly);
// kern_return_t __cdecl _mach_port_mod_refs(ipc_space_t task, mach_port_name_t name, mach_port_right_t right, mach_port_delta_t delta);
// kern_return_t __cdecl _mach_port_request_notification(ipc_space_t task, mach_port_name_t name, mach_msg_id_t msgid, mach_port_mscount_t sync, mach_port_t notify, mach_msg_type_name_t notifyPoly, mach_port_t *previous);
// kern_return_t __cdecl _mach_port_set_attributes(ipc_space_t task, mach_port_name_t name, mach_port_flavor_t flavor, mach_port_info_t port_info, mach_msg_type_number_t port_infoCnt);
// kern_return_t __cdecl _mach_port_space_info(ipc_space_read_t space, ipc_info_space_t *space_info, ipc_info_name_array_t *table_info, mach_msg_type_number_t *table_infoCnt, ipc_info_tree_name_array_t *tree_info, mach_msg_type_number_t *tree_infoCnt);
// kern_return_t __cdecl _mach_ports_register(task_t target_task, mach_port_array_t init_port_set, mach_msg_type_number_t init_port_setCnt);
// __int64 _mach_reply_port(void); weak
// mach_port_t _mach_thread_self(void);
// kern_return_t __cdecl _mach_timebase_info(mach_timebase_info_t info);
// kern_return_t __cdecl _mach_vm_allocate(vm_map_t target, mach_vm_address_t *address, mach_vm_size_t size, int flags);
// kern_return_t __cdecl _mach_vm_deallocate(vm_map_t target, mach_vm_address_t address, mach_vm_size_t size);
// kern_return_t __cdecl _mach_vm_machine_attribute(vm_map_t target_task, mach_vm_address_t address, mach_vm_size_t size, vm_machine_attribute_t attribute, vm_machine_attribute_val_t *value);
// kern_return_t __cdecl _mach_vm_page_info(vm_map_read_t target_task, mach_vm_address_t address, vm_page_info_flavor_t flavor, vm_page_info_t info, mach_msg_type_number_t *infoCnt);
// kern_return_t __cdecl _mach_vm_read_overwrite(vm_map_read_t target_task, mach_vm_address_t address, mach_vm_size_t size, mach_vm_address_t data, mach_vm_size_t *outsize);
// kern_return_t __cdecl _mach_vm_wire(host_priv_t host_priv, vm_map_t task, mach_vm_address_t address, mach_vm_size_t size, vm_prot_t desired_access);
// kern_return_t __cdecl _mach_vm_write(vm_map_t target_task, mach_vm_address_t address, vm_offset_t data, mach_msg_type_number_t dataCnt);
// int __cdecl _madvise(void *, size_t, int);
// void *__cdecl _malloc(size_t __size);
// int __cdecl _memcmp(const void *__s1, const void *__s2, size_t __n);
// void *__cdecl _memcpy(void *__dst, const void *__src, size_t __n);
// void __cdecl _mig_dealloc_reply_port(mach_port_t reply_port);
// mach_port_t _mig_get_reply_port(void);
// int __cdecl _mkdir(const char *, mode_t);
// char *__cdecl _mktemp(char *);
// void *__cdecl _mmap(void *, size_t, int, int, int, off_t);
// int __cdecl _mount(const char *, const char *, int, void *);
// int _necp_client_action(int fd, uint32_t action, const void *client_id, size_t client_id_len, void *buffer, size_t buffer_size); weak
// int _necp_open(int flags); weak
// int _open(const char *, int, ...);
// int _open_dprotected_np(const char *, int, int, int, ...);
// kern_return_t __cdecl _pid_for_task(mach_port_name_t t, int *x);
// int __cdecl _pipe(int[2]);
// int __cdecl _posix_spawn(pid_t *, const char *, const posix_spawn_file_actions_t *, const posix_spawnattr_t *, char *const __argv[], char *const __envp[]);
// int __cdecl _posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *, int, const char *, int, mode_t);
// int __cdecl _posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *);
// int __cdecl _posix_spawn_file_actions_init(posix_spawn_file_actions_t *);
// int __cdecl _posix_spawnattr_destroy(posix_spawnattr_t *);
// int __cdecl _posix_spawnattr_init(posix_spawnattr_t *);
// int __cdecl _posix_spawnattr_setflags(posix_spawnattr_t *, __int16);
// int __cdecl _posix_spawnattr_setpgroup(posix_spawnattr_t *, pid_t);
// int __cdecl _posix_spawnattr_setsigdefault(posix_spawnattr_t *, const sigset_t *);
// ssize_t __cdecl _pread(int __fd, void *__buf, size_t __nbyte, off_t __offset);
// int __cdecl _proc_pidinfo(int pid, int flavor, uint64_t arg, void *buffer, int buffersize);
// kern_return_t __cdecl _processor_set_default(host_t host, processor_set_name_t *default_set);
// kern_return_t __cdecl _processor_set_info(processor_set_name_t set_name, int flavor, host_t *host, processor_set_info_t info_out, mach_msg_type_number_t *info_outCnt);
// int __cdecl _pthread_attr_destroy(pthread_attr_t *);
// int __cdecl _pthread_attr_init(pthread_attr_t *);
// int __cdecl _pthread_attr_setdetachstate(pthread_attr_t *, int);
// int __cdecl _pthread_create(pthread_t *, const pthread_attr_t *, void *(__cdecl *)(void *), void *);
// int __cdecl _pthread_create_suspended_np(pthread_t *, const pthread_attr_t *, void *(__cdecl *)(void *), void *);
// pthread_t __cdecl _pthread_from_mach_thread_np(mach_port_t);
// int __cdecl _pthread_join(pthread_t, void **);
// mach_port_t __cdecl _pthread_mach_thread_np(pthread_t);
// int __cdecl _pthread_mutex_destroy(pthread_mutex_t *);
// int __cdecl _pthread_mutex_init(pthread_mutex_t *, const pthread_mutexattr_t *);
// int __cdecl _pthread_mutex_lock(pthread_mutex_t *);
// int __cdecl _pthread_mutex_unlock(pthread_mutex_t *);
// pthread_t _pthread_self(void);
// void __cdecl _qsort(void *__base, size_t __nel, size_t __width, int (__cdecl *__compar)(const void *, const void *));
// ssize_t __cdecl _read(int, void *, size_t);
// void *__cdecl _realloc(void *__ptr, size_t __size);
// int __cdecl _rmdir(const char *);
// __int64 __fastcall _sandbox_check(int pid);
// int _sched_yield(void);
// kern_return_t __cdecl _semaphore_create(task_t task, semaphore_t *semaphore, int policy, int value);
// kern_return_t __cdecl _semaphore_destroy(task_t task, semaphore_t semaphore);
// kern_return_t __cdecl _semaphore_signal(semaphore_t semaphore);
// kern_return_t __cdecl _semaphore_timedwait(semaphore_t semaphore, mach_timespec_t wait_time);
// kern_return_t __cdecl _semaphore_wait(semaphore_t semaphore);
// int __cdecl _seteuid(uid_t);
// int __cdecl _setsockopt(int, int, int, const void *, socklen_t);
// int _snprintf(char *__str, size_t __size, const char *__format, ...);
// int __cdecl _socket(int, int, int);
// int _sscanf(const char *, const char *, ...);
// int __cdecl _stat(const char *, stat *);
// int __cdecl _statfs(const char *, struct statfs *);
// char *__cdecl _strchr(const char *__s, int __c);
// int __cdecl _strcmp(const char *__s1, const char *__s2);
// char *__cdecl _strcpy(char *__dst, const char *__src);
// char *__cdecl _strdup(const char *__s1);
// size_t __cdecl _strlcpy(char *__dst, const char *__source, size_t __size);
// size_t __cdecl _strlen(const char *__s);
// int __cdecl _strncmp(const char *__s1, const char *__s2, size_t __n);
// char *__cdecl _strsep(char **__stringp, const char *__delim);
// char *__cdecl _strstr(const char *__big, const char *__little);
// __int64 __cdecl _strtol(const char *__str, char **__endptr, int __base);
// int _syscall(int, ...);
// int __cdecl _sysctl(int *, u_int, void *, size_t *, void *, size_t);
// int __cdecl _sysctlbyname(const char *, void *, size_t *, void *, size_t);
// kern_return_t __cdecl _task_get_special_port(task_inspect_t task, int which_port, mach_port_t *special_port);
// kern_return_t __cdecl _task_info(task_name_t target_task, task_flavor_t flavor, task_info_t task_info_out, mach_msg_type_number_t *task_info_outCnt);
// kern_return_t __cdecl _task_map_corpse_info_64(task_t task, task_read_t corspe_task, mach_vm_address_t *kcd_addr_begin, mach_vm_size_t *kcd_size);
// kern_return_t __cdecl _task_resume2(task_suspension_token_t suspend_token);
// kern_return_t __cdecl _task_set_special_port(task_t task, int which_port, mach_port_t special_port);
// kern_return_t __cdecl _task_suspend2(task_t target_task, task_suspension_token_t *suspend_token);
// kern_return_t __cdecl _task_threads(task_inspect_t target_task, thread_act_array_t *act_list, mach_msg_type_number_t *act_listCnt);
// kern_return_t __cdecl _thread_create(task_t parent_task, thread_act_t *child_act);
// kern_return_t __cdecl _thread_get_state(thread_read_t target_act, thread_state_flavor_t flavor, thread_state_t old_state, mach_msg_type_number_t *old_stateCnt);
// kern_return_t __cdecl _thread_policy_set(thread_act_t thread, thread_policy_flavor_t flavor, thread_policy_t policy_info, mach_msg_type_number_t policy_infoCnt);
// kern_return_t __cdecl _thread_resume(thread_act_t target_act);
// kern_return_t __cdecl _thread_set_exception_ports(thread_act_t thread, exception_mask_t exception_mask, mach_port_t new_port, exception_behavior_t behavior, thread_state_flavor_t new_flavor);
// kern_return_t __cdecl _thread_set_state(thread_act_t target_act, thread_state_flavor_t flavor, thread_state_t new_state, mach_msg_type_number_t new_stateCnt);
// kern_return_t __cdecl _thread_suspend(thread_act_t target_act);
// kern_return_t __cdecl _thread_switch(mach_port_name_t thread_name, int option, mach_msg_timeout_t option_time);
// kern_return_t __cdecl _thread_terminate(thread_act_t target_act);
// int __cdecl _uname(utsname *);
// int __cdecl _unlink(const char *);
// int __cdecl _unmount(const char *, int);
// int __cdecl _usleep(useconds_t);
// int __cdecl _uuid_is_null(const uuid_t uu);
// kern_return_t __cdecl _vm_allocate(vm_map_t target_task, vm_address_t *address, vm_size_t size, int flags);
// kern_return_t __cdecl _vm_copy(vm_map_t target_task, vm_address_t source_address, vm_size_t size, vm_address_t dest_address);
// kern_return_t __cdecl _vm_deallocate(vm_map_t target_task, vm_address_t address, vm_size_t size);
// kern_return_t __cdecl _vm_map(vm_map_t target_task, vm_address_t *address, vm_size_t size, vm_address_t mask, int flags, mem_entry_name_port_t object, vm_offset_t offset, boolean_t copy, vm_prot_t cur_protection, vm_prot_t max_protection, vm_inherit_t inheritance);
// kern_return_t __cdecl _vm_protect(vm_map_t target_task, vm_address_t address, vm_size_t size, boolean_t set_maximum, vm_prot_t new_protection);
// kern_return_t __cdecl _vm_read_overwrite(vm_map_t target_task, vm_address_t address, vm_size_t size, vm_address_t data, vm_size_t *outsize);
// kern_return_t __cdecl _vm_region_64(vm_map_t target_task, vm_address_t *address, vm_size_t *size, vm_region_flavor_t flavor, vm_region_info_t info, mach_msg_type_number_t *infoCnt, mach_port_t *object_name);
// kern_return_t __cdecl _vm_region_recurse_64(vm_map_t target_task, vm_address_t *address, vm_size_t *size, natural_t *nesting_depth, vm_region_recurse_info_t info, mach_msg_type_number_t *infoCnt);
// kern_return_t __cdecl _vm_remap(vm_map_t target_task, vm_address_t *target_address, vm_size_t size, vm_address_t mask, int flags, vm_map_t src_task, vm_address_t src_address, boolean_t copy, vm_prot_t *cur_protection, vm_prot_t *max_protection, vm_inherit_t inheritance);
// kern_return_t __cdecl _vm_write(vm_map_t target_task, vm_address_t address, vm_offset_t data, mach_msg_type_number_t dataCnt);
// pid_t __cdecl _waitpid(pid_t, int *, int);
// ssize_t __cdecl _write(int __fd, const void *__buf, size_t __nbyte);
// __int64 __fastcall __chkstk_darwin(uint64_t, uint64_t); weak

#include "entry1_type0x09_data.m"

#include "entry1_type0x09_driver_api.m"

#include "entry1_type0x09_iogpu_physmap_engine.m"

#include "entry1_type0x09_dmafail_setup.m"

#include "entry1_type0x09_macho_patterns.m"

#include "entry1_type0x09_platform_fs.m"

#include "entry1_type0x09_dmafail_write.m"

#include "entry1_type0x09_ipc_ports_vmattr.m"

#include "entry1_type0x09_driver_core.m"

#include "entry1_type0x09_import_thunks.m"

#include "entry1_type0x09_compat_wrappers.m"

// nfuncs=894 queued=886 decompiled=886 lumina nreq=0 worse=0 better=0
// ALL OK, 886 function(s) have been successfully decompiled
