mach_o: C++11/STL parsing library

KS implementation details

License: MIT
Minimal Kaitai Struct required: 0.9

References

This page hosts a formal specification of mach_o using Kaitai Struct. This specification can be automatically translated into a variety of programming languages to get a parsing library.

Usage

Runtime library

All parsing code for C++11/STL generated by Kaitai Struct depends on the C++/STL runtime library. You have to install it before you can parse data.

For C++, the easiest way is to clone the runtime library sources and build them along with your project.

Code

Using Kaitai Struct in C++/STL usually consists of 3 steps.

  1. We need to create an STL input stream (std::istream). One can open local file for that, or use existing std::string or char* buffer.
    #include <fstream>
    
    std::ifstream is("path/to/local/file.bin", std::ifstream::binary);
    
    #include <sstream>
    
    std::istringstream is(str);
    
    #include <sstream>
    
    const char buf[] = { ... };
    std::string str(buf, sizeof buf);
    std::istringstream is(str);
    
  2. We need to wrap our input stream into Kaitai stream:
    #include "kaitai/kaitaistream.h"
    
    kaitai::kstream ks(&is);
    
  3. And finally, we can invoke the parsing:
    mach_o_t data(&ks);
    

After that, one can get various attributes from the structure by invoking getter methods like:

data.magic() // => get magic

C++11/STL source code to parse mach_o

mach_o.h

#pragma once

// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild

#include "kaitai/kaitaistruct.h"
#include <stdint.h>
#include <memory>
#include "asn1_der.h"
#include <vector>

#if KAITAI_STRUCT_VERSION < 9000L
#error "Incompatible Kaitai Struct C++/STL API: version 0.9 or later is required"
#endif
class asn1_der_t;

/**
 * \sa https://www.stonedcoder.org/~kd/lib/MachORuntime.pdf Source
 * \sa https://opensource.apple.com/source/python_modules/python_modules-43/Modules/macholib-1.5.1/macholib-1.5.1.tar.gz Source
 * \sa https://github.com/comex/cs/blob/07a88f9/macho_cs.py Source
 * \sa https://opensource.apple.com/source/Security/Security-55471/libsecurity_codesigning/requirements.grammar.auto.html Source
 * \sa https://github.com/apple/darwin-xnu/blob/xnu-2782.40.9/bsd/sys/codesign.h Source
 * \sa https://opensource.apple.com/source/dyld/dyld-852/src/ImageLoaderMachO.cpp.auto.html Source
 * \sa https://opensource.apple.com/source/dyld/dyld-852/src/ImageLoaderMachOCompressed.cpp.auto.html Source
 */

class mach_o_t : public kaitai::kstruct {

public:
    class rpath_command_t;
    class uleb128_t;
    class source_version_command_t;
    class cs_blob_t;
    class build_version_command_t;
    class routines_command_t;
    class macho_flags_t;
    class routines_command_64_t;
    class linker_option_command_t;
    class segment_command_64_t;
    class vm_prot_t;
    class dysymtab_command_t;
    class mach_header_t;
    class linkedit_data_command_t;
    class sub_command_t;
    class twolevel_hints_command_t;
    class version_t;
    class encryption_info_command_t;
    class code_signature_command_t;
    class dyld_info_command_t;
    class dylinker_command_t;
    class dylib_command_t;
    class segment_command_t;
    class lc_str_t;
    class load_command_t;
    class uuid_command_t;
    class symtab_command_t;
    class version_min_command_t;
    class entry_point_command_t;

    enum magic_type_t {
        MAGIC_TYPE_MACHO_LE_X86 = 3472551422UL,
        MAGIC_TYPE_MACHO_LE_X64 = 3489328638UL,
        MAGIC_TYPE_MACHO_BE_X86 = 4277009102UL,
        MAGIC_TYPE_MACHO_BE_X64 = 4277009103UL
    };

    enum cpu_type_t {
        CPU_TYPE_VAX = 1,
        CPU_TYPE_ROMP = 2,
        CPU_TYPE_NS32032 = 4,
        CPU_TYPE_NS32332 = 5,
        CPU_TYPE_I386 = 7,
        CPU_TYPE_MIPS = 8,
        CPU_TYPE_NS32532 = 9,
        CPU_TYPE_HPPA = 11,
        CPU_TYPE_ARM = 12,
        CPU_TYPE_MC88000 = 13,
        CPU_TYPE_SPARC = 14,
        CPU_TYPE_I860 = 15,
        CPU_TYPE_I860_LITTLE = 16,
        CPU_TYPE_RS6000 = 17,
        CPU_TYPE_POWERPC = 18,
        CPU_TYPE_ABI64 = 16777216,
        CPU_TYPE_X86_64 = 16777223,
        CPU_TYPE_ARM64 = 16777228,
        CPU_TYPE_POWERPC64 = 16777234,
        CPU_TYPE_ANY = 4294967295UL
    };

    enum file_type_t {
        FILE_TYPE_OBJECT = 1,
        FILE_TYPE_EXECUTE = 2,
        FILE_TYPE_FVMLIB = 3,
        FILE_TYPE_CORE = 4,
        FILE_TYPE_PRELOAD = 5,
        FILE_TYPE_DYLIB = 6,
        FILE_TYPE_DYLINKER = 7,
        FILE_TYPE_BUNDLE = 8,
        FILE_TYPE_DYLIB_STUB = 9,
        FILE_TYPE_DSYM = 10,
        FILE_TYPE_KEXT_BUNDLE = 11
    };

    enum load_command_type_t {
        LOAD_COMMAND_TYPE_SEGMENT = 1,
        LOAD_COMMAND_TYPE_SYMTAB = 2,
        LOAD_COMMAND_TYPE_SYMSEG = 3,
        LOAD_COMMAND_TYPE_THREAD = 4,
        LOAD_COMMAND_TYPE_UNIX_THREAD = 5,
        LOAD_COMMAND_TYPE_LOAD_FVM_LIB = 6,
        LOAD_COMMAND_TYPE_ID_FVM_LIB = 7,
        LOAD_COMMAND_TYPE_IDENT = 8,
        LOAD_COMMAND_TYPE_FVM_FILE = 9,
        LOAD_COMMAND_TYPE_PREPAGE = 10,
        LOAD_COMMAND_TYPE_DYSYMTAB = 11,
        LOAD_COMMAND_TYPE_LOAD_DYLIB = 12,
        LOAD_COMMAND_TYPE_ID_DYLIB = 13,
        LOAD_COMMAND_TYPE_LOAD_DYLINKER = 14,
        LOAD_COMMAND_TYPE_ID_DYLINKER = 15,
        LOAD_COMMAND_TYPE_PREBOUND_DYLIB = 16,
        LOAD_COMMAND_TYPE_ROUTINES = 17,
        LOAD_COMMAND_TYPE_SUB_FRAMEWORK = 18,
        LOAD_COMMAND_TYPE_SUB_UMBRELLA = 19,
        LOAD_COMMAND_TYPE_SUB_CLIENT = 20,
        LOAD_COMMAND_TYPE_SUB_LIBRARY = 21,
        LOAD_COMMAND_TYPE_TWOLEVEL_HINTS = 22,
        LOAD_COMMAND_TYPE_PREBIND_CKSUM = 23,
        LOAD_COMMAND_TYPE_SEGMENT_64 = 25,
        LOAD_COMMAND_TYPE_ROUTINES_64 = 26,
        LOAD_COMMAND_TYPE_UUID = 27,
        LOAD_COMMAND_TYPE_CODE_SIGNATURE = 29,
        LOAD_COMMAND_TYPE_SEGMENT_SPLIT_INFO = 30,
        LOAD_COMMAND_TYPE_LAZY_LOAD_DYLIB = 32,
        LOAD_COMMAND_TYPE_ENCRYPTION_INFO = 33,
        LOAD_COMMAND_TYPE_DYLD_INFO = 34,
        LOAD_COMMAND_TYPE_VERSION_MIN_MACOSX = 36,
        LOAD_COMMAND_TYPE_VERSION_MIN_IPHONEOS = 37,
        LOAD_COMMAND_TYPE_FUNCTION_STARTS = 38,
        LOAD_COMMAND_TYPE_DYLD_ENVIRONMENT = 39,
        LOAD_COMMAND_TYPE_DATA_IN_CODE = 41,
        LOAD_COMMAND_TYPE_SOURCE_VERSION = 42,
        LOAD_COMMAND_TYPE_DYLIB_CODE_SIGN_DRS = 43,
        LOAD_COMMAND_TYPE_ENCRYPTION_INFO_64 = 44,
        LOAD_COMMAND_TYPE_LINKER_OPTION = 45,
        LOAD_COMMAND_TYPE_LINKER_OPTIMIZATION_HINT = 46,
        LOAD_COMMAND_TYPE_VERSION_MIN_TVOS = 47,
        LOAD_COMMAND_TYPE_VERSION_MIN_WATCHOS = 48,
        LOAD_COMMAND_TYPE_BUILD_VERSION = 50,
        LOAD_COMMAND_TYPE_REQ_DYLD = 2147483648UL,
        LOAD_COMMAND_TYPE_LOAD_WEAK_DYLIB = 2147483672UL,
        LOAD_COMMAND_TYPE_RPATH = 2147483676UL,
        LOAD_COMMAND_TYPE_REEXPORT_DYLIB = 2147483679UL,
        LOAD_COMMAND_TYPE_DYLD_INFO_ONLY = 2147483682UL,
        LOAD_COMMAND_TYPE_LOAD_UPWARD_DYLIB = 2147483683UL,
        LOAD_COMMAND_TYPE_MAIN = 2147483688UL
    };

    mach_o_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent = nullptr, mach_o_t* p__root = nullptr);

private:
    void _read();
    void _clean_up();

