static int asn1_get_int64(int64_t *pr, const unsigned char *b, size_t blen,
                          int neg)
{
    uint64_t r;
    if (asn1_get_uint64(&r, b, blen) == 0)
        return 0;
    if (neg) {
        if (r > ABS_INT64_MIN) {
            ASN1err(ASN1_F_ASN1_GET_INT64, ASN1_R_TOO_SMALL);
            return 0;
        }
        *pr = 0 - (uint64_t)r;
    } else {
        if (r > INT64_MAX) {
            ASN1err(ASN1_F_ASN1_GET_INT64, ASN1_R_TOO_LARGE);
            return 0;
        }
        *pr = (int64_t)r;
    }
    return 1;
}
['static int asn1_get_int64(int64_t *pr, const unsigned char *b, size_t blen,\n                          int neg)\n{\n    uint64_t r;\n    if (asn1_get_uint64(&r, b, blen) == 0)\n        return 0;\n    if (neg) {\n        if (r > ABS_INT64_MIN) {\n            ASN1err(ASN1_F_ASN1_GET_INT64, ASN1_R_TOO_SMALL);\n            return 0;\n        }\n        *pr = 0 - (uint64_t)r;\n    } else {\n        if (r > INT64_MAX) {\n            ASN1err(ASN1_F_ASN1_GET_INT64, ASN1_R_TOO_LARGE);\n            return 0;\n        }\n        *pr = (int64_t)r;\n    }\n    return 1;\n}', 'static int asn1_get_uint64(uint64_t *pr, const unsigned char *b, size_t blen)\n{\n    size_t i;\n    uint64_t r;\n    if (blen > sizeof(*pr)) {\n        ASN1err(ASN1_F_ASN1_GET_UINT64, ASN1_R_TOO_LARGE);\n        return 0;\n    }\n    if (b == NULL)\n        return 0;\n    for (r = 0, i = 0; i < blen; i++) {\n        r <<= 8;\n        r |= b[i];\n    }\n    *pr = r;\n    return 1;\n}']