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vciBub3QgZW5vdWdoCiAgICAgICAgaW5wdXQgZGF0YSBvciBvdXRwdXQgc3BhY2UgKi8KICAgICBkbyB7Ci0gICAgICAgIGlmIChiaXRzIDwgMTUpIHsKLSAgICAgICAgICAgIGhvbGQgKz0gKHVuc2lnbmVkIGxvbmcpKFBVUChpbikpIDw8IGJpdHM7Ci0gICAgICAgICAgICBiaXRzICs9IDg7Ci0gICAgICAgICAgICBob2xkICs9ICh1bnNpZ25lZCBsb25nKShQVVAoaW4pKSA8PCBiaXRzOwotICAgICAgICAgICAgYml0cyArPSA4OwotICAgICAgICB9Ci0gICAgICAgIHRoaXMgPSBsY29kZVtob2xkICYgbG1hc2tdOworCWlmIChiaXRzIDwgMTUpIHsKKwkgICAgaG9sZCArPSAodW5zaWduZWQgbG9uZykoUFVQKGluKSkgPDwgYml0czsKKwkgICAgYml0cyArPSA4OworCSAgICBob2xkICs9ICh1bnNpZ25lZCBsb25nKShQVVAoaW4pKSA8PCBiaXRzOworCSAgICBiaXRzICs9IDg7CisJfQorCXRoaXMgPSBsY29kZVtob2xkICYgbG1hc2tdOwogICAgICAgZG9sZW46Ci0gICAgICAgIG9wID0gKHVuc2lnbmVkKSh0aGlzLmJpdHMpOwotICAgICAgICBob2xkID4+PSBvcDsKLSAgICAgICAgYml0cyAtPSBvcDsKLSAgICAgICAgb3AgPSAodW5zaWduZWQpKHRoaXMub3ApOwotICAgICAgICBpZiAob3AgPT0gMCkgeyAgICAgICAgICAgICAgICAgICAgICAgICAgLyogbGl0ZXJhbCAqLwotICAgICAgICAgICAgVHJhY2V2digoc3RkZXJyLCB0aGlzLnZhbCA+PSAweDIwICYmIHRoaXMudmFsIDwgMHg3ZiA/Ci0gICAgICAgICAgICAgICAgICAgICJpbmZsYXRlOiAgICAgICAgIGxpdGVyYWwgJyVjJ1xuIiA6Ci0gICAgICAgICAgICAgICAgICAgICJpbmZsYXRlOiAgICAgICAgIGxpdGVyYWwgMHglMDJ4XG4iLCB0aGlzLnZhbCkpOwotICAgICAgICAgICAgUFVQKG91dCkgPSAodW5zaWduZWQgY2hhcikodGhpcy52YWwpOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UgaWYgKG9wICYgMTYpIHsgICAgICAgICAgICAgICAgICAgICAvKiBsZW5ndGggYmFzZSAqLwotICAgICAgICAgICAgbGVuID0gKHVuc2lnbmVkKSh0aGlzLnZhbCk7Ci0gICAgICAgICAgICBvcCAmPSAxNTsgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBudW1iZXIgb2YgZXh0cmEgYml0cyAqLwotICAgICAgICAgICAgaWYgKG9wKSB7Ci0gICAgICAgICAgICAgICAgaWYgKGJpdHMgPCBvcCkgewotICAgICAgICAgICAgICAgICAgICBob2xkICs9ICh1bnNpZ25lZCBsb25nKShQVVAoaW4pKSA8PCBiaXRzOwotICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGxlbiArPSAodW5zaWduZWQpaG9sZCAmICgoMVUgPDwgb3ApIC0gMSk7Ci0gICAgICAgICAgICAgICAgaG9sZCA+Pj0gb3A7Ci0gICAgICAgICAgICAgICAgYml0cyAtPSBvcDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIFRyYWNldnYoKHN0ZGVyciwgImluZmxhdGU6ICAgICAgICAgbGVuZ3RoICV1XG4iLCBsZW4pKTsKLSAgICAgICAgICAgIGlmIChiaXRzIDwgMTUpIHsKLSAgICAgICAgICAgICAgICBob2xkICs9ICh1bnNpZ25lZCBsb25nKShQVVAoaW4pKSA8PCBiaXRzOwotICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKLSAgICAgICAgICAgICAgICBob2xkICs9ICh1bnNpZ25lZCBsb25nKShQVVAoaW4pKSA8PCBiaXRzOwotICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHRoaXMgPSBkY29kZVtob2xkICYgZG1hc2tdOwotICAgICAgICAgIGRvZGlzdDoKLSAgICAgICAgICAgIG9wID0gKHVuc2lnbmVkKSh0aGlzLmJpdHMpOwotICAgICAgICAgICAgaG9sZCA+Pj0gb3A7Ci0gICAgICAgICAgICBiaXRzIC09IG9wOwotICAgICAgICAgICAgb3AgPSAodW5zaWduZWQpKHRoaXMub3ApOwotICAgICAgICAgICAgaWYgKG9wICYgMTYpIHsgICAgICAgICAgICAgICAgICAgICAgLyogZGlzdGFuY2UgYmFzZSAqLwotICAgICAgICAgICAgICAgIGRpc3QgPSAodW5zaWduZWQpKHRoaXMudmFsKTsKLSAgICAgICAgICAgICAgICBvcCAmPSAxNTsgICAgICAgICAgICAgICAgICAgICAgIC8qIG51bWJlciBvZiBleHRyYSBiaXRzICovCi0gICAgICAgICAgICAgICAgaWYgKGJpdHMgPCBvcCkgewotICAgICAgICAgICAgICAgICAgICBob2xkICs9ICh1bnNpZ25lZCBsb25nKShQVVAoaW4pKSA8PCBiaXRzOwotICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChiaXRzIDwgb3ApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gKHVuc2lnbmVkIGxvbmcpKFBVUChpbikpIDw8IGJpdHM7Ci0gICAgICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgZGlzdCArPSAodW5zaWduZWQpaG9sZCAmICgoMVUgPDwgb3ApIC0gMSk7CisJb3AgPSAodW5zaWduZWQpKHRoaXMuYml0cyk7CisJaG9sZCA+Pj0gb3A7CisJYml0cyAtPSBvcDsKKwlvcCA9ICh1bnNpZ25lZCkodGhpcy5vcCk7CisJaWYgKG9wID09IDApIHsgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIGxpdGVyYWwgKi8KKwkgICAgVHJhY2V2digoc3RkZXJyLCB0aGlzLnZhbCA+PSAweDIwICYmIHRoaXMudmFsIDwgMHg3ZiA/CisJCSAgICAiaW5mbGF0ZTogICAgICAgICBsaXRlcmFsICclYydcbiIgOgorCQkgICAgImluZmxhdGU6ICAgICAgICAgbGl0ZXJhbCAweCUwMnhcbiIsIHRoaXMudmFsKSk7CisJICAgIFBVUChvdXQpID0gKHVuc2lnbmVkIGNoYXIpKHRoaXMudmFsKTsKKwl9CisJZWxzZSBpZiAob3AgJiAxNikgeyAgICAgICAgICAgICAgICAgICAgIC8qIGxlbmd0aCBiYXNlICovCisJICAgIGxlbiA9ICh1bnNpZ25lZCkodGhpcy52YWwpOworCSAgICBvcCAmPSAxNTsgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBudW1iZXIgb2YgZXh0cmEgYml0cyAqLworCSAgICBpZiAob3ApIHsKKwkJaWYgKGJpdHMgPCBvcCkgeworCQkgICAgaG9sZCArPSAodW5zaWduZWQgbG9uZykoUFVQKGluKSkgPDwgYml0czsKKwkJICAgIGJpdHMgKz0gODsKKwkJfQorCQlsZW4gKz0gKHVuc2lnbmVkKWhvbGQgJiAoKDFVIDw8IG9wKSAtIDEpOworCQlob2xkID4+PSBvcDsKKwkJYml0cyAtPSBvcDsKKwkgICAgfQorCSAgICBUcmFjZXZ2KChzdGRlcnIsICJpbmZsYXRlOiAgICAgICAgIGxlbmd0aCAldVxuIiwgbGVuKSk7CisJICAgIGlmIChiaXRzIDwgMTUpIHsKKwkJaG9sZCArPSAodW5zaWduZWQgbG9uZykoUFVQKGluKSkgPDwgYml0czsKKwkJYml0cyArPSA4OworCQlob2xkICs9ICh1bnNpZ25lZCBsb25nKShQVVAoaW4pKSA8PCBiaXRzOworCQliaXRzICs9IDg7CisJICAgIH0KKwkgICAgdGhpcyA9IGRjb2RlW2hvbGQgJiBkbWFza107CisJICBkb2Rpc3Q6CisJICAgIG9wID0gKHVuc2lnbmVkKSh0aGlzLmJpdHMpOworCSAgICBob2xkID4+PSBvcDsKKwkgICAgYml0cyAtPSBvcDsKKwkgICAgb3AgPSAodW5zaWduZWQpKHRoaXMub3ApOworCSAgICBpZiAob3AgJiAxNikgeyAgICAgICAgICAgICAgICAgICAgICAvKiBkaXN0YW5jZSBiYXNlICovCisJCWRpc3QgPSAodW5zaWduZWQpKHRoaXMudmFsKTsKKwkJb3AgJj0gMTU7ICAgICAgICAgICAgICAgICAgICAgICAvKiBudW1iZXIgb2YgZXh0cmEgYml0cyAqLworCQlpZiAoYml0cyA8IG9wKSB7CisJCSAgICBob2xkICs9ICh1bnNpZ25lZCBsb25nKShQVVAoaW4pKSA8PCBiaXRzOworCQkgICAgYml0cyArPSA4OworCQkgICAgaWYgKGJpdHMgPCBvcCkgeworCQkJaG9sZCArPSAodW5zaWduZWQgbG9uZykoUFVQKGluKSkgPDwgYml0czsKKwkJCWJpdHMgKz0gODsKKwkJICAgIH0KKwkJfQorCQlkaXN0ICs9ICh1bnNpZ25lZClob2xkICYgKCgxVSA8PCBvcCkgLSAxKTsKICNpZmRlZiBJTkZMQVRFX1NUUklDVAotICAgICAgICAgICAgICAgIGlmIChkaXN0ID4gZG1heCkgewotICAgICAgICAgICAgICAgICAgICBzdHJtLT5tc2cgPSAoY2hhciAqKSJpbnZhbGlkIGRpc3RhbmNlIHRvbyBmYXIgYmFjayI7Ci0gICAgICAgICAgICAgICAgICAgIHN0YXRlLT5tb2RlID0gQkFEOwotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICB9CisJCWlmIChkaXN0ID4gZG1heCkgeworCQkgICAgc3RybS0+bXNnID0gKGNoYXIgKikiaW52YWxpZCBkaXN0YW5jZSB0b28gZmFyIGJhY2siOworCQkgICAgc3RhdGUtPm1vZGUgPSBCQUQ7CisJCSAgICBicmVhazsKKwkJfQogI2VuZGlmCi0gICAgICAgICAgICAgICAgaG9sZCA+Pj0gb3A7Ci0gICAgICAgICAgICAgICAgYml0cyAtPSBvcDsKLSAgICAgICAgICAgICAgICBUcmFjZXZ2KChzdGRlcnIsICJpbmZsYXRlOiAgICAgICAgIGRpc3RhbmNlICV1XG4iLCBkaXN0KSk7Ci0gICAgICAgICAgICAgICAgb3AgPSAodW5zaWduZWQpKG91dCAtIGJlZyk7ICAgICAvKiBtYXggZGlzdGFuY2UgaW4gb3V0cHV0ICovCi0gICAgICAgICAgICAgICAgaWYgKGRpc3QgPiBvcCkgeyAgICAgICAgICAgICAgICAvKiBzZWUgaWYgY29weSBmcm9tIHdpbmRvdyAqLwotICAgICAgICAgICAgICAgICAgICBvcCA9IGRpc3QgLSBvcDsgICAgICAgICAgICAgLyogZGlzdGFuY2UgYmFjayBpbiB3aW5kb3cgKi8KLSAgICAgICAgICAgICAgICAgICAgaWYgKG9wID4gd2hhdmUpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHN0cm0tPm1zZyA9IChjaGFyICopImludmFsaWQgZGlzdGFuY2UgdG9vIGZhciBiYWNrIjsKLSAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLT5tb2RlID0gQkFEOwotICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgZnJvbSA9IHdpbmRvdyAtIE9GRjsKLSAgICAgICAgICAgICAgICAgICAgaWYgKHdyaXRlID09IDApIHsgICAgICAgICAgIC8qIHZlcnkgY29tbW9uIGNhc2UgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIGZyb20gKz0gd3NpemUgLSBvcDsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvcCA8IGxlbikgeyAgICAgICAgIC8qIHNvbWUgZnJvbSB3aW5kb3cgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZW4gLT0gb3A7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZG8gewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQVVAob3V0KSA9IFBVUChmcm9tKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IHdoaWxlICgtLW9wKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tID0gb3V0IC0gZGlzdDsgIC8qIHJlc3QgZnJvbSBvdXRwdXQgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICh3cml0ZSA8IG9wKSB7ICAgICAgLyogd3JhcCBhcm91bmQgd2luZG93ICovCi0gICAgICAgICAgICAgICAgICAgICAgICBmcm9tICs9IHdzaXplICsgd3JpdGUgLSBvcDsKLSAgICAgICAgICAgICAgICAgICAgICAgIG9wIC09IHdyaXRlOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9wIDwgbGVuKSB7ICAgICAgICAgLyogc29tZSBmcm9tIGVuZCBvZiB3aW5kb3cgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZW4gLT0gb3A7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZG8gewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQVVAob3V0KSA9IFBVUChmcm9tKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IHdoaWxlICgtLW9wKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tID0gd2luZG93IC0gT0ZGOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh3cml0ZSA8IGxlbikgeyAgLyogc29tZSBmcm9tIHN0YXJ0IG9mIHdpbmRvdyAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcCA9IHdyaXRlOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZW4gLT0gb3A7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBVUChvdXQpID0gUFVQKGZyb20pOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IHdoaWxlICgtLW9wKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbSA9IG91dCAtIGRpc3Q7ICAgICAgLyogcmVzdCBmcm9tIG91dHB1dCAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBlbHNlIHsgICAgICAgICAgICAgICAgICAgICAgLyogY29udGlndW91cyBpbiB3aW5kb3cgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIGZyb20gKz0gd3JpdGUgLSBvcDsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvcCA8IGxlbikgeyAgICAgICAgIC8qIHNvbWUgZnJvbSB3aW5kb3cgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZW4gLT0gb3A7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZG8gewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQVVAob3V0KSA9IFBVUChmcm9tKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IHdoaWxlICgtLW9wKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tID0gb3V0IC0gZGlzdDsgIC8qIHJlc3QgZnJvbSBvdXRwdXQgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB3aGlsZSAobGVuID4gMikgewotICAgICAgICAgICAgICAgICAgICAgICAgUFVQKG91dCkgPSBQVVAoZnJvbSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBQVVAob3V0KSA9IFBVUChmcm9tKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIFBVUChvdXQpID0gUFVQKGZyb20pOwotICAgICAgICAgICAgICAgICAgICAgICAgbGVuIC09IDM7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgaWYgKGxlbikgewotICAgICAgICAgICAgICAgICAgICAgICAgUFVQKG91dCkgPSBQVVAoZnJvbSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAobGVuID4gMSkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBQVVAob3V0KSA9IFBVUChmcm9tKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgZnJvbSA9IG91dCAtIGRpc3Q7ICAgICAgICAgIC8qIGNvcHkgZGlyZWN0IGZyb20gb3V0cHV0ICovCi0gICAgICAgICAgICAgICAgICAgIGRvIHsgICAgICAgICAgICAgICAgICAgICAgICAvKiBtaW5pbXVtIGxlbmd0aCBpcyB0aHJlZSAqLwotICAgICAgICAgICAgICAgICAgICAgICAgUFVQKG91dCkgPSBQVVAoZnJvbSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBQVVAob3V0KSA9IFBVUChmcm9tKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIFBVUChvdXQpID0gUFVQKGZyb20pOwotICAgICAgICAgICAgICAgICAgICAgICAgbGVuIC09IDM7Ci0gICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKGxlbiA+IDIpOwotICAgICAgICAgICAgICAgICAgICBpZiAobGVuKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBQVVAob3V0KSA9IFBVUChmcm9tKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsZW4gPiAxKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBVUChvdXQpID0gUFVQKGZyb20pOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZSBpZiAoKG9wICYgNjQpID09IDApIHsgICAgICAgICAgLyogMm5kIGxldmVsIGRpc3RhbmNlIGNvZGUgKi8KLSAgICAgICAgICAgICAgICB0aGlzID0gZGNvZGVbdGhpcy52YWwgKyAoaG9sZCAmICgoMVUgPDwgb3ApIC0gMSkpXTsKLSAgICAgICAgICAgICAgICBnb3RvIGRvZGlzdDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UgewotICAgICAgICAgICAgICAgIHN0cm0tPm1zZyA9IChjaGFyICopImludmFsaWQgZGlzdGFuY2UgY29kZSI7Ci0gICAgICAgICAgICAgICAgc3RhdGUtPm1vZGUgPSBCQUQ7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgZWxzZSBpZiAoKG9wICYgNjQpID09IDApIHsgICAgICAgICAgICAgIC8qIDJuZCBsZXZlbCBsZW5ndGggY29kZSAqLwotICAgICAgICAgICAgdGhpcyA9IGxjb2RlW3RoaXMudmFsICsgKGhvbGQgJiAoKDFVIDw8IG9wKSAtIDEpKV07Ci0gICAgICAgICAgICBnb3RvIGRvbGVuOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UgaWYgKG9wICYgMzIpIHsgICAgICAgICAgICAgICAgICAgICAvKiBlbmQtb2YtYmxvY2sgKi8KLSAgICAgICAgICAgIFRyYWNldnYoKHN0ZGVyciwgImluZmxhdGU6ICAgICAgICAgZW5kIG9mIGJsb2NrXG4iKSk7Ci0gICAgICAgICAgICBzdGF0ZS0+bW9kZSA9IFRZUEU7Ci0gICAgICAgICAgICBicmVhazsKLSAgICAgICAgfQotICAgICAgICBlbHNlIHsKLSAgICAgICAgICAgIHN0cm0tPm1zZyA9IChjaGFyICopImludmFsaWQgbGl0ZXJhbC9sZW5ndGggY29kZSI7Ci0gICAgICAgICAgICBzdGF0ZS0+bW9kZSA9IEJBRDsKLSAgICAgICAgICAgIGJyZWFrOwotICAgICAgICB9CisJCWhvbGQgPj49IG9wOworCQliaXRzIC09IG9wOworCQlUcmFjZXZ2KChzdGRlcnIsICJpbmZsYXRlOiAgICAgICAgIGRpc3RhbmNlICV1XG4iLCBkaXN0KSk7CisJ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YgQEAKIAogICAgIC8qIGFjY3VtdWxhdGUgbGVuZ3RocyBmb3IgY29kZXMgKGFzc3VtZXMgbGVuc1tdIGFsbCBpbiAwLi5NQVhCSVRTKSAqLwogICAgIGZvciAobGVuID0gMDsgbGVuIDw9IE1BWEJJVFM7IGxlbisrKQotICAgICAgICBjb3VudFtsZW5dID0gMDsKKwljb3VudFtsZW5dID0gMDsKICAgICBmb3IgKHN5bSA9IDA7IHN5bSA8IGNvZGVzOyBzeW0rKykKLSAgICAgICAgY291bnRbbGVuc1tzeW1dXSsrOworCWNvdW50W2xlbnNbc3ltXV0rKzsKIAogICAgIC8qIGJvdW5kIGNvZGUgbGVuZ3RocywgZm9yY2Ugcm9vdCB0byBiZSB3aXRoaW4gY29kZSBsZW5ndGhzICovCiAgICAgcm9vdCA9ICpiaXRzOwogICAgIGZvciAobWF4ID0gTUFYQklUUzsgbWF4ID49IDE7IG1heC0tKQotICAgICAgICBpZiAoY291bnRbbWF4XSAhPSAwKSBicmVhazsKKwlpZiAoY291bnRbbWF4XSAhPSAwKSBicmVhazsKICAgICBpZiAocm9vdCA+IG1heCkgcm9vdCA9IG1heDsKICAgICBpZiAobWF4ID09IDApIHsgICAgICAgICAgICAgICAgICAgICAvKiBubyBzeW1ib2xzIHRvIGNvZGUgYXQgYWxsICovCi0gICAgICAgIHRoaXMub3AgPSAodW5zaWduZWQgY2hhcik2NDsgICAgLyogaW52YWxpZCBjb2RlIG1hcmtlciAqLwotICAgICAgICB0aGlzLmJpdHMgPSAodW5zaWduZWQgY2hhcikxOwotICAgICAgICB0aGlzLnZhbCA9ICh1bnNpZ25lZCBzaG9ydCkwOwotICAgICAgICAqKCp0YWJsZSkrKyA9IHRoaXM7ICAgICAgICAgICAgIC8qIG1ha2UgYSB0YWJsZSB0byBmb3JjZSBhbiBlcnJvciAqLwotICAgICAgICAqKCp0YWJsZSkrKyA9IHRoaXM7Ci0gICAgICAgICpiaXRzID0gMTsKLSAgICAgICAgcmV0dXJuIDA7ICAgICAvKiBubyBzeW1ib2xzLCBidXQgd2FpdCBmb3IgZGVjb2RpbmcgdG8gcmVwb3J0IGVycm9yICovCisJdGhpcy5vcCA9ICh1bnNpZ25lZCBjaGFyKTY0OyAgICAvKiBpbnZhbGlkIGNvZGUgbWFya2VyICovCisJdGhpcy5iaXRzID0gKHVuc2lnbmVkIGNoYXIpMTsKKwl0aGlzLnZhbCA9ICh1bnNpZ25lZCBzaG9ydCkwOworCSooKnRhYmxlKSsrID0gdGhpczsgICAgICAgICAgICAgLyogbWFrZSBhIHRhYmxlIHRvIGZvcmNlIGFuIGVycm9yICovCisJKigqdGFibGUpKysgPSB0aGlzOworCSpiaXRzID0gMTsKKwlyZXR1cm4gMDsgICAgIC8qIG5vIHN5bWJvbHMsIGJ1dCB3YWl0IGZvciBkZWNvZGluZyB0byByZXBvcnQgZXJyb3IgKi8KICAgICB9CiAgICAgZm9yIChtaW4gPSAxOyBtaW4gPD0gTUFYQklUUzsgbWluKyspCi0gICAgICAgIGlmIChjb3VudFttaW5dICE9IDApIGJyZWFrOworCWlmIChjb3VudFttaW5dICE9IDApIGJyZWFrOwogICAgIGlmIChyb290IDwgbWluKSByb290ID0gbWluOwogCiAgICAgLyogY2hlY2sgZm9yIGFuIG92ZXItc3Vic2NyaWJlZCBvciBpbmNvbXBsZXRlIHNldCBvZiBsZW5ndGhzICovCiAgICAgbGVmdCA9IDE7CiAgICAgZm9yIChsZW4gPSAxOyBsZW4gPD0gTUFYQklUUzsgbGVuKyspIHsKLSAgICAgICAgbGVmdCA8PD0gMTsKLSAgICAgICAgbGVmdCAtPSBjb3VudFtsZW5dOwotICAgICAgICBpZiAobGVmdCA8IDApIHJldHVybiAtMTsgICAgICAgIC8qIG92ZXItc3Vic2NyaWJlZCAqLworCWxlZnQgPDw9IDE7CisJbGVmdCAtPSBjb3VudFtsZW5dOworCWlmIChsZWZ0IDwgMCkgcmV0dXJuIC0xOyAgICAgICAgLyogb3Zlci1zdWJzY3JpYmVkICovCiAgICAg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ICAgYmFzZSA9IGV4dHJhID0gd29yazsgICAgLyogZHVtbXkgdmFsdWUtLW5vdCB1c2VkICovCi0gICAgICAgIGVuZCA9IDE5OwotICAgICAgICBicmVhazsKKwliYXNlID0gZXh0cmEgPSB3b3JrOyAgICAvKiBkdW1teSB2YWx1ZS0tbm90IHVzZWQgKi8KKwllbmQgPSAxOTsKKwlicmVhazsKICAgICBjYXNlIExFTlM6Ci0gICAgICAgIGJhc2UgPSBsYmFzZTsKLSAgICAgICAgYmFzZSAtPSAyNTc7Ci0gICAgICAgIGV4dHJhID0gbGV4dDsKLSAgICAgICAgZXh0cmEgLT0gMjU3OwotICAgICAgICBlbmQgPSAyNTY7Ci0gICAgICAgIGJyZWFrOworCWJhc2UgPSBsYmFzZTsKKwliYXNlIC09IDI1NzsKKwlleHRyYSA9IGxleHQ7CisJZXh0cmEgLT0gMjU3OworCWVuZCA9IDI1NjsKKwlicmVhazsKICAgICBkZWZhdWx0OiAgICAgICAgICAgIC8qIERJU1RTICovCi0gICAgICAgIGJhc2UgPSBkYmFzZTsKLSAgICAgICAgZXh0cmEgPSBkZXh0OwotICAgICAgICBlbmQgPSAtMTsKKwliYXNlID0gZGJhc2U7CisJZXh0cmEgPSBkZXh0OworCWVuZCA9IC0xOwogICAgIH0KIAogICAgIC8qIGluaXRpYWxpemUgc3RhdGUgZm9yIGxvb3AgKi8KQEAgLTg5Myw4MiArODkzLDgyIEBACiAKICAgICAvKiBjaGVjayBhdmFpbGFibGUgdGFibGUgc3BhY2UgKi8KICAgICBpZiAodHlwZSA9PSBMRU5TICYmIHVzZWQgPj0gRU5PVUdIIC0gTUFYRCkKLSAgICAgICAgcmV0dXJuIDE7CisJcmV0dXJuIDE7CiAKICAgICAvKiBwcm9jZXNzIGFsbCBjb2RlcyBhbmQgbWFrZSB0YWJsZSBlbnRyaWVzICovCiAgICAgZm9yICg7OykgewotICAgICAgICAvKiBjcmVhdGUgdGFibGUgZW50cnkgKi8KLSAgICAgICAgdGhpcy5iaXRzID0gKHVuc2lnbmVkIGNoYXIpKGxlbiAtIGRyb3ApOwotICAgICAgICBpZiAoKGludCkod29ya1tzeW1dKSA8IGVuZCkgewotICAgICAgICAgICAgdGhpcy5vcCA9ICh1bnNpZ25lZCBjaGFyKTA7Ci0gICAgICAgICAgICB0aGlzLnZhbCA9IHdvcmtbc3ltXTsKLSAgICAgICAgfQotICAgICAgICBlbHNlIGlmICgoaW50KSh3b3JrW3N5bV0pID4gZW5kKSB7Ci0gICAgICAgICAgICB0aGlzLm9wID0gKHVuc2lnbmVkIGNoYXIpKGV4dHJhW3dvcmtbc3ltXV0pOwotICAgICAgICAgICAgdGhpcy52YWwgPSBiYXNlW3dvcmtbc3ltXV07Ci0gICAgICAgIH0KLSAgICAgICAgZWxzZSB7Ci0gICAgICAgICAgICB0aGlzLm9wID0gKHVuc2lnbmVkIGNoYXIpKDMyICsgNjQpOyAgICAgICAgIC8qIGVuZCBvZiBibG9jayAqLwotICAgICAgICAgICAgdGhpcy52YWwgPSAwOwotICAgICAgICB9CisJLyogY3JlYXRlIHRhYmxlIGVudHJ5ICovCisJdGhpcy5iaXRzID0gKHVuc2lnbmVkIGNoYXIpKGxlbiAtIGRyb3ApOworCWlmICgoaW50KSh3b3JrW3N5bV0pIDwgZW5kKSB7CisJICAgIHRoaXMub3AgPSAodW5zaWduZWQgY2hhcikwOworCSAgICB0aGlzLnZhbCA9IHdvcmtbc3ltXTsKKwl9CisJZWxzZSBpZiAoKGludCkod29ya1tzeW1dKSA+IGVuZCkgeworCSAgICB0aGlzLm9wID0gKHVuc2lnbmVkIGNoYXIpKGV4dHJhW3dvcmtbc3ltXV0pOworCSAgICB0aGlzLnZhbCA9IGJhc2Vbd29ya1tzeW1dXTsKKwl9CisJZWxzZSB7CisJICAgIHRoaXMub3AgPSAodW5zaWduZWQgY2hhcikoMzIgKyA2NCk7ICAgICAgICAgLyogZW5kIG9mIGJsb2NrICovCisJICAgIHRoaXMudmFsID0gMDsKKwl9CiAKLSAgICAgIC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sc2UKLSAgICAgICAgICAgIGh1ZmYgPSAwOworCS8qIGJhY2t3YXJkcyBpbmNyZW1lbnQgdGhlIGxlbi1iaXQgY29kZSBodWZmICovCisJaW5jciA9IDFVIDw8IChsZW4gLSAxKTsKKwl3aGlsZSAoaHVmZiAmIGluY3IpCisJICAgIGluY3IgPj49IDE7CisJaWYgKGluY3IgIT0gMCkgeworCSAgICBodWZmICY9IGluY3IgLSAxOworCSAgICBodWZmICs9IGluY3I7CisJfQorCWVsc2UKKwkgICAgaHVmZiA9IDA7CiAKLSAgICAgICAgLyogZ28gdG8gbmV4dCBzeW1ib2wsIHVwZGF0ZSBjb3VudCwgbGVuICovCi0gICAgICAgIHN5bSsrOwotICAgICAgICBpZiAoLS0oY291bnRbbGVuXSkgPT0gMCkgewotICAgICAgICAgICAgaWYgKGxlbiA9PSBtYXgpIGJyZWFrOwotICAgICAgICAgICAgbGVuID0gbGVuc1t3b3JrW3N5bV1dOwotICAgICAgICB9CisJLyogZ28gdG8gbmV4dCBzeW1ib2wsIHVwZGF0ZSBjb3VudCwgbGVuICovCisJc3ltKys7CisJaWYgKC0tKGNvdW50W2xlbl0pID09IDApIHsKKwkgICAgaWYgKGxlbiA9PSBtYXgpIGJyZWFrOworCSAgICBsZW4gPSBsZW5zW3dvcmtbc3ltXV07CisJfQogCi0gICAgICAgIC8qIGNyZWF0ZSBuZXcgc3ViLXRhYmxlIGlmIG5lZWRlZCAqLwotICAgICAgICBpZiAobGVuID4gcm9vdCAmJiAoaHVmZiAmIG1hc2spICE9IGxvdykgewotICAgICAgICAgICAgLyogaWYgZmlyc3QgdGltZSwgdHJhbnNpdGlvbiB0byBzdWItdGFibGVzICovCi0gICAgICAgICAgICBpZiAoZHJvcCA9PSAwKQotICAgICAgICAgICAgICAgIGRyb3AgPSByb290OworCS8qIGNyZWF0ZSBuZXcgc3ViLXRhYmxlIGlmIG5lZWRlZCAqLworCWlmIChsZW4gPiByb290ICYmIChodWZmICYgbWFzaykgIT0gbG93KSB7CisJICAgIC8qIGlmIGZpcnN0IHRpbWUsIHRyYW5zaXRpb24gdG8gc3ViLXRhYmxlcyAqLworCSAgICBpZiAoZHJvcCA9PSAwKQorCQlkcm9wID0gcm9vdDsKIAotICAgICAgICAgICAgLyogaW5jcmVtZW50IHBhc3QgbGFzdCB0YWJsZSAqLwotICAgICAgICAgICAgbmV4dCArPSBtaW47ICAgICAgICAgICAgLyogaGVyZSBtaW4gaXMgMSA8PCBjdXJyICovCisJICAgIC8qIGluY3JlbWVudCBwYXN0IGxhc3QgdGFibGUgKi8KKwkgICAgbmV4dCArPSBtaW47ICAgICAgICAgICAgLyogaGVyZSBtaW4gaXMgMSA8PCBjdXJyICovCiAKLSAgICAgICAgICAgIC8qIGRldGVybWluZSBsZW5ndGggb2YgbmV4dCB0YWJsZSAqLwotICAgICAgICAgICAgY3VyciA9IGxlbiAtIGRyb3A7Ci0gICAgICAgICAgICBsZWZ0ID0gKGludCkoMSA8PCBjdXJyKTsKLSAgICAgICAgICAgIHdoaWxlIChjdXJyICsgZHJvcCA8IG1heCkgewotICAgICAgICAgICAgICAgIGxlZnQgLT0gY291bnRbY3VyciArIGRyb3BdOwotICAgICAgICAgICAgICAgIGlmIChsZWZ0IDw9IDApIGJyZWFrOwotICAgICAgICAgICAgICAgIGN1cnIrKzsKLSAgICAgICAgICAgICAgICBsZWZ0IDw8PSAxOwotICAgICAgICAgICAgfQorCSAgICAvKiBkZXRlcm1pbmUgbGVuZ3RoIG9mIG5leHQgdGFibGUgKi8KKwkgICAgY3VyciA9IGxlbiAtIGRyb3A7CisJICAgIGxlZnQgPSAoaW50KSgxIDw8IGN1cnIpOworCSAgICB3aGlsZSAoY3VyciArIGRyb3AgPCBtYXgpIHsKKwkJbGVmdCAtPSBjb3VudFtjdXJyICsgZHJvcF07CisJCWlmIChsZWZ0IDw9IDApIGJyZWFrOworCQljdXJyKys7CisJCWxlZnQgPDw9IDE7CisJICAgIH0KIAotICAgICAgICAgICAgLyogY2hlY2sgZm9yIGVub3VnaCBzcGFjZSAqLwotICAgICAgICAgICAgdXNlZCArPSAxVSA8PCBjdXJyOwotICAgICAgICAgICAgaWYgKHR5cGUgPT0gTEVOUyAmJiB1c2VkID49IEVOT1VHSCAtIE1BWEQpCi0gICAgICAgICAgICAgICAgcmV0dXJuIDE7CisJICAgIC8qIGNoZWNrIGZvciBlbm91Z2ggc3BhY2UgKi8KKwkgICAgdXNlZCArPSAxVSA8PCBjdXJyOworCSAgICBpZiAodHlwZSA9PSBMRU5TICYmIHVzZWQgPj0gRU5PVUdIIC0gTUFYRCkKKwkJcmV0dXJuIDE7CiAKLSAgICAgICAgICAgIC8qIHBvaW50IGVudHJ5IGluIHJvb3QgdGFibGUgdG8gc3ViLXRhYmxlICovCi0gICAgICAgICAgICBsb3cgPSBodWZmICYgbWFzazsKLSAgICAgICAgICAgICgqdGFibGUpW2xvd10ub3AgPSAodW5zaWduZWQgY2hhciljdXJyOwotICAgICAgICAgICAgKCp0YWJsZSlbbG93XS5iaXRzID0gKHVuc2lnbmVkIGNoYXIpcm9vdDsKLSAgICAgICAgICAgICgqdGFibGUpW2xvd10udmFsID0gKHVuc2lnbmVkIHNob3J0KShuZXh0IC0gKnRhYmxlKTsKLSAgICAgICAgfQorCSAgICAvKiBwb2ludCBlbnRyeSBpbiByb290IHRhYmxlIHRvIHN1Yi10YWJsZSAqLworCSAgICBsb3cgPSBodWZmICYgbWFzazsKKwkgICAgKCp0YWJsZSlbbG93XS5vcCA9ICh1bnNpZ25lZCBjaGFyKWN1cnI7CisJICAgICgqdGFibGUpW2xvd10uYml0cyA9ICh1bnNpZ25lZCBjaGFyKXJvb3Q7CisJICAgICgqdGFibGUpW2xvd10udmFsID0gKHVuc2lnbmVkIHNob3J0KShuZXh0IC0gKnRhYmxlKTsKKwl9CiAgICAgfQogCiAgICAgLyoKQEAgLTk4MiwyNyArOTgyLDI3IEBACiAgICAgdGhpcy5iaXRzID0gKHVuc2lnbmVkIGNoYXIpKGxlbiAtIGRyb3ApOwogICAgIHRoaXMudmFsID0gKHVuc2lnbmVkIHNob3J0KTA7CiAgICAgd2hpbGUgKGh1ZmYgIT0gMCkgewotICAgICAgICAvKiB3aGVuIGRvbmUgd2l0aCBzdWItdGFibGUsIGRyb3AgYmFjayB0byByb290IHRhYmxlICovCi0gICAgICAgIGlmIChkcm9wICE9IDAgJiYgKGh1ZmYgJiBtYXNrKSAhPSBsb3cpIHsKLSAgICAgICAgICAgIGRyb3AgPSAwOwotICAgICAgICAgICAgbGVuID0gcm9vdDsKLSAgICAgICAgICAgIG5leHQgPSAqdGFibGU7Ci0gICAgICAgICAgICB0aGlzLmJpdHMgPSAodW5zaWduZWQgY2hhcilsZW47Ci0gICAgICAgIH0KKwkvKiB3aGVuIGRvbmUgd2l0aCBzdWItdGFibGUsIGRyb3AgYmFjayB0byByb290IHRhYmxlICovCisJaWYgKGRyb3AgIT0gMCAmJiAoaHVmZiAmIG1hc2spICE9IGxvdykgeworCSAgICBkcm9wID0gMDsKKwkgICAgbGVuID0gcm9vdDsKKwkgICAgbmV4dCA9ICp0YWJsZTsKKwkgICAgdGhpcy5iaXRzID0gKHVuc2lnbmVkIGNoYXIpbGVuOworCX0KIAotICAgICAgICAvKiBwdXQgaW52YWxpZCBjb2RlIG1hcmtlciBpbiB0YWJsZSAqLwotICAgICAgICBuZXh0W2h1ZmYgPj4gZHJvcF0gPSB0aGlzOworCS8qIHB1dCBpbnZhbGlkIGNvZGUgbWFya2VyIGluIHRhYmxlICovCisJbmV4dFtodWZmID4+IGRyb3BdID0gdGhpczsKIAotICAgICAgICAvKiBiYWNrd2FyZHMgaW5jcmVtZW50IHRoZSBsZW4tYml0IGNvZGUgaHVmZiAqLwotICAgICAgICBpbmNyID0gMVUgPDwgKGxlbiAtIDEpOwotICAgICAgICB3aGlsZSAoaHVmZiAmIGluY3IpCi0gICAgICAgICAgICBpbmNyID4+PSAxOwotICAgICAgICBpZiAoaW5jciAhPSAwKSB7Ci0gICAgICAgICAgICBodWZmICY9IGlu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F2YWlsX2luICE9IDApKQotICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CisJKHN0cm0tPm5leHRfaW4gPT0gWl9OVUxMICYmIHN0cm0tPmF2YWlsX2luICE9IDApKQorCXJldHVybiBaX1NUUkVBTV9FUlJPUjsKIAogICAgIHN0YXRlID0gKHN0cnVjdCBpbmZsYXRlX3N0YXRlIEZBUiAqKXN0cm0tPnN0YXRlOwogICAgIGlmIChzdGF0ZS0+bW9kZSA9PSBUWVBFKSBzdGF0ZS0+bW9kZSA9IFRZUEVETzsgICAgICAvKiBza2lwIGNoZWNrICovCkBAIC0xMzc2LDU0NCArMTM3Niw1NDQgQEAKICAgICBvdXQgPSBsZWZ0OwogICAgIHJldCA9IFpfT0s7CiAgICAgZm9yICg7OykKLSAgICAgICAgc3dpdGNoIChzdGF0ZS0+bW9kZSkgewotICAgICAgICBjYXNlIEhFQUQ6Ci0gICAgICAgICAgICBpZiAoc3RhdGUtPndyYXAgPT0gMCkgewotICAgICAgICAgICAgICAgIHN0YXRlLT5tb2RlID0gVFlQRURPOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgTkVFREJJVFMoMTYpOworCXN3aXRjaCAoc3RhdGUtPm1vZGUpIHsKKwljYXNlIEhFQUQ6CisJICAgIGlmIChzdGF0ZS0+d3JhcCA9PSAwKSB7CisJCXN0YXRlLT5tb2RlID0gVFlQRURPOworCQlicmVhazsKKwkgICAgfQorCSAgICBORUVEQklUUygxNik7CiAjaWZkZWYgR1VOWklQCi0gICAgICAgICAgICBpZiAoKHN0YXRlLT53cmFwICYgMikgJiYgaG9sZCA9PSAweDhiMWYpIHsgIC8qIGd6aXAgaGVhZGVyICovCi0gICAgICAgICAgICAgICAgc3RhdGUtPmNoZWNrID0gY3JjMzIoMEwsIFpfTlVMTCwgMCk7Ci0gICAgICAgICAgICAgICAgQ1JDMihzdGF0ZS0+Y2hlY2ssIGhvbGQpOwotICAgICAgICAgICAg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NvcnJlY3QgaGVhZGVyIGNoZWNrIjsKLSAgICAgICAgICAgICAgICBzdGF0ZS0+bW9kZSA9IEJBRDsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChCSVRTKDQpICE9IFpfREVGTEFURUQpIHsKLSAgICAgICAgICAgICAgICBzdHJtLT5tc2cgPSAoY2hhciAqKSJ1bmtub3duIGNvbXByZXNzaW9uIG1ldGhvZCI7Ci0gICAgICAgICAgICAgICAgc3RhdGUtPm1vZGUgPSBCQUQ7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBEUk9QQklUUyg0KTsKLSAgICAgICAgICAgIGxlbiA9IEJJVFMoNCkgKyA4OwotICAgICAgICAgICAgaWYgKGxlbiA+IHN0YXRlLT53Yml0cykgewotICAgICAgICAgICAgICAgIHN0cm0tPm1zZyA9IChjaGFyICopImludmFsaWQgd2luZG93IHNpemUiOwotICAgICAgICAgICAgICAgIHN0YXRlLT5tb2RlID0gQkFEOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgc3RhdGUtPmRtYXggPSAxVSA8PCBsZW47Ci0gICAgICAgICAgICBUcmFjZXYoKHN0ZGVyciwgImluZmxhdGU6ICAgemxpYiBoZWFkZXIgb2tcbiIpKTsKLSAgICAgICAgICAgIHN0cm0tPmFkbGVyID0gc3RhdGUtPmNoZWNrID0gYWRsZXIzMigwTCwgWl9OVUxMLCAwKTsKLSAgICAgICAgICAgIHN0YXRlLT5tb2RlID0gaG9sZCAmIDB4MjAwID8gRElDVElEIDogVFlQRTsKLSAgICAgICAgICAgIElOSVRCSVRTKCk7Ci0gICAgICAgICAgICBicmVhazsKKwkJKChCSVRTKDgpIDw8IDgpICsgKGhvbGQgPj4gOCkpICUgMzEpIHsKKwkJc3RybS0+bXNnID0gKGNoYXIgKikiaW5jb3JyZWN0IGhlYWRlciBj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nJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoc3RhdGUtPmZsYWdzICYgMHhlMDAwKSB7Ci0gICAgICAgICAgICAgICAgc3RybS0+bXNnID0gKGNoYXIgKikidW5rbm93biBoZWFkZXIgZmxhZ3Mgc2V0IjsKLSAgICAgICAgICAgICAgICBzdGF0ZS0+bW9kZSA9IEJBRDsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChzdGF0ZS0+aGVhZCAhPSBaX05VTEwpCi0gICAgICAgICAgICAgICAgc3RhdGUtPmhlYWQtPnRleHQgPSAoaW50KSgoaG9sZCA+PiA4KSAmIDEpOwotICAgICAgICAgICAgaWYgKHN0YXRlLT5mbGFncyAmIDB4MDIwMCkgQ1JDMihzdGF0ZS0+Y2hlY2ssIGhvbGQpOwotICAgICAgICAgICAgSU5JVEJJVFMoKTsKLSAgICAgICAgICAgIHN0YXRlLT5tb2RlID0gVElNRTsKLSAgICAgICAgY2FzZSBUSU1FOgotICAgICAgICAgICAgTkVFREJJVFMoMzIpOwotICAgICAgICAgICAgaWYgKHN0YXRlLT5oZWFkICE9IFpfTlVMTCkKLSAgICAgICAgICAgICAgICBzdGF0ZS0+aGVhZC0+dGltZSA9IGhvbGQ7Ci0gICAgICAgICAgICBpZiAoc3RhdGUtPmZsYWdzICYgMHgwMjAwKSBDUkM0KHN0YXRlLT5jaGVjaywgaG9sZCk7Ci0gICAgICAgICAgICBJTklUQklUUygpOwotICAgICAgICAgICAgc3RhdGUtPm1vZGUgPSBPUzsKLSAgICAgICAgY2FzZSBPUzoKLSAgICAgICAgICAgIE5FRURCSVRTKDE2KTsKLSAgICAgICAgICAgIGlmIChzdGF0ZS0+aGVhZCAhPSBaX05VTEwpIHsKLSAgICAgICAgICAgICAgICBzdGF0ZS0+aGVhZC0+eGZsYWdzID0gKGludCkoaG9sZCAmIDB4ZmYpOwotICAgICAgICAgICAgICAgIHN0YXRlLT5oZWFkLT5vcyA9IChpbnQpKGhvbGQgPj4gOCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoc3RhdGUtPmZsYWdzICYgMHgwMjAwKSBDUkMyKHN0YXRlLT5jaGVjaywgaG9sZCk7Ci0gICAgICAgICAgICBJTklUQklUUygpOwotICAgICAgICAgICAgc3RhdGUtPm1vZGUgPSBFWExFTjsKLSAgICAgICAgY2FzZSBFWExFTjoKLSAgICAgICAgICAgIGlmIChzdGF0ZS0+ZmxhZ3MgJiAweDA0MDApIHsKLSAgICAgICAgICAgICAgICBORUVEQklUUygxNik7Ci0gICAgICAgICAgICAgICAgc3RhdGUtPmxlbmd0aCA9ICh1bnNpZ25lZCkoaG9sZCk7Ci0gICAgICAgICAgICAgICAgaWYgKHN0YXRlLT5oZWFkICE9IFpfTlVMTCkKLSAgICAgICAgICAgICAgICAgICAgc3RhdGUtPmhlYWQtPmV4dHJhX2xlbiA9ICh1bnNpZ25lZClob2xkOwotICAgICAgICAgICAgICAgIGlmIChzdGF0ZS0+ZmxhZ3MgJiAweDAyMDApIENSQzIoc3RhdGUtPmNoZWNrLCBob2xkKTsKLSAgICAgICAgICAgICAgICBJTklUQklUUygpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZSBpZiAoc3RhdGUtPmhlYWQgIT0gWl9OVUxMKQotICAgICAgICAgICAgICAgIHN0YXRlLT5oZWFkLT5leHRyYSA9IFpfTlVMTDsKLSAgICAgICAgICAgIHN0YXRlLT5tb2RlID0gRVhUUkE7Ci0gICAgICAgIGNhc2UgRVhUUkE6Ci0gICAgICAgICAgICBpZiAoc3RhdGUtPmZsYWdzICYgMHgwNDAwKSB7Ci0gICAgICAgICAgICAgICAgY29weSA9IHN0YXRlLT5sZW5ndGg7Ci0gICAgICAgICAgICAgICAgaWYgKGNvcHkgPiBoYXZlKSBjb3B5ID0gaGF2ZTsKLSAgICAgICAgICAgICAgICBpZiAoY29weSkgewotICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdGUtPmhlYWQgIT0gWl9OVUxMICYmCi0gICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS0+aGVhZC0+ZXh0cmEgIT0gWl9OVUxMKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBsZW4gPSBzdGF0ZS0+aGVhZC0+ZXh0cmFfbGVuIC0gc3RhdGUtPmxlbmd0aDsKLSAgICAgICAgICAgICAgICAgICAgICAgIHptZW1jcHkoc3RhdGUtPmhlYWQtPmV4dHJhICsgbGVuLCBuZXh0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZW4gKyBjb3B5ID4gc3RhdGUtPmhlYWQtPmV4dHJhX21heCA/Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLT5oZWFkLT5leHRyYV9tYXggLSBsZW4gOiBjb3B5KTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdGUtPmZsYWdzICYgMHgwMjAwKQotICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGUtPmNoZWNrID0gY3JjMzIoc3RhdGUtPmNoZWNrLCBuZXh0LCBjb3B5KTsKLSAgICAgICAgICAgICAgICAgICAgaGF2ZSAtPSBjb3B5OwotICAgICAgICAgICAgICAgICAgICBuZXh0ICs9IGNvcHk7Ci0gICAgICAgICAgICAgICAgICAgIHN0YXRlLT5sZW5ndGggLT0gY29weTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaWYgKHN0YXRlLT5sZW5ndGgpIGdvdG8gaW5mX2xlYXZlOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgc3RhdGUtPmxlbmd0aCA9IDA7Ci0gICAgICAgICAgICBzdGF0ZS0+bW9kZSA9IE5BTUU7Ci0gICAgICAgIGNhc2UgTkFNRToKLSAgICAgICAgICAgIGlmIChzdGF0ZS0+ZmxhZ3MgJiAweDA4MDApIHsKLSAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PSAwKSBnb3RvIGluZl9sZWF2ZTsKLSAgICAgICAgICAgICAgICBjb3B5ID0gMDsKLSAgICAgICAgICAgICAgICBkbyB7Ci0gICAgICAgICAgICAgICAgICAgIGxlbiA9ICh1bnNpZ25lZCkobmV4dFtjb3B5KytdKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLT5oZWFkICE9IFpfTlVMTCAmJgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLT5oZWFkLT5uYW1lICE9IFpfTlVMTCAmJgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLT5sZW5ndGggPCBzdGF0ZS0+aGVhZC0+bmFtZV9tYXgpCi0gICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS0+aGVhZC0+bmFtZVtzdGF0ZS0+bGVuZ3RoKytdID0gbGVuOwotICAgICAgICAgICAgICAgIH0gd2hpbGUgKGxlbiAmJiBjb3B5IDwgaGF2ZSk7Ci0gICAgICAgICAgICAgICAgaWYgKHN0YXRlLT5mbGFncyAmIDB4MDIwMCkKLSAgICAgICAgICAgICAgICAgICAgc3RhdGUtPmNoZWNrID0gY3JjMzIoc3RhdGUtPmNoZWNrLCBuZXh0LCBjb3B5KTsKLSAgICAgICAgICAgICAgICBoYXZlIC09IGNvcHk7Ci0gICAgICAgICAgICAgICAgbmV4dCArPSBjb3B5OwotICAgICAgICAgICAgICAgIGlmIChsZW4pIGdvdG8gaW5mX2xlYXZlOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZSBpZiAoc3RhdGUtPmhlYWQgIT0gWl9OVUxMKQotICAgICAgICAgICAgICAgIHN0YXRlLT5oZWFkLT5uYW1lID0gWl9OVUxMOwotICAgICAgICAgICAgc3RhdGUtPmxlbmd0aCA9IDA7Ci0gICAgICAgICAgICBzdGF0ZS0+bW9kZSA9IENPTU1FTlQ7Ci0gICAgICAgIGNhc2UgQ09NTUVOVDoKLSAgICAgICAgICAgIGlmIChzdGF0ZS0+ZmxhZ3MgJiAweDEwMDApIHsKLSAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PSAwKSBnb3RvIGluZl9sZWF2ZTsKLSAgICAgICAgICAgICAgICBjb3B5ID0gMDsKLSAgICAgICAgICAgICAgICBkbyB7Ci0gICAgICAgICAgICAgICAgICAgIGxlbiA9ICh1bnNpZ25lZCkobmV4dFtjb3B5KytdKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLT5oZWFkICE9IFpfTlVMTCAmJgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLT5oZWFkLT5jb21tZW50ICE9IFpfTlVMTCAmJgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLT5sZW5ndGggPCBzdGF0ZS0+aGVhZC0+Y29tbV9tYXgpCi0gICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS0+aGVhZC0+Y29tbWVudFtzdGF0ZS0+bGVuZ3RoKytdID0gbGVuOwotICAgICAgICAgICAgICAgIH0gd2hpbGUgKGxlbiAmJiBjb3B5IDwgaGF2ZSk7Ci0gICAgICAgICAgICAgICAgaWYgKHN0YXRlLT5mbGFncyAmIDB4MDIwMCkKLSAgICAgICAgICAgICAgICAgICAgc3RhdGUtPmNoZWNrID0gY3JjMzIoc3RhdGUtPmNoZWNrLCBuZXh0LCBjb3B5KTsKLSAgICAgICAgICAgICAgICBoYXZlIC09IGNvcHk7Ci0gICAgICAgICAgICAgICAgbmV4dCArPSBjb3B5OwotICAgICAgICAgICAgICAgIGlmIChsZW4pIGdvdG8gaW5mX2xlYXZlOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZSBpZiAoc3RhdGUtPmhlYWQgIT0gWl9OVUxMKQotICAgICAgICAgICAgICAgIHN0YXRlLT5oZWFkLT5jb21tZW50ID0gWl9OVUxMOwotICAgICAgICAgICAgc3RhdGUtPm1vZGUgPSBIQ1JDOwotICAgICAgICBjYXNlIEhDUkM6Ci0gICAgICAgICAgICBpZiAoc3RhdGUtPmZsYWdzICYgMHgwMjAwKSB7Ci0gICAgICAgICAgICAgICAgTkVFREJJVFMoMTYpOwotICAgICAgICAgICAgICAgIGlmIChob2xkICE9IChzdGF0ZS0+Y2hlY2sgJiAweGZmZmYpKSB7Ci0gICAgICAgICAgICAgICAgICAgIHN0cm0tPm1zZyA9IChjaGFyICopImhlYWRlciBjcmMgbWlzbWF0Y2giOwotICAgICAgICAgICAgICAgICAgICBzdGF0ZS0+bW9kZSA9IEJBRDsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIElOSVRCSVRTKCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoc3RhdGUtPmhlYWQgIT0gWl9OVUxMKSB7Ci0gICAgICAgICAgICAgICAgc3RhdGUtPmhlYWQtPmhjcmMgPSAoaW50KSgoc3RhdGUtPmZsYWdzID4+IDkpICYgMSk7Ci0gICAgICAgICAgICAgICAgc3RhdGUtPmhlYWQtPmRvbmUgPSAxOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgc3RybS0+YWRsZXIgPSBzdGF0ZS0+Y2hlY2sgPSBjcmMzMigwTCwgWl9OVUxMLCAwKTsKLSAgICAgICAgICAgIHN0YXRlLT5tb2RlID0gVFlQRTsKLSAgICAgICAgICAgIGJyZWFrOworCWNhc2UgRkxBR1M6CisJICAgIE5FRURCSVRTKDE2KTsKKwkgICAgc3RhdGUtPmZsYWdzID0gKGludCkoaG9sZCk7CisJICAgIGlmICgoc3RhdGUtPmZsYWdzICYgMHhmZikgIT0gWl9ERUZMQVRFRCkgeworCQlzdHJtLT5tc2cgPSAoY2hhciAqKSJ1bmtub3duIGNvbXByZXNzaW9uIG1ldGhvZCI7CisJCXN0YXRlLT5tb2RlID0gQkFEOworCQlicmVhazsKKwkgICAgfQorCSAgICBpZiAoc3RhdGUtPmZsYWdzICYgMHhlMDAwKSB7CisJCXN0cm0tPm1zZyA9IChj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N0YXRlLT5oZWFkLT5kb25lID0gMTsKKwkgICAgfQorCSAgICBzdHJtLT5hZGxlciA9IHN0YXRlLT5jaGVjayA9IGNyYzMyKDBMLCBaX05VTEwsIDApOworCSAgICBzdGF0ZS0+bW9kZSA9IFRZUEU7CisJICAgIGJyZWFrOwogI2VuZGlmCi0gICAgICAgIGNhc2UgRElDVElEOgotICAgICAgICAgICAgTkVFREJJVFMoMzIpOwotICAgICAgICAgICAgc3RybS0+YWRsZXIgPSBzdGF0ZS0+Y2hlY2sgPSBSRVZFUlNFKGhvbGQpOwotICAgICAgICAgICAgSU5JVEJJVFMoKTsKLSAgICAgICAgICAgIHN0YXRlLT5tb2RlID0gRElDVDsKLSAgICAgICAgY2FzZSBESUNUOgotICAgICAgICAgICAgaWYgKHN0YXRlLT5oYXZlZGljdCA9PSAwKSB7Ci0gICAgICAgICAgICAgICAgUkVTVE9SRSgpOwotICAgICAgICAgICAgICAgIHJldHVybiBaX05FRURfRElDVDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHN0cm0tPmFkbGVyID0gc3RhdGUtPmNoZWNrID0gYWRsZXIzMigwTCwgWl9OVUxMLCAwKTsKLSAgICAgICAgICAgIHN0YXRlLT5tb2RlID0gVFlQRTsKLSAgICAgICAgY2FzZSBUWVBFOgotICAgICAgICAgICAgaWYgKGZsdXNoID09IFpfQkxPQ0spIGdvdG8gaW5mX2xlYXZlOwotICAgICAgICBjYXNlIFRZUEVETzoKLSAgICAgICAgICAgIGlmIChzdGF0ZS0+bGFzdCkgewotICAgICAgICAgICAgICAgIEJZVEVCSVRTKCk7Ci0gICAgICAgICAgICAgICAgc3RhdGUtPm1vZGUgPSBDSEVDSzsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIE5FRURCSVRTKDMpOwotICAgICAgICAgICAgc3RhdGUtPmxhc3QgPSBCSVRTKDEpOwotICAgICAgICAgICAgRFJPUEJJVFMoMSk7Ci0gICAgICAgICAgICBzd2l0Y2ggKEJJVFMoMikpIHsKLSAgICAgICAgICAgIGNhc2UgMDogICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIHN0b3JlZCBibG9jayAqLwotICAgICAgICAgICAgICAgIFRyYWNldigoc3RkZXJyLCAiaW5mbGF0ZTogICAgIHN0b3JlZCBibG9jayVzXG4iLAotICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGUtPmxhc3QgPyAiIChsYXN0KSIgOiAiIikpOwotICAgICAgICAgICAgICAgIHN0YXRlLT5tb2RlID0gU1RPUkVEOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgY2FzZSAxOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogZml4ZWQgYmxvY2sgKi8KLSAgICAgICAgICAgICAgICBmaXhlZHRhYmxlcyhzdGF0ZSk7Ci0gICAgICAgICAgICAgICAgVHJhY2V2KChzdGRlcnIsICJpbmZsYXRlOiAgICAgZml4ZWQgY29kZXMgYmxvY2slc1xuIiwKLSAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLT5sYXN0ID8gIiAobGFzdCkiIDogIiIpKTsKLSAgICAgICAgICAgICAgICBzdGF0ZS0+bW9kZSA9IExFTjsgICAgICAgICAgICAgIC8qIGRlY29kZSBjb2RlcyAqLwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgY2FzZSAyOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogZHluYW1pYyBibG9jayAqLwotICAgICAgICAgICAgICAgIFRyYWNldigoc3RkZXJyLCAiaW5mbGF0ZTogICAgIGR5bmFtaWMgY29kZXMgYmxvY2slc1xuIiwKLSAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLT5sYXN0ID8gIiAobGFzdCkiIDogIiIpKTsKLSAgICAgICAgICAgICAgICBzdGF0ZS0+bW9kZSA9IFRBQkxFOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgY2FzZSAzOgotICAgICAgICAgICAgICAgIHN0cm0tPm1zZyA9IChjaGFyICopImludmFsaWQgYmxvY2sgdHlwZSI7Ci0gICAgICAgICAgICAgICAgc3RhdGUtPm1vZGUgPSBCQUQ7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBEUk9QQklUUygyKTsKLSAgICAgICAgICAgIGJyZWFrOwotICAgICAgICBjYXNlIFNUT1JFRDoKLSAgICAgICAgICAgIEJZVEVCSVRTKCk7ICAgICAgICAgICAgICAgICAgICAgICAgIC8qIGdvIHRvIGJ5dGUgYm91bmRhcnkgKi8KLSAgICAgICAgICAgIE5FRURCSVRTKDMyKTsKLSAgICAgICAgICAgIGlmICgoaG9sZCAmIDB4ZmZmZikgIT0gKChob2xkID4+IDE2KSBeIDB4ZmZmZikpIHsKLSAgICAgICAgICAgICAgICBzdHJtLT5tc2cgPSAoY2hhciAqKSJpbnZhbGlkIHN0b3JlZCBibG9jayBsZW5ndGhzIjsKLSAgICAgICAgICAgICAgICBzdGF0ZS0+bW9kZSA9IEJBRDsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHN0YXRlLT5sZW5ndGggPSAodW5zaWduZWQpaG9sZCAmIDB4ZmZmZjsKLSAgICAgICAgICAgIFRyYWNldigoc3RkZXJyLCAiaW5mbGF0ZTogICAgICAgc3RvcmVkIGxlbmd0aCAldVxuIiwKLSAgICAgICAgICAgICAgICAgICAgc3RhdGUtPmxlbmd0aCkpOwotICAgICAgICAgICAgSU5JVEJJVFMoKTsKLSAgICAgICAgICAgIHN0YXRlLT5tb2RlID0gQ09QWTsKLSAgICAgICAgY2FzZSBDT1BZOgotICAgICAgICAgICAgY29weSA9IHN0YXRlLT5sZW5ndGg7Ci0gICAgICAgICAgICBpZiAoY29weSkgewotICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gaGF2ZSkgY29weSA9IGhhdmU7Ci0gICAgICAgICAgICAgICAgaWYgKGNvcHkgPiBsZWZ0KSBjb3B5ID0gbGVmdDsKLSAgICAgICAgICAgICAgICBpZiAoY29weSA9PSAwKSBnb3RvIGluZl9sZWF2ZTsKLSAgICAgICAgICAgICAgICB6bWVtY3B5KHB1dCwgbmV4dCwgY29weSk7Ci0gICAgICAgICAgICAgICAgaGF2ZSAtPSBjb3B5OwotICAgICAgICAgICAgICAgIG5leHQgKz0gY29weTsKLSAgICAgICAgICAgICAgICBsZWZ0IC09IGNvcHk7Ci0gICAgICAgICAgICAgICAgcHV0ICs9IGNvcHk7Ci0gICAgICAgICAgICAgICAgc3RhdGUtPmxlbmd0aCAtPSBjb3B5OwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgVHJhY2V2KChzdGRlcnIsICJpbmZsYXRlOiAgICAgICBzdG9yZWQgZW5kXG4iKSk7Ci0gICAgICAgICAgICBzdGF0ZS0+bW9kZSA9IFRZUEU7Ci0gICAgICAgICAgICBicmVhazsKLSAgICAgICAgY2FzZSBUQUJMRToKLSAgICAgICAgICAgIE5FRURCSVRTKDE0KTsKLSAgICAgICAgICAgIHN0YXRlLT5ubGVuID0gQklUUyg1KSArIDI1NzsKLSAgICAgICAgICAgIERST1BCSVRTKDUpOwotICAgICAgICAgICAgc3RhdGUtPm5kaXN0ID0gQklUUyg1KSArIDE7Ci0gICAgICAgICAgICBEUk9QQklUUyg1KTsKLSAgICAgICAgICAgIHN0YXRlLT5uY29kZSA9IEJJVFMoNCkgKyA0OwotICAgICAgICAgICAgRFJPUEJJVFMoNCk7CisJY2FzZSBESUNUSUQ6CisJICAgIE5FRURCSVRTKDMyKTsKKwkgICAgc3RybS0+YWRsZXIgPSBzdGF0ZS0+Y2hlY2sgPSBSRVZFUlNFKGhvbGQpOworCSAgICBJTklUQklUUygpOworCSAgICBzdGF0ZS0+bW9kZSA9IERJQ1Q7CisJY2FzZSBESUNUOgorCSAgICBpZiAoc3RhdGUtPmhhdmVkaWN0ID09IDApIHsKKwkJUkVTVE9SRSgpOworCQlyZXR1cm4gWl9ORUVEX0RJQ1Q7CisJICAgIH0KKwkgICAgc3RybS0+YWRsZXIgPSBzdGF0ZS0+Y2hlY2sgPSBhZGxlcjMyKDBMLCBaX05VTEwsIDApOworCSAgICBzdGF0ZS0+bW9kZSA9IFRZUEU7CisJY2FzZSBUWVBFOgorCSAgICBpZiAoZmx1c2ggPT0gWl9CTE9DSykgZ290byBpbmZfbGVhdmU7CisJY2FzZSBUWVBFRE86CisJICAgIGlmIChzdGF0ZS0+bGFzdCkgeworCQlCWVRFQklUUygpOworCQlzdGF0ZS0+bW9kZSA9IENIRUNLOworCQlicmVhazsKKwkgICAgfQorCSAgICBORUVEQklUUygzKTsKKwkgICAgc3RhdGUtPmxhc3QgPSBCSVRTKDEpOworCSAgICBEUk9QQklUUygxKTsKKwkgICAgc3dpdGNoIChCSVRTKDIpKSB7CisJICAgIGNhc2UgMDogICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIHN0b3JlZCBibG9jayAqLworCQlUcmFjZXYoKHN0ZGVyciwgImluZmxhdGU6ICAgICBzdG9yZWQgYmxvY2slc1xuIiwKKwkJCXN0YXRlLT5sYXN0ID8gIiAobGFzdCkiIDogIiIpKTsKKwkJc3RhdGUtPm1vZGUgPSBTVE9SRUQ7CisJCWJyZWFrOworCSAgICBjYXNlIDE6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBmaXhlZCBibG9jayAqLworCQlmaXhlZHRhYmxlcyhzdGF0ZSk7CisJCVRyYWNldigoc3RkZXJyLCAiaW5mbGF0ZTogICAgIGZpeGVkIGNvZGVzIGJsb2NrJXNcbiIsCisJCQlzdGF0ZS0+bGFzdCA/ICIgKGxhc3QpIiA6ICIiKSk7CisJCXN0YXRlLT5tb2RlID0gTEVOOyAgICAgICAgICAgICAgLyogZGVjb2RlIGNvZGVzICovCisJCWJyZWFrOworCSAgICBjYXNlIDI6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBkeW5hbWljIGJsb2Nr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ICB9CiAjZW5kaWYKLSAgICAgICAgICAgIFRyYWNldigoc3RkZXJyLCAiaW5mbGF0ZTogICAgICAgdGFibGUgc2l6ZXMgb2tcbiIpKTsKLSAgICAgICAgICAgIHN0YXRlLT5oYXZlID0gMDsKLSAgICAgICAgICAgIHN0YXRlLT5tb2RlID0gTEVOTEVOUzsKLSAgICAgICAgY2FzZSBMRU5MRU5TOgotICAgICAgICAgICAgd2hpbGUgKHN0YXRlLT5oYXZlIDwgc3RhdGUtPm5jb2RlKSB7Ci0gICAgICAgICAgICAgICAgTkVFREJJVFMoMyk7Ci0gICAgICAgICAgICAgICAgc3RhdGUtPmxlbnNbb3JkZXJbc3RhdGUtPmhhdmUrK11dID0gKHVuc2lnbmVkIHNob3J0KUJJVFMoMyk7Ci0gICAgICAgICAgICAgICAgRFJPUEJJVFMoMyk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICB3aGlsZSAoc3RhdGUtPmhhdmUgPCAxOSkKLSAgICAgICAgICAgICAgICBzdGF0ZS0+bGVuc1tvcmRlcltzdGF0ZS0+aGF2ZSsrXV0gPSAwOwotICAgICAgICAgICAgc3RhdGUtPm5leHQgPSBzdGF0ZS0+Y29kZXM7Ci0gICAgICAgICAgICBzdGF0ZS0+bGVuY29kZSA9IChjb2RlIGNvbnN0IEZBUiAqKShzdGF0ZS0+bmV4dCk7Ci0gICAgICAgICAgICBzdGF0ZS0+bGVuYml0cyA9IDc7Ci0gICAgICAgICAgICByZXQgPSBpbmZsYXRlX3RhYmxlKENPREVTLCBzdGF0ZS0+bGVucywgMTksICYoc3RhdGUtPm5leHQpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmKHN0YXRlLT5sZW5iaXRzKSwgc3RhdGUtPndvcmspOwotICAgICAgICAgICAgaWYgKHJldCkgewotICAgICAgICAgICAgICAgIHN0cm0tPm1zZyA9IChjaGFyICopImludmFsaWQgY29kZSBsZW5ndGhzIHNldCI7Ci0gICAgICAgICAgICAgICAgc3RhdGUtPm1vZGUgPSBCQUQ7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBUcmFjZXYoKHN0ZGVyciwgImluZmxhdGU6ICAgICAgIGNvZGUgbGVuZ3RocyBva1xuIikpOwotICAgICAgICAgICAgc3RhdGUtPmhhdmUgPSAwOwotICAgICAgICAgICAgc3RhdGUtPm1vZGUgPSBDT0RFTEVOUzsKLSAgICAgICAgY2FzZSBDT0RFTEVOUzoKLSAgICAgICAgICAgIHdoaWxlIChzdGF0ZS0+aGF2ZSA8IHN0YXRlLT5ubGVuICsgc3RhdGUtPm5kaXN0KSB7Ci0gICAgICAgICAgICAgICAgZm9yICg7OykgewotICAgICAgICAgICAgICAgICAgICB0aGlzID0gc3RhdGUtPmxlbmNvZGVbQklUUyhzdGF0ZS0+bGVuYml0cyldOwotICAgICAgICAgICAgICAgICAgICBpZiAoKHVuc2lnbmVkKSh0aGlzLmJpdHMpIDw9IGJpdHMpIGJyZWFrOwotICAgICAgICAgICAgICAgICAgICBQVUxMQllURSgpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBpZiAodGhpcy52YWwgPCAxNikgewotICAgICAgICAgICAgICAgICAgICBORUVEQklUUyh0aGlzLmJpdHMpOwotICAgICAgICAgICAgICAgICAgICBEUk9QQklUUyh0aGlzLmJpdHMpOwotICAgICAgICAgICAgICAgICAgICBzdGF0ZS0+bGVuc1tzdGF0ZS0+aGF2ZSsrXSA9IHRoaXMudmFsOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMudmFsID09IDE2KSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBORUVEQklUUyh0aGlzLmJpdHMgKyAyKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIERST1BCSVRTKHRoaXMuYml0cyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdGUtPmhhdmUgPT0gMCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cm0tPm1zZyA9IChjaGFyICopImludmFsaWQgYml0IGxlbmd0aCByZXBlYXQiOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLT5tb2RlID0gQkFEOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgbGVuID0gc3RhdGUtPmxlbnNbc3RhdGUtPmhhdmUgLSAxXTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGNvcHkgPSAzICsgQklUUygyKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIERST1BCSVRTKDIpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKHRoaXMudmFsID09IDE3KSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBORUVEQklUUyh0aGlzLmJpdHMgKyAzKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIERST1BCSVRTKHRoaXMuYml0cyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBsZW4gPSAwOwotICAgICAgICAgICAgICAgICAgICAgICAgY29weSA9IDMgKyBCSVRTKDMpOwotICAgICAgICAgICAgICAgICAgICAgICAgRFJPUEJJVFMoMyk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBORUVEQklUUyh0aGlzLmJpdHMgKyA3KTsKLSAgICAgICAgICAgICAgICAgICAgICAgIERST1BCSVRTKHRoaXMuYml0cyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBsZW4gPSAwOwotICAgICAgICAgICAgICAgICAgICAgICAgY29weSA9IDExICsgQklUUyg3KTsKLSAgICAgICAgICAgICAgICAgICAgICAgIERST1BCSVRTKDcpOwotICAgICAgICAgICAgICAgICAgICB9Ci0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0YXRlLT5tb2RlID09IEJBRCkgYnJlYWs7CiAKLSAgICAgICAgICAgIC8qIGJ1aWxkIGNvZGUgdGFibGVzICovCi0gICAgICAgICAgICBzdGF0ZS0+bmV4dCA9IHN0YXRlLT5jb2RlczsKLSAgICAgICAgICAgIHN0YXRlLT5sZW5jb2RlID0gKGNvZGUgY29uc3QgRkFSICopKHN0YXRlLT5uZXh0KTsKLSAgICAgICAgICAgIHN0YXRlLT5sZW5iaXRzID0gOTsKLSAgICAgICAgICAgIHJldCA9IGluZmxhdGVfdGFibGUoTEVOUywgc3RhdGUtPmxlbnMsIHN0YXRlLT5ubGVuLCAmKHN0YXRlLT5uZXh0KSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJihzdGF0ZS0+bGVuYml0cyksIHN0YXRlLT53b3JrKTsKLSAgICAgICAgICAgIGlmIChyZXQpIHsKLSAgICAgICAgICAgICAgICBzdHJtLT5tc2cgPSAoY2hhciAqKSJpbnZhbGlkIGxpdGVyYWwvbGVuZ3RocyBzZXQiOwotICAgICAgICAgICAgICAgIHN0YXRlLT5tb2RlID0gQkFEOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgc3RhdGUtPmRpc3Rjb2RlID0gKGNvZGUgY29uc3QgRkFSICopKHN0YXRlLT5uZXh0KTsKLSAgICAgICAgICAgIHN0YXRlLT5kaXN0Yml0cyA9IDY7Ci0gICAgICAgICAgICByZXQgPSBpbmZsYXRlX3RhYmxlKERJU1RTLCBzdGF0ZS0+bGVucyArIHN0YXRlLT5ubGVuLCBzdGF0ZS0+bmRpc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgJihzdGF0ZS0+bmV4dCksICYoc3RhdGUtPmRpc3RiaXRzKSwgc3RhdGUtPndvcmspOwotICAgICAgICAgICAgaWYgKHJldCkgewotICAgICAgICAgICAgICAgIHN0cm0tPm1zZyA9IChjaGFyICopImludmFsaWQgZGlzdGFuY2VzIHNldCI7Ci0gICAgICAgICAgICAgICAgc3RhdGUtPm1vZGUgPSBCQUQ7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBUcmFjZXYoKHN0ZGVyciwgImluZmxhdGU6ICAgICAgIGNvZGVzIG9rXG4iKSk7Ci0gICAgICAgICAgICBzdGF0ZS0+bW9kZSA9IExFTjsKLSAgICAgICAgY2FzZSBMRU46Ci0gICAgICAgICAgICBpZiAoaGF2ZSA+PSA2ICYmIGxlZnQgPj0gMjU4KSB7Ci0gICAgICAgICAgICAgICAgUkVTVE9SRSgpOwotICAgICAgICAgICAgICAgIGluZmxhdGVfZmFzdChzdHJtLCBvdXQpOwotICAgICAgICAgICAgICAgIExPQUQoKTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGZvciAoOzspIHsKLSAgICAgICAgICAgICAgICB0aGlzID0gc3RhdGUtPmxlbmNvZGVbQklUUyhzdGF0ZS0+bGVuYml0cyldOwotICAgICAgICAgICAgICAgIGlmICgodW5zaWduZWQpKHRoaXMuYml0cykgPD0gYml0cykgYnJlYWs7Ci0gICAgICAgICAgICAgICAgUFVMTEJZVEUoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmICh0aGlzLm9wICYmICh0aGlzLm9wICYgMHhmMCkgPT0gMCkgewotICAgICAgICAgICAgICAgIGxhc3QgPSB0aGlzOwotICAgICAgICAgICAgICAgIGZvciAoOzspIHsKLSAgICAgICAgICAgICAgICAgICAgdGhpcyA9IHN0YXRlLT5sZW5jb2RlW2xhc3QudmFsICsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAoQklUUyhsYXN0LmJpdHMgKyBsYXN0Lm9wKSA+PiBsYXN0LmJpdHMpXTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKCh1bnNpZ25lZCkobGFzdC5iaXRzICsgdGhpcy5iaXRzKSA8PSBiaXRzKSBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgUFVMTEJZVEUoKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgRFJPUEJJVFMobGFzdC5iaXRzKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIERST1BCSVRTKHRoaXMuYml0cyk7Ci0gICAgICAgICAgICBzdGF0ZS0+bGVuZ3RoID0gKHVuc2lnbmVkKXRoaXMudmFsOwotICAgICAgICAgICAgaWYgKChpbnQpKHRoaXMub3ApID09IDApIHsKLSAgICAgICAgICAgICAgICBUcmFjZXZ2KChzdGRlcnIsIHRoaXMudmFsID49IDB4MjAgJiYgdGhpcy52YWwgPCAweDdmID8KLSAgICAgICAgICAgICAgICAgICAgICAgICJpbmZsYXRlOiAgICAgICAgIGxpdGVyYWwgJyVjJ1xuIiA6Ci0gICAgICAgICAgICAgICAgICAgICAgICAiaW5mbGF0ZTogICAgICAgICBsaXRlcmFsIDB4JTAyeFxuIiwgdGhpcy52YWwpKTsKLSAgICAgICAgICAgICAgICBzdGF0ZS0+bW9kZSA9IExJVDsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmICh0aGlzLm9wICYgMzIpIHsKLSAgICAgICAgICAgICAgICBUcmFjZXZ2KChzdGRlcnIsICJpbmZsYXRlOiAgICAgICAgIGVuZCBvZiBibG9ja1xuIikpOwotICAgICAgICAgICAgICAgIHN0YXRlLT5tb2RlID0gVFlQRTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmICh0aGlzLm9wICYgNjQpIHsKLSAgICAgICAgICAgICAgICBzdHJtLT5tc2cgPSAoY2hhciAqKSJpbnZhbGlkIGxpdGVyYWwvbGVuZ3RoIGNvZGUiOwotICAgICAgICAgICAgICAgIHN0YXRlLT5tb2RlID0gQkFEOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgc3RhdGUtPmV4dHJhID0gKHVuc2lnbmVkKSh0aGlzLm9wKSAmIDE1OwotICAgICAgICAgICAgc3RhdGUtPm1vZGUgPSBMRU5FWFQ7Ci0gICAgICAgIGNhc2UgTEVORVhUOgotICAgICAgICAgICAgaWYgKHN0YXRlLT5leHRyYSkgewotICAgICAgICAgICAgICAgIE5FRURCSVRTKHN0YXRlLT5leHRyYSk7Ci0gICAgICAgICAgICAgICAgc3RhdGUtPmxlbmd0aCArPSBCSVRTKHN0YXRlLT5leHRyYSk7Ci0gICAgICAgICAgICAgICAgRFJPUEJJVFMoc3RhdGUtPmV4dHJhKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIFRyYWNldnYoKHN0ZGVyciwgImluZmxhdGU6ICAgICAgICAgbGVuZ3RoICV1XG4iLCBzdGF0ZS0+bGVuZ3RoKSk7Ci0gICAgICAgICAgICBzdGF0ZS0+bW9kZSA9IERJU1Q7Ci0gICAgICAgIGNhc2UgRElTVDoKLSAgICAgICAgICAgIGZvciAoOzspIHsKLSAgICAgICAgICAgICAgICB0aGlzID0gc3RhdGUtPmRpc3Rjb2RlW0JJVFMoc3RhdGUtPmRpc3RiaXRzKV07Ci0gICAgICAgICAgICAgICAgaWYgKCh1bnNpZ25lZCkodGhpcy5iaXRzKSA8PSBiaXRzKSBicmVhazsKLSAgICAgICAgICAgICAgICBQVUxMQllURSgpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKCh0aGlzLm9wICYgMHhmMCkgPT0gMCkgewotICAgICAgICAgICAgICAgIGxhc3QgPSB0aGlzOwotICAgICAgICAgICAgICAgIGZvciAoOzspIHsKLSAgICAgICAgICAgICAgICAgICAgdGhpcyA9IHN0YXRlLT5kaXN0Y29kZVtsYXN0LnZhbCArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKEJJVFMobGFzdC5iaXRzICsgbGFzdC5vcCkgPj4gbGFzdC5iaXRzKV07Ci0gICAgICAgICAgICAgICAgICAgIGlmICgodW5zaWduZWQpKGxhc3QuYml0cyArIHRoaXMuYml0cykgPD0gYml0cykgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIFBVTExCWVRFKCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIERST1BCSVRTKGxhc3QuYml0cyk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBEUk9QQklUUyh0aGlzLmJpdHMpOwotICAgICAgICAgICAgaWYgKHRoaXMub3AgJiA2NCkgewotICAgICAgICAgICAgICAgIHN0cm0tPm1zZyA9IChjaGFyICopImludmFsaWQgZGlzdGFuY2UgY29kZSI7Ci0gICAgICAgICAgICAgICAgc3RhdGUtPm1vZGUgPSBCQUQ7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBzdGF0ZS0+b2Zmc2V0ID0gKHVuc2lnbmVkKXRoaXMudmFsOwotICAgICAgICAgICAgc3RhdGUtPmV4dHJhID0gKHVuc2lnbmVkKSh0aGlzLm9wKSAmIDE1OwotICAgICAgICAgICAgc3RhdGUtPm1vZGUgPSBESVNURVhUOwotICAgICAgICBjYXNlIERJU1RFWFQ6Ci0gICAgICAgICAgICBpZiAoc3RhdGUtPmV4dHJhKSB7Ci0gICAgICAgICAgICAgICAgTkVFREJJVFMoc3RhdGUtPmV4dHJhKTsKLSAgICAgICAgICAgICAgICBzdGF0ZS0+b2Zmc2V0ICs9IEJJVFMoc3RhdGUtPmV4dHJhKTsKLSAgICAgICAgICAgICAgICBEUk9QQklUUyhzdGF0ZS0+ZXh0cmEpOwotICAgICAgICAgICAgfQorCSAgICAvKiBidWlsZCBjb2RlIHRhYmxlcyAqLworCSAgICBzdGF0ZS0+bmV4dCA9IHN0YXRlLT5jb2RlczsKKwkgICAgc3RhdGUtPmxlbmNvZGUgPSAoY29kZSBjb25zdCBGQVIgKikoc3RhdGUtPm5leHQpOworCSAgICBzdGF0ZS0+bGVuYml0cyA9IDk7CisJICAgIHJldCA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gZmFyIGJhY2siOwotICAgICAgICAgICAgICAgIHN0YXRlLT5tb2RlID0gQkFEOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgVHJhY2V2digoc3RkZXJyLCAiaW5mbGF0ZTogICAgICAgICBkaXN0YW5jZSAldVxuIiwgc3RhdGUtPm9mZnNldCkpOwotICAgICAgICAgICAgc3RhdGUtPm1vZGUgPSBNQVRDSDsKLSAgICAgICAgY2FzZSBNQVRDSDoKLSAgICAgICAgICAgIGlmIChsZWZ0ID09IDApIGdvdG8gaW5mX2xlYXZlOwotICAgICAgICAgICAgY29weSA9IG91dCAtIGxlZnQ7Ci0gICAgICAgICAgICBpZiAoc3RhdGUtPm9mZnNldCA+IGNvcHkpIHsgICAgICAgICAvKiBjb3B5IGZyb20gd2luZG93ICovCi0gICAgICAgICAgICAgICAgY29weSA9IHN0YXRlLT5vZmZzZXQgLSBjb3B5OwotICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gc3RhdGUtPndyaXRlKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNvcHkgLT0gc3RhdGUtPndyaXRlOwotICAgICAgICAgICAgICAgICAgICBmcm9tID0gc3RhdGUtPndpbmRvdyArIChzdGF0ZS0+d3NpemUgLSBjb3B5KTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgICAgICBmcm9tID0gc3RhdGUtPndpbmRvdyArIChzdGF0ZS0+d3JpdGUgLSBjb3B5KTsKLSAgICAgICAgICAgICAgICBpZiAoY29weSA+IHN0YXRlLT5sZW5ndGgpIGNvcHkgPSBzdGF0ZS0+bGVuZ3RoOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZSB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogY29weSBmcm9tIG91dHB1dCAqLwotICAgICAgICAgICAgICAgIGZyb20gPSBwdXQgLSBzdGF0ZS0+b2Zmc2V0OwotICAgICAgICAgICAgICAgIGNvcHkgPSBzdGF0ZS0+bGVuZ3RoOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKGNvcHkgPiBsZWZ0KSBjb3B5ID0gbGVmdDsKLSAgICAgICAgICAgIGxlZnQgLT0gY29weTsKLSAgICAgICAgICAgIHN0YXRlLT5sZW5ndGggLT0gY29weTsKLSAgICAgICAgICAgIGRvIHsKLSAgICAgICAgICAgICAgICAqcHV0KysgPSAqZnJvbSsrOwotICAgICAgICAgICAgfSB3aGlsZSAoLS1jb3B5KTsKLSAgICAgICAgICAgIGlmIChzdGF0ZS0+bGVuZ3RoID09IDApIHN0YXRlLT5tb2RlID0gTEVOOwotICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgIGNhc2UgTElUOgotICAgICAgICAgICAgaWYgKGxlZnQgPT0gMCkgZ290byBpbmZfbGVhdmU7Ci0gICAgICAgICAgICAqcHV0KysgPSAodW5zaWduZWQgY2hhcikoc3RhdGUtPmxlbmd0aCk7Ci0gICAgICAgICAgICBsZWZ0LS07Ci0gICAgICAgICAgICBzdGF0ZS0+bW9kZSA9IExFTjsKLSAgICAgICAgICAgIGJyZWFrOwotICAgICAgICBjYXNlIENIRUNLOgotICAgICAgICAgICAgaWYgKHN0YXRlLT53cmFwKSB7Ci0gICAgICAgICAgICAgICAgTkVFREJJVFMoMzIpOwotICAgICAgICAgICAgICAgIG91dCAtPSBsZWZ0OwotICAgICAgICAgICAgICAgIHN0cm0tPnRvdGFsX291dCArPSBvdXQ7Ci0gICAgICAgICAgICAgICAgc3RhdGUtPnRvdGFsICs9IG91dDsKLSAgICAgICAgICAgICAgICBpZiAob3V0KQotICAgICAgICAgICAgICAgICAgICBzdHJtLT5hZGxlciA9IHN0YXRlLT5jaGVjayA9Ci0gICAgICAgICAgICAgICAgICAgICAgICBVUERBVEUoc3RhdGUtPmNoZWNrLCBwdXQgLSBvdXQsIG91dCk7Ci0gICAgICAgICAgICAgICAgb3V0ID0gbGVmdDsKLSAgIC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AgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBJTklUQklUUygpOwotICAgICAgICAgICAgICAgIFRyYWNldigoc3RkZXJyLCAiaW5mbGF0ZTogICBjaGVjayBtYXRjaGVzIHRyYWlsZXJcbiIpKTsKLSAgICAgICAgICAgIH0KKwkJICAgICBSRVZFUlNFKGhvbGQpKSAhPSBzdGF0ZS0+Y2hlY2spIHsKKwkJICAgIHN0cm0tPm1zZyA9IChjaGFyICopImluY29ycmVjdCBkYXRhIGNoZWNrIjsKKwkJICAgIHN0YXRlLT5tb2RlID0gQkFEOworCQkgICAgYnJlYWs7CisJCX0KKwkJSU5JVEJJVFMoKTsKKwkJVHJhY2V2KChzdGRlcnIsICJpbmZsYXRlOiAgIGNoZWNrIG1hdGNoZXMgdHJhaWxlclxuIikpOworCSAgICB9CiAjaWZkZWYgR1VOWklQCi0gICAgICAgICAgICBzdGF0ZS0+bW9kZSA9IExFTkdUSDsKLSAgICAgICAgY2FzZSBMRU5HVEg6Ci0gICAgICAgICAgICBpZiAoc3RhdGUtPndyYXAgJiYgc3RhdGUtPmZsYWdzKSB7Ci0gICAgICAgICAgICAgICAgTkVFREJJVFMoMzIpOwotICAgICAgICAgICAgICAgIGlmIChob2xkICE9IChzdGF0ZS0+dG90YWwgJiAweGZmZmZmZmZmVUwpKSB7Ci0gICAgICAgICAgICAgICAgICAgIHN0cm0tPm1zZyA9IChjaGFyICopImluY29ycmVjdCBsZW5ndGggY2hlY2siOwotICAgICAgICAgICAgICAgICAgICBzdGF0ZS0+bW9kZSA9IEJBRDsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIElOSVRCSVRTKCk7Ci0gICAgICAgICAgICAgICAgVHJhY2V2KChzdGRlcnIsICJpbmZsYXRlOiAgIGxlbmd0aCBtYXRjaGVzIHRyYWlsZXJcbiIpKTsKLSAgICAgICAgICAgIH0KKwkgICAgc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49IEJBU0UpCi0gICAgICAgICAgICBhZGxlciAtPSBCQVNFOwotICAgICAgICBzdW0yICs9IGFkbGVyOwotICAgICAgICBpZiAoc3VtMiA+PSBCQVNFKQotICAgICAgICAgICAgc3VtMiAtPSBCQVNFOwotICAgICAgICByZXR1cm4gYWRsZXIgfCAoc3VtMiA8PCAxNik7CisJYWRsZXIgKz0gYnVmWzBdOworCWlmIChhZGxlciA+PSBCQVNFKQorCSAgICBhZGxlciAtPSBCQVNFOworCXN1bTIgKz0gYWRsZXI7CisJaWYgKHN1bTIgPj0gQkFTRSkKKwkgICAgc3VtMiAtPSBCQVNFOworCXJldHVybiBhZGxlciB8IChzdW0yIDw8IDE2KTsKICAgICB9CiAKICAgICAvKiBpbml0aWFsIEFkbGVyLTMyIHZhbHVlIChkZWZlcnJlZCBjaGVjayBmb3IgbGVuID09IDEgc3BlZWQpICovCiAgICAgaWYgKGJ1ZiA9PSBaX05VTEwpCi0gICAgICAgIHJldHVybiAxTDsKKwlyZXR1cm4gMUw7CiAKICAgICAvKiBpbiBjYXNlIHNob3J0IGxlbmd0aHMgYXJlIHByb3ZpZGVkLCBrZWVwIGl0IHNvbWV3aGF0IGZhc3QgKi8KICAgICBpZiAobGVuIDwgMTYpIHsKLSAgICAgICAgd2hpbGUgKGxlbi0tKSB7Ci0gICAgICAgICAgICBhZGxlciArPSAqYnVmKys7Ci0gICAgICAgICAgICBzdW0yICs9IGFkbGVyOwotICAgICAgICB9Ci0gICAgICAgIGlmIChhZGxlciA+PSBCQVNFKQotICAgICAgICAgICAgYWRsZXIgLT0gQkFTRTsKLSAgICAgICAgTU9ENChzdW0yKTsgICAgICAgICAgICAgLyogb25seSBhZGRlZCBzbyBtYW55IEJBU0UncyAqLwotICAgICAgICByZXR1cm4gYWRsZXIgfCAoc3VtMiA8PCAxNik7CisJd2hpbGUgKGxlbi0tKSB7CisJICAgIGFkbGVyICs9ICpidWYrKzsKKwkgICAgc3VtMiArPSBhZGxlcjsKKwl9CisJaWYgKGFkbGVyID49IEJBU0UpCisJICAgIGFkbGVyIC09IEJBU0U7CisJTU9ENChzdW0yKTsgICAgICAgICAgICAgLyogb25seSBhZGRlZCBzbyBtYW55IEJBU0UncyAqLworCXJldHVybiBhZGxlciB8IChzdW0yIDw8IDE2KTsKICAgICB9CiAKICAgICAvKiBkbyBsZW5ndGggTk1BWCBibG9ja3MgLS0gcmVxdWlyZXMganVzdCBvbmUgbW9kdWxvIG9wZXJhdGlvbiAqLwogICAgIHdoaWxlIChsZW4gPj0gTk1BWCkgewotICAgICAgICBsZW4gLT0gTk1BWDsKLSAgICAgICAgbiA9IE5NQVggLyAxNjsgICAgICAgICAgLyogTk1BWCBpcyBkaXZpc2libGUgYnkgMTYgKi8KLSAgICAgICAgZG8gewotICAgICAgICAgICAgRE8xNihidWYpOyAgICAgICAgICAvKiAxNiBzdW1zIHVucm9sbGVkICovCi0gICAgICAgICAgICBidWYgKz0gMTY7Ci0gICAgICAgIH0gd2hpbGUgKC0tbik7Ci0gICAgICAgIE1PRChhZGxlcik7Ci0gICAgICAgIE1PRChzdW0yKTsKKwlsZW4gLT0gTk1BWDsKKwluID0gTk1BWCAvIDE2OyAgICAgICAgICAvKiBOTUFYIGlzIGRpdmlzaWJsZSBieSAxNiAqLworCWRvIHsKKwkgICAgRE8xNihidWYpOyAgICAgICAgICAvKiAxNiBzdW1zIHVucm9sbGVkICovCisJICAgIGJ1ZiArPSAxNjsKKwl9IHdoaWxlICgtLW4pOworCU1PRChhZGxlcik7CisJTU9EKHN1bTIpOwogICAgIH0KIAogICAgIC8qIGRvIHJlbWFpbmluZyBieXRlcyAobGVzcyB0aGFuIE5NQVgsIHN0aWxsIGp1c3Qgb25lIG1vZHVsbykgKi8KICAgICBpZiAobGVuKSB7ICAgICAgICAgICAgICAgICAgLyogYXZvaWQgbW9kdWxvcyBpZiBub25lIHJlbWFpbmluZyAqLwotICAgICAgICB3aGlsZSAobGVuID49IDE2KSB7Ci0gICAgICAgICAgICBsZW4gLT0gMTY7Ci0gICAgICAgICAgICBETzE2KGJ1Zik7Ci0gICAgICAgICAgICBidWYgKz0gMTY7Ci0gICAgICAgIH0KLSAgICAgICAgd2hpbGUgKGxlbi0tKSB7Ci0gICAgICAgICAgICBhZGxlciArPSAqYnVmKys7Ci0gICAgICAgICAgICBzdW0yICs9IGFkbGVyOwotICAgICAgICB9Ci0gICAgICAgIE1PRChhZGxlcik7Ci0gICAgICAgIE1PRChzdW0yKTsKKwl3aGlsZSAobGVuID49IDE2KSB7CisJICAgIGxlbiAtPSAxNjsKKwkgICAgRE8xNihidWYpOworCSAgICBidWYgKz0gMTY7CisJfQorCXdoaWxlIChsZW4tLSkgeworCSAgICBhZGxlciArPSAqYnVmKys7CisJICAgIHN1bTIgKz0gYWRsZXI7CisJfQorCU1PRChhZGxlcik7CisJTU9EKHN1bTIpOwogICAgIH0KIAogICAgIC8qIHJldHVybiByZWNvbWJpbmVkIHN1bXMgKi8KZGlmZiAtLWdpdCBhL25ldC9kbnMuYyBiL25ldC9kbnMuYwppbmRleCBmMjVjM2Y4Li5iYjNlM2Y1IDEwMDY0NAotLS0gYS9uZXQvZG5zLmMKKysrIGIvbmV0L2Rucy5jCkBAIC0yMDgsNCArMjA4LDMgQEAKIAogCURuc1NlbmQoKTsKIH0KLQo=