public:
    ~mach_o_t();

    class rpath_command_t : public kaitai::kstruct {

    public:

        rpath_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~rpath_command_t();

    private:
        uint32_t m_path_offset;
        std::string m_path;
        mach_o_t* m__root;
        mach_o_t::load_command_t* m__parent;

    public:
        uint32_t path_offset() const { return m_path_offset; }
        std::string path() const { return m_path; }
        mach_o_t* _root() const { return m__root; }
        mach_o_t::load_command_t* _parent() const { return m__parent; }
    };

    class uleb128_t : public kaitai::kstruct {

    public:

        uleb128_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~uleb128_t();

    private:
        bool f_value;
        int32_t m_value;

    public:
        int32_t value();

    private:
        uint8_t m_b1;
        uint8_t m_b2;
        bool n_b2;

    public:
        bool _is_null_b2() { b2(); return n_b2; };

    private:
        uint8_t m_b3;
        bool n_b3;

    public:
        bool _is_null_b3() { b3(); return n_b3; };

    private:
        uint8_t m_b4;
        bool n_b4;

    public:
        bool _is_null_b4() { b4(); return n_b4; };

    private:
        uint8_t m_b5;
        bool n_b5;

    public:
        bool _is_null_b5() { b5(); return n_b5; };

    private:
        uint8_t m_b6;
        bool n_b6;

    public:
        bool _is_null_b6() { b6(); return n_b6; };

    private:
        uint8_t m_b7;
        bool n_b7;

    public:
        bool _is_null_b7() { b7(); return n_b7; };

    private:
        uint8_t m_b8;
        bool n_b8;

    public:
        bool _is_null_b8() { b8(); return n_b8; };

    private:
        uint8_t m_b9;
        bool n_b9;

    public:
        bool _is_null_b9() { b9(); return n_b9; };

    private:
        uint8_t m_b10;
        bool n_b10;

    public:
        bool _is_null_b10() { b10(); return n_b10; };

    private:
        mach_o_t* m__root;
        kaitai::kstruct* m__parent;

    public:
        uint8_t b1() const { return m_b1; }
        uint8_t b2() const { return m_b2; }
        uint8_t b3() const { return m_b3; }
        uint8_t b4() const { return m_b4; }
        uint8_t b5() const { return m_b5; }
        uint8_t b6() const { return m_b6; }
        uint8_t b7() const { return m_b7; }
        uint8_t b8() const { return m_b8; }
        uint8_t b9() const { return m_b9; }
        uint8_t b10() const { return m_b10; }
        mach_o_t* _root() const { return m__root; }
        kaitai::kstruct* _parent() const { return m__parent; }
    };

    class source_version_command_t : public kaitai::kstruct {

    public:

        source_version_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~source_version_command_t();

    private:
        uint64_t m_version;
        mach_o_t* m__root;
        mach_o_t::load_command_t* m__parent;

    public:
        uint64_t version() const { return m_version; }
        mach_o_t* _root() const { return m__root; }
        mach_o_t::load_command_t* _parent() const { return m__parent; }
    };

    class cs_blob_t : public kaitai::kstruct {

    public:
        class code_directory_t;
        class data_t;
        class super_blob_t;
        class expr_t;
        class blob_index_t;
        class match_t;
        class requirement_t;
        class requirements_t;
        class blob_wrapper_t;
        class entitlements_t;
        class requirements_blob_index_t;

        enum cs_magic_t {
            CS_MAGIC_BLOB_WRAPPER = 4208855809UL,
            CS_MAGIC_REQUIREMENT = 4208856064UL,
            CS_MAGIC_REQUIREMENTS = 4208856065UL,
            CS_MAGIC_CODE_DIRECTORY = 4208856066UL,
            CS_MAGIC_EMBEDDED_SIGNATURE = 4208856256UL,
            CS_MAGIC_DETACHED_SIGNATURE = 4208856257UL,
            CS_MAGIC_ENTITLEMENTS = 4208882033UL,
            CS_MAGIC_DER_ENTITLEMENTS = 4208882034UL
        };

        cs_blob_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~cs_blob_t();

        class code_directory_t : public kaitai::kstruct {

        public:

            code_directory_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

        private:
            void _read();
            void _clean_up();

        public:
            ~code_directory_t();

        private:
            bool f_ident;
            std::string m_ident;

        public:
            std::string ident();

        private:
            bool f_team_id;
            std::string m_team_id;

        public:
            std::string team_id();

        private:
            bool f_hashes;
            std::unique_ptr<std::vector<std::string>> m_hashes;

        public:
            std::vector<std::string>* hashes();

        private:
            uint32_t m_version;
            uint32_t m_flags;
            uint32_t m_hash_offset;
            uint32_t m_ident_offset;
            uint32_t m_n_special_slots;
            uint32_t m_n_code_slots;
            uint32_t m_code_limit;
            uint8_t m_hash_size;
            uint8_t m_hash_type;
            uint8_t m_spare1;
            uint8_t m_page_size;
            uint32_t m_spare2;
            uint32_t m_scatter_offset;
            bool n_scatter_offset;

        public:
            bool _is_null_scatter_offset() { scatter_offset(); return n_scatter_offset; };

        private:
            uint32_t m_team_id_offset;
            bool n_team_id_offset;

        public:
            bool _is_null_team_id_offset() { team_id_offset(); return n_team_id_offset; };

        private:
            mach_o_t* m__root;
            mach_o_t::cs_blob_t* m__parent;

        public:
            uint32_t version() const { return m_version; }
            uint32_t flags() const { return m_flags; }
            uint32_t hash_offset() const { return m_hash_offset; }
            uint32_t ident_offset() const { return m_ident_offset; }
            uint32_t n_special_slots() const { return m_n_special_slots; }
            uint32_t n_code_slots() const { return m_n_code_slots; }
            uint32_t code_limit() const { return m_code_limit; }
            uint8_t hash_size() const { return m_hash_size; }
            uint8_t hash_type() const { return m_hash_type; }
            uint8_t spare1() const { return m_spare1; }
            uint8_t page_size() const { return m_page_size; }
            uint32_t spare2() const { return m_spare2; }
            uint32_t scatter_offset() const { return m_scatter_offset; }
            uint32_t team_id_offset() const { return m_team_id_offset; }
            mach_o_t* _root() const { return m__root; }
            mach_o_t::cs_blob_t* _parent() const { return m__parent; }
        };

        class data_t : public kaitai::kstruct {

        public:

            data_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent = nullptr, mach_o_t* p__root = nullptr);

        private:
            void _read();
            void _clean_up();

        public:
            ~data_t();

        private:
            uint32_t m_length;
            std::string m_value;
            std::string m_padding;
            mach_o_t* m__root;
            kaitai::kstruct* m__parent;

        public:
            uint32_t length() const { return m_length; }
            std::string value() const { return m_value; }
            std::string padding() const { return m_padding; }
            mach_o_t* _root() const { return m__root; }
            kaitai::kstruct* _parent() const { return m__parent; }
        };

        class super_blob_t : public kaitai::kstruct {

        public:

            super_blob_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

        private:
            void _read();
            void _clean_up();

        public:
            ~super_blob_t();

        private:
            uint32_t m_count;
            std::unique_ptr<std::vector<std::unique_ptr<blob_index_t>>> m_blobs;
            mach_o_t* m__root;
            mach_o_t::cs_blob_t* m__parent;

        public:
            uint32_t count() const { return m_count; }
            std::vector<std::unique_ptr<blob_index_t>>* blobs() const { return m_blobs.get(); }
            mach_o_t* _root() const { return m__root; }
            mach_o_t::cs_blob_t* _parent() const { return m__parent; }
        };

        class expr_t : public kaitai::kstruct {

        public:
            class info_key_field_expr_t;
            class cert_slot_expr_t;
            class cert_generic_expr_t;
            class ident_expr_t;
            class cert_field_expr_t;
            class anchor_hash_expr_t;
            class apple_generic_anchor_expr_t;
            class entitlement_field_expr_t;
            class and_expr_t;
            class or_expr_t;

            enum op_enum_t {
                OP_ENUM_FALSE = 0,
                OP_ENUM_TRUE = 1,
                OP_ENUM_IDENT = 2,
                OP_ENUM_APPLE_ANCHOR = 3,
                OP_ENUM_ANCHOR_HASH = 4,
                OP_ENUM_INFO_KEY_VALUE = 5,
                OP_ENUM_AND_OP = 6,
                OP_ENUM_OR_OP = 7,
                OP_ENUM_CD_HASH = 8,
                OP_ENUM_NOT_OP = 9,
                OP_ENUM_INFO_KEY_FIELD = 10,
                OP_ENUM_CERT_FIELD = 11,
                OP_ENUM_TRUSTED_CERT = 12,
                OP_ENUM_TRUSTED_CERTS = 13,
                OP_ENUM_CERT_GENERIC = 14,
                OP_ENUM_APPLE_GENERIC_ANCHOR = 15,
                OP_ENUM_ENTITLEMENT_FIELD = 16
            };

            enum cert_slot_t {
                CERT_SLOT_LEFT_CERT = 0,
                CERT_SLOT_ANCHOR_CERT = 4294967295UL
            };

            expr_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent = nullptr, mach_o_t* p__root = nullptr);

        private:
            void _read();
            void _clean_up();

        public:
            ~expr_t();

            class info_key_field_expr_t : public kaitai::kstruct {

            public:

                info_key_field_expr_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t::expr_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

            private:
                void _read();
                void _clean_up();

            public:
                ~info_key_field_expr_t();

            private:
                std::unique_ptr<data_t> m_data;
                std::unique_ptr<match_t> m_match;
                mach_o_t* m__root;
                mach_o_t::cs_blob_t::expr_t* m__parent;

            public:
                data_t* data() const { return m_data.get(); }
                match_t* match() const { return m_match.get(); }
                mach_o_t* _root() const { return m__root; }
                mach_o_t::cs_blob_t::expr_t* _parent() const { return m__parent; }
            };

            class cert_slot_expr_t : public kaitai::kstruct {

            public:

                cert_slot_expr_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t::expr_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

            private:
                void _read();
                void _clean_up();

            public:
                ~cert_slot_expr_t();

            private:
                cert_slot_t m_value;
                mach_o_t* m__root;
                mach_o_t::cs_blob_t::expr_t* m__parent;

            public:
                cert_slot_t value() const { return m_value; }
                mach_o_t* _root() const { return m__root; }
                mach_o_t::cs_blob_t::expr_t* _parent() const { return m__parent; }
            };

            class cert_generic_expr_t : public kaitai::kstruct {

            public:

                cert_generic_expr_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t::expr_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

            private:
                void _read();
                void _clean_up();

            public:
                ~cert_generic_expr_t();

            private:
                cert_slot_t m_cert_slot;
                std::unique_ptr<data_t> m_data;
                std::unique_ptr<match_t> m_match;
                mach_o_t* m__root;
                mach_o_t::cs_blob_t::expr_t* m__parent;

            public:
                cert_slot_t cert_slot() const { return m_cert_slot; }
                data_t* data() const { return m_data.get(); }
                match_t* match() const { return m_match.get(); }
                mach_o_t* _root() const { return m__root; }
                mach_o_t::cs_blob_t::expr_t* _parent() const { return m__parent; }
            };

            class ident_expr_t : public kaitai::kstruct {

            public:

                ident_expr_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t::expr_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

            private:
                void _read();
                void _clean_up();

            public:
                ~ident_expr_t();

            private:
                std::unique_ptr<data_t> m_identifier;
                mach_o_t* m__root;
                mach_o_t::cs_blob_t::expr_t* m__parent;

            public:
                data_t* identifier() const { return m_identifier.get(); }
                mach_o_t* _root() const { return m__root; }
                mach_o_t::cs_blob_t::expr_t* _parent() const { return m__parent; }
            };

            class cert_field_expr_t : public kaitai::kstruct {

            public:

                cert_field_expr_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t::expr_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

            private:
                void _read();
                void _clean_up();

            public:
                ~cert_field_expr_t();

            private:
                cert_slot_t m_cert_slot;
                std::unique_ptr<data_t> m_data;
                std::unique_ptr<match_t> m_match;
                mach_o_t* m__root;
                mach_o_t::cs_blob_t::expr_t* m__parent;

            public:
                cert_slot_t cert_slot() const { return m_cert_slot; }
                data_t* data() const { return m_data.get(); }
                match_t* match() const { return m_match.get(); }
                mach_o_t* _root() const { return m__root; }
                mach_o_t::cs_blob_t::expr_t* _parent() const { return m__parent; }
            };

            class anchor_hash_expr_t : public kaitai::kstruct {

            public:

                anchor_hash_expr_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t::expr_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

            private:
                void _read();
                void _clean_up();

            public:
                ~anchor_hash_expr_t();

            private:
                cert_slot_t m_cert_slot;
                std::unique_ptr<data_t> m_data;
                mach_o_t* m__root;
                mach_o_t::cs_blob_t::expr_t* m__parent;

            public:
                cert_slot_t cert_slot() const { return m_cert_slot; }
                data_t* data() const { return m_data.get(); }
                mach_o_t* _root() const { return m__root; }
                mach_o_t::cs_blob_t::expr_t* _parent() const { return m__parent; }
            };

            class apple_generic_anchor_expr_t : public kaitai::kstruct {

            public:

                apple_generic_anchor_expr_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t::expr_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

            private:
                void _read();
                void _clean_up();

            public:
                ~apple_generic_anchor_expr_t();

            private:
                bool f_value;
                std::string m_value;

            public:
                std::string value();

            private:
                mach_o_t* m__root;
                mach_o_t::cs_blob_t::expr_t* m__parent;

            public:
                mach_o_t* _root() const { return m__root; }
                mach_o_t::cs_blob_t::expr_t* _parent() const { return m__parent; }
            };

            class entitlement_field_expr_t : public kaitai::kstruct {

            public:

                entitlement_field_expr_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t::expr_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

            private:
                void _read();
                void _clean_up();

            public:
                ~entitlement_field_expr_t();

            private:
                std::unique_ptr<data_t> m_data;
                std::unique_ptr<match_t> m_match;
                mach_o_t* m__root;
                mach_o_t::cs_blob_t::expr_t* m__parent;

            public:
                data_t* data() const { return m_data.get(); }
                match_t* match() const { return m_match.get(); }
                mach_o_t* _root() const { return m__root; }
                mach_o_t::cs_blob_t::expr_t* _parent() const { return m__parent; }
            };

            class and_expr_t : public kaitai::kstruct {

            public:

                and_expr_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t::expr_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

            private:
                void _read();
                void _clean_up();

            public:
                ~and_expr_t();

            private:
                std::unique_ptr<expr_t> m_left;
                std::unique_ptr<expr_t> m_right;
                mach_o_t* m__root;
                mach_o_t::cs_blob_t::expr_t* m__parent;

            public:
                expr_t* left() const { return m_left.get(); }
                expr_t* right() const { return m_right.get(); }
                mach_o_t* _root() const { return m__root; }
                mach_o_t::cs_blob_t::expr_t* _parent() const { return m__parent; }
            };

            class or_expr_t : public kaitai::kstruct {

            public:

                or_expr_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t::expr_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

            private:
                void _read();
                void _clean_up();

            public:
                ~or_expr_t();

            private:
                std::unique_ptr<expr_t> m_left;
                std::unique_ptr<expr_t> m_right;
                mach_o_t* m__root;
                mach_o_t::cs_blob_t::expr_t* m__parent;

            public:
                expr_t* left() const { return m_left.get(); }
                expr_t* right() const { return m_right.get(); }
                mach_o_t* _root() const { return m__root; }
                mach_o_t::cs_blob_t::expr_t* _parent() const { return m__parent; }
            };

        private:
            op_enum_t m_op;
            std::unique_ptr<kaitai::kstruct> m_data;
            bool n_data;

        public:
            bool _is_null_data() { data(); return n_data; };

        private:
            mach_o_t* m__root;
            kaitai::kstruct* m__parent;

        public:
            op_enum_t op() const { return m_op; }
            kaitai::kstruct* data() const { return m_data.get(); }
            mach_o_t* _root() const { return m__root; }
            kaitai::kstruct* _parent() const { return m__parent; }
        };

        class blob_index_t : public kaitai::kstruct {

        public:

            enum csslot_type_t {
                CSSLOT_TYPE_CODE_DIRECTORY = 0,
                CSSLOT_TYPE_INFO_SLOT = 1,
                CSSLOT_TYPE_REQUIREMENTS = 2,
                CSSLOT_TYPE_RESOURCE_DIR = 3,
                CSSLOT_TYPE_APPLICATION = 4,
                CSSLOT_TYPE_ENTITLEMENTS = 5,
                CSSLOT_TYPE_DER_ENTITLEMENTS = 7,
                CSSLOT_TYPE_ALTERNATE_CODE_DIRECTORIES = 4096,
                CSSLOT_TYPE_SIGNATURE_SLOT = 65536
            };

            blob_index_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t::super_blob_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

        private:
            void _read();
            void _clean_up();

        public:
            ~blob_index_t();

        private:
            bool f_blob;
            std::unique_ptr<cs_blob_t> m_blob;

        public:
            cs_blob_t* blob();

        private:
            csslot_type_t m_type;
            uint32_t m_offset;
            mach_o_t* m__root;
            mach_o_t::cs_blob_t::super_blob_t* m__parent;
            std::string m__raw_blob;
            std::unique_ptr<kaitai::kstream> m__io__raw_blob;

        public:
            csslot_type_t type() const { return m_type; }
            uint32_t offset() const { return m_offset; }
            mach_o_t* _root() const { return m__root; }
            mach_o_t::cs_blob_t::super_blob_t* _parent() const { return m__parent; }
            std::string _raw_blob() const { return m__raw_blob; }
            kaitai::kstream* _io__raw_blob() const { return m__io__raw_blob.get(); }
        };

        class match_t : public kaitai::kstruct {

        public:

            enum op_t {
                OP_EXISTS = 0,
                OP_EQUAL = 1,
                OP_CONTAINS = 2,
                OP_BEGINS_WITH = 3,
                OP_ENDS_WITH = 4,
                OP_LESS_THAN = 5,
                OP_GREATER_THAN = 6,
                OP_LESS_EQUAL = 7,
                OP_GREATER_EQUAL = 8
            };

            match_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent = nullptr, mach_o_t* p__root = nullptr);

        private:
            void _read();
            void _clean_up();

        public:
            ~match_t();

        private:
            op_t m_match_op;
            std::unique_ptr<data_t> m_data;
            bool n_data;

        public:
            bool _is_null_data() { data(); return n_data; };

        private:
            mach_o_t* m__root;
            kaitai::kstruct* m__parent;

        public:
            op_t match_op() const { return m_match_op; }
            data_t* data() const { return m_data.get(); }
            mach_o_t* _root() const { return m__root; }
            kaitai::kstruct* _parent() const { return m__parent; }
        };

        class requirement_t : public kaitai::kstruct {

        public:

            requirement_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

        private:
            void _read();
            void _clean_up();

        public:
            ~requirement_t();

        private:
            uint32_t m_kind;
            std::unique_ptr<expr_t> m_expr;
            mach_o_t* m__root;
            mach_o_t::cs_blob_t* m__parent;

        public:
            uint32_t kind() const { return m_kind; }
            expr_t* expr() const { return m_expr.get(); }
            mach_o_t* _root() const { return m__root; }
            mach_o_t::cs_blob_t* _parent() const { return m__parent; }
        };

        class requirements_t : public kaitai::kstruct {

        public:

            requirements_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

        private:
            void _read();
            void _clean_up();

        public:
            ~requirements_t();

        private:
            uint32_t m_count;
            std::unique_ptr<std::vector<std::unique_ptr<requirements_blob_index_t>>> m_items;
            mach_o_t* m__root;
            mach_o_t::cs_blob_t* m__parent;

        public:
            uint32_t count() const { return m_count; }
            std::vector<std::unique_ptr<requirements_blob_index_t>>* items() const { return m_items.get(); }
            mach_o_t* _root() const { return m__root; }
            mach_o_t::cs_blob_t* _parent() const { return m__parent; }
        };

        class blob_wrapper_t : public kaitai::kstruct {

        public:

            blob_wrapper_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

        private:
            void _read();
            void _clean_up();

        public:
            ~blob_wrapper_t();

        private:
            std::string m_data;
            mach_o_t* m__root;
            mach_o_t::cs_blob_t* m__parent;

        public:
            std::string data() const { return m_data; }
            mach_o_t* _root() const { return m__root; }
            mach_o_t::cs_blob_t* _parent() const { return m__parent; }
        };

        class entitlements_t : public kaitai::kstruct {

        public:

            entitlements_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

        private:
            void _read();
            void _clean_up();

        public:
            ~entitlements_t();

        private:
            std::string m_data;
            mach_o_t* m__root;
            mach_o_t::cs_blob_t* m__parent;

        public:
            std::string data() const { return m_data; }
            mach_o_t* _root() const { return m__root; }
            mach_o_t::cs_blob_t* _parent() const { return m__parent; }
        };

        class requirements_blob_index_t : public kaitai::kstruct {

        public:

            enum requirement_type_t {
                REQUIREMENT_TYPE_HOST = 1,
                REQUIREMENT_TYPE_GUEST = 2,
                REQUIREMENT_TYPE_DESIGNATED = 3,
                REQUIREMENT_TYPE_LIBRARY = 4
            };

            requirements_blob_index_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t::requirements_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

        private:
            void _read();
            void _clean_up();

        public:
            ~requirements_blob_index_t();

        private:
            bool f_value;
            std::unique_ptr<cs_blob_t> m_value;

        public:
            cs_blob_t* value();

        private:
            requirement_type_t m_type;
            uint32_t m_offset;
            mach_o_t* m__root;
            mach_o_t::cs_blob_t::requirements_t* m__parent;

        public:
            requirement_type_t type() const { return m_type; }
            uint32_t offset() const { return m_offset; }
            mach_o_t* _root() const { return m__root; }
            mach_o_t::cs_blob_t::requirements_t* _parent() const { return m__parent; }
        };

    private:
        cs_magic_t m_magic;
        uint32_t m_length;
        std::unique_ptr<kaitai::kstruct> m_body;
        bool n_body;

    public:
        bool _is_null_body() { body(); return n_body; };

    private:
        mach_o_t* m__root;
        kaitai::kstruct* m__parent;
        std::string m__raw_body;
        std::unique_ptr<kaitai::kstream> m__io__raw_body;

    public:
        cs_magic_t magic() const { return m_magic; }
        uint32_t length() const { return m_length; }
        kaitai::kstruct* body() const { return m_body.get(); }
        mach_o_t* _root() const { return m__root; }
        kaitai::kstruct* _parent() const { return m__parent; }
        std::string _raw_body() const { return m__raw_body; }
        kaitai::kstream* _io__raw_body() const { return m__io__raw_body.get(); }
    };

    class build_version_command_t : public kaitai::kstruct {

    public:
        class build_tool_version_t;

        build_version_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~build_version_command_t();

        class build_tool_version_t : public kaitai::kstruct {

        public:

            build_tool_version_t(kaitai::kstream* p__io, mach_o_t::build_version_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

        private:
            void _read();
            void _clean_up();

        public:
            ~build_tool_version_t();

        private:
            uint32_t m_tool;
            uint32_t m_version;
            mach_o_t* m__root;
            mach_o_t::build_version_command_t* m__parent;

        public:
            uint32_t tool() const { return m_tool; }
            uint32_t version() const { return m_version; }
            mach_o_t* _root() const { return m__root; }
            mach_o_t::build_version_command_t* _parent() const { return m__parent; }
        };

    private:
        uint32_t m_platform;
        uint32_t m_minos;
        uint32_t m_sdk;
        uint32_t m_ntools;
        std::unique_ptr<std::vector<std::unique_ptr<build_tool_version_t>>> m_tools;
        mach_o_t* m__root;
        mach_o_t::load_command_t* m__parent;

    public:
        uint32_t platform() const { return m_platform; }
        uint32_t minos() const { return m_minos; }
        uint32_t sdk() const { return m_sdk; }
        uint32_t ntools() const { return m_ntools; }
        std::vector<std::unique_ptr<build_tool_version_t>>* tools() const { return m_tools.get(); }
        mach_o_t* _root() const { return m__root; }
        mach_o_t::load_command_t* _parent() const { return m__parent; }
    };

    class routines_command_t : public kaitai::kstruct {

    public:

        routines_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~routines_command_t();

    private:
        uint32_t m_init_address;
        uint32_t m_init_module;
        std::string m_reserved;
        mach_o_t* m__root;
        mach_o_t::load_command_t* m__parent;

    public:
        uint32_t init_address() const { return m_init_address; }
        uint32_t init_module() const { return m_init_module; }
        std::string reserved() const { return m_reserved; }
        mach_o_t* _root() const { return m__root; }
        mach_o_t::load_command_t* _parent() const { return m__parent; }
    };

    class macho_flags_t : public kaitai::kstruct {

    public:

        macho_flags_t(uint32_t p_value, kaitai::kstream* p__io, mach_o_t::mach_header_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~macho_flags_t();

    private:
        bool f_subsections_via_symbols;
        bool m_subsections_via_symbols;

    public:

        /**
         * safe to divide up the sections into sub-sections via symbols for dead code stripping
         */
        bool subsections_via_symbols();

    private:
        bool f_dead_strippable_dylib;
        bool m_dead_strippable_dylib;

    public:
        bool dead_strippable_dylib();

    private:
        bool f_weak_defines;
        bool m_weak_defines;

    public:

        /**
         * the final linked image contains external weak symbols
         */
        bool weak_defines();

    private:
        bool f_prebound;
        bool m_prebound;

    public:

        /**
         * the file has its dynamic undefined references prebound.
         */
        bool prebound();

    private:
        bool f_all_mods_bound;
        bool m_all_mods_bound;

    public:

        /**
         * indicates that this binary binds to all two-level namespace modules of its dependent libraries. only used when MH_PREBINDABLE and MH_TWOLEVEL are both set.
         */
        bool all_mods_bound();

    private:
        bool f_has_tlv_descriptors;
        bool m_has_tlv_descriptors;

    public:
        bool has_tlv_descriptors();

    private:
        bool f_force_flat;
        bool m_force_flat;

    public:

        /**
         * the executable is forcing all images to use flat name space bindings
         */
        bool force_flat();

    private:
        bool f_root_safe;
        bool m_root_safe;

    public:

        /**
         * When this bit is set, the binary declares it is safe for use in processes with uid zero
         */
        bool root_safe();

    private:
        bool f_no_undefs;
        bool m_no_undefs;

    public:

        /**
         * the object file has no undefined references
         */
        bool no_undefs();

    private:
        bool f_setuid_safe;
        bool m_setuid_safe;

    public:

        /**
         * When this bit is set, the binary declares it is safe for use in processes when issetugid() is true
         */
        bool setuid_safe();

    private:
        bool f_no_heap_execution;
        bool m_no_heap_execution;

    public:
        bool no_heap_execution();

    private:
        bool f_no_reexported_dylibs;
        bool m_no_reexported_dylibs;

    public:

        /**
         * When this bit is set on a dylib, the static linker does not need to examine dependent dylibs to see if any are re-exported
         */
        bool no_reexported_dylibs();

    private:
        bool f_no_multi_defs;
        bool m_no_multi_defs;

    public:

        /**
         * this umbrella guarantees no multiple defintions of symbols in its sub-images so the two-level namespace hints can always be used.
         */
        bool no_multi_defs();

    private:
        bool f_app_extension_safe;
        bool m_app_extension_safe;

    public:
        bool app_extension_safe();

    private:
        bool f_prebindable;
        bool m_prebindable;

    public:

        /**
         * the binary is not prebound but can have its prebinding redone. only used when MH_PREBOUND is not set.
         */
        bool prebindable();

    private:
        bool f_incr_link;
        bool m_incr_link;

    public:

        /**
         * the object file is the output of an incremental link against a base file and can't be link edited again
         */
        bool incr_link();

    private:
        bool f_bind_at_load;
        bool m_bind_at_load;

    public:

        /**
         * the object file's undefined references are bound by the dynamic linker when loaded.
         */
        bool bind_at_load();

    private:
        bool f_canonical;
        bool m_canonical;

    public:

        /**
         * the binary has been canonicalized via the unprebind operation
         */
        bool canonical();

    private:
        bool f_two_level;
        bool m_two_level;

    public:

        /**
         * the image is using two-level name space bindings
         */
        bool two_level();

    private:
        bool f_split_segs;
        bool m_split_segs;

    public:

        /**
         * the file has its read-only and read-write segments split
         */
        bool split_segs();

    private:
        bool f_lazy_init;
        bool m_lazy_init;

    public:

        /**
         * the shared library init routine is to be run lazily via catching memory faults to its writeable segments (obsolete)
         */
        bool lazy_init();

    private:
        bool f_allow_stack_execution;
        bool m_allow_stack_execution;

    public:

        /**
         * When this bit is set, all stacks in the task will be given stack execution privilege.  Only used in MH_EXECUTE filetypes.
         */
        bool allow_stack_execution();

    private:
        bool f_binds_to_weak;
        bool m_binds_to_weak;

    public:

        /**
         * the final linked image uses weak symbols
         */
        bool binds_to_weak();

    private:
        bool f_no_fix_prebinding;
        bool m_no_fix_prebinding;

    public:

        /**
         * do not have dyld notify the prebinding agent about this executable
         */
        bool no_fix_prebinding();

    private:
        bool f_dyld_link;
        bool m_dyld_link;

    public:

        /**
         * the object file is input for the dynamic linker and can't be staticly link edited again
         */
        bool dyld_link();

    private:
        bool f_pie;
        bool m_pie;

    public:

        /**
         * When this bit is set, the OS will load the main executable at a random address. Only used in MH_EXECUTE filetypes.
         */
        bool pie();

    private:
        uint32_t m_value;
        mach_o_t* m__root;
        mach_o_t::mach_header_t* m__parent;

    public:
        uint32_t value() const { return m_value; }
        mach_o_t* _root() const { return m__root; }
        mach_o_t::mach_header_t* _parent() const { return m__parent; }
    };

    class routines_command_64_t : public kaitai::kstruct {

    public:

        routines_command_64_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~routines_command_64_t();

    private:
        uint64_t m_init_address;
        uint64_t m_init_module;
        std::string m_reserved;
        mach_o_t* m__root;
        mach_o_t::load_command_t* m__parent;

    public:
        uint64_t init_address() const { return m_init_address; }
        uint64_t init_module() const { return m_init_module; }
        std::string reserved() const { return m_reserved; }
        mach_o_t* _root() const { return m__root; }
        mach_o_t::load_command_t* _parent() const { return m__parent; }
    };

    class linker_option_command_t : public kaitai::kstruct {

    public:

        linker_option_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~linker_option_command_t();

    private:
        uint32_t m_num_strings;
        std::unique_ptr<std::vector<std::string>> m_strings;
        mach_o_t* m__root;
        mach_o_t::load_command_t* m__parent;

    public:
        uint32_t num_strings() const { return m_num_strings; }
        std::vector<std::string>* strings() const { return m_strings.get(); }
        mach_o_t* _root() const { return m__root; }
        mach_o_t::load_command_t* _parent() const { return m__parent; }
    };

    class segment_command_64_t : public kaitai::kstruct {

    public:
        class section_64_t;

        segment_command_64_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~segment_command_64_t();

        class section_64_t : public kaitai::kstruct {

        public:
            class cf_string_list_t;
            class cf_string_t;
            class eh_frame_item_t;
            class eh_frame_t;
            class pointer_list_t;
            class string_list_t;

            section_64_t(kaitai::kstream* p__io, mach_o_t::segment_command_64_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

        private:
            void _read();
            void _clean_up();

        public:
            ~section_64_t();

            class cf_string_list_t : public kaitai::kstruct {

            public:

                cf_string_list_t(kaitai::kstream* p__io, mach_o_t::segment_command_64_t::section_64_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

            private:
                void _read();
                void _clean_up();

            public:
                ~cf_string_list_t();

            private:
                std::unique_ptr<std::vector<std::unique_ptr<cf_string_t>>> m_items;
                mach_o_t* m__root;
                mach_o_t::segment_command_64_t::section_64_t* m__parent;

            public:
                std::vector<std::unique_ptr<cf_string_t>>* items() const { return m_items.get(); }
                mach_o_t* _root() const { return m__root; }
                mach_o_t::segment_command_64_t::section_64_t* _parent() const { return m__parent; }
            };

            class cf_string_t : public kaitai::kstruct {

            public:

                cf_string_t(kaitai::kstream* p__io, mach_o_t::segment_command_64_t::section_64_t::cf_string_list_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

            private:
                void _read();
                void _clean_up();

            public:
                ~cf_string_t();

            private:
                uint64_t m_isa;
                uint64_t m_info;
                uint64_t m_data;
                uint64_t m_length;
                mach_o_t* m__root;
                mach_o_t::segment_command_64_t::section_64_t::cf_string_list_t* m__parent;

            public:
                uint64_t isa() const { return m_isa; }
                uint64_t info() const { return m_info; }
                uint64_t data() const { return m_data; }
                uint64_t length() const { return m_length; }
                mach_o_t* _root() const { return m__root; }
                mach_o_t::segment_command_64_t::section_64_t::cf_string_list_t* _parent() const { return m__parent; }
            };

            class eh_frame_item_t : public kaitai::kstruct {

            public:
                class char_chain_t;
                class cie_t;
                class augmentation_entry_t;

                eh_frame_item_t(kaitai::kstream* p__io, mach_o_t::segment_command_64_t::section_64_t::eh_frame_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

            private:
                void _read();
                void _clean_up();

            public:
                ~eh_frame_item_t();

                class char_chain_t : public kaitai::kstruct {

                public:

                    char_chain_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent = nullptr, mach_o_t* p__root = nullptr);

                private:
                    void _read();
                    void _clean_up();

                public:
                    ~char_chain_t();

                private:
                    uint8_t m_chr;
                    std::unique_ptr<char_chain_t> m_next;
                    bool n_next;

                public:
                    bool _is_null_next() { next(); return n_next; };

                private:
                    mach_o_t* m__root;
                    kaitai::kstruct* m__parent;

                public:
                    uint8_t chr() const { return m_chr; }
                    char_chain_t* next() const { return m_next.get(); }
                    mach_o_t* _root() const { return m__root; }
                    kaitai::kstruct* _parent() const { return m__parent; }
                };

                class cie_t : public kaitai::kstruct {

                public:

                    cie_t(kaitai::kstream* p__io, mach_o_t::segment_command_64_t::section_64_t::eh_frame_item_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

                private:
                    void _read();
                    void _clean_up();

                public:
                    ~cie_t();

                private:
                    uint8_t m_version;
                    std::unique_ptr<char_chain_t> m_aug_str;
                    std::unique_ptr<uleb128_t> m_code_alignment_factor;
                    std::unique_ptr<uleb128_t> m_data_alignment_factor;
                    uint8_t m_return_address_register;
                    std::unique_ptr<augmentation_entry_t> m_augmentation;
                    bool n_augmentation;

                public:
                    bool _is_null_augmentation() { augmentation(); return n_augmentation; };

                private:
                    mach_o_t* m__root;
                    mach_o_t::segment_command_64_t::section_64_t::eh_frame_item_t* m__parent;

                public:
                    uint8_t version() const { return m_version; }
                    char_chain_t* aug_str() const { return m_aug_str.get(); }
                    uleb128_t* code_alignment_factor() const { return m_code_alignment_factor.get(); }
                    uleb128_t* data_alignment_factor() const { return m_data_alignment_factor.get(); }
                    uint8_t return_address_register() const { return m_return_address_register; }
                    augmentation_entry_t* augmentation() const { return m_augmentation.get(); }
                    mach_o_t* _root() const { return m__root; }
                    mach_o_t::segment_command_64_t::section_64_t::eh_frame_item_t* _parent() const { return m__parent; }
                };

                class augmentation_entry_t : public kaitai::kstruct {

                public:

                    augmentation_entry_t(kaitai::kstream* p__io, mach_o_t::segment_command_64_t::section_64_t::eh_frame_item_t::cie_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

                private:
                    void _read();
                    void _clean_up();

                public:
                    ~augmentation_entry_t();

                private:
                    std::unique_ptr<uleb128_t> m_length;
                    uint8_t m_fde_pointer_encoding;
                    bool n_fde_pointer_encoding;

                public:
                    bool _is_null_fde_pointer_encoding() { fde_pointer_encoding(); return n_fde_pointer_encoding; };

                private:
                    mach_o_t* m__root;
                    mach_o_t::segment_command_64_t::section_64_t::eh_frame_item_t::cie_t* m__parent;

                public:
                    uleb128_t* length() const { return m_length.get(); }
                    uint8_t fde_pointer_encoding() const { return m_fde_pointer_encoding; }
                    mach_o_t* _root() const { return m__root; }
                    mach_o_t::segment_command_64_t::section_64_t::eh_frame_item_t::cie_t* _parent() const { return m__parent; }
                };

            private:
                uint32_t m_length;
                uint64_t m_length64;
                bool n_length64;

            public:
                bool _is_null_length64() { length64(); return n_length64; };

            private:
                uint32_t m_id;
                std::unique_ptr<cie_t> m_body;
                bool n_body;

            public:
                bool _is_null_body() { body(); return n_body; };

            private:
                mach_o_t* m__root;
                mach_o_t::segment_command_64_t::section_64_t::eh_frame_t* m__parent;
                std::string m__raw_body;
                bool n__raw_body;

            public:
                bool _is_null__raw_body() { _raw_body(); return n__raw_body; };

            private:
                std::unique_ptr<kaitai::kstream> m__io__raw_body;

            public:
                uint32_t length() const { return m_length; }
                uint64_t length64() const { return m_length64; }
                uint32_t id() const { return m_id; }
                cie_t* body() const { return m_body.get(); }
                mach_o_t* _root() const { return m__root; }
                mach_o_t::segment_command_64_t::section_64_t::eh_frame_t* _parent() const { return m__parent; }
                std::string _raw_body() const { return m__raw_body; }
                kaitai::kstream* _io__raw_body() const { return m__io__raw_body.get(); }
            };

            class eh_frame_t : public kaitai::kstruct {

            public:

                eh_frame_t(kaitai::kstream* p__io, mach_o_t::segment_command_64_t::section_64_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

            private:
                void _read();
                void _clean_up();

            public:
                ~eh_frame_t();

            private:
                std::unique_ptr<std::vector<std::unique_ptr<eh_frame_item_t>>> m_items;
                mach_o_t* m__root;
                mach_o_t::segment_command_64_t::section_64_t* m__parent;

            public:
                std::vector<std::unique_ptr<eh_frame_item_t>>* items() const { return m_items.get(); }
                mach_o_t* _root() const { return m__root; }
                mach_o_t::segment_command_64_t::section_64_t* _parent() const { return m__parent; }
            };

            class pointer_list_t : public kaitai::kstruct {

            public:

                pointer_list_t(kaitai::kstream* p__io, mach_o_t::segment_command_64_t::section_64_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

            private:
                void _read();
                void _clean_up();

            public:
                ~pointer_list_t();

            private:
                std::unique_ptr<std::vector<uint64_t>> m_items;
                mach_o_t* m__root;
                mach_o_t::segment_command_64_t::section_64_t* m__parent;

            public:
                std::vector<uint64_t>* items() const { return m_items.get(); }
                mach_o_t* _root() const { return m__root; }
                mach_o_t::segment_command_64_t::section_64_t* _parent() const { return m__parent; }
            };

            class string_list_t : public kaitai::kstruct {

            public:

                string_list_t(kaitai::kstream* p__io, mach_o_t::segment_command_64_t::section_64_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

            private:
                void _read();
                void _clean_up();

            public:
                ~string_list_t();

            private:
                std::unique_ptr<std::vector<std::string>> m_strings;
                mach_o_t* m__root;
                mach_o_t::segment_command_64_t::section_64_t* m__parent;

            public:
                std::vector<std::string>* strings() const { return m_strings.get(); }
                mach_o_t* _root() const { return m__root; }
                mach_o_t::segment_command_64_t::section_64_t* _parent() const { return m__parent; }
            };

        private:
            bool f_data;
            std::unique_ptr<kaitai::kstruct> m_data;
            bool n_data;

        public:
            bool _is_null_data() { data(); return n_data; };

        private:

        public:
            kaitai::kstruct* data();

        private:
            std::string m_sect_name;
            std::string m_seg_name;
            uint64_t m_addr;
            uint64_t m_size;
            uint32_t m_offset;
            uint32_t m_align;
            uint32_t m_reloff;
            uint32_t m_nreloc;
            uint32_t m_flags;
            uint32_t m_reserved1;
            uint32_t m_reserved2;
            uint32_t m_reserved3;
            mach_o_t* m__root;
            mach_o_t::segment_command_64_t* m__parent;
            std::string m__raw_data;
            std::unique_ptr<kaitai::kstream> m__io__raw_data;

        public:
            std::string sect_name() const { return m_sect_name; }
            std::string seg_name() const { return m_seg_name; }
            uint64_t addr() const { return m_addr; }
            uint64_t size() const { return m_size; }
            uint32_t offset() const { return m_offset; }
            uint32_t align() const { return m_align; }
            uint32_t reloff() const { return m_reloff; }
            uint32_t nreloc() const { return m_nreloc; }
            uint32_t flags() const { return m_flags; }
            uint32_t reserved1() const { return m_reserved1; }
            uint32_t reserved2() const { return m_reserved2; }
            uint32_t reserved3() const { return m_reserved3; }
            mach_o_t* _root() const { return m__root; }
            mach_o_t::segment_command_64_t* _parent() const { return m__parent; }
            std::string _raw_data() const { return m__raw_data; }
            kaitai::kstream* _io__raw_data() const { return m__io__raw_data.get(); }
        };

    private:
        std::string m_segname;
        uint64_t m_vmaddr;
        uint64_t m_vmsize;
        uint64_t m_fileoff;
        uint64_t m_filesize;
        std::unique_ptr<vm_prot_t> m_maxprot;
        std::unique_ptr<vm_prot_t> m_initprot;
        uint32_t m_nsects;
        uint32_t m_flags;
        std::unique_ptr<std::vector<std::unique_ptr<section_64_t>>> m_sections;
        mach_o_t* m__root;
        mach_o_t::load_command_t* m__parent;

    public:
        std::string segname() const { return m_segname; }
        uint64_t vmaddr() const { return m_vmaddr; }
        uint64_t vmsize() const { return m_vmsize; }
        uint64_t fileoff() const { return m_fileoff; }
        uint64_t filesize() const { return m_filesize; }
        vm_prot_t* maxprot() const { return m_maxprot.get(); }
        vm_prot_t* initprot() const { return m_initprot.get(); }
        uint32_t nsects() const { return m_nsects; }
        uint32_t flags() const { return m_flags; }
        std::vector<std::unique_ptr<section_64_t>>* sections() const { return m_sections.get(); }
        mach_o_t* _root() const { return m__root; }
        mach_o_t::load_command_t* _parent() const { return m__parent; }
    };

    class vm_prot_t : public kaitai::kstruct {

    public:

        vm_prot_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~vm_prot_t();

    private:
        bool m_strip_read;
        bool m_is_mask;
        bool m_reserved0;
        bool m_copy;
        bool m_no_change;
        bool m_execute;
        bool m_write;
        bool m_read;
        uint64_t m_reserved1;
        mach_o_t* m__root;
        kaitai::kstruct* m__parent;

    public:

        /**
         * Special marker to support execute-only protection.
         */
        bool strip_read() const { return m_strip_read; }

        /**
         * Indicates to use value as a mask against the actual protection bits.
         */
        bool is_mask() const { return m_is_mask; }

        /**
         * Reserved (unused) bit.
         */
        bool reserved0() const { return m_reserved0; }

        /**
         * Used when write permission can not be obtained, to mark the entry as COW.
         */
        bool copy() const { return m_copy; }

        /**
         * Used only by memory_object_lock_request to indicate no change to page locks.
         */
        bool no_change() const { return m_no_change; }

        /**
         * Execute permission.
         */
        bool execute() const { return m_execute; }

        /**
         * Write permission.
         */
        bool write() const { return m_write; }

        /**
         * Read permission.
         */
        bool read() const { return m_read; }

        /**
         * Reserved (unused) bits.
         */
        uint64_t reserved1() const { return m_reserved1; }
        mach_o_t* _root() const { return m__root; }
        kaitai::kstruct* _parent() const { return m__parent; }
    };

    class dysymtab_command_t : public kaitai::kstruct {

    public:

        dysymtab_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~dysymtab_command_t();

    private:
        bool f_indirect_symbols;
        std::unique_ptr<std::vector<uint32_t>> m_indirect_symbols;

    public:
        std::vector<uint32_t>* indirect_symbols();

    private:
        uint32_t m_i_local_sym;
        uint32_t m_n_local_sym;
        uint32_t m_i_ext_def_sym;
        uint32_t m_n_ext_def_sym;
        uint32_t m_i_undef_sym;
        uint32_t m_n_undef_sym;
        uint32_t m_toc_off;
        uint32_t m_n_toc;
        uint32_t m_mod_tab_off;
        uint32_t m_n_mod_tab;
        uint32_t m_ext_ref_sym_off;
        uint32_t m_n_ext_ref_syms;
        uint32_t m_indirect_sym_off;
        uint32_t m_n_indirect_syms;
        uint32_t m_ext_rel_off;
        uint32_t m_n_ext_rel;
        uint32_t m_loc_rel_off;
        uint32_t m_n_loc_rel;
        mach_o_t* m__root;
        mach_o_t::load_command_t* m__parent;

    public:
        uint32_t i_local_sym() const { return m_i_local_sym; }
        uint32_t n_local_sym() const { return m_n_local_sym; }
        uint32_t i_ext_def_sym() const { return m_i_ext_def_sym; }
        uint32_t n_ext_def_sym() const { return m_n_ext_def_sym; }
        uint32_t i_undef_sym() const { return m_i_undef_sym; }
        uint32_t n_undef_sym() const { return m_n_undef_sym; }
        uint32_t toc_off() const { return m_toc_off; }
        uint32_t n_toc() const { return m_n_toc; }
        uint32_t mod_tab_off() const { return m_mod_tab_off; }
        uint32_t n_mod_tab() const { return m_n_mod_tab; }
        uint32_t ext_ref_sym_off() const { return m_ext_ref_sym_off; }
        uint32_t n_ext_ref_syms() const { return m_n_ext_ref_syms; }
        uint32_t indirect_sym_off() const { return m_indirect_sym_off; }
        uint32_t n_indirect_syms() const { return m_n_indirect_syms; }
        uint32_t ext_rel_off() const { return m_ext_rel_off; }
        uint32_t n_ext_rel() const { return m_n_ext_rel; }
        uint32_t loc_rel_off() const { return m_loc_rel_off; }
        uint32_t n_loc_rel() const { return m_n_loc_rel; }
        mach_o_t* _root() const { return m__root; }
        mach_o_t::load_command_t* _parent() const { return m__parent; }
    };

    class mach_header_t : public kaitai::kstruct {

    public:

        mach_header_t(kaitai::kstream* p__io, mach_o_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~mach_header_t();

    private:
        bool f_flags_obj;
        std::unique_ptr<macho_flags_t> m_flags_obj;

    public:
        macho_flags_t* flags_obj();

    private:
        cpu_type_t m_cputype;
        uint32_t m_cpusubtype;
        file_type_t m_filetype;
        uint32_t m_ncmds;
        uint32_t m_sizeofcmds;
        uint32_t m_flags;
        uint32_t m_reserved;
        bool n_reserved;

    public:
        bool _is_null_reserved() { reserved(); return n_reserved; };

    private:
        mach_o_t* m__root;
        mach_o_t* m__parent;

    public:
        cpu_type_t cputype() const { return m_cputype; }
        uint32_t cpusubtype() const { return m_cpusubtype; }
        file_type_t filetype() const { return m_filetype; }
        uint32_t ncmds() const { return m_ncmds; }
        uint32_t sizeofcmds() const { return m_sizeofcmds; }
        uint32_t flags() const { return m_flags; }
        uint32_t reserved() const { return m_reserved; }
        mach_o_t* _root() const { return m__root; }
        mach_o_t* _parent() const { return m__parent; }
    };

    class linkedit_data_command_t : public kaitai::kstruct {

    public:

        linkedit_data_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~linkedit_data_command_t();

    private:
        uint32_t m_data_off;
        uint32_t m_data_size;
        mach_o_t* m__root;
        mach_o_t::load_command_t* m__parent;

    public:
        uint32_t data_off() const { return m_data_off; }
        uint32_t data_size() const { return m_data_size; }
        mach_o_t* _root() const { return m__root; }
        mach_o_t::load_command_t* _parent() const { return m__parent; }
    };

    class sub_command_t : public kaitai::kstruct {

    public:

        sub_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~sub_command_t();

    private:
        std::unique_ptr<lc_str_t> m_name;
        mach_o_t* m__root;
        mach_o_t::load_command_t* m__parent;

    public:
        lc_str_t* name() const { return m_name.get(); }
        mach_o_t* _root() const { return m__root; }
        mach_o_t::load_command_t* _parent() const { return m__parent; }
    };

    class twolevel_hints_command_t : public kaitai::kstruct {

    public:

        twolevel_hints_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~twolevel_hints_command_t();

    private:
        uint32_t m_offset;
        uint32_t m_num_hints;
        mach_o_t* m__root;
        mach_o_t::load_command_t* m__parent;

    public:
        uint32_t offset() const { return m_offset; }
        uint32_t num_hints() const { return m_num_hints; }
        mach_o_t* _root() const { return m__root; }
        mach_o_t::load_command_t* _parent() const { return m__parent; }
    };

    class version_t : public kaitai::kstruct {

    public:

        version_t(kaitai::kstream* p__io, mach_o_t::version_min_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~version_t();

    private:
        uint8_t m_p1;
        uint8_t m_minor;
        uint8_t m_major;
        uint8_t m_release;
        mach_o_t* m__root;
        mach_o_t::version_min_command_t* m__parent;

    public:
        uint8_t p1() const { return m_p1; }
        uint8_t minor() const { return m_minor; }
        uint8_t major() const { return m_major; }
        uint8_t release() const { return m_release; }
        mach_o_t* _root() const { return m__root; }
        mach_o_t::version_min_command_t* _parent() const { return m__parent; }
    };

    class encryption_info_command_t : public kaitai::kstruct {

    public:

        encryption_info_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~encryption_info_command_t();

    private:
        uint32_t m_cryptoff;
        uint32_t m_cryptsize;
        uint32_t m_cryptid;
        uint32_t m_pad;
        bool n_pad;

    public:
        bool _is_null_pad() { pad(); return n_pad; };

    private:
        mach_o_t* m__root;
        mach_o_t::load_command_t* m__parent;

    public:
        uint32_t cryptoff() const { return m_cryptoff; }
        uint32_t cryptsize() const { return m_cryptsize; }
        uint32_t cryptid() const { return m_cryptid; }
        uint32_t pad() const { return m_pad; }
        mach_o_t* _root() const { return m__root; }
        mach_o_t::load_command_t* _parent() const { return m__parent; }
    };

    class code_signature_command_t : public kaitai::kstruct {

    public:

        code_signature_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~code_signature_command_t();

    private:
        bool f_code_signature;
        std::unique_ptr<cs_blob_t> m_code_signature;

    public:
        cs_blob_t* code_signature();

    private:
        uint32_t m_data_off;
        uint32_t m_data_size;
        mach_o_t* m__root;
        mach_o_t::load_command_t* m__parent;
        std::string m__raw_code_signature;
        std::unique_ptr<kaitai::kstream> m__io__raw_code_signature;

    public:
        uint32_t data_off() const { return m_data_off; }
        uint32_t data_size() const { return m_data_size; }
        mach_o_t* _root() const { return m__root; }
        mach_o_t::load_command_t* _parent() const { return m__parent; }
        std::string _raw_code_signature() const { return m__raw_code_signature; }
        kaitai::kstream* _io__raw_code_signature() const { return m__io__raw_code_signature.get(); }
    };

    class dyld_info_command_t : public kaitai::kstruct {

    public:
        class rebase_data_t;
        class bind_item_t;
        class bind_data_t;
        class export_node_t;

        enum bind_opcode_t {
            BIND_OPCODE_DONE = 0,
            BIND_OPCODE_SET_DYLIB_ORDINAL_IMMEDIATE = 16,
            BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB = 32,
            BIND_OPCODE_SET_DYLIB_SPECIAL_IMMEDIATE = 48,
            BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMMEDIATE = 64,
            BIND_OPCODE_SET_TYPE_IMMEDIATE = 80,
            BIND_OPCODE_SET_APPEND_SLEB = 96,
            BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB = 112,
            BIND_OPCODE_ADD_ADDRESS_ULEB = 128,
            BIND_OPCODE_DO_BIND = 144,
            BIND_OPCODE_DO_BIND_ADD_ADDRESS_ULEB = 160,
            BIND_OPCODE_DO_BIND_ADD_ADDRESS_IMMEDIATE_SCALED = 176,
            BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB = 192
        };

        dyld_info_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~dyld_info_command_t();

        class rebase_data_t : public kaitai::kstruct {

        public:
            class rebase_item_t;

            enum opcode_t {
                OPCODE_DONE = 0,
                OPCODE_SET_TYPE_IMMEDIATE = 16,
                OPCODE_SET_SEGMENT_AND_OFFSET_ULEB = 32,
                OPCODE_ADD_ADDRESS_ULEB = 48,
                OPCODE_ADD_ADDRESS_IMMEDIATE_SCALED = 64,
                OPCODE_DO_REBASE_IMMEDIATE_TIMES = 80,
                OPCODE_DO_REBASE_ULEB_TIMES = 96,
                OPCODE_DO_REBASE_ADD_ADDRESS_ULEB = 112,
                OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB = 128
            };

            rebase_data_t(kaitai::kstream* p__io, mach_o_t::dyld_info_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

        private:
            void _read();
            void _clean_up();

        public:
            ~rebase_data_t();

            class rebase_item_t : public kaitai::kstruct {

            public:

                rebase_item_t(kaitai::kstream* p__io, mach_o_t::dyld_info_command_t::rebase_data_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

            private:
                void _read();
                void _clean_up();

            public:
                ~rebase_item_t();

            private:
                bool f_opcode;
                opcode_t m_opcode;

            public:
                opcode_t opcode();

            private:
                bool f_immediate;
                int32_t m_immediate;

            public:
                int32_t immediate();

            private:
                uint8_t m_opcode_and_immediate;
                std::unique_ptr<uleb128_t> m_uleb;
                bool n_uleb;

            public:
                bool _is_null_uleb() { uleb(); return n_uleb; };

            private:
                std::unique_ptr<uleb128_t> m_skip;
                bool n_skip;

            public:
                bool _is_null_skip() { skip(); return n_skip; };

            private:
                mach_o_t* m__root;
                mach_o_t::dyld_info_command_t::rebase_data_t* m__parent;

            public:
                uint8_t opcode_and_immediate() const { return m_opcode_and_immediate; }
                uleb128_t* uleb() const { return m_uleb.get(); }
                uleb128_t* skip() const { return m_skip.get(); }
                mach_o_t* _root() const { return m__root; }
                mach_o_t::dyld_info_command_t::rebase_data_t* _parent() const { return m__parent; }
            };

        private:
            std::unique_ptr<std::vector<std::unique_ptr<rebase_item_t>>> m_items;
            mach_o_t* m__root;
            mach_o_t::dyld_info_command_t* m__parent;

        public:
            std::vector<std::unique_ptr<rebase_item_t>>* items() const { return m_items.get(); }
            mach_o_t* _root() const { return m__root; }
            mach_o_t::dyld_info_command_t* _parent() const { return m__parent; }
        };

        class bind_item_t : public kaitai::kstruct {

        public:

            bind_item_t(kaitai::kstream* p__io, mach_o_t::dyld_info_command_t::bind_data_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

        private:
            void _read();
            void _clean_up();

        public:
            ~bind_item_t();

        private:
            bool f_opcode;
            bind_opcode_t m_opcode;

        public:
            bind_opcode_t opcode();

        private:
            bool f_immediate;
            int32_t m_immediate;

        public:
            int32_t immediate();

        private:
            uint8_t m_opcode_and_immediate;
            std::unique_ptr<uleb128_t> m_uleb;
            bool n_uleb;

        public:
            bool _is_null_uleb() { uleb(); return n_uleb; };

        private:
            std::unique_ptr<uleb128_t> m_skip;
            bool n_skip;

        public:
            bool _is_null_skip() { skip(); return n_skip; };

        private:
            std::string m_symbol;
            bool n_symbol;

        public:
            bool _is_null_symbol() { symbol(); return n_symbol; };

        private:
            mach_o_t* m__root;
            mach_o_t::dyld_info_command_t::bind_data_t* m__parent;

        public:
            uint8_t opcode_and_immediate() const { return m_opcode_and_immediate; }
            uleb128_t* uleb() const { return m_uleb.get(); }
            uleb128_t* skip() const { return m_skip.get(); }
            std::string symbol() const { return m_symbol; }
            mach_o_t* _root() const { return m__root; }
            mach_o_t::dyld_info_command_t::bind_data_t* _parent() const { return m__parent; }
        };

        class bind_data_t : public kaitai::kstruct {

        public:

            bind_data_t(kaitai::kstream* p__io, mach_o_t::dyld_info_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

        private:
            void _read();
            void _clean_up();

        public:
            ~bind_data_t();

        private:
            std::unique_ptr<std::vector<std::unique_ptr<bind_item_t>>> m_items;
            mach_o_t* m__root;
            mach_o_t::dyld_info_command_t* m__parent;

        public:
            std::vector<std::unique_ptr<bind_item_t>>* items() const { return m_items.get(); }
            mach_o_t* _root() const { return m__root; }
            mach_o_t::dyld_info_command_t* _parent() const { return m__parent; }
        };

        class export_node_t : public kaitai::kstruct {

        public:
            class child_t;

            export_node_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent = nullptr, mach_o_t* p__root = nullptr);

        private:
            void _read();
            void _clean_up();

        public:
            ~export_node_t();

            class child_t : public kaitai::kstruct {

            public:

                child_t(kaitai::kstream* p__io, mach_o_t::dyld_info_command_t::export_node_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

            private:
                void _read();
                void _clean_up();

            public:
                ~child_t();

            private:
                bool f_value;
                std::unique_ptr<export_node_t> m_value;

            public:
                export_node_t* value();

            private:
                std::string m_name;
                std::unique_ptr<uleb128_t> m_node_offset;
                mach_o_t* m__root;
                mach_o_t::dyld_info_command_t::export_node_t* m__parent;

            public:
                std::string name() const { return m_name; }
                uleb128_t* node_offset() const { return m_node_offset.get(); }
                mach_o_t* _root() const { return m__root; }
                mach_o_t::dyld_info_command_t::export_node_t* _parent() const { return m__parent; }
            };

        private:
            std::unique_ptr<uleb128_t> m_terminal_size;
            uint8_t m_children_count;
            std::unique_ptr<std::vector<std::unique_ptr<child_t>>> m_children;
            std::string m_terminal;
            mach_o_t* m__root;
            kaitai::kstruct* m__parent;

        public:
            uleb128_t* terminal_size() const { return m_terminal_size.get(); }
            uint8_t children_count() const { return m_children_count; }
            std::vector<std::unique_ptr<child_t>>* children() const { return m_children.get(); }
            std::string terminal() const { return m_terminal; }
            mach_o_t* _root() const { return m__root; }
            kaitai::kstruct* _parent() const { return m__parent; }
        };

    private:
        bool f_bind;
        std::unique_ptr<bind_data_t> m_bind;
        bool n_bind;

    public:
        bool _is_null_bind() { bind(); return n_bind; };

    private:

    public:
        bind_data_t* bind();

    private:
        bool f_exports;
        std::unique_ptr<export_node_t> m_exports;
        bool n_exports;

    public:
        bool _is_null_exports() { exports(); return n_exports; };

    private:

    public:
        export_node_t* exports();

    private:
        bool f_weak_bind;
        std::unique_ptr<bind_data_t> m_weak_bind;
        bool n_weak_bind;

    public:
        bool _is_null_weak_bind() { weak_bind(); return n_weak_bind; };

    private:

    public:
        bind_data_t* weak_bind();

    private:
        bool f_rebase;
        std::unique_ptr<rebase_data_t> m_rebase;
        bool n_rebase;

    public:
        bool _is_null_rebase() { rebase(); return n_rebase; };

    private:

    public:
        rebase_data_t* rebase();

    private:
        bool f_lazy_bind;
        std::unique_ptr<bind_data_t> m_lazy_bind;
        bool n_lazy_bind;

    public:
        bool _is_null_lazy_bind() { lazy_bind(); return n_lazy_bind; };

    private:

    public:
        bind_data_t* lazy_bind();

    private:
        uint32_t m_rebase_off;
        uint32_t m_rebase_size;
        uint32_t m_bind_off;
        uint32_t m_bind_size;
        uint32_t m_weak_bind_off;
        uint32_t m_weak_bind_size;
        uint32_t m_lazy_bind_off;
        uint32_t m_lazy_bind_size;
        uint32_t m_export_off;
        uint32_t m_export_size;
        mach_o_t* m__root;
        mach_o_t::load_command_t* m__parent;
        std::string m__raw_bind;
        bool n__raw_bind;

    public:
        bool _is_null__raw_bind() { _raw_bind(); return n__raw_bind; };

    private:
        std::unique_ptr<kaitai::kstream> m__io__raw_bind;
        std::string m__raw_exports;
        bool n__raw_exports;

    public:
        bool _is_null__raw_exports() { _raw_exports(); return n__raw_exports; };

    private:
        std::unique_ptr<kaitai::kstream> m__io__raw_exports;
        std::string m__raw_weak_bind;
        bool n__raw_weak_bind;

    public:
        bool _is_null__raw_weak_bind() { _raw_weak_bind(); return n__raw_weak_bind; };

    private:
        std::unique_ptr<kaitai::kstream> m__io__raw_weak_bind;
        std::string m__raw_rebase;
        bool n__raw_rebase;

    public:
        bool _is_null__raw_rebase() { _raw_rebase(); return n__raw_rebase; };

    private:
        std::unique_ptr<kaitai::kstream> m__io__raw_rebase;
        std::string m__raw_lazy_bind;
        bool n__raw_lazy_bind;

    public:
        bool _is_null__raw_lazy_bind() { _raw_lazy_bind(); return n__raw_lazy_bind; };

    private:
        std::unique_ptr<kaitai::kstream> m__io__raw_lazy_bind;

    public:
        uint32_t rebase_off() const { return m_rebase_off; }
        uint32_t rebase_size() const { return m_rebase_size; }
        uint32_t bind_off() const { return m_bind_off; }
        uint32_t bind_size() const { return m_bind_size; }
        uint32_t weak_bind_off() const { return m_weak_bind_off; }
        uint32_t weak_bind_size() const { return m_weak_bind_size; }
        uint32_t lazy_bind_off() const { return m_lazy_bind_off; }
        uint32_t lazy_bind_size() const { return m_lazy_bind_size; }
        uint32_t export_off() const { return m_export_off; }
        uint32_t export_size() const { return m_export_size; }
        mach_o_t* _root() const { return m__root; }
        mach_o_t::load_command_t* _parent() const { return m__parent; }
        std::string _raw_bind() const { return m__raw_bind; }
        kaitai::kstream* _io__raw_bind() const { return m__io__raw_bind.get(); }
        std::string _raw_exports() const { return m__raw_exports; }
        kaitai::kstream* _io__raw_exports() const { return m__io__raw_exports.get(); }
        std::string _raw_weak_bind() const { return m__raw_weak_bind; }
        kaitai::kstream* _io__raw_weak_bind() const { return m__io__raw_weak_bind.get(); }
        std::string _raw_rebase() const { return m__raw_rebase; }
        kaitai::kstream* _io__raw_rebase() const { return m__io__raw_rebase.get(); }
        std::string _raw_lazy_bind() const { return m__raw_lazy_bind; }
        kaitai::kstream* _io__raw_lazy_bind() const { return m__io__raw_lazy_bind.get(); }
    };

    class dylinker_command_t : public kaitai::kstruct {

    public:

        dylinker_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~dylinker_command_t();

    private:
        std::unique_ptr<lc_str_t> m_name;
        mach_o_t* m__root;
        mach_o_t::load_command_t* m__parent;

    public:
        lc_str_t* name() const { return m_name.get(); }
        mach_o_t* _root() const { return m__root; }
        mach_o_t::load_command_t* _parent() const { return m__parent; }
    };

    class dylib_command_t : public kaitai::kstruct {

    public:

        dylib_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~dylib_command_t();

    private:
        uint32_t m_name_offset;
        uint32_t m_timestamp;
        uint32_t m_current_version;
        uint32_t m_compatibility_version;
        std::string m_name;
        mach_o_t* m__root;
        mach_o_t::load_command_t* m__parent;

    public:
        uint32_t name_offset() const { return m_name_offset; }
        uint32_t timestamp() const { return m_timestamp; }
        uint32_t current_version() const { return m_current_version; }
        uint32_t compatibility_version() const { return m_compatibility_version; }
        std::string name() const { return m_name; }
        mach_o_t* _root() const { return m__root; }
        mach_o_t::load_command_t* _parent() const { return m__parent; }
    };

    class segment_command_t : public kaitai::kstruct {

    public:
        class section_t;

        segment_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~segment_command_t();

        class section_t : public kaitai::kstruct {

        public:

            section_t(kaitai::kstream* p__io, mach_o_t::segment_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

        private:
            void _read();
            void _clean_up();

        public:
            ~section_t();

        private:
            bool f_data;
            std::string m_data;

        public:
            std::string data();

        private:
            std::string m_sect_name;
            std::string m_seg_name;
            uint32_t m_addr;
            uint32_t m_size;
            uint32_t m_offset;
            uint32_t m_align;
            uint32_t m_reloff;
            uint32_t m_nreloc;
            uint32_t m_flags;
            uint32_t m_reserved1;
            uint32_t m_reserved2;
            mach_o_t* m__root;
            mach_o_t::segment_command_t* m__parent;

        public:
            std::string sect_name() const { return m_sect_name; }
            std::string seg_name() const { return m_seg_name; }
            uint32_t addr() const { return m_addr; }
            uint32_t size() const { return m_size; }
            uint32_t offset() const { return m_offset; }
            uint32_t align() const { return m_align; }
            uint32_t reloff() const { return m_reloff; }
            uint32_t nreloc() const { return m_nreloc; }
            uint32_t flags() const { return m_flags; }
            uint32_t reserved1() const { return m_reserved1; }
            uint32_t reserved2() const { return m_reserved2; }
            mach_o_t* _root() const { return m__root; }
            mach_o_t::segment_command_t* _parent() const { return m__parent; }
        };

    private:
        std::string m_segname;
        uint32_t m_vmaddr;
        uint32_t m_vmsize;
        uint32_t m_fileoff;
        uint32_t m_filesize;
        std::unique_ptr<vm_prot_t> m_maxprot;
        std::unique_ptr<vm_prot_t> m_initprot;
        uint32_t m_nsects;
        uint32_t m_flags;
        std::unique_ptr<std::vector<std::unique_ptr<section_t>>> m_sections;
        mach_o_t* m__root;
        mach_o_t::load_command_t* m__parent;

    public:
        std::string segname() const { return m_segname; }
        uint32_t vmaddr() const { return m_vmaddr; }
        uint32_t vmsize() const { return m_vmsize; }
        uint32_t fileoff() const { return m_fileoff; }
        uint32_t filesize() const { return m_filesize; }
        vm_prot_t* maxprot() const { return m_maxprot.get(); }
        vm_prot_t* initprot() const { return m_initprot.get(); }
        uint32_t nsects() const { return m_nsects; }
        uint32_t flags() const { return m_flags; }
        std::vector<std::unique_ptr<section_t>>* sections() const { return m_sections.get(); }
        mach_o_t* _root() const { return m__root; }
        mach_o_t::load_command_t* _parent() const { return m__parent; }
    };

    class lc_str_t : public kaitai::kstruct {

    public:

        lc_str_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~lc_str_t();

    private:
        uint32_t m_length;
        std::string m_value;
        mach_o_t* m__root;
        kaitai::kstruct* m__parent;

    public:
        uint32_t length() const { return m_length; }
        std::string value() const { return m_value; }
        mach_o_t* _root() const { return m__root; }
        kaitai::kstruct* _parent() const { return m__parent; }
    };

    class load_command_t : public kaitai::kstruct {

    public:

        load_command_t(kaitai::kstream* p__io, mach_o_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~load_command_t();

    private:
        load_command_type_t m_type;
        uint32_t m_size;
        std::unique_ptr<kaitai::kstruct> m_body;
        bool n_body;

    public:
        bool _is_null_body() { body(); return n_body; };

    private:
        mach_o_t* m__root;
        mach_o_t* m__parent;
        std::string m__raw_body;
        std::unique_ptr<kaitai::kstream> m__io__raw_body;

    public:
        load_command_type_t type() const { return m_type; }
        uint32_t size() const { return m_size; }
        kaitai::kstruct* body() const { return m_body.get(); }
        mach_o_t* _root() const { return m__root; }
        mach_o_t* _parent() const { return m__parent; }
        std::string _raw_body() const { return m__raw_body; }
        kaitai::kstream* _io__raw_body() const { return m__io__raw_body.get(); }
    };

    class uuid_command_t : public kaitai::kstruct {

    public:

        uuid_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~uuid_command_t();

    private:
        std::string m_uuid;
        mach_o_t* m__root;
        mach_o_t::load_command_t* m__parent;

    public:
        std::string uuid() const { return m_uuid; }
        mach_o_t* _root() const { return m__root; }
        mach_o_t::load_command_t* _parent() const { return m__parent; }
    };

    class symtab_command_t : public kaitai::kstruct {

    public:
        class str_table_t;
        class nlist_64_t;
        class nlist_t;

        symtab_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~symtab_command_t();

        class str_table_t : public kaitai::kstruct {

        public:

            str_table_t(kaitai::kstream* p__io, mach_o_t::symtab_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

        private:
            void _read();
            void _clean_up();

        public:
            ~str_table_t();

        private:
            uint32_t m_unknown;
            std::unique_ptr<std::vector<std::string>> m_items;
            mach_o_t* m__root;
            mach_o_t::symtab_command_t* m__parent;

        public:
            uint32_t unknown() const { return m_unknown; }
            std::vector<std::string>* items() const { return m_items.get(); }
            mach_o_t* _root() const { return m__root; }
            mach_o_t::symtab_command_t* _parent() const { return m__parent; }
        };

        class nlist_64_t : public kaitai::kstruct {

        public:

            nlist_64_t(kaitai::kstream* p__io, mach_o_t::symtab_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

        private:
            void _read();
            void _clean_up();

        public:
            ~nlist_64_t();

        private:
            bool f_name;
            std::string m_name;
            bool n_name;

        public:
            bool _is_null_name() { name(); return n_name; };

        private:

        public:
            std::string name();

        private:
            uint32_t m_un;
            uint8_t m_type;
            uint8_t m_sect;
            uint16_t m_desc;
            uint64_t m_value;
            mach_o_t* m__root;
            mach_o_t::symtab_command_t* m__parent;

        public:
            uint32_t un() const { return m_un; }
            uint8_t type() const { return m_type; }
            uint8_t sect() const { return m_sect; }
            uint16_t desc() const { return m_desc; }
            uint64_t value() const { return m_value; }
            mach_o_t* _root() const { return m__root; }
            mach_o_t::symtab_command_t* _parent() const { return m__parent; }
        };

        class nlist_t : public kaitai::kstruct {

        public:

            nlist_t(kaitai::kstream* p__io, mach_o_t::symtab_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

        private:
            void _read();
            void _clean_up();

        public:
            ~nlist_t();

        private:
            bool f_name;
            std::string m_name;
            bool n_name;

        public:
            bool _is_null_name() { name(); return n_name; };

        private:

        public:
            std::string name();

        private:
            uint32_t m_un;
            uint8_t m_type;
            uint8_t m_sect;
            uint16_t m_desc;
            uint32_t m_value;
            mach_o_t* m__root;
            mach_o_t::symtab_command_t* m__parent;

        public:
            uint32_t un() const { return m_un; }
            uint8_t type() const { return m_type; }
            uint8_t sect() const { return m_sect; }
            uint16_t desc() const { return m_desc; }
            uint32_t value() const { return m_value; }
            mach_o_t* _root() const { return m__root; }
            mach_o_t::symtab_command_t* _parent() const { return m__parent; }
        };

    private:
        bool f_symbols;
        std::unique_ptr<std::vector<std::unique_ptr<kaitai::kstruct>>> m_symbols;

    public:
        std::vector<std::unique_ptr<kaitai::kstruct>>* symbols();

    private:
        bool f_strs;
        std::unique_ptr<str_table_t> m_strs;

    public:
        str_table_t* strs();

    private:
        uint32_t m_sym_off;
        uint32_t m_n_syms;
        uint32_t m_str_off;
        uint32_t m_str_size;
        mach_o_t* m__root;
        mach_o_t::load_command_t* m__parent;
        std::string m__raw_strs;
        std::unique_ptr<kaitai::kstream> m__io__raw_strs;

    public:
        uint32_t sym_off() const { return m_sym_off; }
        uint32_t n_syms() const { return m_n_syms; }
        uint32_t str_off() const { return m_str_off; }
        uint32_t str_size() const { return m_str_size; }
        mach_o_t* _root() const { return m__root; }
        mach_o_t::load_command_t* _parent() const { return m__parent; }
        std::string _raw_strs() const { return m__raw_strs; }
        kaitai::kstream* _io__raw_strs() const { return m__io__raw_strs.get(); }
    };

    class version_min_command_t : public kaitai::kstruct {

    public:

        version_min_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~version_min_command_t();

    private:
        std::unique_ptr<version_t> m_version;
        std::unique_ptr<version_t> m_sdk;
        mach_o_t* m__root;
        mach_o_t::load_command_t* m__parent;

    public:
        version_t* version() const { return m_version.get(); }
        version_t* sdk() const { return m_sdk.get(); }
        mach_o_t* _root() const { return m__root; }
        mach_o_t::load_command_t* _parent() const { return m__parent; }
    };

    class entry_point_command_t : public kaitai::kstruct {

    public:

        entry_point_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent = nullptr, mach_o_t* p__root = nullptr);

    private:
        void _read();
        void _clean_up();

    public:
        ~entry_point_command_t();

    private:
        uint64_t m_entry_off;
        uint64_t m_stack_size;
        mach_o_t* m__root;
        mach_o_t::load_command_t* m__parent;

    public:
        uint64_t entry_off() const { return m_entry_off; }
        uint64_t stack_size() const { return m_stack_size; }
        mach_o_t* _root() const { return m__root; }
        mach_o_t::load_command_t* _parent() const { return m__parent; }
    };

private:
    magic_type_t m_magic;
    std::unique_ptr<mach_header_t> m_header;
    std::unique_ptr<std::vector<std::unique_ptr<load_command_t>>> m_load_commands;
    mach_o_t* m__root;
    kaitai::kstruct* m__parent;

public:
    magic_type_t magic() const { return m_magic; }
    mach_header_t* header() const { return m_header.get(); }
    std::vector<std::unique_ptr<load_command_t>>* load_commands() const { return m_load_commands.get(); }
    mach_o_t* _root() const { return m__root; }
    kaitai::kstruct* _parent() const { return m__parent; }
};

mach_o.cpp

// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild

#include "mach_o.h"

mach_o_t::mach_o_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = this;
    m_header = nullptr;
    m_load_commands = nullptr;
    _read();
}

void mach_o_t::_read() {
    m_magic = static_cast<mach_o_t::magic_type_t>(m__io->read_u4be());
    m_header = std::unique_ptr<mach_header_t>(new mach_header_t(m__io, this, m__root));
    m_load_commands = std::unique_ptr<std::vector<std::unique_ptr<load_command_t>>>(new std::vector<std::unique_ptr<load_command_t>>());
    const int l_load_commands = header()->ncmds();
    for (int i = 0; i < l_load_commands; i++) {
        m_load_commands->push_back(std::move(std::unique_ptr<load_command_t>(new load_command_t(m__io, this, m__root))));
    }
}

mach_o_t::~mach_o_t() {
    _clean_up();
}

void mach_o_t::_clean_up() {
}

mach_o_t::rpath_command_t::rpath_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    _read();
}

void mach_o_t::rpath_command_t::_read() {
    m_path_offset = m__io->read_u4le();
    m_path = kaitai::kstream::bytes_to_str(m__io->read_bytes_term(0, false, true, true), std::string("utf-8"));
}

mach_o_t::rpath_command_t::~rpath_command_t() {
    _clean_up();
}

void mach_o_t::rpath_command_t::_clean_up() {
}

mach_o_t::uleb128_t::uleb128_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    f_value = false;
    _read();
}

void mach_o_t::uleb128_t::_read() {
    m_b1 = m__io->read_u1();
    n_b2 = true;
    if ((b1() & 128) != 0) {
        n_b2 = false;
        m_b2 = m__io->read_u1();
    }
    n_b3 = true;
    if ((b2() & 128) != 0) {
        n_b3 = false;
        m_b3 = m__io->read_u1();
    }
    n_b4 = true;
    if ((b3() & 128) != 0) {
        n_b4 = false;
        m_b4 = m__io->read_u1();
    }
    n_b5 = true;
    if ((b4() & 128) != 0) {
        n_b5 = false;
        m_b5 = m__io->read_u1();
    }
    n_b6 = true;
    if ((b5() & 128) != 0) {
        n_b6 = false;
        m_b6 = m__io->read_u1();
    }
    n_b7 = true;
    if ((b6() & 128) != 0) {
        n_b7 = false;
        m_b7 = m__io->read_u1();
    }
    n_b8 = true;
    if ((b7() & 128) != 0) {
        n_b8 = false;
        m_b8 = m__io->read_u1();
    }
    n_b9 = true;
    if ((b8() & 128) != 0) {
        n_b9 = false;
        m_b9 = m__io->read_u1();
    }
    n_b10 = true;
    if ((b9() & 128) != 0) {
        n_b10 = false;
        m_b10 = m__io->read_u1();
    }
}

mach_o_t::uleb128_t::~uleb128_t() {
    _clean_up();
}

void mach_o_t::uleb128_t::_clean_up() {
    if (!n_b2) {
    }
    if (!n_b3) {
    }
    if (!n_b4) {
    }
    if (!n_b5) {
    }
    if (!n_b6) {
    }
    if (!n_b7) {
    }
    if (!n_b8) {
    }
    if (!n_b9) {
    }
    if (!n_b10) {
    }
}

int32_t mach_o_t::uleb128_t::value() {
    if (f_value)
        return m_value;
    m_value = ((kaitai::kstream::mod(b1(), 128) << 0) + (((b1() & 128) == 0) ? (0) : (((kaitai::kstream::mod(b2(), 128) << 7) + (((b2() & 128) == 0) ? (0) : (((kaitai::kstream::mod(b3(), 128) << 14) + (((b3() & 128) == 0) ? (0) : (((kaitai::kstream::mod(b4(), 128) << 21) + (((b4() & 128) == 0) ? (0) : (((kaitai::kstream::mod(b5(), 128) << 28) + (((b5() & 128) == 0) ? (0) : (((kaitai::kstream::mod(b6(), 128) << 35) + (((b6() & 128) == 0) ? (0) : (((kaitai::kstream::mod(b7(), 128) << 42) + (((b7() & 128) == 0) ? (0) : (((kaitai::kstream::mod(b8(), 128) << 49) + (((b8() & 128) == 0) ? (0) : (((kaitai::kstream::mod(b9(), 128) << 56) + (((b8() & 128) == 0) ? (0) : ((kaitai::kstream::mod(b10(), 128) << 63))))))))))))))))))))))))))));
    f_value = true;
    return m_value;
}

mach_o_t::source_version_command_t::source_version_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    _read();
}

void mach_o_t::source_version_command_t::_read() {
    m_version = m__io->read_u8le();
}

mach_o_t::source_version_command_t::~source_version_command_t() {
    _clean_up();
}

void mach_o_t::source_version_command_t::_clean_up() {
}

mach_o_t::cs_blob_t::cs_blob_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m__io__raw_body = nullptr;
    _read();
}

void mach_o_t::cs_blob_t::_read() {
    m_magic = static_cast<mach_o_t::cs_blob_t::cs_magic_t>(m__io->read_u4be());
    m_length = m__io->read_u4be();
    n_body = true;
    switch (magic()) {
    case mach_o_t::cs_blob_t::CS_MAGIC_REQUIREMENT: {
        n_body = false;
        m__raw_body = m__io->read_bytes((length() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<requirement_t>(new requirement_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::cs_blob_t::CS_MAGIC_CODE_DIRECTORY: {
        n_body = false;
        m__raw_body = m__io->read_bytes((length() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<code_directory_t>(new code_directory_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::cs_blob_t::CS_MAGIC_REQUIREMENTS: {
        n_body = false;
        m__raw_body = m__io->read_bytes((length() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<requirements_t>(new requirements_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::cs_blob_t::CS_MAGIC_BLOB_WRAPPER: {
        n_body = false;
        m__raw_body = m__io->read_bytes((length() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<blob_wrapper_t>(new blob_wrapper_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::cs_blob_t::CS_MAGIC_EMBEDDED_SIGNATURE: {
        n_body = false;
        m__raw_body = m__io->read_bytes((length() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<super_blob_t>(new super_blob_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::cs_blob_t::CS_MAGIC_ENTITLEMENTS: {
        n_body = false;
        m__raw_body = m__io->read_bytes((length() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<entitlements_t>(new entitlements_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::cs_blob_t::CS_MAGIC_DETACHED_SIGNATURE: {
        n_body = false;
        m__raw_body = m__io->read_bytes((length() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<super_blob_t>(new super_blob_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::cs_blob_t::CS_MAGIC_DER_ENTITLEMENTS: {
        n_body = false;
        m__raw_body = m__io->read_bytes((length() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<asn1_der_t>(new asn1_der_t(m__io__raw_body.get()));
        break;
    }
    default: {
        m__raw_body = m__io->read_bytes((length() - 8));
        break;
    }
    }
}

mach_o_t::cs_blob_t::~cs_blob_t() {
    _clean_up();
}

void mach_o_t::cs_blob_t::_clean_up() {
    if (!n_body) {
    }
}

mach_o_t::cs_blob_t::code_directory_t::code_directory_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_hashes = nullptr;
    f_ident = false;
    f_team_id = false;
    f_hashes = false;
    _read();
}

void mach_o_t::cs_blob_t::code_directory_t::_read() {
    m_version = m__io->read_u4be();
    m_flags = m__io->read_u4be();
    m_hash_offset = m__io->read_u4be();
    m_ident_offset = m__io->read_u4be();
    m_n_special_slots = m__io->read_u4be();
    m_n_code_slots = m__io->read_u4be();
    m_code_limit = m__io->read_u4be();
    m_hash_size = m__io->read_u1();
    m_hash_type = m__io->read_u1();
    m_spare1 = m__io->read_u1();
    m_page_size = m__io->read_u1();
    m_spare2 = m__io->read_u4be();
    n_scatter_offset = true;
    if (version() >= 131328) {
        n_scatter_offset = false;
        m_scatter_offset = m__io->read_u4be();
    }
    n_team_id_offset = true;
    if (version() >= 131584) {
        n_team_id_offset = false;
        m_team_id_offset = m__io->read_u4be();
    }
}

mach_o_t::cs_blob_t::code_directory_t::~code_directory_t() {
    _clean_up();
}

void mach_o_t::cs_blob_t::code_directory_t::_clean_up() {
    if (!n_scatter_offset) {
    }
    if (!n_team_id_offset) {
    }
    if (f_ident) {
    }
    if (f_team_id) {
    }
    if (f_hashes) {
    }
}

std::string mach_o_t::cs_blob_t::code_directory_t::ident() {
    if (f_ident)
        return m_ident;
    std::streampos _pos = m__io->pos();
    m__io->seek((ident_offset() - 8));
    m_ident = kaitai::kstream::bytes_to_str(m__io->read_bytes_term(0, false, true, true), std::string("utf-8"));
    m__io->seek(_pos);
    f_ident = true;
    return m_ident;
}

std::string mach_o_t::cs_blob_t::code_directory_t::team_id() {
    if (f_team_id)
        return m_team_id;
    std::streampos _pos = m__io->pos();
    m__io->seek((team_id_offset() - 8));
    m_team_id = kaitai::kstream::bytes_to_str(m__io->read_bytes_term(0, false, true, true), std::string("utf-8"));
    m__io->seek(_pos);
    f_team_id = true;
    return m_team_id;
}

std::vector<std::string>* mach_o_t::cs_blob_t::code_directory_t::hashes() {
    if (f_hashes)
        return m_hashes.get();
    std::streampos _pos = m__io->pos();
    m__io->seek(((hash_offset() - 8) - (hash_size() * n_special_slots())));
    m_hashes = std::unique_ptr<std::vector<std::string>>(new std::vector<std::string>());
    const int l_hashes = (n_special_slots() + n_code_slots());
    for (int i = 0; i < l_hashes; i++) {
        m_hashes->push_back(std::move(m__io->read_bytes(hash_size())));
    }
    m__io->seek(_pos);
    f_hashes = true;
    return m_hashes.get();
}

mach_o_t::cs_blob_t::data_t::data_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    _read();
}

void mach_o_t::cs_blob_t::data_t::_read() {
    m_length = m__io->read_u4be();
    m_value = m__io->read_bytes(length());
    m_padding = m__io->read_bytes(kaitai::kstream::mod(-(length()), 4));
}

mach_o_t::cs_blob_t::data_t::~data_t() {
    _clean_up();
}

void mach_o_t::cs_blob_t::data_t::_clean_up() {
}

mach_o_t::cs_blob_t::super_blob_t::super_blob_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_blobs = nullptr;
    _read();
}

void mach_o_t::cs_blob_t::super_blob_t::_read() {
    m_count = m__io->read_u4be();
    m_blobs = std::unique_ptr<std::vector<std::unique_ptr<blob_index_t>>>(new std::vector<std::unique_ptr<blob_index_t>>());
    const int l_blobs = count();
    for (int i = 0; i < l_blobs; i++) {
        m_blobs->push_back(std::move(std::unique_ptr<blob_index_t>(new blob_index_t(m__io, this, m__root))));
    }
}

mach_o_t::cs_blob_t::super_blob_t::~super_blob_t() {
    _clean_up();
}

void mach_o_t::cs_blob_t::super_blob_t::_clean_up() {
}

mach_o_t::cs_blob_t::expr_t::expr_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    _read();
}

void mach_o_t::cs_blob_t::expr_t::_read() {
    m_op = static_cast<mach_o_t::cs_blob_t::expr_t::op_enum_t>(m__io->read_u4be());
    n_data = true;
    switch (op()) {
    case mach_o_t::cs_blob_t::expr_t::OP_ENUM_IDENT: {
        n_data = false;
        m_data = std::unique_ptr<ident_expr_t>(new ident_expr_t(m__io, this, m__root));
        break;
    }
    case mach_o_t::cs_blob_t::expr_t::OP_ENUM_OR_OP: {
        n_data = false;
        m_data = std::unique_ptr<or_expr_t>(new or_expr_t(m__io, this, m__root));
        break;
    }
    case mach_o_t::cs_blob_t::expr_t::OP_ENUM_INFO_KEY_VALUE: {
        n_data = false;
        m_data = std::unique_ptr<data_t>(new data_t(m__io, this, m__root));
        break;
    }
    case mach_o_t::cs_blob_t::expr_t::OP_ENUM_ANCHOR_HASH: {
        n_data = false;
        m_data = std::unique_ptr<anchor_hash_expr_t>(new anchor_hash_expr_t(m__io, this, m__root));
        break;
    }
    case mach_o_t::cs_blob_t::expr_t::OP_ENUM_INFO_KEY_FIELD: {
        n_data = false;
        m_data = std::unique_ptr<info_key_field_expr_t>(new info_key_field_expr_t(m__io, this, m__root));
        break;
    }
    case mach_o_t::cs_blob_t::expr_t::OP_ENUM_NOT_OP: {
        n_data = false;
        m_data = std::unique_ptr<expr_t>(new expr_t(m__io, this, m__root));
        break;
    }
    case mach_o_t::cs_blob_t::expr_t::OP_ENUM_ENTITLEMENT_FIELD: {
        n_data = false;
        m_data = std::unique_ptr<entitlement_field_expr_t>(new entitlement_field_expr_t(m__io, this, m__root));
        break;
    }
    case mach_o_t::cs_blob_t::expr_t::OP_ENUM_TRUSTED_CERT: {
        n_data = false;
        m_data = std::unique_ptr<cert_slot_expr_t>(new cert_slot_expr_t(m__io, this, m__root));
        break;
    }
    case mach_o_t::cs_blob_t::expr_t::OP_ENUM_AND_OP: {
        n_data = false;
        m_data = std::unique_ptr<and_expr_t>(new and_expr_t(m__io, this, m__root));
        break;
    }
    case mach_o_t::cs_blob_t::expr_t::OP_ENUM_CERT_GENERIC: {
        n_data = false;
        m_data = std::unique_ptr<cert_generic_expr_t>(new cert_generic_expr_t(m__io, this, m__root));
        break;
    }
    case mach_o_t::cs_blob_t::expr_t::OP_ENUM_CERT_FIELD: {
        n_data = false;
        m_data = std::unique_ptr<cert_field_expr_t>(new cert_field_expr_t(m__io, this, m__root));
        break;
    }
    case mach_o_t::cs_blob_t::expr_t::OP_ENUM_CD_HASH: {
        n_data = false;
        m_data = std::unique_ptr<data_t>(new data_t(m__io, this, m__root));
        break;
    }
    case mach_o_t::cs_blob_t::expr_t::OP_ENUM_APPLE_GENERIC_ANCHOR: {
        n_data = false;
        m_data = std::unique_ptr<apple_generic_anchor_expr_t>(new apple_generic_anchor_expr_t(m__io, this, m__root));
        break;
    }
    }
}

mach_o_t::cs_blob_t::expr_t::~expr_t() {
    _clean_up();
}

void mach_o_t::cs_blob_t::expr_t::_clean_up() {
    if (!n_data) {
    }
}

mach_o_t::cs_blob_t::expr_t::info_key_field_expr_t::info_key_field_expr_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t::expr_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_data = nullptr;
    m_match = nullptr;
    _read();
}

void mach_o_t::cs_blob_t::expr_t::info_key_field_expr_t::_read() {
    m_data = std::unique_ptr<data_t>(new data_t(m__io, this, m__root));
    m_match = std::unique_ptr<match_t>(new match_t(m__io, this, m__root));
}

mach_o_t::cs_blob_t::expr_t::info_key_field_expr_t::~info_key_field_expr_t() {
    _clean_up();
}

void mach_o_t::cs_blob_t::expr_t::info_key_field_expr_t::_clean_up() {
}

mach_o_t::cs_blob_t::expr_t::cert_slot_expr_t::cert_slot_expr_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t::expr_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    _read();
}

void mach_o_t::cs_blob_t::expr_t::cert_slot_expr_t::_read() {
    m_value = static_cast<mach_o_t::cs_blob_t::expr_t::cert_slot_t>(m__io->read_u4be());
}

mach_o_t::cs_blob_t::expr_t::cert_slot_expr_t::~cert_slot_expr_t() {
    _clean_up();
}

void mach_o_t::cs_blob_t::expr_t::cert_slot_expr_t::_clean_up() {
}

mach_o_t::cs_blob_t::expr_t::cert_generic_expr_t::cert_generic_expr_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t::expr_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_data = nullptr;
    m_match = nullptr;
    _read();
}

void mach_o_t::cs_blob_t::expr_t::cert_generic_expr_t::_read() {
    m_cert_slot = static_cast<mach_o_t::cs_blob_t::expr_t::cert_slot_t>(m__io->read_u4be());
    m_data = std::unique_ptr<data_t>(new data_t(m__io, this, m__root));
    m_match = std::unique_ptr<match_t>(new match_t(m__io, this, m__root));
}

mach_o_t::cs_blob_t::expr_t::cert_generic_expr_t::~cert_generic_expr_t() {
    _clean_up();
}

void mach_o_t::cs_blob_t::expr_t::cert_generic_expr_t::_clean_up() {
}

mach_o_t::cs_blob_t::expr_t::ident_expr_t::ident_expr_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t::expr_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_identifier = nullptr;
    _read();
}

void mach_o_t::cs_blob_t::expr_t::ident_expr_t::_read() {
    m_identifier = std::unique_ptr<data_t>(new data_t(m__io, this, m__root));
}

mach_o_t::cs_blob_t::expr_t::ident_expr_t::~ident_expr_t() {
    _clean_up();
}

void mach_o_t::cs_blob_t::expr_t::ident_expr_t::_clean_up() {
}

mach_o_t::cs_blob_t::expr_t::cert_field_expr_t::cert_field_expr_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t::expr_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_data = nullptr;
    m_match = nullptr;
    _read();
}

void mach_o_t::cs_blob_t::expr_t::cert_field_expr_t::_read() {
    m_cert_slot = static_cast<mach_o_t::cs_blob_t::expr_t::cert_slot_t>(m__io->read_u4be());
    m_data = std::unique_ptr<data_t>(new data_t(m__io, this, m__root));
    m_match = std::unique_ptr<match_t>(new match_t(m__io, this, m__root));
}

mach_o_t::cs_blob_t::expr_t::cert_field_expr_t::~cert_field_expr_t() {
    _clean_up();
}

void mach_o_t::cs_blob_t::expr_t::cert_field_expr_t::_clean_up() {
}

mach_o_t::cs_blob_t::expr_t::anchor_hash_expr_t::anchor_hash_expr_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t::expr_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_data = nullptr;
    _read();
}

void mach_o_t::cs_blob_t::expr_t::anchor_hash_expr_t::_read() {
    m_cert_slot = static_cast<mach_o_t::cs_blob_t::expr_t::cert_slot_t>(m__io->read_u4be());
    m_data = std::unique_ptr<data_t>(new data_t(m__io, this, m__root));
}

mach_o_t::cs_blob_t::expr_t::anchor_hash_expr_t::~anchor_hash_expr_t() {
    _clean_up();
}

void mach_o_t::cs_blob_t::expr_t::anchor_hash_expr_t::_clean_up() {
}

mach_o_t::cs_blob_t::expr_t::apple_generic_anchor_expr_t::apple_generic_anchor_expr_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t::expr_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    f_value = false;
    _read();
}

void mach_o_t::cs_blob_t::expr_t::apple_generic_anchor_expr_t::_read() {
}

mach_o_t::cs_blob_t::expr_t::apple_generic_anchor_expr_t::~apple_generic_anchor_expr_t() {
    _clean_up();
}

void mach_o_t::cs_blob_t::expr_t::apple_generic_anchor_expr_t::_clean_up() {
}

std::string mach_o_t::cs_blob_t::expr_t::apple_generic_anchor_expr_t::value() {
    if (f_value)
        return m_value;
    m_value = std::string("anchor apple generic");
    f_value = true;
    return m_value;
}

mach_o_t::cs_blob_t::expr_t::entitlement_field_expr_t::entitlement_field_expr_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t::expr_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_data = nullptr;
    m_match = nullptr;
    _read();
}

void mach_o_t::cs_blob_t::expr_t::entitlement_field_expr_t::_read() {
    m_data = std::unique_ptr<data_t>(new data_t(m__io, this, m__root));
    m_match = std::unique_ptr<match_t>(new match_t(m__io, this, m__root));
}

mach_o_t::cs_blob_t::expr_t::entitlement_field_expr_t::~entitlement_field_expr_t() {
    _clean_up();
}

void mach_o_t::cs_blob_t::expr_t::entitlement_field_expr_t::_clean_up() {
}

mach_o_t::cs_blob_t::expr_t::and_expr_t::and_expr_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t::expr_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_left = nullptr;
    m_right = nullptr;
    _read();
}

void mach_o_t::cs_blob_t::expr_t::and_expr_t::_read() {
    m_left = std::unique_ptr<expr_t>(new expr_t(m__io, this, m__root));
    m_right = std::unique_ptr<expr_t>(new expr_t(m__io, this, m__root));
}

mach_o_t::cs_blob_t::expr_t::and_expr_t::~and_expr_t() {
    _clean_up();
}

void mach_o_t::cs_blob_t::expr_t::and_expr_t::_clean_up() {
}

mach_o_t::cs_blob_t::expr_t::or_expr_t::or_expr_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t::expr_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_left = nullptr;
    m_right = nullptr;
    _read();
}

void mach_o_t::cs_blob_t::expr_t::or_expr_t::_read() {
    m_left = std::unique_ptr<expr_t>(new expr_t(m__io, this, m__root));
    m_right = std::unique_ptr<expr_t>(new expr_t(m__io, this, m__root));
}

mach_o_t::cs_blob_t::expr_t::or_expr_t::~or_expr_t() {
    _clean_up();
}

void mach_o_t::cs_blob_t::expr_t::or_expr_t::_clean_up() {
}

mach_o_t::cs_blob_t::blob_index_t::blob_index_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t::super_blob_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_blob = nullptr;
    m__io__raw_blob = nullptr;
    f_blob = false;
    _read();
}

void mach_o_t::cs_blob_t::blob_index_t::_read() {
    m_type = static_cast<mach_o_t::cs_blob_t::blob_index_t::csslot_type_t>(m__io->read_u4be());
    m_offset = m__io->read_u4be();
}

mach_o_t::cs_blob_t::blob_index_t::~blob_index_t() {
    _clean_up();
}

void mach_o_t::cs_blob_t::blob_index_t::_clean_up() {
    if (f_blob) {
    }
}

mach_o_t::cs_blob_t* mach_o_t::cs_blob_t::blob_index_t::blob() {
    if (f_blob)
        return m_blob.get();
    kaitai::kstream *io = _parent()->_io();
    std::streampos _pos = io->pos();
    io->seek((offset() - 8));
    m__raw_blob = io->read_bytes_full();
    m__io__raw_blob = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_blob));
    m_blob = std::unique_ptr<cs_blob_t>(new cs_blob_t(m__io__raw_blob.get(), this, m__root));
    io->seek(_pos);
    f_blob = true;
    return m_blob.get();
}

mach_o_t::cs_blob_t::match_t::match_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_data = nullptr;
    _read();
}

void mach_o_t::cs_blob_t::match_t::_read() {
    m_match_op = static_cast<mach_o_t::cs_blob_t::match_t::op_t>(m__io->read_u4be());
    n_data = true;
    if (match_op() != mach_o_t::cs_blob_t::match_t::OP_EXISTS) {
        n_data = false;
        m_data = std::unique_ptr<data_t>(new data_t(m__io, this, m__root));
    }
}

mach_o_t::cs_blob_t::match_t::~match_t() {
    _clean_up();
}

void mach_o_t::cs_blob_t::match_t::_clean_up() {
    if (!n_data) {
    }
}

mach_o_t::cs_blob_t::requirement_t::requirement_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_expr = nullptr;
    _read();
}

void mach_o_t::cs_blob_t::requirement_t::_read() {
    m_kind = m__io->read_u4be();
    m_expr = std::unique_ptr<expr_t>(new expr_t(m__io, this, m__root));
}

mach_o_t::cs_blob_t::requirement_t::~requirement_t() {
    _clean_up();
}

void mach_o_t::cs_blob_t::requirement_t::_clean_up() {
}

mach_o_t::cs_blob_t::requirements_t::requirements_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_items = nullptr;
    _read();
}

void mach_o_t::cs_blob_t::requirements_t::_read() {
    m_count = m__io->read_u4be();
    m_items = std::unique_ptr<std::vector<std::unique_ptr<requirements_blob_index_t>>>(new std::vector<std::unique_ptr<requirements_blob_index_t>>());
    const int l_items = count();
    for (int i = 0; i < l_items; i++) {
        m_items->push_back(std::move(std::unique_ptr<requirements_blob_index_t>(new requirements_blob_index_t(m__io, this, m__root))));
    }
}

mach_o_t::cs_blob_t::requirements_t::~requirements_t() {
    _clean_up();
}

void mach_o_t::cs_blob_t::requirements_t::_clean_up() {
}

mach_o_t::cs_blob_t::blob_wrapper_t::blob_wrapper_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    _read();
}

void mach_o_t::cs_blob_t::blob_wrapper_t::_read() {
    m_data = m__io->read_bytes_full();
}

mach_o_t::cs_blob_t::blob_wrapper_t::~blob_wrapper_t() {
    _clean_up();
}

void mach_o_t::cs_blob_t::blob_wrapper_t::_clean_up() {
}

mach_o_t::cs_blob_t::entitlements_t::entitlements_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    _read();
}

void mach_o_t::cs_blob_t::entitlements_t::_read() {
    m_data = m__io->read_bytes_full();
}

mach_o_t::cs_blob_t::entitlements_t::~entitlements_t() {
    _clean_up();
}

void mach_o_t::cs_blob_t::entitlements_t::_clean_up() {
}

mach_o_t::cs_blob_t::requirements_blob_index_t::requirements_blob_index_t(kaitai::kstream* p__io, mach_o_t::cs_blob_t::requirements_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_value = nullptr;
    f_value = false;
    _read();
}

void mach_o_t::cs_blob_t::requirements_blob_index_t::_read() {
    m_type = static_cast<mach_o_t::cs_blob_t::requirements_blob_index_t::requirement_type_t>(m__io->read_u4be());
    m_offset = m__io->read_u4be();
}

mach_o_t::cs_blob_t::requirements_blob_index_t::~requirements_blob_index_t() {
    _clean_up();
}

void mach_o_t::cs_blob_t::requirements_blob_index_t::_clean_up() {
    if (f_value) {
    }
}

mach_o_t::cs_blob_t* mach_o_t::cs_blob_t::requirements_blob_index_t::value() {
    if (f_value)
        return m_value.get();
    std::streampos _pos = m__io->pos();
    m__io->seek((offset() - 8));
    m_value = std::unique_ptr<cs_blob_t>(new cs_blob_t(m__io, this, m__root));
    m__io->seek(_pos);
    f_value = true;
    return m_value.get();
}

mach_o_t::build_version_command_t::build_version_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_tools = nullptr;
    _read();
}

void mach_o_t::build_version_command_t::_read() {
    m_platform = m__io->read_u4le();
    m_minos = m__io->read_u4le();
    m_sdk = m__io->read_u4le();
    m_ntools = m__io->read_u4le();
    m_tools = std::unique_ptr<std::vector<std::unique_ptr<build_tool_version_t>>>(new std::vector<std::unique_ptr<build_tool_version_t>>());
    const int l_tools = ntools();
    for (int i = 0; i < l_tools; i++) {
        m_tools->push_back(std::move(std::unique_ptr<build_tool_version_t>(new build_tool_version_t(m__io, this, m__root))));
    }
}

mach_o_t::build_version_command_t::~build_version_command_t() {
    _clean_up();
}

void mach_o_t::build_version_command_t::_clean_up() {
}

mach_o_t::build_version_command_t::build_tool_version_t::build_tool_version_t(kaitai::kstream* p__io, mach_o_t::build_version_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    _read();
}

void mach_o_t::build_version_command_t::build_tool_version_t::_read() {
    m_tool = m__io->read_u4le();
    m_version = m__io->read_u4le();
}

mach_o_t::build_version_command_t::build_tool_version_t::~build_tool_version_t() {
    _clean_up();
}

void mach_o_t::build_version_command_t::build_tool_version_t::_clean_up() {
}

mach_o_t::routines_command_t::routines_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    _read();
}

void mach_o_t::routines_command_t::_read() {
    m_init_address = m__io->read_u4le();
    m_init_module = m__io->read_u4le();
    m_reserved = m__io->read_bytes(24);
}

mach_o_t::routines_command_t::~routines_command_t() {
    _clean_up();
}

void mach_o_t::routines_command_t::_clean_up() {
}

mach_o_t::macho_flags_t::macho_flags_t(uint32_t p_value, kaitai::kstream* p__io, mach_o_t::mach_header_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_value = p_value;
    f_subsections_via_symbols = false;
    f_dead_strippable_dylib = false;
    f_weak_defines = false;
    f_prebound = false;
    f_all_mods_bound = false;
    f_has_tlv_descriptors = false;
    f_force_flat = false;
    f_root_safe = false;
    f_no_undefs = false;
    f_setuid_safe = false;
    f_no_heap_execution = false;
    f_no_reexported_dylibs = false;
    f_no_multi_defs = false;
    f_app_extension_safe = false;
    f_prebindable = false;
    f_incr_link = false;
    f_bind_at_load = false;
    f_canonical = false;
    f_two_level = false;
    f_split_segs = false;
    f_lazy_init = false;
    f_allow_stack_execution = false;
    f_binds_to_weak = false;
    f_no_fix_prebinding = false;
    f_dyld_link = false;
    f_pie = false;
    _read();
}

void mach_o_t::macho_flags_t::_read() {
}

mach_o_t::macho_flags_t::~macho_flags_t() {
    _clean_up();
}

void mach_o_t::macho_flags_t::_clean_up() {
}

bool mach_o_t::macho_flags_t::subsections_via_symbols() {
    if (f_subsections_via_symbols)
        return m_subsections_via_symbols;
    m_subsections_via_symbols = (value() & 8192) != 0;
    f_subsections_via_symbols = true;
    return m_subsections_via_symbols;
}

bool mach_o_t::macho_flags_t::dead_strippable_dylib() {
    if (f_dead_strippable_dylib)
        return m_dead_strippable_dylib;
    m_dead_strippable_dylib = (value() & 4194304) != 0;
    f_dead_strippable_dylib = true;
    return m_dead_strippable_dylib;
}

bool mach_o_t::macho_flags_t::weak_defines() {
    if (f_weak_defines)
        return m_weak_defines;
    m_weak_defines = (value() & 32768) != 0;
    f_weak_defines = true;
    return m_weak_defines;
}

bool mach_o_t::macho_flags_t::prebound() {
    if (f_prebound)
        return m_prebound;
    m_prebound = (value() & 16) != 0;
    f_prebound = true;
    return m_prebound;
}

bool mach_o_t::macho_flags_t::all_mods_bound() {
    if (f_all_mods_bound)
        return m_all_mods_bound;
    m_all_mods_bound = (value() & 4096) != 0;
    f_all_mods_bound = true;
    return m_all_mods_bound;
}

bool mach_o_t::macho_flags_t::has_tlv_descriptors() {
    if (f_has_tlv_descriptors)
        return m_has_tlv_descriptors;
    m_has_tlv_descriptors = (value() & 8388608) != 0;
    f_has_tlv_descriptors = true;
    return m_has_tlv_descriptors;
}

bool mach_o_t::macho_flags_t::force_flat() {
    if (f_force_flat)
        return m_force_flat;
    m_force_flat = (value() & 256) != 0;
    f_force_flat = true;
    return m_force_flat;
}

bool mach_o_t::macho_flags_t::root_safe() {
    if (f_root_safe)
        return m_root_safe;
    m_root_safe = (value() & 262144) != 0;
    f_root_safe = true;
    return m_root_safe;
}

bool mach_o_t::macho_flags_t::no_undefs() {
    if (f_no_undefs)
        return m_no_undefs;
    m_no_undefs = (value() & 1) != 0;
    f_no_undefs = true;
    return m_no_undefs;
}

bool mach_o_t::macho_flags_t::setuid_safe() {
    if (f_setuid_safe)
        return m_setuid_safe;
    m_setuid_safe = (value() & 524288) != 0;
    f_setuid_safe = true;
    return m_setuid_safe;
}

bool mach_o_t::macho_flags_t::no_heap_execution() {
    if (f_no_heap_execution)
        return m_no_heap_execution;
    m_no_heap_execution = (value() & 16777216) != 0;
    f_no_heap_execution = true;
    return m_no_heap_execution;
}

bool mach_o_t::macho_flags_t::no_reexported_dylibs() {
    if (f_no_reexported_dylibs)
        return m_no_reexported_dylibs;
    m_no_reexported_dylibs = (value() & 1048576) != 0;
    f_no_reexported_dylibs = true;
    return m_no_reexported_dylibs;
}

bool mach_o_t::macho_flags_t::no_multi_defs() {
    if (f_no_multi_defs)
        return m_no_multi_defs;
    m_no_multi_defs = (value() & 512) != 0;
    f_no_multi_defs = true;
    return m_no_multi_defs;
}

bool mach_o_t::macho_flags_t::app_extension_safe() {
    if (f_app_extension_safe)
        return m_app_extension_safe;
    m_app_extension_safe = (value() & 33554432) != 0;
    f_app_extension_safe = true;
    return m_app_extension_safe;
}

bool mach_o_t::macho_flags_t::prebindable() {
    if (f_prebindable)
        return m_prebindable;
    m_prebindable = (value() & 2048) != 0;
    f_prebindable = true;
    return m_prebindable;
}

bool mach_o_t::macho_flags_t::incr_link() {
    if (f_incr_link)
        return m_incr_link;
    m_incr_link = (value() & 2) != 0;
    f_incr_link = true;
    return m_incr_link;
}

bool mach_o_t::macho_flags_t::bind_at_load() {
    if (f_bind_at_load)
        return m_bind_at_load;
    m_bind_at_load = (value() & 8) != 0;
    f_bind_at_load = true;
    return m_bind_at_load;
}

bool mach_o_t::macho_flags_t::canonical() {
    if (f_canonical)
        return m_canonical;
    m_canonical = (value() & 16384) != 0;
    f_canonical = true;
    return m_canonical;
}

bool mach_o_t::macho_flags_t::two_level() {
    if (f_two_level)
        return m_two_level;
    m_two_level = (value() & 128) != 0;
    f_two_level = true;
    return m_two_level;
}

bool mach_o_t::macho_flags_t::split_segs() {
    if (f_split_segs)
        return m_split_segs;
    m_split_segs = (value() & 32) != 0;
    f_split_segs = true;
    return m_split_segs;
}

bool mach_o_t::macho_flags_t::lazy_init() {
    if (f_lazy_init)
        return m_lazy_init;
    m_lazy_init = (value() & 64) != 0;
    f_lazy_init = true;
    return m_lazy_init;
}

bool mach_o_t::macho_flags_t::allow_stack_execution() {
    if (f_allow_stack_execution)
        return m_allow_stack_execution;
    m_allow_stack_execution = (value() & 131072) != 0;
    f_allow_stack_execution = true;
    return m_allow_stack_execution;
}

bool mach_o_t::macho_flags_t::binds_to_weak() {
    if (f_binds_to_weak)
        return m_binds_to_weak;
    m_binds_to_weak = (value() & 65536) != 0;
    f_binds_to_weak = true;
    return m_binds_to_weak;
}

bool mach_o_t::macho_flags_t::no_fix_prebinding() {
    if (f_no_fix_prebinding)
        return m_no_fix_prebinding;
    m_no_fix_prebinding = (value() & 1024) != 0;
    f_no_fix_prebinding = true;
    return m_no_fix_prebinding;
}

bool mach_o_t::macho_flags_t::dyld_link() {
    if (f_dyld_link)
        return m_dyld_link;
    m_dyld_link = (value() & 4) != 0;
    f_dyld_link = true;
    return m_dyld_link;
}

bool mach_o_t::macho_flags_t::pie() {
    if (f_pie)
        return m_pie;
    m_pie = (value() & 2097152) != 0;
    f_pie = true;
    return m_pie;
}

mach_o_t::routines_command_64_t::routines_command_64_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    _read();
}

void mach_o_t::routines_command_64_t::_read() {
    m_init_address = m__io->read_u8le();
    m_init_module = m__io->read_u8le();
    m_reserved = m__io->read_bytes(48);
}

mach_o_t::routines_command_64_t::~routines_command_64_t() {
    _clean_up();
}

void mach_o_t::routines_command_64_t::_clean_up() {
}

mach_o_t::linker_option_command_t::linker_option_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_strings = nullptr;
    _read();
}

void mach_o_t::linker_option_command_t::_read() {
    m_num_strings = m__io->read_u4le();
    m_strings = std::unique_ptr<std::vector<std::string>>(new std::vector<std::string>());
    const int l_strings = num_strings();
    for (int i = 0; i < l_strings; i++) {
        m_strings->push_back(std::move(kaitai::kstream::bytes_to_str(m__io->read_bytes_term(0, false, true, true), std::string("utf-8"))));
    }
}

mach_o_t::linker_option_command_t::~linker_option_command_t() {
    _clean_up();
}

void mach_o_t::linker_option_command_t::_clean_up() {
}

mach_o_t::segment_command_64_t::segment_command_64_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_maxprot = nullptr;
    m_initprot = nullptr;
    m_sections = nullptr;
    _read();
}

void mach_o_t::segment_command_64_t::_read() {
    m_segname = kaitai::kstream::bytes_to_str(kaitai::kstream::bytes_strip_right(m__io->read_bytes(16), 0), std::string("ascii"));
    m_vmaddr = m__io->read_u8le();
    m_vmsize = m__io->read_u8le();
    m_fileoff = m__io->read_u8le();
    m_filesize = m__io->read_u8le();
    m_maxprot = std::unique_ptr<vm_prot_t>(new vm_prot_t(m__io, this, m__root));
    m_initprot = std::unique_ptr<vm_prot_t>(new vm_prot_t(m__io, this, m__root));
    m_nsects = m__io->read_u4le();
    m_flags = m__io->read_u4le();
    m_sections = std::unique_ptr<std::vector<std::unique_ptr<section_64_t>>>(new std::vector<std::unique_ptr<section_64_t>>());
    const int l_sections = nsects();
    for (int i = 0; i < l_sections; i++) {
        m_sections->push_back(std::move(std::unique_ptr<section_64_t>(new section_64_t(m__io, this, m__root))));
    }
}

mach_o_t::segment_command_64_t::~segment_command_64_t() {
    _clean_up();
}

void mach_o_t::segment_command_64_t::_clean_up() {
}

mach_o_t::segment_command_64_t::section_64_t::section_64_t(kaitai::kstream* p__io, mach_o_t::segment_command_64_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m__io__raw_data = nullptr;
    f_data = false;
    _read();
}

void mach_o_t::segment_command_64_t::section_64_t::_read() {
    m_sect_name = kaitai::kstream::bytes_to_str(kaitai::kstream::bytes_strip_right(m__io->read_bytes(16), 0), std::string("ascii"));
    m_seg_name = kaitai::kstream::bytes_to_str(kaitai::kstream::bytes_strip_right(m__io->read_bytes(16), 0), std::string("ascii"));
    m_addr = m__io->read_u8le();
    m_size = m__io->read_u8le();
    m_offset = m__io->read_u4le();
    m_align = m__io->read_u4le();
    m_reloff = m__io->read_u4le();
    m_nreloc = m__io->read_u4le();
    m_flags = m__io->read_u4le();
    m_reserved1 = m__io->read_u4le();
    m_reserved2 = m__io->read_u4le();
    m_reserved3 = m__io->read_u4le();
}

mach_o_t::segment_command_64_t::section_64_t::~section_64_t() {
    _clean_up();
}

void mach_o_t::segment_command_64_t::section_64_t::_clean_up() {
    if (f_data && !n_data) {
    }
}

mach_o_t::segment_command_64_t::section_64_t::cf_string_list_t::cf_string_list_t(kaitai::kstream* p__io, mach_o_t::segment_command_64_t::section_64_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_items = nullptr;
    _read();
}

void mach_o_t::segment_command_64_t::section_64_t::cf_string_list_t::_read() {
    m_items = std::unique_ptr<std::vector<std::unique_ptr<cf_string_t>>>(new std::vector<std::unique_ptr<cf_string_t>>());
    {
        int i = 0;
        while (!m__io->is_eof()) {
            m_items->push_back(std::move(std::unique_ptr<cf_string_t>(new cf_string_t(m__io, this, m__root))));
            i++;
        }
    }
}

mach_o_t::segment_command_64_t::section_64_t::cf_string_list_t::~cf_string_list_t() {
    _clean_up();
}

void mach_o_t::segment_command_64_t::section_64_t::cf_string_list_t::_clean_up() {
}

mach_o_t::segment_command_64_t::section_64_t::cf_string_t::cf_string_t(kaitai::kstream* p__io, mach_o_t::segment_command_64_t::section_64_t::cf_string_list_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    _read();
}

void mach_o_t::segment_command_64_t::section_64_t::cf_string_t::_read() {
    m_isa = m__io->read_u8le();
    m_info = m__io->read_u8le();
    m_data = m__io->read_u8le();
    m_length = m__io->read_u8le();
}

mach_o_t::segment_command_64_t::section_64_t::cf_string_t::~cf_string_t() {
    _clean_up();
}

void mach_o_t::segment_command_64_t::section_64_t::cf_string_t::_clean_up() {
}

mach_o_t::segment_command_64_t::section_64_t::eh_frame_item_t::eh_frame_item_t(kaitai::kstream* p__io, mach_o_t::segment_command_64_t::section_64_t::eh_frame_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m__io__raw_body = nullptr;
    _read();
}

void mach_o_t::segment_command_64_t::section_64_t::eh_frame_item_t::_read() {
    m_length = m__io->read_u4le();
    n_length64 = true;
    if (length() == 4294967295UL) {
        n_length64 = false;
        m_length64 = m__io->read_u8le();
    }
    m_id = m__io->read_u4le();
    n_body = true;
    if (length() > 0) {
        n_body = false;
        n_body = true;
        switch (id()) {
        case 0: {
            n_body = false;
            m__raw_body = m__io->read_bytes((length() - 4));
            m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
            m_body = std::unique_ptr<cie_t>(new cie_t(m__io__raw_body.get(), this, m__root));
            break;
        }
        default: {
            m__raw_body = m__io->read_bytes((length() - 4));
            break;
        }
        }
    }
}

mach_o_t::segment_command_64_t::section_64_t::eh_frame_item_t::~eh_frame_item_t() {
    _clean_up();
}

void mach_o_t::segment_command_64_t::section_64_t::eh_frame_item_t::_clean_up() {
    if (!n_length64) {
    }
    if (!n_body) {
    }
}

mach_o_t::segment_command_64_t::section_64_t::eh_frame_item_t::char_chain_t::char_chain_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_next = nullptr;
    _read();
}

void mach_o_t::segment_command_64_t::section_64_t::eh_frame_item_t::char_chain_t::_read() {
    m_chr = m__io->read_u1();
    n_next = true;
    if (chr() != 0) {
        n_next = false;
        m_next = std::unique_ptr<char_chain_t>(new char_chain_t(m__io, this, m__root));
    }
}

mach_o_t::segment_command_64_t::section_64_t::eh_frame_item_t::char_chain_t::~char_chain_t() {
    _clean_up();
}

void mach_o_t::segment_command_64_t::section_64_t::eh_frame_item_t::char_chain_t::_clean_up() {
    if (!n_next) {
    }
}

mach_o_t::segment_command_64_t::section_64_t::eh_frame_item_t::cie_t::cie_t(kaitai::kstream* p__io, mach_o_t::segment_command_64_t::section_64_t::eh_frame_item_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_aug_str = nullptr;
    m_code_alignment_factor = nullptr;
    m_data_alignment_factor = nullptr;
    m_augmentation = nullptr;
    _read();
}

void mach_o_t::segment_command_64_t::section_64_t::eh_frame_item_t::cie_t::_read() {
    m_version = m__io->read_u1();
    m_aug_str = std::unique_ptr<char_chain_t>(new char_chain_t(m__io, this, m__root));
    m_code_alignment_factor = std::unique_ptr<uleb128_t>(new uleb128_t(m__io, this, m__root));
    m_data_alignment_factor = std::unique_ptr<uleb128_t>(new uleb128_t(m__io, this, m__root));
    m_return_address_register = m__io->read_u1();
    n_augmentation = true;
    if (aug_str()->chr() == 122) {
        n_augmentation = false;
        m_augmentation = std::unique_ptr<augmentation_entry_t>(new augmentation_entry_t(m__io, this, m__root));
    }
}

mach_o_t::segment_command_64_t::section_64_t::eh_frame_item_t::cie_t::~cie_t() {
    _clean_up();
}

void mach_o_t::segment_command_64_t::section_64_t::eh_frame_item_t::cie_t::_clean_up() {
    if (!n_augmentation) {
    }
}

mach_o_t::segment_command_64_t::section_64_t::eh_frame_item_t::augmentation_entry_t::augmentation_entry_t(kaitai::kstream* p__io, mach_o_t::segment_command_64_t::section_64_t::eh_frame_item_t::cie_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_length = nullptr;
    _read();
}

void mach_o_t::segment_command_64_t::section_64_t::eh_frame_item_t::augmentation_entry_t::_read() {
    m_length = std::unique_ptr<uleb128_t>(new uleb128_t(m__io, this, m__root));
    n_fde_pointer_encoding = true;
    if (_parent()->aug_str()->next()->chr() == 82) {
        n_fde_pointer_encoding = false;
        m_fde_pointer_encoding = m__io->read_u1();
    }
}

mach_o_t::segment_command_64_t::section_64_t::eh_frame_item_t::augmentation_entry_t::~augmentation_entry_t() {
    _clean_up();
}

void mach_o_t::segment_command_64_t::section_64_t::eh_frame_item_t::augmentation_entry_t::_clean_up() {
    if (!n_fde_pointer_encoding) {
    }
}

mach_o_t::segment_command_64_t::section_64_t::eh_frame_t::eh_frame_t(kaitai::kstream* p__io, mach_o_t::segment_command_64_t::section_64_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_items = nullptr;
    _read();
}

void mach_o_t::segment_command_64_t::section_64_t::eh_frame_t::_read() {
    m_items = std::unique_ptr<std::vector<std::unique_ptr<eh_frame_item_t>>>(new std::vector<std::unique_ptr<eh_frame_item_t>>());
    {
        int i = 0;
        while (!m__io->is_eof()) {
            m_items->push_back(std::move(std::unique_ptr<eh_frame_item_t>(new eh_frame_item_t(m__io, this, m__root))));
            i++;
        }
    }
}

mach_o_t::segment_command_64_t::section_64_t::eh_frame_t::~eh_frame_t() {
    _clean_up();
}

void mach_o_t::segment_command_64_t::section_64_t::eh_frame_t::_clean_up() {
}

mach_o_t::segment_command_64_t::section_64_t::pointer_list_t::pointer_list_t(kaitai::kstream* p__io, mach_o_t::segment_command_64_t::section_64_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_items = nullptr;
    _read();
}

void mach_o_t::segment_command_64_t::section_64_t::pointer_list_t::_read() {
    m_items = std::unique_ptr<std::vector<uint64_t>>(new std::vector<uint64_t>());
    {
        int i = 0;
        while (!m__io->is_eof()) {
            m_items->push_back(std::move(m__io->read_u8le()));
            i++;
        }
    }
}

mach_o_t::segment_command_64_t::section_64_t::pointer_list_t::~pointer_list_t() {
    _clean_up();
}

void mach_o_t::segment_command_64_t::section_64_t::pointer_list_t::_clean_up() {
}

mach_o_t::segment_command_64_t::section_64_t::string_list_t::string_list_t(kaitai::kstream* p__io, mach_o_t::segment_command_64_t::section_64_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_strings = nullptr;
    _read();
}

void mach_o_t::segment_command_64_t::section_64_t::string_list_t::_read() {
    m_strings = std::unique_ptr<std::vector<std::string>>(new std::vector<std::string>());
    {
        int i = 0;
        while (!m__io->is_eof()) {
            m_strings->push_back(std::move(kaitai::kstream::bytes_to_str(m__io->read_bytes_term(0, false, true, true), std::string("ascii"))));
            i++;
        }
    }
}

mach_o_t::segment_command_64_t::section_64_t::string_list_t::~string_list_t() {
    _clean_up();
}

void mach_o_t::segment_command_64_t::section_64_t::string_list_t::_clean_up() {
}

kaitai::kstruct* mach_o_t::segment_command_64_t::section_64_t::data() {
    if (f_data)
        return m_data.get();
    kaitai::kstream *io = _root()->_io();
    std::streampos _pos = io->pos();
    io->seek(offset());
    n_data = true;
    {
        std::string on = sect_name();
        if (on == std::string("__objc_nlclslist")) {
            n_data = false;
            m__raw_data = io->read_bytes(size());
            m__io__raw_data = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_data));
            m_data = std::unique_ptr<pointer_list_t>(new pointer_list_t(m__io__raw_data.get(), this, m__root));
        }
        else if (on == std::string("__objc_methname")) {
            n_data = false;
            m__raw_data = io->read_bytes(size());
            m__io__raw_data = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_data));
            m_data = std::unique_ptr<string_list_t>(new string_list_t(m__io__raw_data.get(), this, m__root));
        }
        else if (on == std::string("__nl_symbol_ptr")) {
            n_data = false;
            m__raw_data = io->read_bytes(size());
            m__io__raw_data = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_data));
            m_data = std::unique_ptr<pointer_list_t>(new pointer_list_t(m__io__raw_data.get(), this, m__root));
        }
        else if (on == std::string("__la_symbol_ptr")) {
            n_data = false;
            m__raw_data = io->read_bytes(size());
            m__io__raw_data = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_data));
            m_data = std::unique_ptr<pointer_list_t>(new pointer_list_t(m__io__raw_data.get(), this, m__root));
        }
        else if (on == std::string("__objc_selrefs")) {
            n_data = false;
            m__raw_data = io->read_bytes(size());
            m__io__raw_data = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_data));
            m_data = std::unique_ptr<pointer_list_t>(new pointer_list_t(m__io__raw_data.get(), this, m__root));
        }
        else if (on == std::string("__cstring")) {
            n_data = false;
            m__raw_data = io->read_bytes(size());
            m__io__raw_data = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_data));
            m_data = std::unique_ptr<string_list_t>(new string_list_t(m__io__raw_data.get(), this, m__root));
        }
        else if (on == std::string("__objc_classlist")) {
            n_data = false;
            m__raw_data = io->read_bytes(size());
            m__io__raw_data = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_data));
            m_data = std::unique_ptr<pointer_list_t>(new pointer_list_t(m__io__raw_data.get(), this, m__root));
        }
        else if (on == std::string("__objc_protolist")) {
            n_data = false;
            m__raw_data = io->read_bytes(size());
            m__io__raw_data = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_data));
            m_data = std::unique_ptr<pointer_list_t>(new pointer_list_t(m__io__raw_data.get(), this, m__root));
        }
        else if (on == std::string("__objc_imageinfo")) {
            n_data = false;
            m__raw_data = io->read_bytes(size());
            m__io__raw_data = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_data));
            m_data = std::unique_ptr<pointer_list_t>(new pointer_list_t(m__io__raw_data.get(), this, m__root));
        }
        else if (on == std::string("__objc_methtype")) {
            n_data = false;
            m__raw_data = io->read_bytes(size());
            m__io__raw_data = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_data));
            m_data = std::unique_ptr<string_list_t>(new string_list_t(m__io__raw_data.get(), this, m__root));
        }
        else if (on == std::string("__cfstring")) {
            n_data = false;
            m__raw_data = io->read_bytes(size());
            m__io__raw_data = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_data));
            m_data = std::unique_ptr<cf_string_list_t>(new cf_string_list_t(m__io__raw_data.get(), this, m__root));
        }
        else if (on == std::string("__objc_classrefs")) {
            n_data = false;
            m__raw_data = io->read_bytes(size());
            m__io__raw_data = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_data));
            m_data = std::unique_ptr<pointer_list_t>(new pointer_list_t(m__io__raw_data.get(), this, m__root));
        }
        else if (on == std::string("__objc_protorefs")) {
            n_data = false;
            m__raw_data = io->read_bytes(size());
            m__io__raw_data = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_data));
            m_data = std::unique_ptr<pointer_list_t>(new pointer_list_t(m__io__raw_data.get(), this, m__root));
        }
        else if (on == std::string("__objc_classname")) {
            n_data = false;
            m__raw_data = io->read_bytes(size());
            m__io__raw_data = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_data));
            m_data = std::unique_ptr<string_list_t>(new string_list_t(m__io__raw_data.get(), this, m__root));
        }
        else if (on == std::string("__got")) {
            n_data = false;
            m__raw_data = io->read_bytes(size());
            m__io__raw_data = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_data));
            m_data = std::unique_ptr<pointer_list_t>(new pointer_list_t(m__io__raw_data.get(), this, m__root));
        }
        else if (on == std::string("__eh_frame")) {
            n_data = false;
            m__raw_data = io->read_bytes(size());
            m__io__raw_data = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_data));
            m_data = std::unique_ptr<eh_frame_t>(new eh_frame_t(m__io__raw_data.get(), this, m__root));
        }
        else if (on == std::string("__objc_superrefs")) {
            n_data = false;
            m__raw_data = io->read_bytes(size());
            m__io__raw_data = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_data));
            m_data = std::unique_ptr<pointer_list_t>(new pointer_list_t(m__io__raw_data.get(), this, m__root));
        }
        else {
            m__raw_data = io->read_bytes(size());
        }
    }
    io->seek(_pos);
    f_data = true;
    return m_data.get();
}

