int dtls1_buffer_message(SSL *s, int is_ccs)
{
    pitem *item;
    hm_fragment *frag;
    unsigned char seq64be[8];
    OPENSSL_assert(s->init_off == 0);
    frag = dtls1_hm_fragment_new(s->init_num, 0);
    if (frag == NULL)
        return 0;
    memcpy(frag->fragment, s->init_buf->data, s->init_num);
    if (is_ccs) {
        OPENSSL_assert(s->d1->w_msg_hdr.msg_len +
                       ((s->version==DTLS1_BAD_VER)?3:DTLS1_CCS_HEADER_LENGTH)
                       == (unsigned int)s->init_num);
    } else {
        OPENSSL_assert(s->d1->w_msg_hdr.msg_len +
                       DTLS1_HM_HEADER_LENGTH == (unsigned int)s->init_num);
    }
    frag->msg_header.msg_len = s->d1->w_msg_hdr.msg_len;
    frag->msg_header.seq = s->d1->w_msg_hdr.seq;
    frag->msg_header.type = s->d1->w_msg_hdr.type;
    frag->msg_header.frag_off = 0;
    frag->msg_header.frag_len = s->d1->w_msg_hdr.msg_len;
    frag->msg_header.is_ccs = is_ccs;
    frag->msg_header.saved_retransmit_state.enc_write_ctx = s->enc_write_ctx;
    frag->msg_header.saved_retransmit_state.write_hash = s->write_hash;
    frag->msg_header.saved_retransmit_state.compress = s->compress;
    frag->msg_header.saved_retransmit_state.session = s->session;
    frag->msg_header.saved_retransmit_state.epoch =
        DTLS_RECORD_LAYER_get_w_epoch(&s->rlayer);
    memset(seq64be, 0, sizeof(seq64be));
    seq64be[6] =
        (unsigned
         char)(dtls1_get_queue_priority(frag->msg_header.seq,
                                        frag->msg_header.is_ccs) >> 8);
    seq64be[7] =
        (unsigned
         char)(dtls1_get_queue_priority(frag->msg_header.seq,
                                        frag->msg_header.is_ccs));
    item = pitem_new(seq64be, frag);
    if (item == NULL) {
        dtls1_hm_fragment_free(frag);
        return 0;
    }
    pqueue_insert(s->d1->sent_messages, item);
    return 1;
}
['int dtls1_buffer_message(SSL *s, int is_ccs)\n{\n    pitem *item;\n    hm_fragment *frag;\n    unsigned char seq64be[8];\n    OPENSSL_assert(s->init_off == 0);\n    frag = dtls1_hm_fragment_new(s->init_num, 0);\n    if (frag == NULL)\n        return 0;\n    memcpy(frag->fragment, s->init_buf->data, s->init_num);\n    if (is_ccs) {\n        OPENSSL_assert(s->d1->w_msg_hdr.msg_len +\n                       ((s->version==DTLS1_BAD_VER)?3:DTLS1_CCS_HEADER_LENGTH)\n                       == (unsigned int)s->init_num);\n    } else {\n        OPENSSL_assert(s->d1->w_msg_hdr.msg_len +\n                       DTLS1_HM_HEADER_LENGTH == (unsigned int)s->init_num);\n    }\n    frag->msg_header.msg_len = s->d1->w_msg_hdr.msg_len;\n    frag->msg_header.seq = s->d1->w_msg_hdr.seq;\n    frag->msg_header.type = s->d1->w_msg_hdr.type;\n    frag->msg_header.frag_off = 0;\n    frag->msg_header.frag_len = s->d1->w_msg_hdr.msg_len;\n    frag->msg_header.is_ccs = is_ccs;\n    frag->msg_header.saved_retransmit_state.enc_write_ctx = s->enc_write_ctx;\n    frag->msg_header.saved_retransmit_state.write_hash = s->write_hash;\n    frag->msg_header.saved_retransmit_state.compress = s->compress;\n    frag->msg_header.saved_retransmit_state.session = s->session;\n    frag->msg_header.saved_retransmit_state.epoch =\n        DTLS_RECORD_LAYER_get_w_epoch(&s->rlayer);\n    memset(seq64be, 0, sizeof(seq64be));\n    seq64be[6] =\n        (unsigned\n         char)(dtls1_get_queue_priority(frag->msg_header.seq,\n                                        frag->msg_header.is_ccs) >> 8);\n    seq64be[7] =\n        (unsigned\n         char)(dtls1_get_queue_priority(frag->msg_header.seq,\n                                        frag->msg_header.is_ccs));\n    item = pitem_new(seq64be, frag);\n    if (item == NULL) {\n        dtls1_hm_fragment_free(frag);\n        return 0;\n    }\n    pqueue_insert(s->d1->sent_messages, item);\n    return 1;\n}', 'static hm_fragment *dtls1_hm_fragment_new(unsigned long frag_len,\n                                          int reassembly)\n{\n    hm_fragment *frag = NULL;\n    unsigned char *buf = NULL;\n    unsigned char *bitmask = NULL;\n    frag = OPENSSL_malloc(sizeof(*frag));\n    if (frag == NULL)\n        return NULL;\n    if (frag_len) {\n        buf = OPENSSL_malloc(frag_len);\n        if (buf == NULL) {\n            OPENSSL_free(frag);\n            return NULL;\n        }\n    }\n    frag->fragment = buf;\n    if (reassembly) {\n        bitmask = OPENSSL_zalloc(RSMBLY_BITMASK_SIZE(frag_len));\n        if (bitmask == NULL) {\n            OPENSSL_free(buf);\n            OPENSSL_free(frag);\n            return NULL;\n        }\n    }\n    frag->reassembly = bitmask;\n    return frag;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    if (num <= 0)\n        return NULL;\n    allow_customize = 0;\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);\n        ret = malloc(num);\n        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);\n    } else {\n        ret = malloc(num);\n    }\n#else\n    (void)file;\n    (void)line;\n    ret = malloc(num);\n#endif\n#ifndef OPENSSL_CPUID_OBJ\n    if (ret && (num > 2048)) {\n        extern unsigned char cleanse_ctr;\n        ((unsigned char *)ret)[0] = cleanse_ctr;\n    }\n#endif\n    return ret;\n}', 'int dtls1_get_queue_priority(unsigned short seq, int is_ccs)\n{\n    return seq * 2 - is_ccs;\n}', 'pitem *pitem_new(unsigned char *prio64be, void *data)\n{\n    pitem *item = OPENSSL_malloc(sizeof(*item));\n    if (item == NULL)\n        return NULL;\n    memcpy(item->priority, prio64be, sizeof(item->priority));\n    item->data = data;\n    item->next = NULL;\n    return item;\n}']