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ioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiAjIHRhcmdldHMKICMqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCi1hbGw6ICQoRVhFQykKK2FsbDogJChFWEVDMSkgJChFWEVDMikgJChFWEVDMykgJChFWEVDNCkgJChFWEVDNSkgJChFWEVDNikKIAotJChFWEVDKTogJChPQkpTKQorJChFWEVDMSk6ICQoT0JKUzEpCiAJJChDQykgJChMREZMQUdTKSAtbyAkQCAkXiAtV2wsLS1zdGFydC1ncm91cCAkKExETElCUykgJChMRExJQlNfJEApIC1XbCwtLWVuZC1ncm91cAogCUBjcCAkQCAkQC5lbGYKIAorJChFWEVDMik6ICQoT0JKUzIpCisJJChDQykgJChMREZMQUdTKSAtbyAkQCAkXiAtV2wsLS1zdGFydC1ncm91cCAkKExETElCUykgJChMRExJQlNfJEApIC1XbCwtLWVuZC1ncm91cAorCUBjcCAkQCAkQC5lbGYKIAorJChFWEVDMyk6ICQoT0JKUzMpCisJJChDQykgJChMREZMQUdTKSAtbyAkQCAkXiAtV2wsLS1zdGFydC1ncm91cCAkKExETElCUykgJChMRExJQlNfJEApIC1XbCwtLWVuZC1ncm91cAorCUBjcCAkQCAkQC5lbGYKKworJChFWEVDNCk6ICQoT0JKUzQpCisJJChDQykgJChMREZMQUdTKSAtbyAkQCAkXiAtV2wsLS1zdGFydC1ncm91cCAkKExETElCUykgJChMRExJQlNfJEApIC1XbCwtLWVuZC1ncm91cAorCUBjcCAkQCAkQC5lbGYKKworJChFWEVDNSk6ICQoT0JKUzUpCisJJChDQykgJChMREZMQUdTKSAtbyAkQCAkXiAtV2wsLS1zdGFydC1ncm91cCAkKExETElCUykgJChMRExJQlNfJEApIC1XbCwtLWVuZC1ncm91cAorCUBjcCAkQCAkQC5lbGYKKworJChFWEVDNik6ICQoT0JKUzYpCisJJChDQykgJChMREZ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FWFRfU0laRV07Cit9c2htX3VzZV9yZW1vdGU7CisKK3NobV9ub2RlX3Qgc2htX25vZGU7CisKK2Jvb2wgc2htX2lzX3JlbW90ZShjb25zdCBjaGFyICpzaG1fbmFtZSkKK3sKKyAgICBpZiAoIXNobV9uYW1lKQorICAgICAgICByZXR1cm4gRkFMU0U7CisgICAgaWYgKHN0cm5jbXAoc2htX25hbWUsIFNITV9OQU1FX0NST1NTX1BSRUZJWCwgc3RybGVuKFNITV9OQU1FX0NST1NTX1BSRUZJWCkpID09IDApCisgICAgICAgIHJldHVybiBUUlVFOworICAgIGVsc2UKKyAgICAgICAgcmV0dXJuIEZBTFNFOworfQorCitpbnQgbWFpbiAoaW50IGFyZ2MsIGNoYXIgKmFyZ3ZbXSkKK3sKKyAgICBpbnQgICAgICAgICAgb3B0OworICAgIGludCAgICAgICAgICBzaG1mZCAgICAgID0gMDsKKyAgICBpbnQgICAgICAgICAgcmV0ICAgICAgICA9IDA7CisgICAgdW5zaWduZWQgaW50IHNobV9zaXplICAgPSAwOworICAgIGNoYXIgICAgICAgICAqbmFtZSAgICAgID0gTlVMTDsKKyAgICBjaGFyICAgICAgICAgKnBzaG0gICAgICA9IE5VTEw7CisgICAgY2hhciAgICAgICAgICpyZWFkX2RhdGEgPSBOVUxMOworICAgIGV4dGVybiBjaGFyICAqb3B0YXJnOworCisgICAgc2htX3VzZV9yZW1vdGUgKnNoYXJlZDsKKworICAgIHdoaWxlICgob3B0ID0gZ2V0b3B0KGFyZ2MsYXJndiwibjpkOnM6OiIpKSAhPSBFT0YpCisgICAgeworICAgICAgICBzd2l0Y2ggKG9wdCkgCisgICAgICAgIHsKKyAgICAgICAgICAgIGNhc2UgJ24nOgorICAgICAgICAgICAgICAgIG5hbWUgPSBvcHRhcmc7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlICdkJzoKKyAgICAgICAgICAgICAgICByZWFkX2RhdGEgPSBvcHRhcmc7CisgICAgICAgICAgICAgICAg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BpcyAlZFxuIiwgbmFtZSwgc2htX3NpemUpOworCisgICAgc2htZmQgPSBzaG1fb3BlbihuYW1lLCBPX0NSRUFUIHwgT19SRFdSLCAwNjY2KTsKKyAgICBpZihzaG1mZCA8IDApCisgICAgeworICAgICAgICBwZXJyb3IoInNobV9vcGVuIGZhaWxcbiIpOworICAgICAgICBleGl0KDEpOworICAgIH0KKyAgICBwcmludGYoInNobV9vcGVuIHJldHVybiBva1xuIik7CisKKyAgICBpZihmdHJ1bmNhdGUoc2htZmQsIHNobV9zaXplKSA9PSAgLTEpCisgICAgeworICAgICAgICBwZXJyb3IoImZ0cnVuY2F0ZSBmYWlsXG4iKTsKKyAgICAgICAgZXhpdCgxKTsKKyAgICB9CisKKyAgICBwc2htID0gKGNoYXIgKiltbWFwKE5VTEwsIHNobV9zaXplLCBQUk9UX1JFQUR8UFJPVF9XUklURSwgTUFQX1NIQVJFRCwgc2htZmQsIDApOworICAgIGlmIChwc2htID09IE1BUF9GQUlMRUQpCisgICAgeworICAgICAgICBwZXJyb3IoIm1tYXAgZmFpbFxuIik7CisgICAgICAgIGV4aXQoMSk7CisgICAgfQorICAgIHByaW50ZigibW1hcCByZXR1cm4gb2tcbiIpOworICAgIHNobV9ub2RlLnNobV9zaXplID0gc2htX3NpemU7CisgICAgc3RybmNweShzaG1fbm9kZS5uYW1lLCBuYW1lLCBTSE1fTkFNRV9TSVpFLTEpOworCisgICAgc2hhcmVkID0gKHNobV91c2VfcmVtb3RlICopcHNobTsKKyAgICBzaGFyZWQtPndyaXRlICA9IDE7CisgICAgcHJpbnRmKCJyZWFkX2RhdGEgJXMgb2tcbiIsIHJlYWRfZGF0YSk7CisKKyAgICB3aGlsZSgxKQorICAgIHsKKyAgICAgICAgaWYoc3RybmNtcChzaGFyZWQtPmRhdGEsIHJlYWRfZGF0YSwgc2l6ZW9mKHJlYWRfZGF0YSkpID09IDApCisgICAgICAgIHsKKyAgICAgICAgICAgIHByaW50ZigiU3VjY2VzcywgQVAgcmVhZCAlcyBmcm9tIHNobVxuIiwgcmVhZF9kYXRhKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHNsZWVwKDIpOworICAgIH0KKyAgICAgCisgICAgcmV0ID0gbXVubWFwKHBzaG0sIHNobV9zaXplKTsKKyAgICBpZihyZXQgPCAwKQorICAgIHsKKyAgICAgICAgcHJpbnRmKCJtdW5tYXAgcmV0dXJuIGVycm5vICVkOiAlc1xuIiwgZXJybm8sIHN0cmVycm9yKGVycm5vKSk7CisgICAgICAgIGV4aXQoMSk7CisgICAgfQorCisgICAgaWYoc2htX2lzX3JlbW90ZShuYW1lKSkKKyAgICB7CisgICAgICAgIHJldCA9IHNobV91bmxpbmsobmFtZSk7CisgICAgICAgIGlmKHJldCA8IDApCisgICAgICAgIHsKKyAgICAgICAgICAgIHByaW50Zigic2htX3VubGluayBlcnJubyAlZDogJXNcbiIsIGVycm5vLCBzdHJlcnJvcihlcnJubykpOworICAgICAgICAgICAgZXhpdCgxKTsKKyAgICAgICAgfQorICAgIH0KKyAgICBjbG9zZShzaG1mZCk7CisKKyAgICBwcmludGYoInNobSBwb3NpeCByZWFkIGVuZFxuIik7CisgICAgcmV0dXJuIDA7Cit9CisKZGlmZiAtLWdpdCBhL2FwL2FwcC9zaG1fdGVzdC9zaG1fcG9zaXhfdGVzdC5jIGIvYXAvYXBwL3NobV90ZXN0L3NobV9wb3NpeF90ZXN0LmMKbmV3IGZpbGUgbW9kZSAxMDA3NTUKaW5kZXggMDAwMDAwMC4uZWVjOWY4ZQotLS0gL2Rldi9udWxsCisrKyBiL2FwL2FwcC9zaG1fdGVzdC9zaG1fcG9zaXhfdGVzdC5jCkBAIC0wLDAgKzEsMjg4IEBACisjaW5jbHVkZSA8ZXJybm8uaD4KKyNpbmNsdWRlIDxzdGRpby5oPgorI2luY2x1ZGUgPHN0ZGxpYi5oPgorI2luY2x1ZGUgPHN0cmluZy5oPgorI2luY2x1ZGU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E1fQUxMT0NfT05FX1BBR0VfU0laRSAgICgxMDI0KQorI2RlZmluZSBTSE1fQUxMT0NfVFdPX1BBR0VfU0laRSAgICg4MTAwKQorI2RlZmluZSBTSE1fQUxMT0NfRk9VUl9QQUdFX1NJWkUgICgxNjAwMCkKKworI2RlZmluZSBTSE1fVEVTVF9SRUFEX0ZST01fU0hNX1BBR0UwICgweDBBKQorI2RlZmluZSBTSE1fVEVTVF9XUklURV9UT19TSE1fUEFHRTEgICgweDFCKQorI2RlZmluZSBTSE1fVEVTVF9SRUFEX0ZST01fU0hNX1BBR0UyICgweDJBKQorI2RlZmluZSBTSE1fVEVTVF9XUklURV9UT19TSE1fUEFHRTMgICgweDNCKQorCisjZGVmaW5lIFNITV9JUENfRklMRV9OQU1FICAgICAicmVtb3RlLXBvc2l4X3Rlc3QiCisjZGVmaW5lIFNITV9UUkFOU19GSUxFX05BTUUgICAicmVtb3RlLXBvc2l4X3RyYW5zZmVyIgorCisvKioKKyAqIMirvtax5MG/tqjS5QorICovCitwdGhyZWFkX3Qgc2htX3Bjcm9zc190aHJlYWQ7CitwdGhyZWFkX3Qgc2htX3VubGlua190aHJlYWQ7CisKK2ludCAgIGdfc2htZmRbU0hNX1RFU1RfVEhSRUFEX05VTV0gPSB7MH07CitjaGFyICAqZ19wc2htW1NITV9URVNUX1RIUkVBRF9OVU1dID0ge05VTEx9OworaW50ICAgZ19tYXJrX3BhdGhbU0hNX1RFU1RfTUFSS19OVU1dID0gezB4RkZGRn07CisKK3ZvaWQgKmFwX3NobV9mb3VycGFnZV9jcm9zcyh2b2lkKiBhcmdzKQoreworICAgIGludCAgIGkgICAgICAgID0gMDsKKyAgICBpbnQgICByZXQgICAgICA9IDA7CisgICAgaW50ICAgc2htZmQgICAgPSAwOworICAgIGNoYXIgIHRlc3RfbnVtID0gMDsKKyAgICBjaGFyICAqcHNobSAgICA9IE5VTEw7CisgICAgc3RydWN0IHN0YXQgYnVmOworCisgICAgcHJjdGwoUFJfU0VUX05BTUUsICJzaG1fcG9zaXhfdHJhbnNfdGFzayIpOworCisgICAgc2htZmQgPSBzaG1fb3BlbihTSE1fVFJBTlNfRklMRV9OQU1FLCBPX0NSRUFUIHwgT19SRFdSLCAwNjY2KTsKKyAgICBpZihzaG1mZCA8IDApCisgICAgeworICAgICAgICBwcmludGYoInNobV9vcGVuIHJldHVybiBlcnJvclxuIik7CisgICAgICAgIGFzc2VydCgwKTsKKyAgICB9CisKKyAgICBpZihmdHJ1bmNhdGUoc2htZmQsIFNITV9BTExPQ19GT1VSX1BBR0VfU0laRSkgPT0gIC0xKQorICAgIHsKKyAgICAgICAgcGVycm9yKCJmdHJ1bmNhdGUgZmFpbGVkXG4iKTsKKyAgICAgICAgZXhpdCgxKTsKKyAgICB9CisKKyAgICBpZiAoZnN0YXQoc2htZmQsICZidWYpID09IC0xKQorICAgIHsKKyAgICAgICAgcHJpbnRmKCJmc3RhdCBlcnJvclxuIik7CisgICAgfQorICAgIHByaW50Zigic2l6ZSA9ICVkLCBtb2RlID0gJW9cbiIsYnVmLnN0X3NpemUsIGJ1Zi5zdF9tb2RlICYgMDc3Nyk7CisKKyAgICBwc2htID0gKGNoYXIgKiltbWFwKE5VTEwsIFNITV9BTExPQ19GT1VSX1BBR0VfU0laRSwgUFJPVF9SRUFEfFBST1RfV1JJVEUsIE1BUF9TSEFSRUQsIHNobWZkLCAwKTsKKyAgICBpZiAocHNobSA9PSBOVUxMKQorICAgIHsKKyAgICAgICAgcGVycm9yKCJtbWFwIGZhaWxlZFxuIik7CisgICAgICAgIGV4aXQoMSk7CisgICAgfQorICAgIGdfc2htZmRbU0hNX1RFU1RfVFJBTlNfVEhSRUFEXSA9IHNobWZkOworICAgIGdfcHNobVtTSE1fVEVTVF9UUkFOU19USFJFQURdICAgID0gcHNobTsKKworICAgIGZvcig7OykKKyAgICB7CisgICAgICAgIHdoaWxlKDEpCisgICAgICAgIHsKKyAgICAgICAgICAgIHRlc3RfbnVtID0gKihjaGFyICopcHNobTsKKyAgICAgICAgICAgIGlmKHRlc3RfbnVtID09IFNITV9URVNUX1JFQURfRlJPTV9TSE1fUEFHRTApCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgKihjaGFyICopKHBzaG0gKyBTSE1fUEFHRV9TSVpFKSA9IFNITV9URVNUX1dSSVRFX1RPX1NITV9QQUdFMTsKKyAgICAgICAgICAgICAgICBnX21hcmtfcGF0aFsyXSA9ICBTSE1fVEVTVF9SRUFEX0ZST01fU0hNX1BBR0UwOworICAgICAgICAgICAgICAgIHByaW50Zigic2htYXQgdGVzdF9udW0sIEFQIHdyaXRlICV4IHRvIHNobVxuIixTSE1fVEVTVF9XUklURV9UT19TSE1fUEFHRTEpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgc2xlZXAoMik7CisgICAgICAgIH0KKyAgICAgICAgd2hpbGUoMSkKKyAgICAgICAgeworICAgICAgICAgICAgdGVzdF9udW0gPSAqKGNoYXIgKikocHNobSArIDIgKiBTSE1fUEFHRV9TSVpFKTsKKyAgICAgICAgICAgIGlmKHRlc3RfbnVtID09IFNITV9URVNUX1JFQURfRlJPTV9TSE1fUEFHRTIpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgKihjaGFyICopKHBzaG0gKyAzICogU0hNX1BBR0VfU0laRSkgPSBTSE1fVEVTVF9XUklURV9UT19TSE1fUEFHRTM7CisgICAgICAgICAgICAgICAgZ19tYXJrX3BhdGhbNF0gPSAgU0hNX1RFU1RfUkVBRF9GUk9NX1NITV9QQUdFMjsKKyAgICAgICAgICAgICAgICBwcmludGYoInNobWF0IHRlc3RfbnVtLCBBUCB3cml0ZSAleCB0byBzaG1cbiIsIFNITV9URVNUX1dSSVRFX1RPX1NITV9QQUdFMyk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBzbGVlcCgyKTsKKyAgICAgICAgfQorICAgICAgICBpZiAoaSsrID49IDEwKQorICAgICAgICAgICAgYnJlYWs7CisgICAgfQorICAgIHJldCA9IG11bm1hcChwc2htLCBTSE1fQUxMT0NfRk9VUl9QQUdFX1NJWkUpOworICAgIGlmKHJldCA8IDApCisgICAgeworICAgICAgICBwcmludGYoIm11bm1hcCBlcnJubyAlZDogJXNcbiIsIGVycm5vLCBzdHJlcnJvcihlcnJubykpOworICAgICAgICBleGl0KDEpOworICAgIH0KKyAgICBwcmludGYoIm11bm1hcCByZXR1cm4gb2tcbiIpOworCisgICAgcmV0ID0gc2htX3VubGluayhTSE1fVFJBTlNfRklMRV9OQU1FKTsKKyAgICBpZihyZXQgPCAwKQorICAgIHsKKyAgICAgICAgcHJpbnRmKCJzaG1fdW5saW5rIGVycm5vICVkOiAlc1xuIiwgZXJybm8sIHN0cmVycm9yKGVycm5vKSk7CisgICAgICAgIHJldHVybiAtMTsKKyAgICB9CisKKyAgICBwcmludGYoInNobV91bmxpbmsgcmV0dXJuIG9rXG4iKTsKKyAgICBjbG9zZShzaG1mZCk7CisgICAgd2hpbGUoMSkKKyAgICB7CisgICAgICAgIHNsZWVwKDUpOworICAgIH0KK30KKwordm9pZCAqYXBfd3JpdGVfYW5kX3VubGluayh2b2lkKiBhcmdzKQoreworICAgIGludCAgc2htZmQgPSAwOworICAgIGludCAgcmV0ICAgPSAwOworICAgIGNoYXIgKnBzaG0gPSBOVUxMOworICAgIHN0cnVjdCBzdGF0IGJ1ZjsKKyAgICBpbnQgICB0ZXN0X251bSA9IDA7CisKKyAgICBwcmN0bChQUl9TRVRfTkFNRSwgInNobV9wb3NpeF90YXNrIik7CisgICAgCisgICAgc2htZmQgPSBzaG1fb3BlbihTSE1fSVBDX0ZJTEVfTkFNRSwgT19DUkVBVCB8IE9fUkRXUiwgMDY2Nik7CisgICAgaWYoc2htZmQgPCAwKQorICAgIHsKKyAgICAgICAgcHJpbnRmKCJzaG1fb3BlbiByZXR1cm4gZXJyb3JcbiIpOworICAgICAgICBhc3NlcnQoMCk7CisgICAgfQorCisgICAgaWYoZnRydW5jYXRlKHNobWZkLCBTSE1fQUxMT0NfVFdPX1BBR0VfU0laRSkgPT0gIC0xKQorICAgIHsKKyAgICAgICAgcGVycm9yKCJmdHJ1bmNhdGUgZmFpbGVkXG4iKTsKKyAgICAgICAgZXhpdCgxKTsKKyAgICB9CisKKyAgICBpZiAoZnN0YXQoc2htZmQsICZidWYpID09IC0xKQorICAgIHsKKyAgICAgICAgcHJpbnRmKCJmc3RhdCBlcnJvclxuIik7CisgICAgfQorICAgIHByaW50Zigic2l6ZSA9ICVkLCBtb2RlID0gJW9cbiIsYnVmLnN0X3NpemUsIGJ1Zi5zdF9tb2RlICYgMDc3Nyk7CisgICAgCisgICAgcHNobSA9IChjaGFyICopbW1hcChOVUxMLCBTSE1fQUxMT0NfVFdPX1BBR0VfU0laRSwgUFJPVF9SRUFEfFBST1RfV1JJVEUsIE1BUF9TSEFSRUQsIHNobWZkLCAwKTsKKyAgICBpZiAocHNobSA9PSBNQVBfRkFJTEVEKQorICAgIHsKKyAgICAgICAgcGVycm9yKCJtbWFwIGZhaWxlZFxuIik7CisgICAgICAgIGV4aXQoMSk7CisgICAgfQorCisgICAgZ19zaG1mZFtTSE1fVEVTVF9BTExPQ19USFJFQURdID0gc2htZmQ7CisgICAgZ19wc2htW1NITV9URVNUX0FMTE9DX1RIUkVBRF0gID0gcHNobTsKKworICAgIHdoaWxlKDEpCisgICAgeworICAgICAgICB0ZXN0X251bSA9ICooaW50ICopcHNobTsKKyAgICAgICAgaWYodGVzdF9udW0gPT0gU0hNX1RFU1RfQ0FQX0lOSVRfVkFMVUUpCisgICAgICAgIHsgICAgICAgIAorICAgICAgICAgICAgKihpbnQgKilwc2htID0gU0hNX1RFU1RfTUFSS18wWDEgKyAxOworICAgICAgICAgICAgZ19tYXJrX3BhdGhbMV0gPSBTSE1fVEVTVF9NQVJLXzBYMTsKKyAgICAgICAgICAgIHByaW50Zigic2htYXQgdGVzdF9udW0gMHgxNiwgZ19tYXJrX3BhdGhbMV0gPSAleFxuIiwgZ19tYXJrX3BhdGhbMV0pOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgc2xlZXAoMSk7CisgICAgfQorCisgICAgd2hpbGUoMSkKKyAgICB7CisgICAgICAgIHRlc3RfbnVtID0gKihpbnQgKilwc2htOworICAgICAgICBpZih0ZXN0X251bSA9PSBTSE1fVEVTVF9NQVJLXzBYMykKKyAgICAgICAgeworICAgICAgICAgICAgKihpbnQgKilwc2htID0gU0hNX1RFU1RfTUFSS18wWDMgKyAxOworICAgICAgICAgICAgZ19tYXJrX3BhdGhbM10gPSBTSE1fVEVTVF9NQVJLXzBYMzsKKyAgICAgICAgICAgIHByaW50Zigic2htYXQgdGVzdF9udW0gMywgZ19tYXJrX3BhdGhbM10gYmVmb3JlPSAleFxuIiwgZ19tYXJrX3BhdGhbM10pOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgc2xlZXAoMSk7CisgICAgfQorCisgICAgd2hpbGUoMSkKKyAgICB7CisgICAgICAgIHRlc3RfbnVtID0gKihpbnQgKilwc2htOworICAgICAgICBpZih0ZXN0X251bSA9PSBTSE1fVEVTVF9NQVJLXzBYNSkKKyAgICAgICAgeworICAgICAgICAgICAgKihpbnQgKilwc2htID0gU0hNX1RFU1RfTUFSS18wWDUgKyAxOworICAgICAgICAgICAgZ19tYXJrX3BhdGhbNV0gPSBTSE1fVEVTVF9NQVJLXzBYNTsKKyAgICAgICAgICAgIHByaW50Zigic2htYXQgdGVzdF9udW0gNSwgZ19tYXJrX3BhdGg1IGJlZm9yZT0gJXhcbiIsIGdfbWFya19wYXRoWzVdKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIHNsZWVwKDEpOworICAgIH0KKworICAgIHdoaWxlKDEpCisgICAgeworICAgICAgICB0ZXN0X251bSA9ICooaW50ICopcHNobTsKKyAgICAgICAgaWYodGVzdF9udW0gPT0gU0hNX1RFU1RfTUFSS18wWDcpCisgICAgICAgIHsKKyAgICAgICAgICAgICooaW50ICopcHNobSA9IFNITV9URVNUX01BUktfMFg3ICsgMTsgICAgICAgIAorICAgICAgICAgICAgZ19tYXJrX3BhdGhbN10gPSBTSE1fVEVTVF9NQVJLXzBYNzsKKyAgICAgICAgICAgIHByaW50Zigic2htYXQgdGVzdF9udW0gNywgZ19tYXJrX3BhdGg3IGJlZm9yZT0gJXhcbiIsIGdfbWFya19wYXRoWzddKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIHNsZWVwKDEpOworICAgIH0KKyAgICBtZW1jcHkocHNobSArIDMyLCAiMTIzNDU2IiwgU0hNX1RFU1RfU1RSX05VTSk7ICAgIAorCisgICAgcmV0ID0gbXVubWFwKHBzaG0sIFNITV9BTExPQ19UV09fUEFHRV9TSVpFKTsKKyAgICBpZihyZXQgPCAwKQorICAgIHsKKyAgICAgICAgcHJpbnRmKCJtdW5tYXAgZXJybm8gJWQ6ICVzXG4iLCBlcnJubywgc3RyZXJyb3IoZXJybm8pKTsKKyAgICAgICAgZXhpdCgxKTsKKyAgICB9CisgICAgcmV0ID0gc2htX3VubGluayhTSE1fSVBDX0ZJTEVfTkFNRSk7CisgICAgaWYocmV0IDwgMCkKKyAgICB7CisgICAgICAgIHByaW50Zigic2htX3VubGluayBlcnJubyAlZDogJXNcbiIsIGVycm5vLCBzdHJlcnJvcihlcnJubykpOworICAgICAgICBhc3NlcnQoMCk7CisgICAgfQorICAgIGNsb3NlKHNobWZkKTsKKworICAgIHdoaWxlKDEpCisgICAgeworICAgICAgICBzbGVlcCg1KTsKKyAgICB9CisgICAgcmV0dXJuIDA7Cit9CisKKworaW50IG1haW4gKGludCBhcmdjLCBjaGFyICphcmd2W10pCit7CisgICAgaW50IHJldCA9IDA7CisKKyAgICByZXQgPSBwdGhyZWFkX2NyZWF0ZSgmc2htX3Bjcm9zc190aHJlYWQsIE5VTEwsIGFwX3NobV9mb3VycGFnZV9jcm9zcywgTlVMTCk7C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ICAgY29weV9zaXplID0gMDsKKyAgICB1bnNpZ25lZCBpbnQgc2htX3NpemUgID0gMDsKKyAgICBpbnQgICAgICAgICAgc2htZmQgICAgID0gMDsKKyAgICBjaGFyICAgICAgICAgKm5hbWUgICAgID0gTlVMTDsKKyAgICBjaGFyICAgICAgICAgKnBzaG0gICAgID0gTlVMTDsKKyAgICBjaGFyICAgICAgICAgKndyaXRlX2RhdGEgPSBOVUxMOworICAgIGV4dGVybiBjaGFyICAqb3B0YXJnOworICAgIHNobV91c2VfcmVtb3RlICpzaGFyZWQ7CisKKyAgICB3aGlsZSAoKG9wdCA9IGdldG9wdChhcmdjLGFyZ3YsIm46ZDpzOjoiKSkgIT0gRU9GKQorICAgIHsKKyAgICAgICAgc3dpdGNoIChvcHQpIAorICAgICAgICB7CisgICAgICAgICAgICBjYXNlICduJzoKKyAgICAgICAgICAgICAgICBuYW1lID0gb3B0YXJnOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSAnZCc6CisgICAgICAgICAgICAgICAgd3JpdGVfZGF0YSA9IG9wdGFyZzsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgJ3MnOgorICAgICAgICAgICAgICAgIHNobV9zaXplID0gYXRvaShvcHRhcmcpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgIH0KKworICAgIGlmICghbmFtZSB8fCAhd3JpdGVfZGF0YSkKKyAgICB7CisgICAgICAgIHByaW50ZigicGFyYW0gZXJyb3I6IHlvdSBjYW4gaW5wdXQgXCJzaG1fcG9zaXhfd3JpdGUgLW4gXCJyZW1vdGUtc2htX3Rlc3RcIiAtZCBcIjEyMzQ1NlwiIC1zMTAyNCBcbiIpOyAgIAorICAgICAgICBwcmludGYoIm9yIFwic2htX3Bvc2l4X3dyaXRlIC1uIFwicmVtb3RlLXNobV90ZXN0XC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gICAgcHNobSA9IChjaGFyICopbW1hcChOVUxMLCBzaG1fc2l6ZSwgUFJPVF9SRUFEfFBST1RfV1JJVEUsIE1BUF9TSEFSRUQsIHNobWZkLCAwKTsKKyAgICBpZiAocHNobSA9PSBNQVBfRkFJTEVEKQorICAgIHsKKyAgICAgICAgcGVycm9yKCJtbWFwIGZhaWxlZFxuIik7CisgICAgICAgIGV4aXQoMSk7CisgICAgfSAgICAKKyAgICBzaG1fbm9kZS5zaG1fc2l6ZSA9IHNobV9zaXplOworICAgIHN0cm5jcHkoc2htX25vZGUubmFtZSwgbmFtZSwgU0hNX05BTUVfU0laRS0xKTsKKworICAgIHByaW50ZigiQVAgd3JpdGUgdGVzdCA6IG1tYXAgcmV0dXJuIG9rXG4iKTsKKyAgICBzaGFyZWQgPSAoc2htX3VzZV9yZW1vdGUgKilwc2htOworICAgIGNvcHlfc2l6ZSA9IFNITV9NSU4oc3RybGVuKHdyaXRlX2RhdGEpLCAoU0hNX1RFWFRfU0laRSAtIDEpKTsKKworICAgIHByaW50ZigiQVAgd3JpdGUgdGVzdCA6IHNoYXJlZC0+d3JpdGUgJWRcbiIsc2hhcmVkLT53cml0ZSk7CisKKyAgICB3aGlsZSgxKQorICAgIHsgICAgICAgIAorICAgICAgICBpZihzaGFyZWQtPndyaXRlID09IDEpCisgICAgICAgIHsKKyAgICAgICAgICAgIHN0cm5jcHkoc2hhcmVkLT5kYXRhLCB3cml0ZV9kYXRhLCBjb3B5X3NpemUpOworICAgICAgICAgICAgcHJpbnRmKCJBUCB3cml0ZSAlcyB0byBzaG1cbiIsIHdyaXRlX2RhdGEpOworICAgICAgICAgICAgc2hhcmVkLT53cml0ZSA9IDA7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICBlbHNleworICAgICAgICAgICAgc2xlZXAoMik7CisgICAgICAgIH0KKyAgICB9CisgICAgcmV0ID0gbXVubWFwKHBzaG0sIHNobV9zaXplKTsKKyAgICBpZihyZXQgPCAwKQorICAg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UgPHN5cy9zdGF0Lmg+CisjaW5jbHVkZSA8ZmNudGwuaD4KKworLyoqCisgKiC66rao0uUKKyAqLworI2RlZmluZSBTSE1fVEVYVF9TSVpFICAgICAgICAgICAgICg4MTkyKQorI2RlZmluZSBTSE1fUEFHRV9TSVpFICAgICAgICAgICAgICg0MDk2KQorI2RlZmluZSBTSE1fQUxMT0NfT05FX1BBR0VfU0laRSAgICgxMDI0KQorI2RlZmluZSBTSE1fQUxMT0NfVFdPX1BBR0VfU0laRSAgICg4MTAwKQorI2RlZmluZSBTSE1fQUxMT0NfRk9VUl9QQUdFX1NJWkUgICgxNjAwMCkKKwordHlwZWRlZiBzdHJ1Y3QgCit7CisgICAga2V5X3QgICAgICAgIGtleTsKKyAgICBpbnQgICAgICAgICAgc2htaWQ7CisgICAgdW5zaWduZWQgaW50IHNobV9zaXplOworfXNobV9ub2RlX3Q7CisKK3R5cGVkZWYgc3RydWN0IAoreworICAgIGludCAgd3JpdGU7CisgICAgY2hhciBkYXRhW1NITV9URVhUX1NJWkVdOworfXNobV91c2VfcmVtb3RlOworCitzaG1fbm9kZV90IHNobV9ub2RlOworCitpbnQgbWFpbiAoaW50IGFyZ2MsIGNoYXIgKmFyZ3ZbXSkKK3sKKyAgICBpbnQgICAgICAgICAgb3B0OworICAgIGludCAgICAgICAgICByZXQgICAgICAgID0gMDsKKyAgICBpbnQgICAgICAgICAgc2htaWQgICAgICA9IDA7CisgICAgdW5zaWduZWQgaW50IHNobV9zaXplICAgPSAwOworICAgIGtleV90ICAgICAgICBrZXkgICAgICAgID0gMDsKKyAgICBjaGFyICAgICAgICAgKnBzaG0gICAgICA9IE5VTEw7CisgICAgY2hhciAgICAgICAgICpyZWFkX2RhdGEgPSBOVUxMOworICAgIGV4dGVybiBjaGFyICAqb3B0YXJnOworCisgICAgc2htX3VzZV9yZW1vdGUgKnNoYXJlZDsKKworICAgIHdoaWxlICgob3B0ID0gZ2V0b3B0KGFyZ2MsYXJndiwiazpkOnM6OiIpKSAhPSBFT0YpCisgICAgeworICAgICAgICBzd2l0Y2ggKG9wdCkgCisgICAgICAgIHsKKyAgICAgICAgICAgIGNhc2UgJ2snOgorICAgICAgICAgICAgICAgIGtleSA9IGF0b2kob3B0YXJnKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgJ2QnOgorICAgICAgICAgICAgICAgIHJlYWRfZGF0YSA9IG9wdGFyZzsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgJ3MnOgorICAgICAgICAgICAgICAgIHNobV9zaXplID0gYXRvaShvcHRhcmcpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgIH0KKworICAgIGlmIChrZXkgPT0gMCB8fCAhcmVhZF9kYXRhKQorICAgIHsKKyAgICAgICAgcHJpbnRmKCJwYXJhbSBlcnJvcjogeW91IGNhbiBpbnB1dCBcInNobV9yZWFkIC1rIC0yMDAgLWQgXCIxMjM0NTZcIiAtczEwMjQgXG4iKTsgICAgCisgICAgICAgIHByaW50Zigib3IgXCJzaG1fcmVhZCAtayAtMjAwIC1kIFwiMTIzNDU2XCIgXG4iKTsgICAgCisgICAgICAgIHByaW50ZigiLWsgLTIwMDogY3JlYXRlIGEgc2htIHVzaW5nIGtleSAtMjAwXG4iKTsKKyAgICAgICAgcHJpbnRmKCItZCBcIjEyMzQ1NlwiOiBpZiB3ZSB3cml0ZSAxMjM0NTYgdG8gc2htLCB0aGVuIGNhbiByZWFkIDEyMzQ1NiBmb3JtIHNobSwgdGhlIHRlc3QgY2FzZSBpcyBwYXNzISBcbiIpOworICAgICAgICBwcmludGYoIi1zMTAyNDogc2V0IHRoZSBzaXplIG9mIHNobSwgdGhlbiB0aGUgZGVmYXVsdCBzaXplIGlzIDEwMjQgXG4iKTsKKyAgICAgICAgcmV0dXJuIC0xOworICAgIH0KKworICAgIGlmIChzaG1fc2l6ZSA9PSAwKQorICAgICAgICBzaG1fc2l6ZSA9IFNITV9BTExPQ19PTkVfUEFHRV9TSVpFOworCisgICAgcHJpbnRmKCJBUCByZWFkIHRlc3Q6IGtleSBpcyAlZCwgc2htX3NpemUgaXMgJWRcbiIsIGtleSwgc2htX3NpemUpOworCisgICAgc2htaWQgPSBzaG1nZXQoa2V5LCBzaG1fc2l6ZSwgMDY2NnxJUENfQ1JFQVQpOworICAgIGlmKHNobWlkIDwgMCkKKyAgICB7CisgICAgICAgIHByaW50Zigic2htaWQgcmV0dXJuIGVycm9yXG4iKTsKKyAgICAgICAgcmV0dXJuIC0xOworICAgIH0KKworICAgIHBzaG0gPSAoY2hhciAqKXNobWF0KHNobWlkLCAwLCAwKTsKKyAgICBpZiAocHNobSA9PSBOVUxMKQorICAgIHsKKyAgICAgICAgcHJpbnRmKCJzaG1hdCByZXR1cm4gZXJyb3JcbiIpOworICAgICAgICByZXR1cm4gLTE7CisgICAgfQorICAgIHNobV9ub2RlLmtleSAgICAgICA9IGtleTsKKyAgICBzaG1fbm9kZS5zaG1fc2l6ZSA9IHNobV9zaXplOworCisgICAgc2hhcmVkID0gKHNobV91c2VfcmVtb3RlICopcHNobTsKKyAgICBzaGFyZWQtPndyaXRlICA9IDE7CisKKyAgICB3aGlsZSgxKQorICAgIHsKKyAgICAgICAgaWYoc3RybmNtcChzaGFyZWQtPmRhdGEsIHJlYWRfZGF0YSwgc2l6ZW9mKHJlYWRfZGF0YSkpID09IDApCisgICAgICAgIHsKKyAgICAgICAgICAgIHByaW50ZigiU3VjY2VzcywgQVAgcmVhZCAlcyBmcm9tIHNobVxuIiwgcmVhZF9kYXRhKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHNsZWVwKDIpOworICAgIH0KKworICAgIGlmKHNobWR0KHBzaG0pIDwgMCkKKyAgICB7CisgICAgICAgIHByaW50Zigic2htZHQgZXJybm8gJWQ6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V5X3QgICAgICAgIGtleTsKKyAgICBpbnQgICAgICAgICAgc2htaWQ7CisgICAgdW5zaWduZWQgaW50IHNobV9zaXplOworfXNobV9ub2RlX3Q7CisKK3R5cGVkZWYgc3RydWN0IAoreworICAgIGludCAgd3JpdGU7CisgICAgY2hhciBkYXRhW1NITV9URVhUX1NJWkVdOworfXNobV91c2VfcmVtb3RlOworCitzaG1fbm9kZV90IHNobV9ub2RlOworCitpbnQgbWFpbiAoaW50IGFyZ2MsIGNoYXIgKmFyZ3ZbXSkKK3sKKyAgICBpbnQgICAgICAgICAgb3B0OworICAgIGludCAgICAgICAgICByZXQgICAgICA9IDA7CisgICAgaW50ICAgICAgICAgIHNobWlkICAgID0gMDsJCisgICAgaW50ICAgICAgICAgIGNvcHlfc2l6ZSA9IDA7CisgICAgdW5zaWduZWQgaW50IHNobV9zaXplID0gMDsKKyAgICBrZXlfdCAgICAgICAga2V5ICAgICAgPSAwOworICAgIGNoYXIgICAgICAgICAqcHNobSAgICA9IE5VTEw7CisgICAgY2hhciAgICAgICAgICp3cml0ZV9kYXRhID0gTlVMTDsKKyAgICBleHRlcm4gY2hhciAgKm9wdGFyZzsKKyAgICBzaG1fdXNlX3JlbW90ZSAqc2hhcmVkOworCisgICAgd2hpbGUgKChvcHQgPSBnZXRvcHQoYXJnYyxhcmd2LCJrOmQ6czo6IikpICE9IEVPRikKKyAgICB7CisgICAgICAgIHN3aXRjaCAob3B0KSAKKyAgICAgICAgeworICAgICAgICAgICAgY2FzZSAnayc6CisgICAgICAgICAgICAgICAga2V5ID0gYXRvaShvcHRhcmcpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSAnZCc6CisgICAgICAgICAgICAgICAgd3JpdGVfZGF0YSA9IG9wdGFyZzsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgJ3MnOgorICAgICAgICAgICAgICAgIHNobV9zaXplID0gYXRvaShvcHRhcmcpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgIH0KKworICAgIGlmIChrZXkgPT0gMCB8fCAhd3JpdGVfZGF0YSkKKyAgICB7CisgICAgICAgIHByaW50ZigicGFyYW0gZXJyb3I6IHlvdSBjYW4gaW5wdXQgXCJzaG1fd3JpdGUgLWsgLTIwMCAtZCBcIjEyMzQ1NlwiIC1zMTAyNCBcbiIpOyAgICAKKyAgICAgICAgcHJpbnRmKCJvciBcInNobV9yZWFkIC1rIC0yMDAgLWQgXCIxMjM0NTZcIiBcbiIpOyAgICAKKyAgICAgICAgcHJpbnRmKCItayAtMjAwOiBjcmVhdGUgYSBzaG0gdXNpbmcga2V5IC0yMDBcbiIpOworICAgICAgICBwcmludGYoIi1kIFwiMTIzNDU2XCI6IHRoZSBkYXRhIHdyaXRlIHRvIHNobTogZm9yIGV4YW1wbGUsIGlmIHdlIHdyaXRlIDEyMzQ1NiB0byBzaG0sIHRoZW4gY2FuIHJlYWQgMTIzNDU2IGZvcm0gc2htLCB0aGUgdGVzdCBjYXNlIGlzIHBhc3MhIFxuIik7CisgICAgICAgIHByaW50ZigiLXMxMDI0OiBzZXQgdGhlIHNpemUgb2Ygc2htLCB0aGVuIHRoZSBkZWZhdWx0IHNpemUgaXMgMTAyNCBcbiIpOworICAgICAgICByZXR1cm4gLTE7CisgICAgfQorICAgIGlmIChzaG1fc2l6ZSA9PSAwKQorICAgICAgICBzaG1fc2l6ZSA9IFNITV9BTExPQ19PTkVfUEFHRV9TSVpFOworCisgICAgcHJpbnRmKCJBUCB3cml0ZSB0ZXN0OiBrZXkgaXMgJWQsIHNobV9zaXplIGlzICVkXG4iLCBrZXksIHNobV9zaXplKTsKKworICAgIHNobWlkID0gc2htZ2V0KGtleSwgc2htX3NpemUsIDA2NjZ8SVBDX0NSRUFUKTsKKyAgICBpZihzaG1pZCA8IDApCisgICAgeworICAgICAgICBwcmludGYoInNobWlkIHJldHVybiBlcnJvclxuIik7CisgICAgICAgIHJldHVybiAtMTsKKyAgICB9CisgICAgcHJpbnRmKCJzaG1pZCAlZCBcbiIsc2htaWQpOworCisgICAgcHNobSA9IChjaGFyICopc2htYXQoc2htaWQsIDAsIDApOworICAgIGlmIChwc2htID09IE5VTEwpCisgICAgeworICAgICAgICBwcmludGYoInNobWF0IHJldHVybiBlcnJvclxuIik7CisgICAgICAgIHJldHVybiAtMTsKKyAgICB9CisgICAgCisgICAgcHJpbnRmKCJwc2htIDB4JXggXG4iLHBzaG0pOworICAgIHNoYXJlZCA9IChzaG1fdXNlX3JlbW90ZSAqKXBzaG07CisKKyAgICBzaG1fbm9kZS5rZXkgICAgICAgPSBrZXk7CisgICAgc2htX25vZGUuc2htX3NpemUgPSBzaG1fc2l6ZTsKKworICAgIGNvcHlfc2l6ZSA9IFNITV9NSU4oc3RybGVuKHdyaXRlX2RhdGEpLCAoU0hNX1RFWFRfU0laRSAtIDEpKTsKKworICAgIHdoaWxlKDEpCisgICAgeyAgICAgICAgCisgICAgICAgIGlmKHNoYXJlZC0+d3JpdGUgPT0gMSkKKyAgICAgICAgeworICAgICAgICAgICAgc3RybmNweShzaGFyZWQtPmRhdGEsIHdyaXRlX2RhdGEsIGNvcHlfc2l6ZSk7CisgICAgICAgICAgICBwcmludGYoIkFQIHdyaXRlICVzIHRvIHNobVxuIiwgd3JpdGVfZGF0YSk7CisgICAgICAgICAgICBzaGFyZWQtPndyaXRlID0gMDsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGVsc2V7CisgICAgICAgICAgICBzbGVlcCgyKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIGlmKHNobWR0KHBzaG0pIDwgMCkKKyAgICB7CisgICAgICAgIHByaW50Zigic2htZHQgZXJybm8gJWQ6ICVzXG4iLCBlcnJubywgc3RyZXJyb3IoZXJybm8pKTsKKyAgICAgICAgcmV0dXJuIC0xOworICAgIH0KKworICAgIGlmKHNobWN0bChzaG1pZCwgSVBDX1JNSUQsIE5VTEwpID09IC0xKQorICAgIHsKKyAgICAgICAgcHJpbnRmKCJzaG1jdGwgZXJybm8gJWQ6ICVzXG4iLCBlcnJubywgc3RyZXJyb3IoZXJybm8pKTsgCisgICAgICAgIHJldHVybiAtMTsKKyAgICB9CisKKyAgICBwcmludGYoInNobSB3cml0ZSBlbmRcbiIpOworCisgICAgcmV0dXJuIDA7Cit9CisKKwo=