mach_o_t::vm_prot_t::vm_prot_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    _read();
}

void mach_o_t::vm_prot_t::_read() {
    m_strip_read = m__io->read_bits_int_be(1);
    m_is_mask = m__io->read_bits_int_be(1);
    m_reserved0 = m__io->read_bits_int_be(1);
    m_copy = m__io->read_bits_int_be(1);
    m_no_change = m__io->read_bits_int_be(1);
    m_execute = m__io->read_bits_int_be(1);
    m_write = m__io->read_bits_int_be(1);
    m_read = m__io->read_bits_int_be(1);
    m_reserved1 = m__io->read_bits_int_be(24);
}

mach_o_t::vm_prot_t::~vm_prot_t() {
    _clean_up();
}

void mach_o_t::vm_prot_t::_clean_up() {
}

mach_o_t::dysymtab_command_t::dysymtab_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_indirect_symbols = nullptr;
    f_indirect_symbols = false;
    _read();
}

void mach_o_t::dysymtab_command_t::_read() {
    m_i_local_sym = m__io->read_u4le();
    m_n_local_sym = m__io->read_u4le();
    m_i_ext_def_sym = m__io->read_u4le();
    m_n_ext_def_sym = m__io->read_u4le();
    m_i_undef_sym = m__io->read_u4le();
    m_n_undef_sym = m__io->read_u4le();
    m_toc_off = m__io->read_u4le();
    m_n_toc = m__io->read_u4le();
    m_mod_tab_off = m__io->read_u4le();
    m_n_mod_tab = m__io->read_u4le();
    m_ext_ref_sym_off = m__io->read_u4le();
    m_n_ext_ref_syms = m__io->read_u4le();
    m_indirect_sym_off = m__io->read_u4le();
    m_n_indirect_syms = m__io->read_u4le();
    m_ext_rel_off = m__io->read_u4le();
    m_n_ext_rel = m__io->read_u4le();
    m_loc_rel_off = m__io->read_u4le();
    m_n_loc_rel = m__io->read_u4le();
}

mach_o_t::dysymtab_command_t::~dysymtab_command_t() {
    _clean_up();
}

void mach_o_t::dysymtab_command_t::_clean_up() {
    if (f_indirect_symbols) {
    }
}

std::vector<uint32_t>* mach_o_t::dysymtab_command_t::indirect_symbols() {
    if (f_indirect_symbols)
        return m_indirect_symbols.get();
    kaitai::kstream *io = _root()->_io();
    std::streampos _pos = io->pos();
    io->seek(indirect_sym_off());
    m_indirect_symbols = std::unique_ptr<std::vector<uint32_t>>(new std::vector<uint32_t>());
    const int l_indirect_symbols = n_indirect_syms();
    for (int i = 0; i < l_indirect_symbols; i++) {
        m_indirect_symbols->push_back(std::move(io->read_u4le()));
    }
    io->seek(_pos);
    f_indirect_symbols = true;
    return m_indirect_symbols.get();
}

mach_o_t::mach_header_t::mach_header_t(kaitai::kstream* p__io, mach_o_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_flags_obj = nullptr;
    f_flags_obj = false;
    _read();
}

void mach_o_t::mach_header_t::_read() {
    m_cputype = static_cast<mach_o_t::cpu_type_t>(m__io->read_u4le());
    m_cpusubtype = m__io->read_u4le();
    m_filetype = static_cast<mach_o_t::file_type_t>(m__io->read_u4le());
    m_ncmds = m__io->read_u4le();
    m_sizeofcmds = m__io->read_u4le();
    m_flags = m__io->read_u4le();
    n_reserved = true;
    if ( ((_root()->magic() == mach_o_t::MAGIC_TYPE_MACHO_BE_X64) || (_root()->magic() == mach_o_t::MAGIC_TYPE_MACHO_LE_X64)) ) {
        n_reserved = false;
        m_reserved = m__io->read_u4le();
    }
}

mach_o_t::mach_header_t::~mach_header_t() {
    _clean_up();
}

void mach_o_t::mach_header_t::_clean_up() {
    if (!n_reserved) {
    }
    if (f_flags_obj) {
    }
}

mach_o_t::macho_flags_t* mach_o_t::mach_header_t::flags_obj() {
    if (f_flags_obj)
        return m_flags_obj.get();
    m_flags_obj = std::unique_ptr<macho_flags_t>(new macho_flags_t(flags(), m__io, this, m__root));
    f_flags_obj = true;
    return m_flags_obj.get();
}

mach_o_t::linkedit_data_command_t::linkedit_data_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    _read();
}

void mach_o_t::linkedit_data_command_t::_read() {
    m_data_off = m__io->read_u4le();
    m_data_size = m__io->read_u4le();
}

mach_o_t::linkedit_data_command_t::~linkedit_data_command_t() {
    _clean_up();
}

void mach_o_t::linkedit_data_command_t::_clean_up() {
}

mach_o_t::sub_command_t::sub_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_name = nullptr;
    _read();
}

void mach_o_t::sub_command_t::_read() {
    m_name = std::unique_ptr<lc_str_t>(new lc_str_t(m__io, this, m__root));
}

mach_o_t::sub_command_t::~sub_command_t() {
    _clean_up();
}

void mach_o_t::sub_command_t::_clean_up() {
}

mach_o_t::twolevel_hints_command_t::twolevel_hints_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    _read();
}

void mach_o_t::twolevel_hints_command_t::_read() {
    m_offset = m__io->read_u4le();
    m_num_hints = m__io->read_u4le();
}

mach_o_t::twolevel_hints_command_t::~twolevel_hints_command_t() {
    _clean_up();
}

void mach_o_t::twolevel_hints_command_t::_clean_up() {
}

mach_o_t::version_t::version_t(kaitai::kstream* p__io, mach_o_t::version_min_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    _read();
}

void mach_o_t::version_t::_read() {
    m_p1 = m__io->read_u1();
    m_minor = m__io->read_u1();
    m_major = m__io->read_u1();
    m_release = m__io->read_u1();
}

mach_o_t::version_t::~version_t() {
    _clean_up();
}

void mach_o_t::version_t::_clean_up() {
}

mach_o_t::encryption_info_command_t::encryption_info_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    _read();
}

void mach_o_t::encryption_info_command_t::_read() {
    m_cryptoff = m__io->read_u4le();
    m_cryptsize = m__io->read_u4le();
    m_cryptid = m__io->read_u4le();
    n_pad = true;
    if ( ((_root()->magic() == mach_o_t::MAGIC_TYPE_MACHO_BE_X64) || (_root()->magic() == mach_o_t::MAGIC_TYPE_MACHO_LE_X64)) ) {
        n_pad = false;
        m_pad = m__io->read_u4le();
    }
}

mach_o_t::encryption_info_command_t::~encryption_info_command_t() {
    _clean_up();
}

void mach_o_t::encryption_info_command_t::_clean_up() {
    if (!n_pad) {
    }
}

mach_o_t::code_signature_command_t::code_signature_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_code_signature = nullptr;
    m__io__raw_code_signature = nullptr;
    f_code_signature = false;
    _read();
}

void mach_o_t::code_signature_command_t::_read() {
    m_data_off = m__io->read_u4le();
    m_data_size = m__io->read_u4le();
}

mach_o_t::code_signature_command_t::~code_signature_command_t() {
    _clean_up();
}

void mach_o_t::code_signature_command_t::_clean_up() {
    if (f_code_signature) {
    }
}

mach_o_t::cs_blob_t* mach_o_t::code_signature_command_t::code_signature() {
    if (f_code_signature)
        return m_code_signature.get();
    kaitai::kstream *io = _root()->_io();
    std::streampos _pos = io->pos();
    io->seek(data_off());
    m__raw_code_signature = io->read_bytes(data_size());
    m__io__raw_code_signature = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_code_signature));
    m_code_signature = std::unique_ptr<cs_blob_t>(new cs_blob_t(m__io__raw_code_signature.get(), this, m__root));
    io->seek(_pos);
    f_code_signature = true;
    return m_code_signature.get();
}

mach_o_t::dyld_info_command_t::dyld_info_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_bind = nullptr;
    m__io__raw_bind = nullptr;
    m_exports = nullptr;
    m__io__raw_exports = nullptr;
    m_weak_bind = nullptr;
    m__io__raw_weak_bind = nullptr;
    m_rebase = nullptr;
    m__io__raw_rebase = nullptr;
    m_lazy_bind = nullptr;
    m__io__raw_lazy_bind = nullptr;
    f_bind = false;
    f_exports = false;
    f_weak_bind = false;
    f_rebase = false;
    f_lazy_bind = false;
    _read();
}

void mach_o_t::dyld_info_command_t::_read() {
    m_rebase_off = m__io->read_u4le();
    m_rebase_size = m__io->read_u4le();
    m_bind_off = m__io->read_u4le();
    m_bind_size = m__io->read_u4le();
    m_weak_bind_off = m__io->read_u4le();
    m_weak_bind_size = m__io->read_u4le();
    m_lazy_bind_off = m__io->read_u4le();
    m_lazy_bind_size = m__io->read_u4le();
    m_export_off = m__io->read_u4le();
    m_export_size = m__io->read_u4le();
}

mach_o_t::dyld_info_command_t::~dyld_info_command_t() {
    _clean_up();
}

void mach_o_t::dyld_info_command_t::_clean_up() {
    if (f_bind && !n_bind) {
    }
    if (f_exports && !n_exports) {
    }
    if (f_weak_bind && !n_weak_bind) {
    }
    if (f_rebase && !n_rebase) {
    }
    if (f_lazy_bind && !n_lazy_bind) {
    }
}

mach_o_t::dyld_info_command_t::rebase_data_t::rebase_data_t(kaitai::kstream* p__io, mach_o_t::dyld_info_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_items = nullptr;
    _read();
}

void mach_o_t::dyld_info_command_t::rebase_data_t::_read() {
    m_items = std::unique_ptr<std::vector<std::unique_ptr<rebase_item_t>>>(new std::vector<std::unique_ptr<rebase_item_t>>());
    {
        int i = 0;
        rebase_item_t* _;
        do {
            _ = new rebase_item_t(m__io, this, m__root);
            m_items->push_back(std::move(std::unique_ptr<rebase_item_t>(_)));
            i++;
        } while (!(_->opcode() == mach_o_t::dyld_info_command_t::rebase_data_t::OPCODE_DONE));
    }
}

mach_o_t::dyld_info_command_t::rebase_data_t::~rebase_data_t() {
    _clean_up();
}

void mach_o_t::dyld_info_command_t::rebase_data_t::_clean_up() {
}

mach_o_t::dyld_info_command_t::rebase_data_t::rebase_item_t::rebase_item_t(kaitai::kstream* p__io, mach_o_t::dyld_info_command_t::rebase_data_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_uleb = nullptr;
    m_skip = nullptr;
    f_opcode = false;
    f_immediate = false;
    _read();
}

void mach_o_t::dyld_info_command_t::rebase_data_t::rebase_item_t::_read() {
    m_opcode_and_immediate = m__io->read_u1();
    n_uleb = true;
    if ( ((opcode() == mach_o_t::dyld_info_command_t::rebase_data_t::OPCODE_SET_SEGMENT_AND_OFFSET_ULEB) || (opcode() == mach_o_t::dyld_info_command_t::rebase_data_t::OPCODE_ADD_ADDRESS_ULEB) || (opcode() == mach_o_t::dyld_info_command_t::rebase_data_t::OPCODE_DO_REBASE_ULEB_TIMES) || (opcode() == mach_o_t::dyld_info_command_t::rebase_data_t::OPCODE_DO_REBASE_ADD_ADDRESS_ULEB) || (opcode() == mach_o_t::dyld_info_command_t::rebase_data_t::OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB)) ) {
        n_uleb = false;
        m_uleb = std::unique_ptr<uleb128_t>(new uleb128_t(m__io, this, m__root));
    }
    n_skip = true;
    if (opcode() == mach_o_t::dyld_info_command_t::rebase_data_t::OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB) {
        n_skip = false;
        m_skip = std::unique_ptr<uleb128_t>(new uleb128_t(m__io, this, m__root));
    }
}

mach_o_t::dyld_info_command_t::rebase_data_t::rebase_item_t::~rebase_item_t() {
    _clean_up();
}

void mach_o_t::dyld_info_command_t::rebase_data_t::rebase_item_t::_clean_up() {
    if (!n_uleb) {
    }
    if (!n_skip) {
    }
}

mach_o_t::dyld_info_command_t::rebase_data_t::opcode_t mach_o_t::dyld_info_command_t::rebase_data_t::rebase_item_t::opcode() {
    if (f_opcode)
        return m_opcode;
    m_opcode = static_cast<mach_o_t::dyld_info_command_t::rebase_data_t::opcode_t>((opcode_and_immediate() & 240));
    f_opcode = true;
    return m_opcode;
}

int32_t mach_o_t::dyld_info_command_t::rebase_data_t::rebase_item_t::immediate() {
    if (f_immediate)
        return m_immediate;
    m_immediate = (opcode_and_immediate() & 15);
    f_immediate = true;
    return m_immediate;
}

mach_o_t::dyld_info_command_t::bind_item_t::bind_item_t(kaitai::kstream* p__io, mach_o_t::dyld_info_command_t::bind_data_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_uleb = nullptr;
    m_skip = nullptr;
    f_opcode = false;
    f_immediate = false;
    _read();
}

void mach_o_t::dyld_info_command_t::bind_item_t::_read() {
    m_opcode_and_immediate = m__io->read_u1();
    n_uleb = true;
    if ( ((opcode() == mach_o_t::dyld_info_command_t::BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB) || (opcode() == mach_o_t::dyld_info_command_t::BIND_OPCODE_SET_APPEND_SLEB) || (opcode() == mach_o_t::dyld_info_command_t::BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB) || (opcode() == mach_o_t::dyld_info_command_t::BIND_OPCODE_ADD_ADDRESS_ULEB) || (opcode() == mach_o_t::dyld_info_command_t::BIND_OPCODE_DO_BIND_ADD_ADDRESS_ULEB) || (opcode() == mach_o_t::dyld_info_command_t::BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB)) ) {
        n_uleb = false;
        m_uleb = std::unique_ptr<uleb128_t>(new uleb128_t(m__io, this, m__root));
    }
    n_skip = true;
    if (opcode() == mach_o_t::dyld_info_command_t::BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB) {
        n_skip = false;
        m_skip = std::unique_ptr<uleb128_t>(new uleb128_t(m__io, this, m__root));
    }
    n_symbol = true;
    if (opcode() == mach_o_t::dyld_info_command_t::BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMMEDIATE) {
        n_symbol = false;
        m_symbol = kaitai::kstream::bytes_to_str(m__io->read_bytes_term(0, false, true, true), std::string("ascii"));
    }
}

mach_o_t::dyld_info_command_t::bind_item_t::~bind_item_t() {
    _clean_up();
}

void mach_o_t::dyld_info_command_t::bind_item_t::_clean_up() {
    if (!n_uleb) {
    }
    if (!n_skip) {
    }
    if (!n_symbol) {
    }
}

mach_o_t::dyld_info_command_t::bind_opcode_t mach_o_t::dyld_info_command_t::bind_item_t::opcode() {
    if (f_opcode)
        return m_opcode;
    m_opcode = static_cast<mach_o_t::dyld_info_command_t::bind_opcode_t>((opcode_and_immediate() & 240));
    f_opcode = true;
    return m_opcode;
}

int32_t mach_o_t::dyld_info_command_t::bind_item_t::immediate() {
    if (f_immediate)
        return m_immediate;
    m_immediate = (opcode_and_immediate() & 15);
    f_immediate = true;
    return m_immediate;
}

mach_o_t::dyld_info_command_t::bind_data_t::bind_data_t(kaitai::kstream* p__io, mach_o_t::dyld_info_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_items = nullptr;
    _read();
}

void mach_o_t::dyld_info_command_t::bind_data_t::_read() {
    m_items = std::unique_ptr<std::vector<std::unique_ptr<bind_item_t>>>(new std::vector<std::unique_ptr<bind_item_t>>());
    {
        int i = 0;
        while (!m__io->is_eof()) {
            m_items->push_back(std::move(std::unique_ptr<bind_item_t>(new bind_item_t(m__io, this, m__root))));
            i++;
        }
    }
}

mach_o_t::dyld_info_command_t::bind_data_t::~bind_data_t() {
    _clean_up();
}

void mach_o_t::dyld_info_command_t::bind_data_t::_clean_up() {
}

mach_o_t::dyld_info_command_t::export_node_t::export_node_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_terminal_size = nullptr;
    m_children = nullptr;
    _read();
}

void mach_o_t::dyld_info_command_t::export_node_t::_read() {
    m_terminal_size = std::unique_ptr<uleb128_t>(new uleb128_t(m__io, this, m__root));
    m_children_count = m__io->read_u1();
    m_children = std::unique_ptr<std::vector<std::unique_ptr<child_t>>>(new std::vector<std::unique_ptr<child_t>>());
    const int l_children = children_count();
    for (int i = 0; i < l_children; i++) {
        m_children->push_back(std::move(std::unique_ptr<child_t>(new child_t(m__io, this, m__root))));
    }
    m_terminal = m__io->read_bytes(terminal_size()->value());
}

mach_o_t::dyld_info_command_t::export_node_t::~export_node_t() {
    _clean_up();
}

void mach_o_t::dyld_info_command_t::export_node_t::_clean_up() {
}

mach_o_t::dyld_info_command_t::export_node_t::child_t::child_t(kaitai::kstream* p__io, mach_o_t::dyld_info_command_t::export_node_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_node_offset = nullptr;
    m_value = nullptr;
    f_value = false;
    _read();
}

void mach_o_t::dyld_info_command_t::export_node_t::child_t::_read() {
    m_name = kaitai::kstream::bytes_to_str(m__io->read_bytes_term(0, false, true, true), std::string("ascii"));
    m_node_offset = std::unique_ptr<uleb128_t>(new uleb128_t(m__io, this, m__root));
}

mach_o_t::dyld_info_command_t::export_node_t::child_t::~child_t() {
    _clean_up();
}

void mach_o_t::dyld_info_command_t::export_node_t::child_t::_clean_up() {
    if (f_value) {
    }
}

mach_o_t::dyld_info_command_t::export_node_t* mach_o_t::dyld_info_command_t::export_node_t::child_t::value() {
    if (f_value)
        return m_value.get();
    std::streampos _pos = m__io->pos();
    m__io->seek(node_offset()->value());
    m_value = std::unique_ptr<export_node_t>(new export_node_t(m__io, this, m__root));
    m__io->seek(_pos);
    f_value = true;
    return m_value.get();
}

mach_o_t::dyld_info_command_t::bind_data_t* mach_o_t::dyld_info_command_t::bind() {
    if (f_bind)
        return m_bind.get();
    n_bind = true;
    if (bind_size() != 0) {
        n_bind = false;
        kaitai::kstream *io = _root()->_io();
        std::streampos _pos = io->pos();
        io->seek(bind_off());
        m__raw_bind = io->read_bytes(bind_size());
        m__io__raw_bind = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_bind));
        m_bind = std::unique_ptr<bind_data_t>(new bind_data_t(m__io__raw_bind.get(), this, m__root));
        io->seek(_pos);
        f_bind = true;
    }
    return m_bind.get();
}

mach_o_t::dyld_info_command_t::export_node_t* mach_o_t::dyld_info_command_t::exports() {
    if (f_exports)
        return m_exports.get();
    n_exports = true;
    if (export_size() != 0) {
        n_exports = false;
        kaitai::kstream *io = _root()->_io();
        std::streampos _pos = io->pos();
        io->seek(export_off());
        m__raw_exports = io->read_bytes(export_size());
        m__io__raw_exports = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_exports));
        m_exports = std::unique_ptr<export_node_t>(new export_node_t(m__io__raw_exports.get(), this, m__root));
        io->seek(_pos);
        f_exports = true;
    }
    return m_exports.get();
}

mach_o_t::dyld_info_command_t::bind_data_t* mach_o_t::dyld_info_command_t::weak_bind() {
    if (f_weak_bind)
        return m_weak_bind.get();
    n_weak_bind = true;
    if (weak_bind_size() != 0) {
        n_weak_bind = false;
        kaitai::kstream *io = _root()->_io();
        std::streampos _pos = io->pos();
        io->seek(weak_bind_off());
        m__raw_weak_bind = io->read_bytes(weak_bind_size());
        m__io__raw_weak_bind = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_weak_bind));
        m_weak_bind = std::unique_ptr<bind_data_t>(new bind_data_t(m__io__raw_weak_bind.get(), this, m__root));
        io->seek(_pos);
        f_weak_bind = true;
    }
    return m_weak_bind.get();
}

mach_o_t::dyld_info_command_t::rebase_data_t* mach_o_t::dyld_info_command_t::rebase() {
    if (f_rebase)
        return m_rebase.get();
    n_rebase = true;
    if (rebase_size() != 0) {
        n_rebase = false;
        kaitai::kstream *io = _root()->_io();
        std::streampos _pos = io->pos();
        io->seek(rebase_off());
        m__raw_rebase = io->read_bytes(rebase_size());
        m__io__raw_rebase = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_rebase));
        m_rebase = std::unique_ptr<rebase_data_t>(new rebase_data_t(m__io__raw_rebase.get(), this, m__root));
        io->seek(_pos);
        f_rebase = true;
    }
    return m_rebase.get();
}

mach_o_t::dyld_info_command_t::bind_data_t* mach_o_t::dyld_info_command_t::lazy_bind() {
    if (f_lazy_bind)
        return m_lazy_bind.get();
    n_lazy_bind = true;
    if (lazy_bind_size() != 0) {
        n_lazy_bind = false;
        kaitai::kstream *io = _root()->_io();
        std::streampos _pos = io->pos();
        io->seek(lazy_bind_off());
        m__raw_lazy_bind = io->read_bytes(lazy_bind_size());
        m__io__raw_lazy_bind = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_lazy_bind));
        m_lazy_bind = std::unique_ptr<bind_data_t>(new bind_data_t(m__io__raw_lazy_bind.get(), this, m__root));
        io->seek(_pos);
        f_lazy_bind = true;
    }
    return m_lazy_bind.get();
}

mach_o_t::dylinker_command_t::dylinker_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_name = nullptr;
    _read();
}

void mach_o_t::dylinker_command_t::_read() {
    m_name = std::unique_ptr<lc_str_t>(new lc_str_t(m__io, this, m__root));
}

mach_o_t::dylinker_command_t::~dylinker_command_t() {
    _clean_up();
}

void mach_o_t::dylinker_command_t::_clean_up() {
}

mach_o_t::dylib_command_t::dylib_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    _read();
}

void mach_o_t::dylib_command_t::_read() {
    m_name_offset = m__io->read_u4le();
    m_timestamp = m__io->read_u4le();
    m_current_version = m__io->read_u4le();
    m_compatibility_version = m__io->read_u4le();
    m_name = kaitai::kstream::bytes_to_str(m__io->read_bytes_term(0, false, true, true), std::string("utf-8"));
}

mach_o_t::dylib_command_t::~dylib_command_t() {
    _clean_up();
}

void mach_o_t::dylib_command_t::_clean_up() {
}

mach_o_t::segment_command_t::segment_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_maxprot = nullptr;
    m_initprot = nullptr;
    m_sections = nullptr;
    _read();
}

void mach_o_t::segment_command_t::_read() {
    m_segname = kaitai::kstream::bytes_to_str(kaitai::kstream::bytes_strip_right(m__io->read_bytes(16), 0), std::string("ascii"));
    m_vmaddr = m__io->read_u4le();
    m_vmsize = m__io->read_u4le();
    m_fileoff = m__io->read_u4le();
    m_filesize = m__io->read_u4le();
    m_maxprot = std::unique_ptr<vm_prot_t>(new vm_prot_t(m__io, this, m__root));
    m_initprot = std::unique_ptr<vm_prot_t>(new vm_prot_t(m__io, this, m__root));
    m_nsects = m__io->read_u4le();
    m_flags = m__io->read_u4le();
    m_sections = std::unique_ptr<std::vector<std::unique_ptr<section_t>>>(new std::vector<std::unique_ptr<section_t>>());
    const int l_sections = nsects();
    for (int i = 0; i < l_sections; i++) {
        m_sections->push_back(std::move(std::unique_ptr<section_t>(new section_t(m__io, this, m__root))));
    }
}

mach_o_t::segment_command_t::~segment_command_t() {
    _clean_up();
}

void mach_o_t::segment_command_t::_clean_up() {
}

mach_o_t::segment_command_t::section_t::section_t(kaitai::kstream* p__io, mach_o_t::segment_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    f_data = false;
    _read();
}

void mach_o_t::segment_command_t::section_t::_read() {
    m_sect_name = kaitai::kstream::bytes_to_str(kaitai::kstream::bytes_strip_right(m__io->read_bytes(16), 0), std::string("ascii"));
    m_seg_name = kaitai::kstream::bytes_to_str(kaitai::kstream::bytes_strip_right(m__io->read_bytes(16), 0), std::string("ascii"));
    m_addr = m__io->read_u4le();
    m_size = m__io->read_u4le();
    m_offset = m__io->read_u4le();
    m_align = m__io->read_u4le();
    m_reloff = m__io->read_u4le();
    m_nreloc = m__io->read_u4le();
    m_flags = m__io->read_u4le();
    m_reserved1 = m__io->read_u4le();
    m_reserved2 = m__io->read_u4le();
}

mach_o_t::segment_command_t::section_t::~section_t() {
    _clean_up();
}

void mach_o_t::segment_command_t::section_t::_clean_up() {
    if (f_data) {
    }
}

std::string mach_o_t::segment_command_t::section_t::data() {
    if (f_data)
        return m_data;
    kaitai::kstream *io = _root()->_io();
    std::streampos _pos = io->pos();
    io->seek(offset());
    m_data = io->read_bytes(size());
    io->seek(_pos);
    f_data = true;
    return m_data;
}

mach_o_t::lc_str_t::lc_str_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    _read();
}

void mach_o_t::lc_str_t::_read() {
    m_length = m__io->read_u4le();
    m_value = kaitai::kstream::bytes_to_str(m__io->read_bytes_term(0, false, true, true), std::string("UTF-8"));
}

mach_o_t::lc_str_t::~lc_str_t() {
    _clean_up();
}

void mach_o_t::lc_str_t::_clean_up() {
}

mach_o_t::load_command_t::load_command_t(kaitai::kstream* p__io, mach_o_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m__io__raw_body = nullptr;
    _read();
}

void mach_o_t::load_command_t::_read() {
    m_type = static_cast<mach_o_t::load_command_type_t>(m__io->read_u4le());
    m_size = m__io->read_u4le();
    n_body = true;
    switch (type()) {
    case mach_o_t::LOAD_COMMAND_TYPE_ID_DYLINKER: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<dylinker_command_t>(new dylinker_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_REEXPORT_DYLIB: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<dylib_command_t>(new dylib_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_BUILD_VERSION: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<build_version_command_t>(new build_version_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_SOURCE_VERSION: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<source_version_command_t>(new source_version_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_FUNCTION_STARTS: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<linkedit_data_command_t>(new linkedit_data_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_RPATH: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<rpath_command_t>(new rpath_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_SUB_FRAMEWORK: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<sub_command_t>(new sub_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_ROUTINES: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<routines_command_t>(new routines_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_SUB_LIBRARY: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<sub_command_t>(new sub_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_DYLD_INFO_ONLY: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<dyld_info_command_t>(new dyld_info_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_DYLD_ENVIRONMENT: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<dylinker_command_t>(new dylinker_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_LOAD_DYLINKER: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<dylinker_command_t>(new dylinker_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_SEGMENT_SPLIT_INFO: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<linkedit_data_command_t>(new linkedit_data_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_MAIN: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<entry_point_command_t>(new entry_point_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_LOAD_DYLIB: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<dylib_command_t>(new dylib_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_ENCRYPTION_INFO: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<encryption_info_command_t>(new encryption_info_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_DYSYMTAB: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<dysymtab_command_t>(new dysymtab_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_TWOLEVEL_HINTS: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<twolevel_hints_command_t>(new twolevel_hints_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_ENCRYPTION_INFO_64: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<encryption_info_command_t>(new encryption_info_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_LINKER_OPTION: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<linker_option_command_t>(new linker_option_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_DYLD_INFO: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<dyld_info_command_t>(new dyld_info_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_VERSION_MIN_TVOS: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<version_min_command_t>(new version_min_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_LOAD_UPWARD_DYLIB: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<dylib_command_t>(new dylib_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_SEGMENT_64: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<segment_command_64_t>(new segment_command_64_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_SEGMENT: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<segment_command_t>(new segment_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_SUB_UMBRELLA: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<sub_command_t>(new sub_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_VERSION_MIN_WATCHOS: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<version_min_command_t>(new version_min_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_ROUTINES_64: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<routines_command_64_t>(new routines_command_64_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_ID_DYLIB: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<dylib_command_t>(new dylib_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_SUB_CLIENT: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<sub_command_t>(new sub_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_DYLIB_CODE_SIGN_DRS: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<linkedit_data_command_t>(new linkedit_data_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_SYMTAB: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<symtab_command_t>(new symtab_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_LINKER_OPTIMIZATION_HINT: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<linkedit_data_command_t>(new linkedit_data_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_DATA_IN_CODE: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<linkedit_data_command_t>(new linkedit_data_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_CODE_SIGNATURE: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<code_signature_command_t>(new code_signature_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_VERSION_MIN_IPHONEOS: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<version_min_command_t>(new version_min_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_LOAD_WEAK_DYLIB: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<dylib_command_t>(new dylib_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_LAZY_LOAD_DYLIB: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<dylib_command_t>(new dylib_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_UUID: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<uuid_command_t>(new uuid_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    case mach_o_t::LOAD_COMMAND_TYPE_VERSION_MIN_MACOSX: {
        n_body = false;
        m__raw_body = m__io->read_bytes((size() - 8));
        m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
        m_body = std::unique_ptr<version_min_command_t>(new version_min_command_t(m__io__raw_body.get(), this, m__root));
        break;
    }
    default: {
        m__raw_body = m__io->read_bytes((size() - 8));
        break;
    }
    }
}

mach_o_t::load_command_t::~load_command_t() {
    _clean_up();
}

void mach_o_t::load_command_t::_clean_up() {
    if (!n_body) {
    }
}

mach_o_t::uuid_command_t::uuid_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    _read();
}

void mach_o_t::uuid_command_t::_read() {
    m_uuid = m__io->read_bytes(16);
}

mach_o_t::uuid_command_t::~uuid_command_t() {
    _clean_up();
}

void mach_o_t::uuid_command_t::_clean_up() {
}

mach_o_t::symtab_command_t::symtab_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_symbols = nullptr;
    m_strs = nullptr;
    m__io__raw_strs = nullptr;
    f_symbols = false;
    f_strs = false;
    _read();
}

void mach_o_t::symtab_command_t::_read() {
    m_sym_off = m__io->read_u4le();
    m_n_syms = m__io->read_u4le();
    m_str_off = m__io->read_u4le();
    m_str_size = m__io->read_u4le();
}

mach_o_t::symtab_command_t::~symtab_command_t() {
    _clean_up();
}

void mach_o_t::symtab_command_t::_clean_up() {
    if (f_symbols) {
    }
    if (f_strs) {
    }
}

mach_o_t::symtab_command_t::str_table_t::str_table_t(kaitai::kstream* p__io, mach_o_t::symtab_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_items = nullptr;
    _read();
}

void mach_o_t::symtab_command_t::str_table_t::_read() {
    m_unknown = m__io->read_u4le();
    m_items = std::unique_ptr<std::vector<std::string>>(new std::vector<std::string>());
    {
        int i = 0;
        std::string _;
        do {
            _ = kaitai::kstream::bytes_to_str(m__io->read_bytes_term(0, false, true, false), std::string("utf-8"));
            m_items->push_back(_);
            i++;
        } while (!(_ == (std::string(""))));
    }
}

mach_o_t::symtab_command_t::str_table_t::~str_table_t() {
    _clean_up();
}

void mach_o_t::symtab_command_t::str_table_t::_clean_up() {
}

mach_o_t::symtab_command_t::nlist_64_t::nlist_64_t(kaitai::kstream* p__io, mach_o_t::symtab_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    f_name = false;
    _read();
}

void mach_o_t::symtab_command_t::nlist_64_t::_read() {
    m_un = m__io->read_u4le();
    m_type = m__io->read_u1();
    m_sect = m__io->read_u1();
    m_desc = m__io->read_u2le();
    m_value = m__io->read_u8le();
}

mach_o_t::symtab_command_t::nlist_64_t::~nlist_64_t() {
    _clean_up();
}

void mach_o_t::symtab_command_t::nlist_64_t::_clean_up() {
    if (f_name && !n_name) {
    }
}

std::string mach_o_t::symtab_command_t::nlist_64_t::name() {
    if (f_name)
        return m_name;
    n_name = true;
    if (un() != 0) {
        n_name = false;
        std::streampos _pos = m__io->pos();
        m__io->seek((_parent()->str_off() + un()));
        m_name = kaitai::kstream::bytes_to_str(m__io->read_bytes_term(0, false, true, true), std::string("utf-8"));
        m__io->seek(_pos);
        f_name = true;
    }
    return m_name;
}

mach_o_t::symtab_command_t::nlist_t::nlist_t(kaitai::kstream* p__io, mach_o_t::symtab_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    f_name = false;
    _read();
}

void mach_o_t::symtab_command_t::nlist_t::_read() {
    m_un = m__io->read_u4le();
    m_type = m__io->read_u1();
    m_sect = m__io->read_u1();
    m_desc = m__io->read_u2le();
    m_value = m__io->read_u4le();
}

mach_o_t::symtab_command_t::nlist_t::~nlist_t() {
    _clean_up();
}

void mach_o_t::symtab_command_t::nlist_t::_clean_up() {
    if (f_name && !n_name) {
    }
}

std::string mach_o_t::symtab_command_t::nlist_t::name() {
    if (f_name)
        return m_name;
    n_name = true;
    if (un() != 0) {
        n_name = false;
        std::streampos _pos = m__io->pos();
        m__io->seek((_parent()->str_off() + un()));
        m_name = kaitai::kstream::bytes_to_str(m__io->read_bytes_term(0, false, true, true), std::string("utf-8"));
        m__io->seek(_pos);
        f_name = true;
    }
    return m_name;
}

std::vector<std::unique_ptr<kaitai::kstruct>>* mach_o_t::symtab_command_t::symbols() {
    if (f_symbols)
        return m_symbols.get();
    kaitai::kstream *io = _root()->_io();
    std::streampos _pos = io->pos();
    io->seek(sym_off());
    m_symbols = std::unique_ptr<std::vector<std::unique_ptr<kaitai::kstruct>>>(new std::vector<std::unique_ptr<kaitai::kstruct>>());
    const int l_symbols = n_syms();
    for (int i = 0; i < l_symbols; i++) {
        switch (_root()->magic()) {
        case mach_o_t::MAGIC_TYPE_MACHO_LE_X64: {
            m_symbols->push_back(std::move(std::unique_ptr<nlist_64_t>(new nlist_64_t(io, this, m__root))));
            break;
        }
        case mach_o_t::MAGIC_TYPE_MACHO_BE_X64: {
            m_symbols->push_back(std::move(std::unique_ptr<nlist_64_t>(new nlist_64_t(io, this, m__root))));
            break;
        }
        case mach_o_t::MAGIC_TYPE_MACHO_LE_X86: {
            m_symbols->push_back(std::move(std::unique_ptr<nlist_t>(new nlist_t(io, this, m__root))));
            break;
        }
        case mach_o_t::MAGIC_TYPE_MACHO_BE_X86: {
            m_symbols->push_back(std::move(std::unique_ptr<nlist_t>(new nlist_t(io, this, m__root))));
            break;
        }
        }
    }
    io->seek(_pos);
    f_symbols = true;
    return m_symbols.get();
}

mach_o_t::symtab_command_t::str_table_t* mach_o_t::symtab_command_t::strs() {
    if (f_strs)
        return m_strs.get();
    kaitai::kstream *io = _root()->_io();
    std::streampos _pos = io->pos();
    io->seek(str_off());
    m__raw_strs = io->read_bytes(str_size());
    m__io__raw_strs = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_strs));
    m_strs = std::unique_ptr<str_table_t>(new str_table_t(m__io__raw_strs.get(), this, m__root));
    io->seek(_pos);
    f_strs = true;
    return m_strs.get();
}

mach_o_t::version_min_command_t::version_min_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    m_version = nullptr;
    m_sdk = nullptr;
    _read();
}

void mach_o_t::version_min_command_t::_read() {
    m_version = std::unique_ptr<version_t>(new version_t(m__io, this, m__root));
    m_sdk = std::unique_ptr<version_t>(new version_t(m__io, this, m__root));
}

mach_o_t::version_min_command_t::~version_min_command_t() {
    _clean_up();
}

void mach_o_t::version_min_command_t::_clean_up() {
}

mach_o_t::entry_point_command_t::entry_point_command_t(kaitai::kstream* p__io, mach_o_t::load_command_t* p__parent, mach_o_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    _read();
}

void mach_o_t::entry_point_command_t::_read() {
    m_entry_off = m__io->read_u8le();
    m_stack_size = m__io->read_u8le();
}

mach_o_t::entry_point_command_t::~entry_point_command_t() {
    _clean_up();
}

void mach_o_t::entry_point_command_t::_clean_up() {
}